diff --git a/internal/providers/pluginfw/common/common_test.go b/internal/providers/pluginfw/common/common_test.go index dca9729ac..f2fa718bb 100644 --- a/internal/providers/pluginfw/common/common_test.go +++ b/internal/providers/pluginfw/common/common_test.go @@ -1,21 +1,22 @@ -package common +package common_test import ( "testing" + "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" "github.com/stretchr/testify/assert" ) func TestGetDatabricksStagingName(t *testing.T) { resourceName := "test" expected := "databricks_test_pluginframework" - result := GetDatabricksStagingName(resourceName) + result := common.GetDatabricksStagingName(resourceName) assert.Equal(t, expected, result, "GetDatabricksStagingName should return the expected staging name") } func TestGetDatabricksProductionName(t *testing.T) { resourceName := "test" expected := "databricks_test" - result := GetDatabricksProductionName(resourceName) + result := common.GetDatabricksProductionName(resourceName) assert.Equal(t, expected, result, "GetDatabricksProductionName should return the expected production name") } diff --git a/internal/providers/pluginfw/common/complex_field_type_provider.go b/internal/providers/pluginfw/common/complex_field_type_provider.go new file mode 100644 index 000000000..ef074398b --- /dev/null +++ b/internal/providers/pluginfw/common/complex_field_type_provider.go @@ -0,0 +1,27 @@ +package common + +import ( + "context" + "reflect" +) + +// ComplexFieldTypeProvider must be implemented by any TFSDK structure that contains +// a complex field (list, map, object). Such fields do not include sufficient type +// information to understand the type of the contained elements in the case of a list +// or map, or the fields in the case of an object. This interface enables callers +// to recover that information. +type ComplexFieldTypeProvider interface { + // GetComplexFieldTypes returns a map from field name to the type of the value in + // the list, map or object. The keys of the map must match the value of the + // `tfsdk` tag on the field. There must be one entry in the map for each field + // that has type types.List, types.Map or types.Object. + // + // If the field has type types.List or types.Map, the reflect.Type instance may + // correspond to either a primitive value (e.g. types.String) or a TFSDK structure. + // It is not allowed to return a reflect.Type that corresponds to a type value + // (e.g. types.StringType). + // + // If the field has type types.Object, the reflect.Type instance must correspond + // to a TFSDK structure. + GetComplexFieldTypes(context.Context) map[string]reflect.Type +} diff --git a/internal/providers/pluginfw/common/diag_to_string.go b/internal/providers/pluginfw/common/diag_to_string.go new file mode 100644 index 000000000..96b6edb73 --- /dev/null +++ b/internal/providers/pluginfw/common/diag_to_string.go @@ -0,0 +1,17 @@ +package common + +import ( + "fmt" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/diag" +) + +// DiagToString converts a slice of diag.Diagnostics to a string. +func DiagToString(d diag.Diagnostics) string { + b := strings.Builder{} + for _, diag := range d { + b.WriteString(fmt.Sprintf("[%s] %s: %s\n", diag.Severity(), diag.Summary(), diag.Detail())) + } + return b.String() +} diff --git a/internal/providers/pluginfw/common/object_typable.go b/internal/providers/pluginfw/common/object_typable.go new file mode 100644 index 000000000..49e2d0d70 --- /dev/null +++ b/internal/providers/pluginfw/common/object_typable.go @@ -0,0 +1,125 @@ +package common + +import ( + "context" + "fmt" + "reflect" + + "github.com/databricks/terraform-provider-databricks/common" + "github.com/databricks/terraform-provider-databricks/internal/tfreflect" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" +) + +// An ObjectTypable is an object that has a corresponding attr.Type. +// Note that this is different from the plugin framework's ObjectTypable interface, +// which is used to implement custom types in the plugin framework. Today, the +// serialization to plugin framework types is done in the converters package. +type ObjectTypable interface { + // Type returns the corresponding attr.Type for the object. For TF SDK types, + // this must always return an instance of basetypes.ObjectType. + Type(context.Context) attr.Type +} + +type ObjectTyper struct { + // A TF SDK structure. + // If this contains types.List, types.Map, or types.Object, it must implement the + // ComplexFieldTypesProvider interface. + inner any +} + +// Construct a new ObjectTyper. +// TFSDK structs automatically implement ObjectTypable, so they are returned as-is. +// Hand-written structs do not necessarily implement ObjectTypable, so this is a +// convenience implementation using reflection. +func NewObjectTyper(inner any) ObjectTypable { + if ov, ok := inner.(ObjectTypable); ok { + return ov + } + return ObjectTyper{inner: inner} +} + +// Type implements basetypes.ObjectValuable. +func (o ObjectTyper) Type(ctx context.Context) attr.Type { + attrs := map[string]attr.Type{} + + // Tolerate pointers. + rv := reflect.Indirect(reflect.ValueOf(o.inner)) + for _, field := range tfreflect.ListAllFields(rv) { + typeField := field.StructField + fieldName := typeField.Tag.Get("tfsdk") + if fieldName == "-" { + continue + } + // If it is a simple type, we can determine the type from the reflect.Type. + if t, ok := getAttrType(field.Value); ok { + attrs[fieldName] = t + continue + } + + // Otherwise, additional metadata is required to determine the type of the list elements. + // This is available via the ComplexFieldTypeProvider interface, implemented on the parent type. + provider, ok := o.inner.(ComplexFieldTypeProvider) + if !ok { + panic(fmt.Errorf("complex field types not provided for type: %T. %s", o.inner, common.TerraformBugErrorMessage)) + } + complexFieldTypes := provider.GetComplexFieldTypes(ctx) + fieldType, ok := complexFieldTypes[fieldName] + if !ok { + panic(fmt.Errorf("complex field type not found for field %s on type %T. %s", typeField.Name, o.inner, common.TerraformBugErrorMessage)) + } + + // This is either a "simple" type or a TF SDK structure. + var innerType attr.Type + if t, ok := getAttrType(fieldType); ok { + innerType = t + } else { + // If this is a TF SDK structure, we need to recursively determine the type. + nested := reflect.New(fieldType).Elem().Interface() + ov := NewObjectTyper(nested) + innerType = ov.Type(ctx) + } + + switch field.Value.Interface().(type) { + case types.List: + attrs[fieldName] = types.ListType{ElemType: innerType} + case types.Map: + attrs[fieldName] = types.MapType{ElemType: innerType} + case types.Object: + // Objects are only used for nested structures, not primitives, so we must go through + // the else case above. + innerType, ok = innerType.(basetypes.ObjectType) + if !ok { + panic(fmt.Errorf("expected ObjectType, got %T", innerType)) + } + attrs[fieldName] = innerType + } + } + + return basetypes.ObjectType{ + AttrTypes: attrs, + } +} + +var simpleTypeMap = map[reflect.Type]attr.Type{ + reflect.TypeOf(types.Bool{}): types.BoolType, + reflect.TypeOf(types.Int64{}): types.Int64Type, + reflect.TypeOf(types.Float64{}): types.Float64Type, + reflect.TypeOf(types.String{}): types.StringType, +} + +// getAttrType returns the attr.Type for the given value. The value can be a +// reflect.Type instance or a Terraform type instance. +func getAttrType(v any) (attr.Type, bool) { + if r, ok := v.(reflect.Type); ok { + t, ok := simpleTypeMap[r] + return t, ok + } + if rv, ok := v.(reflect.Value); ok { + t, ok := simpleTypeMap[rv.Type()] + return t, ok + } + t, ok := simpleTypeMap[reflect.TypeOf(v)] + return t, ok +} diff --git a/internal/providers/pluginfw/converters/converters_test.go b/internal/providers/pluginfw/converters/converters_test.go index 75f4cef63..c8f4bf172 100644 --- a/internal/providers/pluginfw/converters/converters_test.go +++ b/internal/providers/pluginfw/converters/converters_test.go @@ -6,30 +6,54 @@ import ( "reflect" "testing" + tfcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/stretchr/testify/assert" ) type DummyTfSdk struct { - Enabled types.Bool `tfsdk:"enabled" tf:"optional"` - Workers types.Int64 `tfsdk:"workers" tf:""` - Floats types.Float64 `tfsdk:"floats" tf:""` - Description types.String `tfsdk:"description" tf:""` - Tasks types.String `tfsdk:"task" tf:"optional"` - NoPointerNested DummyNestedTfSdk `tfsdk:"no_pointer_nested" tf:"optional"` - NestedList []DummyNestedTfSdk `tfsdk:"nested_list" tf:"optional"` - NestedPointerList []*DummyNestedTfSdk `tfsdk:"nested_pointer_list" tf:"optional"` - Map map[string]types.String `tfsdk:"map" tf:"optional"` - NestedMap map[string]DummyNestedTfSdk `tfsdk:"nested_map" tf:"optional"` - Repeated []types.Int64 `tfsdk:"repeated" tf:"optional"` - Attributes map[string]types.String `tfsdk:"attributes" tf:"optional"` - EnumField types.String `tfsdk:"enum_field" tf:"optional"` - AdditionalField types.String `tfsdk:"additional_field" tf:"optional"` - DistinctField types.String `tfsdk:"distinct_field" tf:"optional"` - SliceStruct []DummyNestedTfSdk `tfsdk:"slice_struct" tf:"optional"` - SliceStructPtr []DummyNestedTfSdk `tfsdk:"slice_struct_ptr" tf:"optional"` - Irrelevant types.String `tfsdk:"-"` + Enabled types.Bool `tfsdk:"enabled" tf:"optional"` + Workers types.Int64 `tfsdk:"workers" tf:""` + Floats types.Float64 `tfsdk:"floats" tf:""` + Description types.String `tfsdk:"description" tf:""` + Tasks types.String `tfsdk:"task" tf:"optional"` + NoPointerNested types.List `tfsdk:"no_pointer_nested" tf:"optional"` + NestedList types.List `tfsdk:"nested_list" tf:"optional"` + NestedPointerList types.List `tfsdk:"nested_pointer_list" tf:"optional"` + Map types.Map `tfsdk:"map" tf:"optional"` + NestedMap types.Map `tfsdk:"nested_map" tf:"optional"` + Repeated types.List `tfsdk:"repeated" tf:"optional"` + Attributes types.Map `tfsdk:"attributes" tf:"optional"` + EnumField types.String `tfsdk:"enum_field" tf:"optional"` + AdditionalField types.String `tfsdk:"additional_field" tf:"optional"` + DistinctField types.String `tfsdk:"distinct_field" tf:"optional"` + SliceStructPtr types.List `tfsdk:"slice_struct_ptr" tf:"optional"` + Irrelevant types.String `tfsdk:"-"` + Object types.Object `tfsdk:"object" tf:"optional"` + ObjectPtr types.Object `tfsdk:"object_ptr" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:""` // Test Type_ renaming + EmptyStructList types.List `tfsdk:"empty_struct_list" tf:"optional"` + EmptyStructObject types.Object `tfsdk:"empty_struct_object" tf:"optional"` +} + +func (DummyTfSdk) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "no_pointer_nested": reflect.TypeOf(DummyNestedTfSdk{}), + "nested_list": reflect.TypeOf(DummyNestedTfSdk{}), + "nested_pointer_list": reflect.TypeOf(DummyNestedTfSdk{}), + "map": reflect.TypeOf(types.String{}), + "nested_map": reflect.TypeOf(DummyNestedTfSdk{}), + "repeated": reflect.TypeOf(types.Int64{}), + "attributes": reflect.TypeOf(types.String{}), + "slice_struct_ptr": reflect.TypeOf(DummyNestedTfSdk{}), + "object": reflect.TypeOf(DummyNestedTfSdk{}), + "object_ptr": reflect.TypeOf(DummyNestedTfSdk{}), + "empty_struct_list": reflect.TypeOf(DummyNestedTfSdkEmpty{}), + "empty_struct_object": reflect.TypeOf(DummyNestedTfSdkEmpty{}), + } } type TestEnum string @@ -64,6 +88,8 @@ type DummyNestedTfSdk struct { Enabled types.Bool `tfsdk:"enabled" tf:"optional"` } +type DummyNestedTfSdkEmpty struct{} + type DummyGoSdk struct { Enabled bool `json:"enabled"` Workers int64 `json:"workers"` @@ -80,8 +106,12 @@ type DummyGoSdk struct { EnumField TestEnum `json:"enum_field"` AdditionalField string `json:"additional_field"` DistinctField string `json:"distinct_field"` // distinct field that the tfsdk struct doesn't have - SliceStruct DummyNestedGoSdk `json:"slice_struct"` SliceStructPtr *DummyNestedGoSdk `json:"slice_struct_ptr"` + Object DummyNestedGoSdk `json:"object"` + ObjectPtr *DummyNestedGoSdk `json:"object_ptr"` + Type string `json:"type"` // Test Type_ renaming + EmptyStructList []DummyNestedGoSdkEmpty `json:"empty_struct_list"` + EmptyStructObject *DummyNestedGoSdkEmpty `json:"empty_struct_object"` ForceSendFields []string `json:"-"` } @@ -91,16 +121,72 @@ type DummyNestedGoSdk struct { ForceSendFields []string `json:"-"` } +type DummyNestedGoSdkEmpty struct{} + +// This function is used to populate empty fields in the tfsdk struct with null values. +// This is required because the Go->TF conversion function instantiates list, map, and +// object fields with empty values, which are not equal to null values in the tfsdk struct. +func populateEmptyFields(c DummyTfSdk) DummyTfSdk { + if c.NoPointerNested.IsNull() { + c.NoPointerNested = types.ListNull(dummyType) + } + if c.NestedList.IsNull() { + c.NestedList = types.ListNull(dummyType) + } + if c.NestedPointerList.IsNull() { + c.NestedPointerList = types.ListNull(dummyType) + } + if c.Map.IsNull() { + c.Map = types.MapNull(types.StringType) + } + if c.NestedMap.IsNull() { + c.NestedMap = types.MapNull(dummyType) + } + if c.Repeated.IsNull() { + c.Repeated = types.ListNull(types.Int64Type) + } + if c.Attributes.IsNull() { + c.Attributes = types.MapNull(types.StringType) + } + if c.SliceStructPtr.IsNull() { + c.SliceStructPtr = types.ListNull(dummyType) + } + if c.Object.IsNull() { + // type.Object fields that correspond to structs are considered never to be null. + c.Object = types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringNull(), + "enabled": types.BoolNull(), + }) + } + if c.ObjectPtr.IsNull() { + // type.Object fields that correspond to pointers are considered null when the Go SDK value is nil. + c.ObjectPtr = types.ObjectNull(dummyType.AttrTypes) + } + if c.EmptyStructList.IsNull() { + c.EmptyStructList = types.ListNull(basetypes.ObjectType{AttrTypes: map[string]attr.Type{}}) + } + if c.EmptyStructObject.IsNull() { + c.EmptyStructObject = types.ObjectNull(map[string]attr.Type{}) + } + return c +} + // Function to construct individual test case with a pair of matching tfSdkStruct and gosdkStruct. // Verifies that the conversion both ways are working as expected. func RunConverterTest(t *testing.T, description string, tfSdkStruct DummyTfSdk, goSdkStruct DummyGoSdk) { convertedGoSdkStruct := DummyGoSdk{} - assert.True(t, !TfSdkToGoSdkStruct(context.Background(), tfSdkStruct, &convertedGoSdkStruct).HasError()) - assert.True(t, reflect.DeepEqual(convertedGoSdkStruct, goSdkStruct), fmt.Sprintf("tfsdk to gosdk conversion - %s", description)) + d := TfSdkToGoSdkStruct(context.Background(), tfSdkStruct, &convertedGoSdkStruct) + if d.HasError() { + t.Errorf("tfsdk to gosdk conversion: %s", tfcommon.DiagToString(d)) + } + assert.Equal(t, goSdkStruct, convertedGoSdkStruct, fmt.Sprintf("tfsdk to gosdk conversion - %s", description)) convertedTfSdkStruct := DummyTfSdk{} - assert.True(t, !GoSdkToTfSdkStruct(context.Background(), goSdkStruct, &convertedTfSdkStruct).HasError()) - assert.True(t, reflect.DeepEqual(convertedTfSdkStruct, tfSdkStruct), fmt.Sprintf("gosdk to tfsdk conversion - %s", description)) + d = GoSdkToTfSdkStruct(context.Background(), goSdkStruct, &convertedTfSdkStruct) + if d.HasError() { + t.Errorf("gosdk to tfsdk conversion: %s", tfcommon.DiagToString(d)) + } + assert.Equal(t, populateEmptyFields(tfSdkStruct), convertedTfSdkStruct, fmt.Sprintf("gosdk to tfsdk conversion - %s", description)) } func TestTfSdkToGoSdkStructConversionFailure(t *testing.T) { @@ -121,6 +207,9 @@ func TestGoSdkToTfSdkStructConversionFailure(t *testing.T) { assert.True(t, actualDiagnostics.Equal(expectedDiagnostics)) } +var dummyType = tfcommon.NewObjectTyper(DummyNestedTfSdk{}).Type(context.Background()).(types.ObjectType) +var emptyType = basetypes.ObjectType{AttrTypes: map[string]attr.Type{}} + var tests = []struct { name string tfSdkStruct DummyTfSdk @@ -178,38 +267,44 @@ var tests = []struct { }, { "struct conversion", - DummyTfSdk{NoPointerNested: DummyNestedTfSdk{ - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }}, + DummyTfSdk{NoPointerNested: types.ListValueMust( + dummyType, []attr.Value{ + types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(true), + }), + }), + }, DummyGoSdk{NoPointerNested: DummyNestedGoSdk{ Name: "def", Enabled: true, ForceSendFields: []string{"Name", "Enabled"}, - }}, + }, ForceSendFields: []string{"NoPointerNested"}}, }, { "list conversion", - DummyTfSdk{Repeated: []types.Int64{types.Int64Value(12), types.Int64Value(34)}}, + DummyTfSdk{Repeated: types.ListValueMust(types.Int64Type, []attr.Value{types.Int64Value(12), types.Int64Value(34)})}, DummyGoSdk{Repeated: []int64{12, 34}}, }, { "map conversion", - DummyTfSdk{Attributes: map[string]types.String{"key": types.StringValue("value")}}, - DummyGoSdk{Attributes: map[string]string{"key": "value"}}, + DummyTfSdk{Attributes: types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")})}, + DummyGoSdk{Attributes: map[string]string{"key": "value"}, ForceSendFields: []string{"Attributes"}}, }, { "nested list conversion", - DummyTfSdk{NestedList: []DummyNestedTfSdk{ - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }, - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }, - }}, + DummyTfSdk{NestedList: types.ListValueMust(dummyType, + []attr.Value{ + types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(true), + }), + types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(true), + }), + }), + }, DummyGoSdk{NestedList: []DummyNestedGoSdk{ { Name: "def", @@ -225,16 +320,16 @@ var tests = []struct { }, { "nested map conversion", - DummyTfSdk{NestedMap: map[string]DummyNestedTfSdk{ - "key1": { - Name: types.StringValue("abc"), - Enabled: types.BoolValue(true), - }, - "key2": { - Name: types.StringValue("def"), - Enabled: types.BoolValue(false), - }, - }}, + DummyTfSdk{NestedMap: types.MapValueMust(dummyType, map[string]attr.Value{ + "key1": types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("abc"), + "enabled": types.BoolValue(true), + }), + "key2": types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(false), + }), + })}, DummyGoSdk{NestedMap: map[string]DummyNestedGoSdk{ "key1": { Name: "abc", @@ -246,35 +341,58 @@ var tests = []struct { Enabled: false, ForceSendFields: []string{"Name", "Enabled"}, }, - }}, + }, ForceSendFields: []string{"NestedMap"}}, }, { - "list representation of struct conversion", // we use list with one element in the tfsdk to represent struct in gosdk - DummyTfSdk{SliceStruct: []DummyNestedTfSdk{ - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }, - }}, - DummyGoSdk{SliceStruct: DummyNestedGoSdk{ + "list representation of struct pointer conversion", // we use list with one element in the tfsdk to represent struct in gosdk + DummyTfSdk{SliceStructPtr: types.ListValueMust(dummyType, + []attr.Value{ + types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(true), + }), + }), + }, + DummyGoSdk{SliceStructPtr: &DummyNestedGoSdk{ Name: "def", Enabled: true, ForceSendFields: []string{"Name", "Enabled"}, - }}, + }, ForceSendFields: []string{"SliceStructPtr"}}, }, { - "list representation of struct pointer conversion", // we use list with one element in the tfsdk to represent struct in gosdk - DummyTfSdk{SliceStructPtr: []DummyNestedTfSdk{ - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }, - }}, - DummyGoSdk{SliceStructPtr: &DummyNestedGoSdk{ + "object conversion", + DummyTfSdk{Object: types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(true), + })}, + DummyGoSdk{Object: DummyNestedGoSdk{ Name: "def", Enabled: true, ForceSendFields: []string{"Name", "Enabled"}, - }}, + }, ForceSendFields: []string{"Object"}}, + }, + { + "type name", + DummyTfSdk{Type_: types.StringValue("abc")}, + DummyGoSdk{Type: "abc", ForceSendFields: []string{"Type"}}, + }, + { + "empty list of empty struct to list conversion", + DummyTfSdk{EmptyStructList: types.ListValueMust(emptyType, []attr.Value{})}, + DummyGoSdk{EmptyStructList: []DummyNestedGoSdkEmpty{}}, + }, + { + "non-empty list empty struct to list conversion", + DummyTfSdk{EmptyStructList: types.ListValueMust(emptyType, []attr.Value{ + types.ObjectValueMust(map[string]attr.Type{}, map[string]attr.Value{}), + types.ObjectValueMust(map[string]attr.Type{}, map[string]attr.Value{}), + })}, + DummyGoSdk{EmptyStructList: []DummyNestedGoSdkEmpty{{}, {}}}, + }, + { + "non-nil pointer of empty struct to object conversion", + DummyTfSdk{EmptyStructObject: types.ObjectValueMust(emptyType.AttrTypes, map[string]attr.Value{})}, + DummyGoSdk{EmptyStructObject: &DummyNestedGoSdkEmpty{}, ForceSendFields: []string{"EmptyStructObject"}}, }, } diff --git a/internal/providers/pluginfw/converters/go_to_tf.go b/internal/providers/pluginfw/converters/go_to_tf.go index 9fed34b49..058995296 100644 --- a/internal/providers/pluginfw/converters/go_to_tf.go +++ b/internal/providers/pluginfw/converters/go_to_tf.go @@ -6,10 +6,12 @@ import ( "reflect" "github.com/databricks/databricks-sdk-go/logger" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/databricks/terraform-provider-databricks/common" + tfcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" "github.com/databricks/terraform-provider-databricks/internal/tfreflect" ) @@ -18,23 +20,23 @@ const goSdkToTfSdkFieldConversionFailureMessage = "gosdk to tfsdk field conversi // GoSdkToTfSdkStruct converts a gosdk struct into a tfsdk struct, with the folowing rules. // -// string -> types.String -// bool -> types.Bool -// int64 -> types.Int64 -// float64 -> types.Float64 -// string -> types.String +// string -> types.String +// bool -> types.Bool +// int64 -> types.Int64 +// float64 -> types.Float64 +// Struct and pointer to struct -> types.List +// Slice -> types.List +// Map -> types.Map // -// NOTE: -// -// # Structs in gosdk are represented as slices of structs in tfsdk, and pointers are removed +// `gosdk` parameter must be a struct or pointer to a struct. `tfsdk` must be a pointer to the corresponding +// TF SDK structure. // +// Structs in Go SDK are represented as types.Lists. // If field name doesn't show up in ForceSendFields and the field is zero value, we set the null value on the tfsdk. -// types.list and types.map are not supported -// map keys should always be a string -// tfsdk structs use types.String for all enum values -// non-json fields will be omitted -func GoSdkToTfSdkStruct(ctx context.Context, gosdk interface{}, tfsdk interface{}) diag.Diagnostics { - +// Map keys must always be strings. +// TF SDK structs use types.String for all enum values. +// Non-JSON fields will be omitted. +func GoSdkToTfSdkStruct(ctx context.Context, gosdk interface{}, tfsdk interface{}) (d diag.Diagnostics) { srcVal := reflect.ValueOf(gosdk) destVal := reflect.ValueOf(tfsdk) @@ -43,16 +45,27 @@ func GoSdkToTfSdkStruct(ctx context.Context, gosdk interface{}, tfsdk interface{ } if destVal.Kind() != reflect.Ptr { - return diag.Diagnostics{diag.NewErrorDiagnostic(goSdkToTfSdkStructConversionFailureMessage, fmt.Sprintf("please provide a pointer for the tfsdk struct, got %s", destVal.Type().Name()))} + d.AddError(goSdkToTfSdkStructConversionFailureMessage, fmt.Sprintf("please provide a pointer for the tfsdk struct, got %s", destVal.Type().Name())) + return } destVal = destVal.Elem() if srcVal.Kind() != reflect.Struct || destVal.Kind() != reflect.Struct { - return diag.Diagnostics{diag.NewErrorDiagnostic(goSdkToTfSdkStructConversionFailureMessage, fmt.Sprintf("input should be structs %s, %s", srcVal.Type().Name(), destVal.Type().Name()))} + d.AddError(goSdkToTfSdkStructConversionFailureMessage, fmt.Sprintf("input should be structs, got %s, %s", srcVal.Type().Name(), destVal.Type().Name())) + return } - var forceSendFieldVal []string + // complexFieldTypes captures the elements within a types.List, types.Object, or types.Map. + var complexFieldTypes map[string]reflect.Type + if cftp, ok := destVal.Interface().(tfcommon.ComplexFieldTypeProvider); ok { + complexFieldTypes = cftp.GetComplexFieldTypes(ctx) + } + + // objectType is the type of the destination struct. Entries from this are used when constructing + // plugin framework attr.Values for fields in the object. + objectType := tfcommon.NewObjectTyper(tfsdk).Type(ctx).(types.ObjectType) + var forceSendFieldVal []string forceSendField := srcVal.FieldByName("ForceSendFields") if !forceSendField.IsValid() { // If no forceSendField, just use an empty list. @@ -69,60 +82,76 @@ func GoSdkToTfSdkStruct(ctx context.Context, gosdk interface{}, tfsdk interface{ if srcFieldTag == "-" { continue } - destField := destVal.FieldByName(srcFieldName) + destFieldStructName := toTfSdkName(srcFieldName) + destField := destVal.FieldByName(destFieldStructName) + destFieldType, ok := destVal.Type().FieldByName(destFieldStructName) + if !ok { + d.AddError(goSdkToTfSdkStructConversionFailureMessage, fmt.Sprintf("destination struct does not have field %s. %s", srcFieldName, common.TerraformBugErrorMessage)) + return + } + destFieldName := destFieldType.Tag.Get("tfsdk") + if destFieldName == "-" { + continue + } if !destField.IsValid() { logger.Tracef(ctx, fmt.Sprintf("field skipped in gosdk to tfsdk conversion: destination struct does not have field %s", srcFieldName)) continue } + innerType := objectType.AttrTypes[destFieldName] + complexFieldType := complexFieldTypes[destFieldName] - err := goSdkToTfSdkSingleField(ctx, srcField, destField, fieldInForceSendFields(srcFieldName, forceSendFieldVal)) - if err != nil { - return diag.Diagnostics{diag.NewErrorDiagnostic(goSdkToTfSdkFieldConversionFailureMessage, err.Error())} + d.Append(goSdkToTfSdkSingleField(ctx, srcField, destField, fieldInForceSendFields(srcFieldName, forceSendFieldVal), innerType, complexFieldType)...) + if d.HasError() { + return } } - return nil + return } -func goSdkToTfSdkSingleField(ctx context.Context, srcField reflect.Value, destField reflect.Value, forceSendField bool) error { - +// goSdkToTfSdkSingleField converts a single field from a Go SDK struct to a TF SDK struct. +// The `srcField` is the field in the Go SDK struct, and `destField` is the field on which +// the value will be set in the TF SDK struct. Note that unlike GoSdkToTfSdkStruct, the +// `destField` parameter is not a pointer to the field, but the field itself. The `tfType` +// parameter is the Terraform type of the field, and `complexFieldType` is the runtime +// type of the field. These parameters are only needed when the field is a list, object, or +// map. +func goSdkToTfSdkSingleField( + ctx context.Context, + srcField reflect.Value, + destField reflect.Value, + forceSendField bool, + tfType attr.Type, + innerType reflect.Type) (d diag.Diagnostics) { if !destField.CanSet() { - panic(fmt.Errorf("destination field can not be set: %s. %s", destField.Type().Name(), common.TerraformBugErrorMessage)) - } - - srcFieldValue := srcField.Interface() - - if srcFieldValue == nil { - return nil + d.AddError(goSdkToTfSdkStructConversionFailureMessage, fmt.Sprintf("destination field can not be set: %s. %s", destField.Type().Name(), common.TerraformBugErrorMessage)) + return } switch srcField.Kind() { case reflect.Ptr: + // This corresponds to either a types.List or types.Object. + // If nil, set the destination field to the null value of the appropriate type. if srcField.IsNil() { - // Skip nils - return nil + setFieldToNull(destField, tfType) + return } - var fieldToSetInterface any - - if destField.Kind() == reflect.Slice { - sliceType := destField.Type() - newSlice := reflect.MakeSlice(sliceType, 1, 1) - newSlice.Index(0).Set(reflect.New(sliceType.Elem()).Elem()) - - destField.Set(newSlice) - fieldToSetInterface = newSlice.Index(0).Addr().Interface() - } else { - destField.Set(reflect.New(destField.Type().Elem())) - fieldToSetInterface = destField.Interface() + // Otherwise, the source field is a non-nil pointer to a struct. + // If the target is a list, we treat the source field as a slice with length 1 + // containing only the dereferenced pointer. + if destField.Type() == reflect.TypeOf(types.List{}) { + listSrc := reflect.MakeSlice(reflect.SliceOf(srcField.Type().Elem()), 1, 1) + listSrc.Index(0).Set(srcField.Elem()) + d.Append(goSdkToTfSdkSingleField(ctx, listSrc, destField, forceSendField, tfType, innerType)...) + return } - // Recursively populate the nested struct. - if GoSdkToTfSdkStruct(ctx, srcFieldValue, fieldToSetInterface).HasError() { - panic(fmt.Sprintf("%s. %s", goSdkToTfSdkStructConversionFailureMessage, common.TerraformBugErrorMessage)) - } + // Otherwise, the target is an object. Dereference the pointer and convert the underlying struct. + d.Append(goSdkToTfSdkSingleField(ctx, srcField.Elem(), destField, forceSendField, tfType, innerType)...) + return case reflect.Bool: - boolVal := srcFieldValue.(bool) + boolVal := srcField.Interface().(bool) // check if the value is non-zero or if the field is in the forceSendFields list if boolVal || forceSendField { destField.Set(reflect.ValueOf(types.BoolValue(boolVal))) @@ -151,9 +180,14 @@ func goSdkToTfSdkSingleField(ctx context.Context, srcField reflect.Value, destFi var strVal string if srcField.Type().Name() != "string" { // This case is for Enum Types. - strVal = getStringFromEnum(srcField) + var ds diag.Diagnostics + strVal, ds = getStringFromEnum(srcField) + d.Append(ds...) + if d.HasError() { + return + } } else { - strVal = srcFieldValue.(string) + strVal = srcField.Interface().(string) } // check if the value is non-zero or if the field is in the forceSendFields list if strVal != "" || forceSendField { @@ -162,63 +196,156 @@ func goSdkToTfSdkSingleField(ctx context.Context, srcField reflect.Value, destFi destField.Set(reflect.ValueOf(types.StringNull())) } case reflect.Struct: - if srcField.IsZero() { - // Skip zeros - return nil - } - var dest any - if destField.Kind() == reflect.Slice { - // allocate a slice first - destSlice := reflect.MakeSlice(destField.Type(), 1, 1) - destField.Set(destSlice) - dest = destSlice.Index(0).Addr().Interface() - } else { - dest = destField.Addr().Interface() + // This corresponds to either a types.List or types.Object. + // If the destination field is a types.List, treat the source field as a slice with length 1 + // containing only this struct. + if destField.Type() == reflect.TypeOf(types.List{}) { + // For compatibility, a field consisting of a zero-valued struct that is mapped to lists is treated as an + // empty list. + if srcField.IsZero() { + setFieldToNull(destField, tfType) + return + } + + listSrc := reflect.MakeSlice(reflect.SliceOf(srcField.Type()), 1, 1) + listSrc.Index(0).Set(srcField) + d.Append(goSdkToTfSdkSingleField(ctx, listSrc, destField, forceSendField, tfType, innerType)...) + return } - // resolve the nested struct by recursively calling the function - if GoSdkToTfSdkStruct(ctx, srcFieldValue, dest).HasError() { - panic(fmt.Sprintf("%s. %s", goSdkToTfSdkStructConversionFailureMessage, common.TerraformBugErrorMessage)) + + // Otherwise, the destination field is a types.Object. Convert the nested struct to the corresponding + // TFSDK struct, then set the destination field to the object + dest := reflect.New(innerType).Interface() + d.Append(GoSdkToTfSdkStruct(ctx, srcField.Interface(), dest)...) + if d.HasError() { + return + } + objectType, ok := tfType.(types.ObjectType) + if !ok { + d.AddError(goSdkToTfSdkFieldConversionFailureMessage, fmt.Sprintf("inner type is not an object type: %s. %s", tfType, common.TerraformBugErrorMessage)) + return + } + objectVal, ds := types.ObjectValueFrom(ctx, objectType.AttrTypes, dest) + d.Append(ds...) + if d.HasError() { + return } + destField.Set(reflect.ValueOf(objectVal)) case reflect.Slice: + // This always corresponds to a types.List. + listType, ok := tfType.(types.ListType) + if !ok { + d.AddError(goSdkToTfSdkFieldConversionFailureMessage, fmt.Sprintf("inner type is not a list type: %s. %s", tfType, common.TerraformBugErrorMessage)) + return + } if srcField.IsNil() { - // Skip nils - return nil + // Treat the source field as an empty slice. + nullList := types.ListNull(listType.ElemType) + destField.Set(reflect.ValueOf(nullList)) + return + } + if srcField.Len() == 0 { + // Treat the source field as an empty slice. + emptyList := types.ListValueMust(listType.ElemType, []attr.Value{}) + destField.Set(reflect.ValueOf(emptyList)) + return } - destSlice := reflect.MakeSlice(destField.Type(), srcField.Len(), srcField.Cap()) - for j := 0; j < srcField.Len(); j++ { - - srcElem := srcField.Index(j) - destElem := destSlice.Index(j) - if err := goSdkToTfSdkSingleField(ctx, srcElem, destElem, true); err != nil { - return err + // Convert each element of the slice to the corresponding inner type. + elements := make([]any, 0, srcField.Len()) + for i := 0; i < srcField.Len(); i++ { + element := reflect.New(innerType) + // If the element is a primitive type, we can convert it by recursively calling this function. + // Otherwise, it is a struct, and we need to convert it by calling GoSdkToTfSdkStruct. + switch innerType { + case reflect.TypeOf(types.String{}), reflect.TypeOf(types.Bool{}), reflect.TypeOf(types.Int64{}), reflect.TypeOf(types.Float64{}): + d.Append(goSdkToTfSdkSingleField(ctx, srcField.Index(i), element.Elem(), true, listType.ElemType, innerType)...) + default: + d.Append(GoSdkToTfSdkStruct(ctx, srcField.Index(i).Interface(), element.Interface())...) + } + if d.HasError() { + return } + elements = append(elements, element.Interface()) } - destField.Set(destSlice) + + // Construct the Terraform value and set it. + destVal, ds := types.ListValueFrom(ctx, listType.ElemType, elements) + d.Append(ds...) + if d.HasError() { + return + } + destField.Set(reflect.ValueOf(destVal)) case reflect.Map: + // This always corresponds to a types.Map. + mapType, ok := tfType.(types.MapType) + if !ok { + d.AddError(goSdkToTfSdkFieldConversionFailureMessage, fmt.Sprintf("inner type is not a map type: %s. %s", tfType, common.TerraformBugErrorMessage)) + return + } if srcField.IsNil() { - // Skip nils - return nil + // If the source field is nil, treat the destination field as an empty map. + nullMap := types.MapNull(mapType.ElemType) + destField.Set(reflect.ValueOf(nullMap)) + return } - destMap := reflect.MakeMap(destField.Type()) + if srcField.Len() == 0 { + // If the destination field is a types.Map, treat the source field as an empty map. + emptyMap := types.MapValueMust(mapType.ElemType, map[string]attr.Value{}) + destField.Set(reflect.ValueOf(emptyMap)) + return + } + + // Convert each key-value pair of the map to the corresponding inner type. + destMap := map[string]any{} for _, key := range srcField.MapKeys() { srcMapValue := srcField.MapIndex(key) - destMapValue := reflect.New(destField.Type().Elem()).Elem() - destMapKey := reflect.ValueOf(key.Interface()) - if err := goSdkToTfSdkSingleField(ctx, srcMapValue, destMapValue, true); err != nil { - return err + destMapValue := reflect.New(innerType) + // If the element is a primitive type, we can convert it by recursively calling this function. + // Otherwise, it is a struct, and we need to convert it by calling GoSdkToTfSdkStruct. + switch innerType { + case reflect.TypeOf(types.String{}), reflect.TypeOf(types.Bool{}), reflect.TypeOf(types.Int64{}), reflect.TypeOf(types.Float64{}): + d.Append(goSdkToTfSdkSingleField(ctx, srcMapValue, destMapValue.Elem(), true, mapType.ElemType, innerType)...) + default: + d.Append(GoSdkToTfSdkStruct(ctx, srcMapValue.Interface(), destMapValue.Interface())...) + } + if d.HasError() { + return } - destMap.SetMapIndex(destMapKey, destMapValue) + destMap[key.String()] = destMapValue.Interface() + } + + // Construct the Terraform value and set it. + destVal, ds := types.MapValueFrom(ctx, mapType.ElemType, destMap) + d.Append(ds...) + if d.HasError() { + return } - destField.Set(destMap) + destField.Set(reflect.ValueOf(destVal)) default: - panic(fmt.Errorf("unknown type for field: %s. %s", srcField.Type().Name(), common.TerraformBugErrorMessage)) + d.AddError(goSdkToTfSdkFieldConversionFailureMessage, fmt.Sprintf("%s is not currently supported as a source field. %s", srcField.Type().Name(), common.TerraformBugErrorMessage)) + } + return +} + +// setFieldToNull sets the destination field to the null value of the appropriate type. +func setFieldToNull(destField reflect.Value, innerType attr.Type) { + switch destField.Type() { + case reflect.TypeOf(types.List{}): + // If the destination field is a types.List, treat the source field as an empty slice. + listType := innerType.(types.ListType) + nullList := types.ListNull(listType.ElemType) + destField.Set(reflect.ValueOf(nullList)) + case reflect.TypeOf(types.Object{}): + // If the destination field is a types.Object, treat the source field as an empty object. + innerType := innerType.(types.ObjectType) + nullObject := types.ObjectNull(innerType.AttrTypes) + destField.Set(reflect.ValueOf(nullObject)) } - return nil } // Get the string value of an enum by calling the .String() method on the enum object. -func getStringFromEnum(srcField reflect.Value) string { +func getStringFromEnum(srcField reflect.Value) (s string, d diag.Diagnostics) { var stringMethod reflect.Value if srcField.CanAddr() { stringMethod = srcField.Addr().MethodByName("String") @@ -232,13 +359,14 @@ func getStringFromEnum(srcField reflect.Value) string { if stringMethod.IsValid() { stringResult := stringMethod.Call(nil) if len(stringResult) == 1 { - return stringResult[0].Interface().(string) - } else { - panic(fmt.Sprintf("num get string has more than one result. %s", common.TerraformBugErrorMessage)) + s = stringResult[0].Interface().(string) + return } - } else { - panic(fmt.Sprintf("enum does not have valid .String() method. %s", common.TerraformBugErrorMessage)) + d.AddError(goSdkToTfSdkFieldConversionFailureMessage, fmt.Sprintf("num get string has more than one result. %s", common.TerraformBugErrorMessage)) + return } + d.AddError(goSdkToTfSdkFieldConversionFailureMessage, fmt.Sprintf("enum does not have valid .String() method. %s", common.TerraformBugErrorMessage)) + return } func fieldInForceSendFields(fieldName string, forceSendFields []string) bool { diff --git a/internal/providers/pluginfw/converters/names.go b/internal/providers/pluginfw/converters/names.go new file mode 100644 index 000000000..5c1847aaf --- /dev/null +++ b/internal/providers/pluginfw/converters/names.go @@ -0,0 +1,20 @@ +package converters + +import ( + "strings" +) + +var reservedNames = map[string]struct{}{ + "Type": {}, +} + +func toGoSdkName(tfSdkName string) string { + return strings.TrimSuffix(tfSdkName, "_") +} + +func toTfSdkName(goSdkName string) string { + if _, ok := reservedNames[goSdkName]; ok { + return goSdkName + "_" + } + return goSdkName +} diff --git a/internal/providers/pluginfw/converters/tf_to_go.go b/internal/providers/pluginfw/converters/tf_to_go.go index 27eb02d91..27f18feae 100644 --- a/internal/providers/pluginfw/converters/tf_to_go.go +++ b/internal/providers/pluginfw/converters/tf_to_go.go @@ -5,9 +5,11 @@ import ( "fmt" "reflect" - "github.com/databricks/databricks-sdk-go/logger" + tfcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/databricks/terraform-provider-databricks/common" @@ -33,7 +35,7 @@ const tfSdkToGoSdkFieldConversionFailureMessage = "tfsdk to gosdk field conversi // types.list and types.map are not supported // map keys should always be a string // tfsdk structs use types.String for all enum values -func TfSdkToGoSdkStruct(ctx context.Context, tfsdk interface{}, gosdk interface{}) diag.Diagnostics { +func TfSdkToGoSdkStruct(ctx context.Context, tfsdk interface{}, gosdk interface{}) (d diag.Diagnostics) { srcVal := reflect.ValueOf(tfsdk) destVal := reflect.ValueOf(gosdk) @@ -42,202 +44,257 @@ func TfSdkToGoSdkStruct(ctx context.Context, tfsdk interface{}, gosdk interface{ } if destVal.Kind() != reflect.Ptr { - return diag.Diagnostics{diag.NewErrorDiagnostic(tfSdkToGoSdkStructConversionFailureMessage, fmt.Sprintf("please provide a pointer for the gosdk struct, got %s", destVal.Type().Name()))} + d.AddError(tfSdkToGoSdkStructConversionFailureMessage, fmt.Sprintf("please provide a pointer for the gosdk struct, got %s", destVal.Type().Name())) + return } destVal = destVal.Elem() if srcVal.Kind() != reflect.Struct { - return diag.Diagnostics{diag.NewErrorDiagnostic(tfSdkToGoSdkStructConversionFailureMessage, fmt.Sprintf("input should be structs, got %s,", srcVal.Type().Name()))} + d.AddError(tfSdkToGoSdkStructConversionFailureMessage, fmt.Sprintf("input should be structs, got %s,", srcVal.Type().Name())) + return } forceSendFieldsField := destVal.FieldByName("ForceSendFields") + var innerTypes map[string]reflect.Type + if cftp, ok := tfsdk.(tfcommon.ComplexFieldTypeProvider); ok { + innerTypes = cftp.GetComplexFieldTypes(ctx) + } + allFields := tfreflect.ListAllFields(srcVal) for _, field := range allFields { srcField := field.Value - srcFieldName := field.StructField.Name + destFieldName := toGoSdkName(field.StructField.Name) srcFieldTag := field.StructField.Tag.Get("tfsdk") if srcFieldTag == "-" { continue } - destField := destVal.FieldByName(srcFieldName) + destField := destVal.FieldByName(destFieldName) + innerType := innerTypes[srcFieldTag] - err := tfSdkToGoSdkSingleField(ctx, srcField, destField, srcFieldName, &forceSendFieldsField) - if err != nil { - return diag.Diagnostics{diag.NewErrorDiagnostic(tfSdkToGoSdkFieldConversionFailureMessage, err.Error())} + d.Append(tfSdkToGoSdkSingleField(ctx, srcField, destField, destFieldName, &forceSendFieldsField, innerType)...) + if d.HasError() { + return } } return nil } -func tfSdkToGoSdkSingleField(ctx context.Context, srcField reflect.Value, destField reflect.Value, srcFieldName string, forceSendFieldsField *reflect.Value) error { +func tfSdkToGoSdkSingleField( + ctx context.Context, + srcField reflect.Value, + destField reflect.Value, + destFieldName string, + forceSendFieldsField *reflect.Value, + innerType reflect.Type) (d diag.Diagnostics) { if !destField.IsValid() { // Skip field that destination struct does not have. - logger.Tracef(ctx, fmt.Sprintf("field skipped in tfsdk to gosdk conversion: destination struct does not have field %s", srcFieldName)) - return nil + tflog.Trace(ctx, fmt.Sprintf("field skipped in tfsdk to gosdk conversion: destination struct does not have field %s", destFieldName)) + return } if !destField.CanSet() { - panic(fmt.Errorf("destination field can not be set: %s. %s", destField.Type().Name(), common.TerraformBugErrorMessage)) + d.AddError(tfSdkToGoSdkFieldConversionFailureMessage, fmt.Sprintf("destination field can not be set: %T. %s", destField.Type(), common.TerraformBugErrorMessage)) + return } - srcFieldValue := srcField.Interface() - - if srcFieldValue == nil { - return nil - } else if srcField.Kind() == reflect.Ptr { - if srcField.IsNil() { - // Skip nils - return nil - } - // Allocate new memory for the destination field - destField.Set(reflect.New(destField.Type().Elem())) - // Recursively populate the nested struct. - if TfSdkToGoSdkStruct(ctx, srcFieldValue, destField.Interface()).HasError() { - panic(fmt.Sprintf("%s. %s", tfSdkToGoSdkStructConversionFailureMessage, common.TerraformBugErrorMessage)) - } - } else if srcField.Kind() == reflect.Slice && destField.Kind() == reflect.Struct { - if srcField.IsNil() { - // Skip nils - return nil - } - assertStructSliceLengthIsOne(srcField) - tfsdkToGoSdkStructField(srcField.Index(0), destField, srcFieldName, forceSendFieldsField, ctx) - } else if srcField.Kind() == reflect.Slice && destField.Kind() == reflect.Ptr { - if srcField.IsNil() { - // Skip nils - return nil - } - destField.Set(reflect.New(destField.Type().Elem())) - - assertStructSliceLengthIsOne(srcField) - - // Recursively populate the nested struct. - if TfSdkToGoSdkStruct(ctx, srcField.Index(0).Interface(), destField.Interface()).HasError() { - panic(fmt.Sprintf("%s. %s", tfSdkToGoSdkStructConversionFailureMessage, common.TerraformBugErrorMessage)) - } - } else if srcField.Kind() == reflect.Struct { - tfsdkToGoSdkStructField(srcField, destField, srcFieldName, forceSendFieldsField, ctx) - } else if srcField.Kind() == reflect.Slice { - if srcField.IsNil() { - // Skip nils - return nil - } - destSlice := reflect.MakeSlice(destField.Type(), srcField.Len(), srcField.Cap()) - for j := 0; j < srcField.Len(); j++ { + // The field being processed must be an attr.Value (a field of the TF SDK struct). + v, ok := srcField.Interface().(attr.Value) + if !ok { + d.AddError(tfSdkToGoSdkFieldConversionFailureMessage, fmt.Sprintf("unexpected type %T in tfsdk structs, expected a plugin framework type. %s", v, common.TerraformBugErrorMessage)) + return + } - srcElem := srcField.Index(j) + if v.IsUnknown() { + return + } - destElem := destSlice.Index(j) - if err := tfSdkToGoSdkSingleField(ctx, srcElem, destElem, "", nil); err != nil { - return err - } - } - destField.Set(destSlice) - } else if srcField.Kind() == reflect.Map { - if srcField.IsNil() { - // Skip nils - return nil - } - destMap := reflect.MakeMap(destField.Type()) - for _, key := range srcField.MapKeys() { - srcMapValue := srcField.MapIndex(key) - destMapValue := reflect.New(destField.Type().Elem()).Elem() - destMapKey := reflect.ValueOf(key.Interface()) - if err := tfSdkToGoSdkSingleField(ctx, srcMapValue, destMapValue, "", nil); err != nil { - return err - } - destMap.SetMapIndex(destMapKey, destMapValue) - } - destField.Set(destMap) - } else { - panic(fmt.Errorf("unknown type for field: %s. %s", srcField.Type().Name(), common.TerraformBugErrorMessage)) + if shouldSetForceSendFields(v, destField) { + addToForceSendFields(ctx, destFieldName, forceSendFieldsField) } - return nil + d.Append(tfsdkToGoSdkStructField(ctx, v, destField, destFieldName, forceSendFieldsField, innerType)...) + return } -func tfsdkToGoSdkStructField(srcField reflect.Value, destField reflect.Value, srcFieldName string, forceSendFieldsField *reflect.Value, ctx context.Context) { - srcFieldValue := srcField.Interface() +func tfsdkToGoSdkStructField( + ctx context.Context, + srcFieldValue attr.Value, + destField reflect.Value, + destFieldName string, + forceSendFieldsField *reflect.Value, + innerType reflect.Type) (d diag.Diagnostics) { switch v := srcFieldValue.(type) { case types.Bool: destField.SetBool(v.ValueBool()) - if !v.IsNull() { - addToForceSendFields(ctx, srcFieldName, forceSendFieldsField) - } case types.Int64: destField.SetInt(v.ValueInt64()) - if !v.IsNull() { - addToForceSendFields(ctx, srcFieldName, forceSendFieldsField) - } case types.Float64: destField.SetFloat(v.ValueFloat64()) - if !v.IsNull() { - addToForceSendFields(ctx, srcFieldName, forceSendFieldsField) - } case types.String: if destField.Type().Name() != "string" { // This is the case for enum. // Skip unset value. - if srcField.IsZero() || v.ValueString() == "" { + if v.ValueString() == "" { return } - // Find the Set method - destVal := reflect.New(destField.Type()) - setMethod := destVal.MethodByName("Set") - if !setMethod.IsValid() { - panic(fmt.Sprintf("set method not found on enum type: %s. %s", destField.Type().Name(), common.TerraformBugErrorMessage)) - } + destVal := convertToEnumValue(v, destField.Type()) + destField.Set(destVal) + } else { + destField.SetString(v.ValueString()) + } + case types.List: + // Empty lists correspond to nil slices or the struct zero value. + if v.IsNull() { + return + } - // Prepare the argument for the Set method - arg := reflect.ValueOf(v.ValueString()) + // Read the nested elements into the TFSDK struct slice + // This is a slice of either TFSDK structs or bools, ints, strings, and floats from the TF plugin framework types. + innerValue := reflect.New(reflect.SliceOf(innerType)) + d.Append(v.ElementsAs(ctx, innerValue.Interface(), true)...) + if d.HasError() { + return + } - // Call the Set method - result := setMethod.Call([]reflect.Value{arg}) - if len(result) != 0 { - if err, ok := result[0].Interface().(error); ok && err != nil { - panic(fmt.Sprintf("%s. %s", err, common.TerraformBugErrorMessage)) - } - } - // We don't need to set ForceSendFields for enums because the value is never going to be a zero value (empty string). - destField.Set(destVal.Elem()) + // Recursively call TFSDK to GOSDK conversion for each element in the list. If this corresponds to a slice, + // the target type is the slice element type. If it corresponds to a struct, the target type is the struct type. + // If it corresponds to a pointer, the target type is the type pointed to by the pointer. + var destInnerType reflect.Type + if destField.Type().Kind() == reflect.Slice { + destInnerType = destField.Type().Elem() } else { - destField.SetString(v.ValueString()) - if !v.IsNull() { - addToForceSendFields(ctx, srcFieldName, forceSendFieldsField) + if innerValue.Elem().Len() > 1 { + d.AddError(tfSdkToGoSdkFieldConversionFailureMessage, fmt.Sprintf("The length of a slice can not be greater than 1 if it is representing a struct, %s", common.TerraformBugErrorMessage)) + return + } + // Case of types.List <-> struct or ptr + if destField.Type().Kind() == reflect.Ptr { + destInnerType = destField.Type().Elem() + } else { + destInnerType = destField.Type() } } - case types.List: - panic(fmt.Sprintf("types.List should never be used, use go native slices instead. %s", common.TerraformBugErrorMessage)) + + // Recursively call TFSDK to GOSDK conversion for each element in the list + converted := reflect.MakeSlice(reflect.SliceOf(destInnerType), 0, innerValue.Elem().Len()) + for i := 0; i < innerValue.Elem().Len(); i++ { + vv := innerValue.Elem().Index(i).Interface() + nextDest := reflect.New(destInnerType) + // If the element is a primitive type, we can convert it by recursively calling this function. + // Otherwise, it is a TF SDK struct, and we need to call TfSdkToGoSdkStruct to convert it. + switch typedVv := vv.(type) { + case types.Bool, types.String, types.Int64, types.Float64: + d.Append(tfsdkToGoSdkStructField(ctx, typedVv.(attr.Value), nextDest.Elem(), destFieldName, forceSendFieldsField, innerType)...) + default: + d.Append(TfSdkToGoSdkStruct(ctx, vv, nextDest.Interface())...) + } + if d.HasError() { + return + } + converted = reflect.Append(converted, reflect.Indirect(nextDest)) + } + + if destField.Type().Kind() == reflect.Slice { + destField.Set(converted) + } else if destField.Type().Kind() == reflect.Ptr { + destField.Set(converted.Index(0).Addr()) + } else { + destField.Set(converted.Index(0)) + } case types.Map: - panic(fmt.Sprintf("types.Map should never be used, use go native maps instead. %s", common.TerraformBugErrorMessage)) - default: - if srcField.IsZero() { - // Skip zeros + // Empty maps correspond to nil maps or the struct zero value. + if v.IsNull() { return } - // If it is a real stuct instead of a tfsdk type, recursively resolve it. - if TfSdkToGoSdkStruct(ctx, srcFieldValue, destField.Addr().Interface()).HasError() { - panic(fmt.Sprintf("%s. %s", tfSdkToGoSdkStructConversionFailureMessage, common.TerraformBugErrorMessage)) + + // Read the nested elements into the TFSDK struct map + // This is a map from string to either TFSDK structs or bools, ints, strings, and floats from the TF plugin framework types. + innerValue := reflect.New(reflect.MapOf(reflect.TypeOf(""), innerType)) + d.Append(v.ElementsAs(ctx, innerValue.Interface(), true)...) + if d.HasError() { + return + } + + // Recursively call TFSDK to GOSDK conversion for each element in the map + destType := destField.Type().Elem() + converted := reflect.MakeMap(reflect.MapOf(reflect.TypeOf(""), destType)) + for _, key := range innerValue.Elem().MapKeys() { + vv := innerValue.Elem().MapIndex(key).Interface() + nextDest := reflect.New(destType) + // If the element is a primitive type, we can convert it by recursively calling this function. + // Otherwise, it is a TF SDK struct, and we need to call TfSdkToGoSdkStruct to convert it. + switch typedVv := vv.(type) { + case types.Bool, types.String, types.Int64, types.Float64: + d.Append(tfsdkToGoSdkStructField(ctx, typedVv.(attr.Value), nextDest.Elem(), destFieldName, forceSendFieldsField, innerType)...) + default: + d.Append(TfSdkToGoSdkStruct(ctx, vv, nextDest.Interface())...) + } + if d.HasError() { + return + } + converted.SetMapIndex(key, nextDest.Elem()) } + + destField.Set(converted) + case types.Object: + if v.IsNull() { + return + } + + innerValue := reflect.New(innerType) + d.Append(v.As(ctx, innerValue.Interface(), basetypes.ObjectAsOptions{UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true})...) + if d.HasError() { + return + } + + destType := destField.Type() + if destType.Kind() == reflect.Ptr { + destType = destType.Elem() + } + destValue := reflect.New(destType) + d.Append(TfSdkToGoSdkStruct(ctx, innerValue.Interface(), destValue.Interface())...) + if d.HasError() { + return + } + if destField.Type().Kind() == reflect.Ptr { + destField.Set(destValue) + } else { + destField.Set(destValue.Elem()) + } + default: + d.AddError(tfSdkToGoSdkFieldConversionFailureMessage, fmt.Sprintf("%T is not currently supported as a source field. %s", v, common.TerraformBugErrorMessage)) + return } + return } -func assertStructSliceLengthIsOne(srcSlice reflect.Value) { - if srcSlice.Len() > 1 { - panic(fmt.Sprintf("The length of a slice can not be greater than 1 if it is representing a struct, %s", common.TerraformBugErrorMessage)) +func shouldSetForceSendFields(srcFieldValue attr.Value, destField reflect.Value) bool { + if srcFieldValue.IsNull() { + return false } + // Don't set forceSendFields for enums + // We don't need to set ForceSendFields for enums because the value is never going to be a zero value (empty string). + if _, ok := srcFieldValue.(types.String); ok && destField.Type().Name() != "string" { + return false + } + // Don't set forceSendFields for lists + if _, ok := srcFieldValue.(types.List); ok && destField.Kind() == reflect.Slice { + return false + } + + return true } func addToForceSendFields(ctx context.Context, fieldName string, forceSendFieldsField *reflect.Value) { if forceSendFieldsField == nil || !forceSendFieldsField.IsValid() || !forceSendFieldsField.CanSet() { - tflog.Debug(ctx, fmt.Sprintf("[Debug] forceSendFieldsField is nil, invalid or not settable. %s", fieldName)) + tflog.Debug(ctx, fmt.Sprintf("forceSendFieldsField is nil, invalid or not settable. %s", fieldName)) return } // Initialize forceSendFields if it is a zero Value @@ -250,3 +307,25 @@ func addToForceSendFields(ctx context.Context, fieldName string, forceSendFields forceSendFields = append(forceSendFields, fieldName) forceSendFieldsField.Set(reflect.ValueOf(forceSendFields)) } + +// Returns a reflect.Value of the enum type with the value set to the given string. +func convertToEnumValue(v types.String, destType reflect.Type) reflect.Value { + // Find the Set method + destVal := reflect.New(destType) + setMethod := destVal.MethodByName("Set") + if !setMethod.IsValid() { + panic(fmt.Sprintf("set method not found on enum type: %s. %s", destType.Name(), common.TerraformBugErrorMessage)) + } + + // Prepare the argument for the Set method + arg := reflect.ValueOf(v.ValueString()) + + // Call the Set method + result := setMethod.Call([]reflect.Value{arg}) + if len(result) != 0 { + if err, ok := result[0].Interface().(error); ok && err != nil { + panic(fmt.Sprintf("%s. %s", err, common.TerraformBugErrorMessage)) + } + } + return destVal.Elem() +} diff --git a/internal/providers/pluginfw/products/catalog/data_functions.go b/internal/providers/pluginfw/products/catalog/data_functions.go index 9f6c3aba6..5c0ca3bea 100644 --- a/internal/providers/pluginfw/products/catalog/data_functions.go +++ b/internal/providers/pluginfw/products/catalog/data_functions.go @@ -3,6 +3,7 @@ package catalog import ( "context" "fmt" + "reflect" "github.com/databricks/databricks-sdk-go/apierr" "github.com/databricks/databricks-sdk-go/service/catalog" @@ -12,6 +13,7 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/catalog_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -30,10 +32,16 @@ type FunctionsDataSource struct { } type FunctionsData struct { - CatalogName types.String `tfsdk:"catalog_name"` - SchemaName types.String `tfsdk:"schema_name"` - IncludeBrowse types.Bool `tfsdk:"include_browse" tf:"optional"` - Functions []catalog_tf.FunctionInfo `tfsdk:"functions" tf:"optional,computed"` + CatalogName types.String `tfsdk:"catalog_name"` + SchemaName types.String `tfsdk:"schema_name"` + IncludeBrowse types.Bool `tfsdk:"include_browse" tf:"optional"` + Functions types.List `tfsdk:"functions" tf:"optional,computed"` +} + +func (FunctionsData) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "functions": reflect.TypeOf(catalog_tf.FunctionInfo{}), + } } func (d *FunctionsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -41,7 +49,7 @@ func (d *FunctionsDataSource) Metadata(ctx context.Context, req datasource.Metad } func (d *FunctionsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(FunctionsData{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, FunctionsData{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -82,13 +90,15 @@ func (d *FunctionsDataSource) Read(ctx context.Context, req datasource.ReadReque resp.Diagnostics.AddError(fmt.Sprintf("failed to get functions for %s.%s schema", catalogName, schemaName), err.Error()) return } + tfFunctions := []attr.Value{} for _, functionSdk := range functionsInfosSdk { var function catalog_tf.FunctionInfo resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, functionSdk, &function)...) if resp.Diagnostics.HasError() { return } - functions.Functions = append(functions.Functions, function) + tfFunctions = append(tfFunctions, function.ToObjectValue(ctx)) } + functions.Functions = types.ListValueMust(catalog_tf.FunctionInfo{}.Type(ctx), tfFunctions) resp.Diagnostics.Append(resp.State.Set(ctx, functions)...) } diff --git a/internal/providers/pluginfw/products/cluster/data_cluster.go b/internal/providers/pluginfw/products/cluster/data_cluster.go index 8d0499ccb..ffcf6a70d 100644 --- a/internal/providers/pluginfw/products/cluster/data_cluster.go +++ b/internal/providers/pluginfw/products/cluster/data_cluster.go @@ -3,9 +3,10 @@ package cluster import ( "context" "fmt" + "reflect" "strings" - "github.com/databricks/databricks-sdk-go/apierr" + "github.com/databricks/databricks-sdk-go" "github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/terraform-provider-databricks/common" pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" @@ -13,6 +14,7 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/compute_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -32,9 +34,15 @@ type ClusterDataSource struct { } type ClusterInfo struct { - ClusterId types.String `tfsdk:"cluster_id" tf:"optional,computed"` - Name types.String `tfsdk:"cluster_name" tf:"optional,computed"` - ClusterInfo []compute_tf.ClusterDetails `tfsdk:"cluster_info" tf:"optional,computed"` + ClusterId types.String `tfsdk:"cluster_id" tf:"optional,computed"` + Name types.String `tfsdk:"cluster_name" tf:"optional,computed"` + ClusterInfo types.List `tfsdk:"cluster_info" tf:"optional,computed"` +} + +func (ClusterInfo) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster_info": reflect.TypeOf(compute_tf.ClusterDetails{}), + } } func (d *ClusterDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -42,7 +50,7 @@ func (d *ClusterDataSource) Metadata(ctx context.Context, req datasource.Metadat } func (d *ClusterDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(ClusterInfo{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, ClusterInfo{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -55,20 +63,6 @@ func (d *ClusterDataSource) Configure(_ context.Context, req datasource.Configur } } -func validateClustersList(ctx context.Context, clusters []compute_tf.ClusterDetails, clusterName string) diag.Diagnostics { - if len(clusters) == 0 { - return diag.Diagnostics{diag.NewErrorDiagnostic(fmt.Sprintf("there is no cluster with name '%s'", clusterName), "")} - } - if len(clusters) > 1 { - clusterIDs := []string{} - for _, cluster := range clusters { - clusterIDs = append(clusterIDs, cluster.ClusterId.ValueString()) - } - return diag.Diagnostics{diag.NewErrorDiagnostic(fmt.Sprintf("there is more than one cluster with name '%s'", clusterName), fmt.Sprintf("The IDs of those clusters are: %s. When specifying a cluster name, the name must be unique. Alternatively, specify the cluster by ID using the cluster_id attribute.", strings.Join(clusterIDs, ", ")))} - } - return nil -} - func (d *ClusterDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { ctx = pluginfwcontext.SetUserAgentInDataSourceContext(ctx, dataSourceName) w, diags := d.Client.GetWorkspaceClient() @@ -82,54 +76,69 @@ func (d *ClusterDataSource) Read(ctx context.Context, req datasource.ReadRequest if resp.Diagnostics.HasError() { return } + clusterName := clusterInfo.Name.ValueString() clusterId := clusterInfo.ClusterId.ValueString() + cluster, diag := d.getClusterDetails(ctx, w, clusterName, clusterId) + resp.Diagnostics.Append(diag...) + if resp.Diagnostics.HasError() { + return + } + + var tfCluster compute_tf.ClusterDetails + resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, cluster, &tfCluster)...) + if resp.Diagnostics.HasError() { + return + } + + clusterInfo.ClusterId = tfCluster.ClusterId + clusterInfo.Name = tfCluster.ClusterName + clusterInfo.ClusterInfo = types.ListValueMust(tfCluster.Type(ctx), []attr.Value{tfCluster.ToObjectValue(ctx)}) + resp.Diagnostics.Append(resp.State.Set(ctx, clusterInfo)...) +} + +func validateClustersList(_ context.Context, clusters []compute.ClusterDetails, clusterName string) diag.Diagnostics { + if len(clusters) == 0 { + return diag.Diagnostics{diag.NewErrorDiagnostic(fmt.Sprintf("there is no cluster with name '%s'", clusterName), "")} + } + if len(clusters) > 1 { + clusterIDs := []string{} + for _, cluster := range clusters { + clusterIDs = append(clusterIDs, cluster.ClusterId) + } + return diag.Diagnostics{diag.NewErrorDiagnostic(fmt.Sprintf("there is more than one cluster with name '%s'", clusterName), fmt.Sprintf("The IDs of those clusters are: %s. When specifying a cluster name, the name must be unique. Alternatively, specify the cluster by ID using the cluster_id attribute.", strings.Join(clusterIDs, ", ")))} + } + return nil +} + +func (d *ClusterDataSource) getClusterDetails(ctx context.Context, w *databricks.WorkspaceClient, clusterName, clusterId string) (c compute.ClusterDetails, dd diag.Diagnostics) { if clusterName != "" { - clustersGoSDk, err := w.Clusters.ListAll(ctx, compute.ListClustersRequest{}) + clusters, err := w.Clusters.ListAll(ctx, compute.ListClustersRequest{}) if err != nil { - resp.Diagnostics.AddError("failed to list clusters", err.Error()) + dd.AddError("failed to list clusters", err.Error()) return } - var clustersTfSDK []compute_tf.ClusterDetails - for _, cluster := range clustersGoSDk { - var clusterDetails compute_tf.ClusterDetails - resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, cluster, &clusterDetails)...) - if resp.Diagnostics.HasError() { - return - } - clustersTfSDK = append(clustersTfSDK, clusterDetails) - } - namedClusters := []compute_tf.ClusterDetails{} - for _, cluster := range clustersTfSDK { - if cluster.ClusterName == clusterInfo.Name { - namedClusters = append(namedClusters, cluster) + cc := []compute.ClusterDetails{} + for _, cluster := range clusters { + if cluster.ClusterName == clusterName { + cc = append(cc, cluster) } } - resp.Diagnostics.Append(validateClustersList(ctx, namedClusters, clusterName)...) - if resp.Diagnostics.HasError() { + dd.Append(validateClustersList(ctx, cc, clusterName)...) + if dd.HasError() { return } - clusterInfo.ClusterInfo = namedClusters[0:1] - } else if clusterId != "" { + return cc[0], dd + } + if clusterId != "" { cluster, err := w.Clusters.GetByClusterId(ctx, clusterId) if err != nil { - if apierr.IsMissing(err) { - resp.State.RemoveResource(ctx) - } - resp.Diagnostics.AddError(fmt.Sprintf("failed to get cluster with cluster id: %s", clusterId), err.Error()) - return - } - var clusterDetails compute_tf.ClusterDetails - resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, cluster, &clusterDetails)...) - if resp.Diagnostics.HasError() { + dd.AddError(fmt.Sprintf("failed to get cluster with cluster id: %s", clusterId), err.Error()) return } - clusterInfo.ClusterInfo = []compute_tf.ClusterDetails{clusterDetails} - } else { - resp.Diagnostics.AddError("you need to specify either `cluster_name` or `cluster_id`", "") - return + return *cluster, dd } - clusterInfo.ClusterId = clusterInfo.ClusterInfo[0].ClusterId - clusterInfo.Name = clusterInfo.ClusterInfo[0].ClusterName - resp.Diagnostics.Append(resp.State.Set(ctx, clusterInfo)...) + + dd.AddError("you need to specify either `cluster_name` or `cluster_id`", "") + return } diff --git a/internal/providers/pluginfw/products/cluster/data_cluster_test.go b/internal/providers/pluginfw/products/cluster/data_cluster_test.go index 83ee608a9..2e36e367d 100644 --- a/internal/providers/pluginfw/products/cluster/data_cluster_test.go +++ b/internal/providers/pluginfw/products/cluster/data_cluster_test.go @@ -5,15 +5,14 @@ import ( "fmt" "testing" - "github.com/databricks/terraform-provider-databricks/internal/service/compute_tf" + "github.com/databricks/databricks-sdk-go/service/compute" "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/types" "github.com/stretchr/testify/assert" ) func TestNoClusterError(t *testing.T) { clusterName := "test-cluster-name" - clusters := []compute_tf.ClusterDetails{} + clusters := []compute.ClusterDetails{} actualDiagnostics := validateClustersList(context.Background(), clusters, clusterName) expectedDiagnostics := diag.Diagnostics{diag.NewErrorDiagnostic(fmt.Sprintf("there is no cluster with name '%s'", clusterName), "")} assert.True(t, actualDiagnostics.HasError()) @@ -22,14 +21,14 @@ func TestNoClusterError(t *testing.T) { func TestMultipleClustersError(t *testing.T) { clusterName := "test-cluster-name" - clusters := []compute_tf.ClusterDetails{ + clusters := []compute.ClusterDetails{ { - ClusterName: types.StringValue("test-cluster-name"), - ClusterId: types.StringValue("123"), + ClusterName: "test-cluster-name", + ClusterId: "123", }, { - ClusterName: types.StringValue("test-cluster-name"), - ClusterId: types.StringValue("456"), + ClusterName: "test-cluster-name", + ClusterId: "456", }, } actualDiagnostics := validateClustersList(context.Background(), clusters, clusterName) diff --git a/internal/providers/pluginfw/products/library/resource_library.go b/internal/providers/pluginfw/products/library/resource_library.go index 2f9d8b9ea..178687495 100644 --- a/internal/providers/pluginfw/products/library/resource_library.go +++ b/internal/providers/pluginfw/products/library/resource_library.go @@ -87,7 +87,7 @@ func (r *LibraryResource) Metadata(ctx context.Context, req resource.MetadataReq } func (r *LibraryResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - attrs, blocks := tfschema.ResourceStructToSchemaMap(LibraryExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { + attrs, blocks := tfschema.ResourceStructToSchemaMap(ctx, LibraryExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { for field, attribute := range c.ToNestedBlockObject().Attributes { switch attribute.(type) { case tfschema.StringAttributeBuilder: diff --git a/internal/providers/pluginfw/products/notificationdestinations/data_notification_destinations.go b/internal/providers/pluginfw/products/notificationdestinations/data_notification_destinations.go index 8b48a74e3..5e6688bb7 100755 --- a/internal/providers/pluginfw/products/notificationdestinations/data_notification_destinations.go +++ b/internal/providers/pluginfw/products/notificationdestinations/data_notification_destinations.go @@ -3,6 +3,7 @@ package notificationdestinations import ( "context" "fmt" + "reflect" "slices" "strings" @@ -13,6 +14,7 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/settings_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -32,9 +34,15 @@ type NotificationDestinationsDataSource struct { } type NotificationDestinationsInfo struct { - DisplayNameContains types.String `tfsdk:"display_name_contains" tf:"optional"` - Type types.String `tfsdk:"type" tf:"optional"` - NotificationDestinations []settings_tf.ListNotificationDestinationsResult `tfsdk:"notification_destinations" tf:"computed"` + DisplayNameContains types.String `tfsdk:"display_name_contains" tf:"optional"` + Type types.String `tfsdk:"type" tf:"optional"` + NotificationDestinations types.List `tfsdk:"notification_destinations" tf:"computed"` +} + +func (NotificationDestinationsInfo) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "notification_destinations": reflect.TypeOf(settings_tf.ListNotificationDestinationsResult{}), + } } func (d *NotificationDestinationsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -42,7 +50,7 @@ func (d *NotificationDestinationsDataSource) Metadata(ctx context.Context, req d } func (d *NotificationDestinationsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(NotificationDestinationsInfo{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, NotificationDestinationsInfo{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -100,7 +108,7 @@ func (d *NotificationDestinationsDataSource) Read(ctx context.Context, req datas return } - var notificationsTfSdk []settings_tf.ListNotificationDestinationsResult + var notificationsTfSdk []attr.Value for _, notification := range notificationsGoSdk { if (notificationType != "" && notification.DestinationType.String() != notificationType) || (notificationDisplayName != "" && !strings.Contains(strings.ToLower(notification.DisplayName), notificationDisplayName)) { @@ -111,10 +119,10 @@ func (d *NotificationDestinationsDataSource) Read(ctx context.Context, req datas if AppendDiagAndCheckErrors(resp, converters.GoSdkToTfSdkStruct(ctx, notification, ¬ificationDestination)) { return } - notificationsTfSdk = append(notificationsTfSdk, notificationDestination) + notificationsTfSdk = append(notificationsTfSdk, notificationDestination.ToObjectValue(ctx)) } - notificationInfo.NotificationDestinations = notificationsTfSdk + notificationInfo.NotificationDestinations = types.ListValueMust(settings_tf.ListNotificationDestinationsResult{}.Type(ctx), notificationsTfSdk) resp.Diagnostics.Append(resp.State.Set(ctx, notificationInfo)...) } diff --git a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go index 8f6551922..00e04a3bd 100644 --- a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go +++ b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go @@ -3,6 +3,7 @@ package qualitymonitor import ( "context" "fmt" + "reflect" "time" "github.com/databricks/databricks-sdk-go" @@ -61,6 +62,12 @@ type MonitorInfoExtended struct { ID types.String `tfsdk:"id" tf:"optional,computed"` // Adding ID field to stay compatible with SDKv2 } +var _ pluginfwcommon.ComplexFieldTypeProvider = MonitorInfoExtended{} + +func (m MonitorInfoExtended) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return m.MonitorInfo.GetComplexFieldTypes(ctx) +} + type QualityMonitorResource struct { Client *common.DatabricksClient } @@ -70,7 +77,7 @@ func (r *QualityMonitorResource) Metadata(ctx context.Context, req resource.Meta } func (r *QualityMonitorResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - attrs, blocks := tfschema.ResourceStructToSchemaMap(MonitorInfoExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { + attrs, blocks := tfschema.ResourceStructToSchemaMap(ctx, MonitorInfoExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { c.SetRequired("assets_dir") c.SetRequired("output_schema_name") c.SetReadOnly("monitor_version") diff --git a/internal/providers/pluginfw/products/registered_model/data_registered_model.go b/internal/providers/pluginfw/products/registered_model/data_registered_model.go index 980c46ed1..912f5b606 100644 --- a/internal/providers/pluginfw/products/registered_model/data_registered_model.go +++ b/internal/providers/pluginfw/products/registered_model/data_registered_model.go @@ -3,6 +3,7 @@ package registered_model import ( "context" "fmt" + "reflect" "github.com/databricks/databricks-sdk-go/apierr" "github.com/databricks/databricks-sdk-go/service/catalog" @@ -12,9 +13,12 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/catalog_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) const dataSourceName = "registered_model" @@ -30,10 +34,16 @@ type RegisteredModelDataSource struct { } type RegisteredModelData struct { - FullName types.String `tfsdk:"full_name"` - IncludeAliases types.Bool `tfsdk:"include_aliases" tf:"optional"` - IncludeBrowse types.Bool `tfsdk:"include_browse" tf:"optional"` - ModelInfo []catalog_tf.RegisteredModelInfo `tfsdk:"model_info" tf:"optional,computed"` + FullName types.String `tfsdk:"full_name"` + IncludeAliases types.Bool `tfsdk:"include_aliases" tf:"optional"` + IncludeBrowse types.Bool `tfsdk:"include_browse" tf:"optional"` + ModelInfo types.List `tfsdk:"model_info" tf:"optional,computed"` +} + +func (RegisteredModelData) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_info": reflect.TypeOf(catalog_tf.RegisteredModelInfo{}), + } } func (d *RegisteredModelDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -41,7 +51,7 @@ func (d *RegisteredModelDataSource) Metadata(ctx context.Context, req datasource } func (d *RegisteredModelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(RegisteredModelData{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, RegisteredModelData{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -86,9 +96,11 @@ func (d *RegisteredModelDataSource) Read(ctx context.Context, req datasource.Rea if resp.Diagnostics.HasError() { return } - if modelInfo.Aliases == nil { - modelInfo.Aliases = []catalog_tf.RegisteredModelAlias{} + if modelInfo.Aliases.IsNull() { + var d diag.Diagnostics + modelInfo.Aliases, d = basetypes.NewListValueFrom(ctx, modelInfo.Aliases.ElementType(ctx), []catalog_tf.RegisteredModelAlias{}) + resp.Diagnostics.Append(d...) } - registeredModel.ModelInfo = append(registeredModel.ModelInfo, modelInfo) + registeredModel.ModelInfo = types.ListValueMust(catalog_tf.RegisteredModelInfo{}.Type(ctx), []attr.Value{modelInfo.ToObjectValue(ctx)}) resp.Diagnostics.Append(resp.State.Set(ctx, registeredModel)...) } diff --git a/internal/providers/pluginfw/products/registered_model/data_registered_model_versions.go b/internal/providers/pluginfw/products/registered_model/data_registered_model_versions.go index 916221032..5e3ab0c55 100644 --- a/internal/providers/pluginfw/products/registered_model/data_registered_model_versions.go +++ b/internal/providers/pluginfw/products/registered_model/data_registered_model_versions.go @@ -3,12 +3,14 @@ package registered_model import ( "context" "fmt" + "reflect" "github.com/databricks/terraform-provider-databricks/common" pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/catalog_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -25,8 +27,14 @@ type RegisteredModelVersionsDataSource struct { } type RegisteredModelVersionsData struct { - FullName types.String `tfsdk:"full_name"` - ModelVersions []catalog_tf.ModelVersionInfo `tfsdk:"model_versions" tf:"optional,computed"` + FullName types.String `tfsdk:"full_name"` + ModelVersions types.List `tfsdk:"model_versions" tf:"optional,computed"` +} + +func (RegisteredModelVersionsData) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_versions": reflect.TypeOf(catalog_tf.ModelVersionInfo{}), + } } func (d *RegisteredModelVersionsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -34,7 +42,7 @@ func (d *RegisteredModelVersionsDataSource) Metadata(ctx context.Context, req da } func (d *RegisteredModelVersionsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(RegisteredModelVersionsData{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, RegisteredModelVersionsData{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -66,13 +74,15 @@ func (d *RegisteredModelVersionsDataSource) Read(ctx context.Context, req dataso resp.Diagnostics.AddError(fmt.Sprintf("failed to list model versions for registered model %s", modelFullName), err.Error()) return } + var tfModelVersions []attr.Value for _, modelVersionSdk := range modelVersions.ModelVersions { var modelVersion catalog_tf.ModelVersionInfo resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, modelVersionSdk, &modelVersion)...) if resp.Diagnostics.HasError() { return } - registeredModelVersions.ModelVersions = append(registeredModelVersions.ModelVersions, modelVersion) + tfModelVersions = append(tfModelVersions, modelVersion.ToObjectValue(ctx)) } + registeredModelVersions.ModelVersions = types.ListValueMust(catalog_tf.ModelVersionInfo{}.Type(ctx), tfModelVersions) resp.Diagnostics.Append(resp.State.Set(ctx, registeredModelVersions)...) } diff --git a/internal/providers/pluginfw/products/serving/data_serving_endpoints.go b/internal/providers/pluginfw/products/serving/data_serving_endpoints.go index 48068ad07..51c5e2c64 100644 --- a/internal/providers/pluginfw/products/serving/data_serving_endpoints.go +++ b/internal/providers/pluginfw/products/serving/data_serving_endpoints.go @@ -2,6 +2,7 @@ package serving import ( "context" + "reflect" "github.com/databricks/databricks-sdk-go/apierr" "github.com/databricks/terraform-provider-databricks/common" @@ -9,8 +10,10 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/serving_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" ) func DataSourceServingEndpoints() datasource.DataSource { @@ -24,7 +27,13 @@ type ServingEndpointsDataSource struct { } type ServingEndpointsData struct { - Endpoints []serving_tf.ServingEndpoint `tfsdk:"endpoints" tf:"optional,computed"` + Endpoints types.List `tfsdk:"endpoints" tf:"optional,computed"` +} + +func (ServingEndpointsData) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "endpoints": reflect.TypeOf(serving_tf.ServingEndpoint{}), + } } func (d *ServingEndpointsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -32,7 +41,7 @@ func (d *ServingEndpointsDataSource) Metadata(ctx context.Context, req datasourc } func (d *ServingEndpointsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(ServingEndpointsData{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, ServingEndpointsData{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -66,13 +75,15 @@ func (d *ServingEndpointsDataSource) Read(ctx context.Context, req datasource.Re resp.Diagnostics.AddError("failed to list endpoints", err.Error()) return } + tfEndpoints := []attr.Value{} for _, endpoint := range endpointsInfoSdk { var endpointsInfo serving_tf.ServingEndpoint resp.Diagnostics.Append(converters.GoSdkToTfSdkStruct(ctx, endpoint, &endpointsInfo)...) if resp.Diagnostics.HasError() { return } - endpoints.Endpoints = append(endpoints.Endpoints, endpointsInfo) + tfEndpoints = append(tfEndpoints, endpointsInfo.ToObjectValue(ctx)) } + endpoints.Endpoints = types.ListValueMust(serving_tf.ServingEndpoint{}.Type(ctx), tfEndpoints) resp.Diagnostics.Append(resp.State.Set(ctx, endpoints)...) } diff --git a/internal/providers/pluginfw/products/sharing/data_share.go b/internal/providers/pluginfw/products/sharing/data_share.go index 5855283c1..bfb9cbb9d 100644 --- a/internal/providers/pluginfw/products/sharing/data_share.go +++ b/internal/providers/pluginfw/products/sharing/data_share.go @@ -32,7 +32,7 @@ func (d *ShareDataSource) Metadata(ctx context.Context, req datasource.MetadataR } func (d *ShareDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(sharing_tf.ShareInfo{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, sharing_tf.ShareInfo{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, diff --git a/internal/providers/pluginfw/products/sharing/data_shares.go b/internal/providers/pluginfw/products/sharing/data_shares.go index 7b996ab33..457ba8633 100644 --- a/internal/providers/pluginfw/products/sharing/data_shares.go +++ b/internal/providers/pluginfw/products/sharing/data_shares.go @@ -2,22 +2,37 @@ package sharing import ( "context" - - "github.com/hashicorp/terraform-plugin-framework/types" + "reflect" "github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/terraform-provider-databricks/common" pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" pluginfwcontext "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/context" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" ) const dataSourceNameShares = "shares" type SharesList struct { - Shares []types.String `tfsdk:"shares" tf:"computed,optional,slice_set"` + Shares types.List `tfsdk:"shares" tf:"computed,optional,slice_set"` +} + +func (SharesList) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "shares": reflect.TypeOf(types.String{}), + } +} + +func (SharesList) ToObjectType(ctx context.Context) types.ObjectType { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "shares": types.ListType{ElemType: types.StringType}, + }, + } } func DataSourceShares() datasource.DataSource { @@ -35,7 +50,7 @@ func (d *SharesDataSource) Metadata(ctx context.Context, req datasource.Metadata } func (d *SharesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(SharesList{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, SharesList{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -62,10 +77,10 @@ func (d *SharesDataSource) Read(ctx context.Context, req datasource.ReadRequest, return } - shareNames := make([]types.String, len(shares)) + shareNames := make([]attr.Value, len(shares)) for i, share := range shares { shareNames[i] = types.StringValue(share.Name) } - resp.Diagnostics.Append(resp.State.Set(ctx, SharesList{Shares: shareNames})...) + resp.Diagnostics.Append(resp.State.Set(ctx, SharesList{Shares: types.ListValueMust(types.StringType, shareNames)})...) } diff --git a/internal/providers/pluginfw/products/sharing/resource_share.go b/internal/providers/pluginfw/products/sharing/resource_share.go index e86847e0c..39d1cf2cb 100644 --- a/internal/providers/pluginfw/products/sharing/resource_share.go +++ b/internal/providers/pluginfw/products/sharing/resource_share.go @@ -13,6 +13,7 @@ import ( "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" "github.com/databricks/terraform-provider-databricks/internal/service/sharing_tf" + "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -32,6 +33,12 @@ type ShareInfoExtended struct { sharing_tf.ShareInfo } +var _ pluginfwcommon.ComplexFieldTypeProvider = ShareInfoExtended{} + +func (s ShareInfoExtended) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return s.ShareInfo.GetComplexFieldTypes(ctx) +} + func matchOrder[T any, K comparable](target, reference []T, keyFunc func(T) K) { // Create a map to store the index positions of each key in the reference slice. orderMap := make(map[K]int) @@ -137,7 +144,7 @@ func (r *ShareResource) Metadata(ctx context.Context, req resource.MetadataReque } func (r *ShareResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - attrs, blocks := tfschema.ResourceStructToSchemaMap(ShareInfoExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { + attrs, blocks := tfschema.ResourceStructToSchemaMap(ctx, ShareInfoExtended{}, func(c tfschema.CustomizableSchema) tfschema.CustomizableSchema { c.SetRequired("name") c.AddPlanModifier(stringplanmodifier.RequiresReplace(), "name") // ForceNew @@ -145,8 +152,8 @@ func (r *ShareResource) Schema(ctx context.Context, req resource.SchemaRequest, c.AddPlanModifier(stringplanmodifier.UseStateForUnknown(), "created_by") c.SetRequired("object", "data_object_type") - c.SetRequired("object", "partitions", "values", "op") - c.SetRequired("object", "partitions", "values", "name") + c.SetRequired("object", "partition", "value", "op") + c.SetRequired("object", "partition", "value", "name") return c }) resp.Schema = schema.Schema{ @@ -213,15 +220,13 @@ func (r *ShareResource) Create(ctx context.Context, req resource.CreateRequest, return } - newState.SyncEffectiveFieldsDuringCreateOrUpdate(plan.ShareInfo) - for i := range newState.Objects { - newState.Objects[i].SyncEffectiveFieldsDuringCreateOrUpdate(plan.Objects[i]) - } - - resp.Diagnostics.Append(resp.State.Set(ctx, newState)...) + newState, d := r.syncEffectiveFields(ctx, plan, newState, effectiveFieldsActionCreateOrUpdate{}) + resp.Diagnostics.Append(d...) if resp.Diagnostics.HasError() { return } + + resp.Diagnostics.Append(resp.State.Set(ctx, newState)...) } func (r *ShareResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { @@ -271,9 +276,10 @@ func (r *ShareResource) Read(ctx context.Context, req resource.ReadRequest, resp return } - newState.SyncEffectiveFieldsDuringRead(existingState.ShareInfo) - for i := range newState.Objects { - newState.Objects[i].SyncEffectiveFieldsDuringRead(existingState.Objects[i]) + newState, d := r.syncEffectiveFields(ctx, existingState, newState, effectiveFieldsActionRead{}) + resp.Diagnostics.Append(d...) + if resp.Diagnostics.HasError() { + return } resp.Diagnostics.Append(resp.State.Set(ctx, newState)...) @@ -370,9 +376,10 @@ func (r *ShareResource) Update(ctx context.Context, req resource.UpdateRequest, } } - state.SyncEffectiveFieldsDuringCreateOrUpdate(plan.ShareInfo) - for i := range state.Objects { - state.Objects[i].SyncEffectiveFieldsDuringCreateOrUpdate(plan.Objects[i]) + state, d := r.syncEffectiveFields(ctx, plan, state, effectiveFieldsActionCreateOrUpdate{}) + resp.Diagnostics.Append(d...) + if resp.Diagnostics.HasError() { + return } resp.Diagnostics.Append(resp.State.Set(ctx, state)...) @@ -398,3 +405,42 @@ func (r *ShareResource) Delete(ctx context.Context, req resource.DeleteRequest, return } } + +type effectiveFieldsAction interface { + resourceLevel(*ShareInfoExtended, sharing_tf.ShareInfo) + objectLevel(*sharing_tf.SharedDataObject, sharing_tf.SharedDataObject) +} + +type effectiveFieldsActionCreateOrUpdate struct{} + +func (effectiveFieldsActionCreateOrUpdate) resourceLevel(state *ShareInfoExtended, plan sharing_tf.ShareInfo) { + state.SyncEffectiveFieldsDuringCreateOrUpdate(plan) +} + +func (effectiveFieldsActionCreateOrUpdate) objectLevel(state *sharing_tf.SharedDataObject, plan sharing_tf.SharedDataObject) { + state.SyncEffectiveFieldsDuringCreateOrUpdate(plan) +} + +type effectiveFieldsActionRead struct{} + +func (effectiveFieldsActionRead) resourceLevel(state *ShareInfoExtended, plan sharing_tf.ShareInfo) { + state.SyncEffectiveFieldsDuringRead(plan) +} + +func (effectiveFieldsActionRead) objectLevel(state *sharing_tf.SharedDataObject, plan sharing_tf.SharedDataObject) { + state.SyncEffectiveFieldsDuringRead(plan) +} + +func (r *ShareResource) syncEffectiveFields(ctx context.Context, plan, state ShareInfoExtended, mode effectiveFieldsAction) (ShareInfoExtended, diag.Diagnostics) { + var d diag.Diagnostics + mode.resourceLevel(&state, plan.ShareInfo) + planObjects, _ := plan.GetObjects(ctx) + stateObjects, _ := state.GetObjects(ctx) + finalObjects := []sharing_tf.SharedDataObject{} + for i := range stateObjects { + mode.objectLevel(&stateObjects[i], planObjects[i]) + finalObjects = append(finalObjects, stateObjects[i]) + } + state.SetObjects(ctx, finalObjects) + return state, d +} diff --git a/internal/providers/pluginfw/products/volume/data_volumes.go b/internal/providers/pluginfw/products/volume/data_volumes.go index 6a4af53ba..6727dc20c 100644 --- a/internal/providers/pluginfw/products/volume/data_volumes.go +++ b/internal/providers/pluginfw/products/volume/data_volumes.go @@ -3,6 +3,7 @@ package volume import ( "context" "fmt" + "reflect" "github.com/databricks/databricks-sdk-go/apierr" "github.com/databricks/databricks-sdk-go/service/catalog" @@ -11,6 +12,7 @@ import ( pluginfwcontext "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/context" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/converters" "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/tfschema" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" @@ -29,9 +31,15 @@ type VolumesDataSource struct { } type VolumesList struct { - CatalogName types.String `tfsdk:"catalog_name"` - SchemaName types.String `tfsdk:"schema_name"` - Ids []types.String `tfsdk:"ids" tf:"optional,computed"` + CatalogName types.String `tfsdk:"catalog_name"` + SchemaName types.String `tfsdk:"schema_name"` + Ids types.List `tfsdk:"ids" tf:"optional,computed"` +} + +func (VolumesList) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ids": reflect.TypeOf(types.String{}), + } } func (d *VolumesDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { @@ -39,7 +47,7 @@ func (d *VolumesDataSource) Metadata(ctx context.Context, req datasource.Metadat } func (d *VolumesDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - attrs, blocks := tfschema.DataSourceStructToSchemaMap(VolumesList{}, nil) + attrs, blocks := tfschema.DataSourceStructToSchemaMap(ctx, VolumesList{}, nil) resp.Schema = schema.Schema{ Attributes: attrs, Blocks: blocks, @@ -76,8 +84,10 @@ func (d *VolumesDataSource) Read(ctx context.Context, req datasource.ReadRequest resp.Diagnostics.AddError(fmt.Sprintf("failed to get volumes for the catalog:%s and schema%s", listVolumesRequest.CatalogName, listVolumesRequest.SchemaName), err.Error()) return } + ids := []attr.Value{} for _, v := range volumes { - volumesList.Ids = append(volumesList.Ids, types.StringValue(v.FullName)) + ids = append(ids, types.StringValue(v.FullName)) } + volumesList.Ids = types.ListValueMust(types.StringType, ids) resp.Diagnostics.Append(resp.State.Set(ctx, volumesList)...) } diff --git a/internal/providers/pluginfw/tfschema/customizable_schema_test.go b/internal/providers/pluginfw/tfschema/customizable_schema_test.go index 512e3d93a..6de3c0002 100644 --- a/internal/providers/pluginfw/tfschema/customizable_schema_test.go +++ b/internal/providers/pluginfw/tfschema/customizable_schema_test.go @@ -3,6 +3,7 @@ package tfschema import ( "context" "fmt" + "reflect" "testing" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -14,10 +15,18 @@ import ( ) type TestTfSdk struct { - Description types.String `tfsdk:"description" tf:""` - Nested *NestedTfSdk `tfsdk:"nested" tf:"optional"` - NestedSliceObject []NestedTfSdk `tfsdk:"nested_slice_object" tf:"optional,object"` - Map map[string]types.String `tfsdk:"map" tf:"optional"` + Description types.String `tfsdk:"description" tf:""` + Nested types.List `tfsdk:"nested" tf:"optional"` + NestedSliceObject types.List `tfsdk:"nested_slice_object" tf:"optional,object"` + Map types.Map `tfsdk:"map" tf:"optional"` +} + +func (TestTfSdk) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "nested": reflect.TypeOf(NestedTfSdk{}), + "nested_slice_object": reflect.TypeOf(NestedTfSdk{}), + "map": reflect.TypeOf(types.StringType), + } } type NestedTfSdk struct { @@ -61,7 +70,7 @@ func (v stringLengthBetweenValidator) ValidateString(ctx context.Context, req va } func TestCustomizeSchemaSetRequired(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetRequired("nested", "enabled") return c }) @@ -70,7 +79,7 @@ func TestCustomizeSchemaSetRequired(t *testing.T) { } func TestCustomizeSchemaSetOptional(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetOptional("description") return c }) @@ -79,7 +88,7 @@ func TestCustomizeSchemaSetOptional(t *testing.T) { } func TestCustomizeSchemaSetSensitive(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetSensitive("nested", "name") return c }) @@ -88,7 +97,7 @@ func TestCustomizeSchemaSetSensitive(t *testing.T) { } func TestCustomizeSchemaSetDeprecated(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetDeprecated("deprecated", "map") return c }) @@ -97,7 +106,7 @@ func TestCustomizeSchemaSetDeprecated(t *testing.T) { } func TestCustomizeSchemaSetReadOnly(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetReadOnly("map") return c }) @@ -107,7 +116,7 @@ func TestCustomizeSchemaSetReadOnly(t *testing.T) { } func TestCustomizeSchemaAddValidator(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.AddValidator(stringLengthBetweenValidator{}, "description") return c }) @@ -116,7 +125,7 @@ func TestCustomizeSchemaAddValidator(t *testing.T) { } func TestCustomizeSchemaAddPlanModifier(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.AddPlanModifier(stringplanmodifier.RequiresReplace(), "description") return c }) @@ -125,7 +134,7 @@ func TestCustomizeSchemaAddPlanModifier(t *testing.T) { } func TestCustomizeSchemaObjectTypeValidatorAdded(t *testing.T) { - scm := ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + scm := ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { return c }) @@ -134,7 +143,7 @@ func TestCustomizeSchemaObjectTypeValidatorAdded(t *testing.T) { func TestCustomizeSchema_SetRequired_PanicOnBlock(t *testing.T) { assert.Panics(t, func() { - _ = ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + _ = ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetRequired("nested") return c }) @@ -143,7 +152,7 @@ func TestCustomizeSchema_SetRequired_PanicOnBlock(t *testing.T) { func TestCustomizeSchema_SetOptional_PanicOnBlock(t *testing.T) { assert.Panics(t, func() { - _ = ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + _ = ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetOptional("nested") return c }) @@ -152,7 +161,7 @@ func TestCustomizeSchema_SetOptional_PanicOnBlock(t *testing.T) { func TestCustomizeSchema_SetSensitive_PanicOnBlock(t *testing.T) { assert.Panics(t, func() { - _ = ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + _ = ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetSensitive("nested") return c }) @@ -161,7 +170,7 @@ func TestCustomizeSchema_SetSensitive_PanicOnBlock(t *testing.T) { func TestCustomizeSchema_SetReadOnly_PanicOnBlock(t *testing.T) { assert.Panics(t, func() { - _ = ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + _ = ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetReadOnly("nested") return c }) @@ -170,7 +179,7 @@ func TestCustomizeSchema_SetReadOnly_PanicOnBlock(t *testing.T) { func TestCustomizeSchema_SetComputed_PanicOnBlock(t *testing.T) { assert.Panics(t, func() { - _ = ResourceStructToSchema(TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { + _ = ResourceStructToSchema(context.Background(), TestTfSdk{}, func(c CustomizableSchema) CustomizableSchema { c.SetComputed("nested") return c }) diff --git a/internal/providers/pluginfw/tfschema/struct_to_schema.go b/internal/providers/pluginfw/tfschema/struct_to_schema.go index b5b6e35fb..318029a34 100644 --- a/internal/providers/pluginfw/tfschema/struct_to_schema.go +++ b/internal/providers/pluginfw/tfschema/struct_to_schema.go @@ -1,13 +1,16 @@ package tfschema import ( + "context" "fmt" "reflect" "strings" "github.com/databricks/terraform-provider-databricks/common" + tfcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" "github.com/databricks/terraform-provider-databricks/internal/tfreflect" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" dataschema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" @@ -20,7 +23,7 @@ type structTag struct { singleObject bool } -func typeToSchema(v reflect.Value) NestedBlockObject { +func typeToSchema(ctx context.Context, v reflect.Value) NestedBlockObject { scmAttr := map[string]AttributeBuilder{} scmBlock := map[string]BlockBuilder{} rk := v.Kind() @@ -31,164 +34,127 @@ func typeToSchema(v reflect.Value) NestedBlockObject { if rk != reflect.Struct { panic(fmt.Errorf("schema value of Struct is expected, but got %s: %#v. %s", rk.String(), v, common.TerraformBugErrorMessage)) } - fields := tfreflect.ListAllFields(v) - for _, field := range fields { + + for _, field := range tfreflect.ListAllFields(v) { typeField := field.StructField fieldName := typeField.Tag.Get("tfsdk") if fieldName == "-" { continue } structTag := getStructTag(typeField) - kind := typeField.Type.Kind() - value := field.Value - typeFieldType := typeField.Type - if kind == reflect.Ptr { - typeFieldType = typeFieldType.Elem() - kind = typeFieldType.Kind() - value = reflect.New(typeFieldType).Elem() + value := field.Value.Interface() + if _, ok := value.(attr.Value); !ok { + panic(fmt.Errorf("unexpected type %T in tfsdk structs, expected a plugin framework value type. %s", value, common.TerraformBugErrorMessage)) } - if kind == reflect.Slice { - elemType := typeFieldType.Elem() - if elemType.Kind() == reflect.Ptr { - elemType = elemType.Elem() + switch value.(type) { + case types.Bool: + scmAttr[fieldName] = BoolAttributeBuilder{} + case types.Int64: + scmAttr[fieldName] = Int64AttributeBuilder{} + case types.Float64: + scmAttr[fieldName] = Float64AttributeBuilder{} + case types.String: + scmAttr[fieldName] = StringAttributeBuilder{} + case types.List, types.Map, types.Object: + // Additional metadata is required to determine the type of the list elements. + // This is available via the ComplexFieldTypeProvider interface, implemented on the parent type. + provider, ok := v.Interface().(tfcommon.ComplexFieldTypeProvider) + if !ok { + panic(fmt.Errorf("complex field types not provided for type: %T. %s", v.Interface(), common.TerraformBugErrorMessage)) } - if elemType.Kind() != reflect.Struct { - panic(fmt.Errorf("unsupported slice value for %s: %s. %s", fieldName, elemType.Kind().String(), common.TerraformBugErrorMessage)) + complexFieldTypes := provider.GetComplexFieldTypes(ctx) + fieldType, ok := complexFieldTypes[fieldName] + if !ok { + panic(fmt.Errorf("complex field type not found for field %s on type %T. %s", typeField.Name, v.Interface(), common.TerraformBugErrorMessage)) } - switch elemType { - case reflect.TypeOf(types.Bool{}): - scmAttr[fieldName] = ListAttributeBuilder{ - ElementType: types.BoolType, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case reflect.TypeOf(types.Int64{}): - scmAttr[fieldName] = ListAttributeBuilder{ - ElementType: types.Int64Type, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case reflect.TypeOf(types.Float64{}): - scmAttr[fieldName] = ListAttributeBuilder{ - ElementType: types.Float64Type, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case reflect.TypeOf(types.String{}): - scmAttr[fieldName] = ListAttributeBuilder{ - ElementType: types.StringType, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, + // If the field type is a "primitive", use the appropriate AttributeBuilder. This includes enums, which are treated as strings. + // Otherwise, use ListNestedBlockBuilder. + switch fieldType { + // Note: The list of primitive types must match all of the possible types generated by the `attr-type` template in .codegen/model.go.tmpl. + // If new types are added there, they must also be added here to work properly. + case reflect.TypeOf(types.Bool{}), reflect.TypeOf(types.Int64{}), reflect.TypeOf(types.Float64{}), reflect.TypeOf(types.String{}): + // Look up the element type from the Type() methods for TF SDK structs. + // This is always a attr.TypeWithElementType because the field is a list or map. + objectType := tfcommon.NewObjectTyper(v.Interface()).Type(ctx).(types.ObjectType) + attrType, ok := objectType.AttrTypes[fieldName] + if !ok { + panic(fmt.Errorf("attr type not found for field %s on type %T. %s", typeField.Name, v.Interface(), common.TerraformBugErrorMessage)) + } + containerType := attrType.(attr.TypeWithElementType) + switch value.(type) { + case types.List: + scmAttr[fieldName] = ListAttributeBuilder{ElementType: containerType.ElementType()} + case types.Map: + scmAttr[fieldName] = MapAttributeBuilder{ElementType: containerType.ElementType()} } default: - // Nested struct - nestedScm := typeToSchema(reflect.New(elemType).Elem()) - var validators []validator.List - if structTag.singleObject { - validators = append(validators, listvalidator.SizeAtMost(1)) - } - scmBlock[fieldName] = ListNestedBlockBuilder{ - NestedObject: NestedBlockObject{ - Attributes: nestedScm.Attributes, - Blocks: nestedScm.Blocks, - }, - Validators: validators, + // The element type is a TFSDK type. Map fields are treated as MapNestedAttributes. For compatibility, + // list fields are treated as ListNestedBlocks. + // TODO: Change the default for lists to ListNestedAttribute. + fieldValue := reflect.New(fieldType).Elem() + + // Generate the nested block schema + nestedSchema := typeToSchema(ctx, fieldValue) + switch value.(type) { + case types.List: + validators := []validator.List{} + if structTag.singleObject { + validators = append(validators, listvalidator.SizeAtMost(1)) + } + // Note that this is being added to the block map, not the attribute map. + scmBlock[fieldName] = ListNestedBlockBuilder{ + NestedObject: nestedSchema, + Validators: validators, + } + case types.Map: + scmAttr[fieldName] = MapNestedAttributeBuilder{ + NestedObject: nestedSchema.ToNestedAttributeObject(), + } + case types.Object: + scmAttr[fieldName] = SingleNestedAttributeBuilder{ + Attributes: nestedSchema.ToNestedAttributeObject().Attributes, + } } } - } else if kind == reflect.Map { - elemType := typeFieldType.Elem() - if elemType.Kind() == reflect.Ptr { - elemType = elemType.Elem() + // No other types are supported. Instead, we provide helpful error messages to help users writing + // custom TFSDK structures to use the appropriate types. + case int, int32, int64: + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.Int intead. %s", value, common.TerraformBugErrorMessage)) + case float32, float64: + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.Float64 instead. %s", value, common.TerraformBugErrorMessage)) + case string: + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.String instead. %s", value, common.TerraformBugErrorMessage)) + case bool: + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.Bool instead. %s", value, common.TerraformBugErrorMessage)) + default: + fieldType := field.Value.Type() + if fieldType.Kind() == reflect.Slice { + fieldElemType := fieldType.Elem() + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.List instead. To capture the element type, implement the ComplexFieldTypeProvider interface and add the following mapping: \"%s\": reflect.TypeOf(%s). %s", value, fieldName, fieldElemType.Name(), common.TerraformBugErrorMessage)) } - if elemType.Kind() != reflect.Struct { - panic(fmt.Errorf("unsupported map value for %s: %s. %s", fieldName, elemType.Kind().String(), common.TerraformBugErrorMessage)) + if fieldType.Kind() == reflect.Map { + fieldElemType := fieldType.Elem() + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.Map instead. To capture the element type, implement the ComplexFieldTypeProvider interface and add the following mapping: \"%s\": reflect.TypeOf(%s). %s", value, fieldName, fieldElemType.Name(), common.TerraformBugErrorMessage)) } - switch elemType { - case reflect.TypeOf(types.Bool{}): - scmAttr[fieldName] = MapAttributeBuilder{ - ElementType: types.BoolType, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case reflect.TypeOf(types.Int64{}): - scmAttr[fieldName] = MapAttributeBuilder{ - ElementType: types.Int64Type, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case reflect.TypeOf(types.Float64{}): - scmAttr[fieldName] = MapAttributeBuilder{ - ElementType: types.Float64Type, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case reflect.TypeOf(types.String{}): - scmAttr[fieldName] = MapAttributeBuilder{ - ElementType: types.StringType, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - default: - // Nested struct - nestedScm := typeToSchema(reflect.New(elemType).Elem()) - scmAttr[fieldName] = MapNestedAttributeBuilder{ - NestedObject: NestedAttributeObject{ - Attributes: nestedScm.Attributes, - }, - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } + if fieldType.Kind() == reflect.Struct { + // TODO: change the recommendation to use types.Object when support is added. + panic(fmt.Errorf("unsupported type %T in tfsdk structs. Use types.List instead, and treat the nested object as a list of length 1. To capture the element type, implement the ComplexFieldTypeProvider interface and add the following mapping: \"%s\": reflect.TypeOf(%s). %s", value, fieldName, fieldType.Name(), common.TerraformBugErrorMessage)) } - } else if kind == reflect.Struct { - switch value.Interface().(type) { - case types.Bool: - scmAttr[fieldName] = BoolAttributeBuilder{ - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case types.Int64: - scmAttr[fieldName] = Int64AttributeBuilder{ - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case types.Float64: - scmAttr[fieldName] = Float64AttributeBuilder{ - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case types.String: - scmAttr[fieldName] = StringAttributeBuilder{ - Optional: structTag.optional, - Required: !structTag.optional, - Computed: structTag.computed, - } - case types.List: - panic(fmt.Errorf("types.List should never be used in tfsdk structs. %s", common.TerraformBugErrorMessage)) - case types.Map: - panic(fmt.Errorf("types.Map should never be used in tfsdk structs. %s", common.TerraformBugErrorMessage)) - default: - // If it is a real stuct instead of a tfsdk type, recursively resolve it. - elem := typeFieldType - sv := reflect.New(elem) - nestedScm := typeToSchema(sv) - scmBlock[fieldName] = ListNestedBlockBuilder{ - NestedObject: nestedScm, - } + panic(fmt.Errorf("unexpected type %T in tfsdk structs, expected a plugin framework value type. %s", value, common.TerraformBugErrorMessage)) + } + // types.List fields of complex types correspond to ListNestedBlock, which don't have optional/required/computed flags. + // When these fields are later changed to use ListNestedAttribute, we can inline the if statement below, as all fields + // will be attributes. + if attr, ok := scmAttr[fieldName]; ok { + if structTag.optional { + attr = attr.SetOptional() + } else { + attr = attr.SetRequired() + } + if structTag.computed { + attr = attr.SetComputed() } - } else { - panic(fmt.Errorf("unknown type for field: %s. %s", typeField.Name, common.TerraformBugErrorMessage)) + scmAttr[fieldName] = attr } } return NestedBlockObject{Attributes: scmAttr, Blocks: scmBlock} @@ -204,20 +170,20 @@ func getStructTag(field reflect.StructField) structTag { } // ResourceStructToSchema builds a resource schema from a tfsdk struct, with custoimzations applied. -func ResourceStructToSchema(v any, customizeSchema func(CustomizableSchema) CustomizableSchema) schema.Schema { - attributes, blocks := ResourceStructToSchemaMap(v, customizeSchema) +func ResourceStructToSchema(ctx context.Context, v any, customizeSchema func(CustomizableSchema) CustomizableSchema) schema.Schema { + attributes, blocks := ResourceStructToSchemaMap(ctx, v, customizeSchema) return schema.Schema{Attributes: attributes, Blocks: blocks} } // DataSourceStructToSchema builds a data source schema from a tfsdk struct, with custoimzations applied. -func DataSourceStructToSchema(v any, customizeSchema func(CustomizableSchema) CustomizableSchema) dataschema.Schema { - attributes, blocks := DataSourceStructToSchemaMap(v, customizeSchema) +func DataSourceStructToSchema(ctx context.Context, v any, customizeSchema func(CustomizableSchema) CustomizableSchema) dataschema.Schema { + attributes, blocks := DataSourceStructToSchemaMap(ctx, v, customizeSchema) return dataschema.Schema{Attributes: attributes, Blocks: blocks} } // ResourceStructToSchemaMap returns two maps from string to resource schema attributes and blocks using a tfsdk struct, with custoimzations applied. -func ResourceStructToSchemaMap(v any, customizeSchema func(CustomizableSchema) CustomizableSchema) (map[string]schema.Attribute, map[string]schema.Block) { - nestedBlockObj := typeToSchema(reflect.ValueOf(v)) +func ResourceStructToSchemaMap(ctx context.Context, v any, customizeSchema func(CustomizableSchema) CustomizableSchema) (map[string]schema.Attribute, map[string]schema.Block) { + nestedBlockObj := typeToSchema(ctx, reflect.ValueOf(v)) if customizeSchema != nil { cs := customizeSchema(*ConstructCustomizableSchema(nestedBlockObj)) @@ -228,8 +194,8 @@ func ResourceStructToSchemaMap(v any, customizeSchema func(CustomizableSchema) C } // DataSourceStructToSchemaMap returns twp maps from string to data source schema attributes and blocks using a tfsdk struct, with custoimzations applied. -func DataSourceStructToSchemaMap(v any, customizeSchema func(CustomizableSchema) CustomizableSchema) (map[string]dataschema.Attribute, map[string]dataschema.Block) { - nestedBlockObj := typeToSchema(reflect.ValueOf(v)) +func DataSourceStructToSchemaMap(ctx context.Context, v any, customizeSchema func(CustomizableSchema) CustomizableSchema) (map[string]dataschema.Attribute, map[string]dataschema.Block) { + nestedBlockObj := typeToSchema(ctx, reflect.ValueOf(v)) if customizeSchema != nil { cs := customizeSchema(*ConstructCustomizableSchema(nestedBlockObj)) diff --git a/internal/providers/pluginfw/tfschema/struct_to_schema_test.go b/internal/providers/pluginfw/tfschema/struct_to_schema_test.go index a6005844c..6a410ffce 100644 --- a/internal/providers/pluginfw/tfschema/struct_to_schema_test.go +++ b/internal/providers/pluginfw/tfschema/struct_to_schema_test.go @@ -3,10 +3,13 @@ package tfschema import ( "context" "fmt" + "reflect" "strings" "testing" "github.com/databricks/terraform-provider-databricks/common" + tfcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/stretchr/testify/assert" @@ -35,15 +38,43 @@ type TestFloatTfSdk struct { } type TestListTfSdk struct { - Repeated []types.Int64 `tfsdk:"repeated" tf:"optional"` + Repeated types.List `tfsdk:"repeated" tf:"optional"` +} + +func (TestListTfSdk) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "repeated": reflect.TypeOf(types.Int64{}), + } } type TestMapTfSdk struct { - Attributes map[string]types.String `tfsdk:"attributes" tf:"optional"` + Attributes types.Map `tfsdk:"attributes" tf:"optional"` +} + +func (TestMapTfSdk) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "attributes": reflect.TypeOf(types.String{}), + } +} + +type TestObjectTfSdk struct { + Object types.Object `tfsdk:"object" tf:"optional"` +} + +func (TestObjectTfSdk) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "object": reflect.TypeOf(DummyNested{}), + } } type TestNestedListTfSdk struct { - NestedList []DummyNested `tfsdk:"nested_list" tf:"optional"` + NestedList types.List `tfsdk:"nested_list" tf:"optional"` +} + +func (TestNestedListTfSdk) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "nested_list": reflect.TypeOf(DummyNested{}), + } } type DummyNested struct { @@ -51,21 +82,17 @@ type DummyNested struct { Enabled types.Bool `tfsdk:"enabled" tf:"optional"` } -type DummyDoubleNested struct { - Nested []*DummyNested `tfsdk:"nested" tf:"optional"` -} - type TestNestedMapTfSdk struct { - NestedMap map[string]DummyNested `tfsdk:"nested_map" tf:"optional"` + NestedMap types.Map `tfsdk:"nested_map" tf:"optional"` } -type TestPointerTfSdk struct { - Nested *[]DummyNested `tfsdk:"nested" tf:"optional"` +func (TestNestedMapTfSdk) GetComplexFieldTypes(context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "nested_map": reflect.TypeOf(DummyNested{}), + } } -type TestNestedPointerTfSdk struct { - Nested []DummyDoubleNested `tfsdk:"nested" tf:"optional"` -} +var dummyType = tfcommon.NewObjectTyper(DummyNested{}).Type(context.Background()).(types.ObjectType) var tests = []struct { name string @@ -89,81 +116,71 @@ var tests = []struct { }, { "list conversion", - TestListTfSdk{Repeated: []types.Int64{types.Int64Value(12), types.Int64Value(34)}}, + TestListTfSdk{Repeated: types.ListValueMust(types.Int64Type, []attr.Value{types.Int64Value(12), types.Int64Value(34)})}, }, { "map conversion", - TestMapTfSdk{Attributes: map[string]types.String{"key": types.StringValue("value")}}, - }, - { - "nested list conversion", - TestNestedListTfSdk{NestedList: []DummyNested{ - { - Name: types.StringValue("abc"), - Enabled: types.BoolValue(true), - }, - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(false), - }, - }}, + TestMapTfSdk{Attributes: types.MapValueMust(types.StringType, map[string]attr.Value{"key": types.StringValue("value")})}, }, { - "nested map conversion", - TestNestedMapTfSdk{NestedMap: map[string]DummyNested{ - "key1": { - Name: types.StringValue("abc"), - Enabled: types.BoolValue(true), - }, - "key2": { - Name: types.StringValue("def"), - Enabled: types.BoolValue(false), - }, - }}, + "object conversion", + TestObjectTfSdk{Object: types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("abc"), + "enabled": types.BoolValue(true), + })}, }, { - "pointer to a struct conversion", - TestPointerTfSdk{ - &[]DummyNested{ - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }, - }, + "nested list conversion", + TestNestedListTfSdk{NestedList: types.ListValueMust(dummyType, + []attr.Value{ + types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("abc"), + "enabled": types.BoolValue(true), + }), + types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(false), + }), + }), }, }, { - "nested pointer to a struct conversion", - TestNestedPointerTfSdk{ - []DummyDoubleNested{ - { - Nested: []*DummyNested{ - { - Name: types.StringValue("def"), - Enabled: types.BoolValue(true), - }, - }, - }, - }, + "nested map conversion", + TestNestedMapTfSdk{NestedMap: types.MapValueMust(dummyType, map[string]attr.Value{ + "key1": types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("abc"), + "enabled": types.BoolValue(true), + }), + "key2": types.ObjectValueMust(dummyType.AttrTypes, map[string]attr.Value{ + "name": types.StringValue("def"), + "enabled": types.BoolValue(false), + }), + }), }, }, } // StructToSchemaConversionTestCase runs a single test case to verify StructToSchema works for both data source and resource. func StructToSchemaConversionTestCase(t *testing.T, description string, testStruct any) { - scm := ResourceStructToSchema(testStruct, nil) + scm := ResourceStructToSchema(context.Background(), testStruct, nil) state := tfsdk.State{ Schema: scm, } // Assert we can properly set the state, this means the schema and the struct are consistent. - assert.True(t, !state.Set(context.Background(), testStruct).HasError(), fmt.Sprintf("ResourceStructToSchema - %s", description)) + d := state.Set(context.Background(), testStruct) + if d.HasError() { + t.Errorf("ResourceStructToSchema - %s: %s", description, tfcommon.DiagToString(d)) + } - data_scm := DataSourceStructToSchema(testStruct, nil) + data_scm := DataSourceStructToSchema(context.Background(), testStruct, nil) data_state := tfsdk.State{ Schema: data_scm, } // Assert we can properly set the state, this means the schema and the struct are consistent. - assert.True(t, !data_state.Set(context.Background(), testStruct).HasError(), fmt.Sprintf("DataSourceStructToSchema - %s", description)) + d = data_state.Set(context.Background(), testStruct) + if d.HasError() { + t.Errorf("DataSourceStructToSchema - %s: %s", description, tfcommon.DiagToString(d)) + } } func TestStructToSchemaConversion(t *testing.T) { @@ -174,12 +191,12 @@ func TestStructToSchemaConversion(t *testing.T) { func TestStructToSchemaOptionalVsRequiredField(t *testing.T) { // Test that description is an optional field. - scm := ResourceStructToSchema(TestStringTfSdk{}, nil) + scm := ResourceStructToSchema(context.Background(), TestStringTfSdk{}, nil) assert.True(t, scm.Attributes["description"].IsOptional()) assert.True(t, !scm.Attributes["description"].IsRequired()) // Test that enabled is a required field. - data_scm := DataSourceStructToSchema(TestBoolTfSdk{}, nil) + data_scm := DataSourceStructToSchema(context.Background(), TestBoolTfSdk{}, nil) assert.True(t, !data_scm.Attributes["enabled"].IsOptional()) assert.True(t, data_scm.Attributes["enabled"].IsRequired()) } @@ -204,14 +221,14 @@ func testStructToSchemaPanics(t *testing.T, testStruct any, expectedError string t.Fatalf("error %s did not include expected error message %q", errMsg, expectedError) } }() - ResourceStructToSchema(testStruct, nil) + ResourceStructToSchema(context.Background(), testStruct, nil) } type TestTfSdkList struct { Description types.List `tfsdk:"description" tf:"optional"` } -type TestTfSdkMap struct { +type TestTfSdkMapWithoutMetadata struct { Description types.Map `tfsdk:"description" tf:"optional"` } @@ -219,24 +236,15 @@ type TestSliceOfSlice struct { NestedList [][]string `tfsdk:"nested_list" tf:"optional"` } -type TestMapOfMap struct { - NestedMap map[string]map[string]string `tfsdk:"nested_map" tf:"optional"` -} - var error_tests = []struct { name string testStruct any expectedError string }{ { - "tf list conversion", - TestTfSdkList{}, - fmt.Sprintf("types.List should never be used in tfsdk structs. %s", common.TerraformBugErrorMessage), - }, - { - "tf map conversion", - TestTfSdkMap{}, - fmt.Sprintf("types.Map should never be used in tfsdk structs. %s", common.TerraformBugErrorMessage), + "tfsdk struct without complex field types conversion", + TestTfSdkMapWithoutMetadata{}, + fmt.Sprintf("complex field types not provided for type: tfschema.TestTfSdkMapWithoutMetadata. %s", common.TerraformBugErrorMessage), }, { "non-struct conversion", @@ -246,12 +254,7 @@ var error_tests = []struct { { "slice of slice conversion", TestSliceOfSlice{}, - fmt.Sprintf("unsupported slice value for nested_list: slice. %s", common.TerraformBugErrorMessage), - }, - { - "map of map conversion", - TestMapOfMap{}, - fmt.Sprintf("unsupported map value for nested_map: map. %s", common.TerraformBugErrorMessage), + fmt.Sprintf("unexpected type [][]string in tfsdk structs, expected a plugin framework value type. %s", common.TerraformBugErrorMessage), }, } @@ -263,7 +266,7 @@ func TestStructToSchemaExpectedError(t *testing.T) { func TestComputedField(t *testing.T) { // Test that ComputedTag field is computed and required - scm := ResourceStructToSchema(TestComputedTfSdk{}, nil) + scm := ResourceStructToSchema(context.Background(), TestComputedTfSdk{}, nil) assert.True(t, scm.Attributes["computedtag"].IsComputed()) assert.True(t, scm.Attributes["computedtag"].IsRequired()) diff --git a/internal/service/apps_tf/model.go b/internal/service/apps_tf/model.go index 2da3b843f..ec2b5a415 100755 --- a/internal/service/apps_tf/model.go +++ b/internal/service/apps_tf/model.go @@ -11,17 +11,24 @@ We use go-native types for lists and maps intentionally for the ease for convert package apps_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type App struct { // The active deployment of the app. A deployment is considered active when // it has been deployed to the app compute. - ActiveDeployment []AppDeployment `tfsdk:"active_deployment" tf:"optional,object"` + ActiveDeployment types.List `tfsdk:"active_deployment" tf:"optional,object"` - AppStatus []ApplicationStatus `tfsdk:"app_status" tf:"optional,object"` + AppStatus types.List `tfsdk:"app_status" tf:"optional,object"` - ComputeStatus []ComputeStatus `tfsdk:"compute_status" tf:"optional,object"` + ComputeStatus types.List `tfsdk:"compute_status" tf:"optional,object"` // The creation time of the app. Formatted timestamp in ISO 6801. CreateTime types.String `tfsdk:"create_time" tf:"computed,optional"` // The email of the user that created the app. @@ -37,9 +44,9 @@ type App struct { Name types.String `tfsdk:"name" tf:""` // The pending deployment of the app. A deployment is considered pending // when it is being prepared for deployment to the app compute. - PendingDeployment []AppDeployment `tfsdk:"pending_deployment" tf:"optional,object"` + PendingDeployment types.List `tfsdk:"pending_deployment" tf:"optional,object"` // Resources for the app. - Resources []AppResource `tfsdk:"resources" tf:"optional"` + Resources types.List `tfsdk:"resources" tf:"optional"` ServicePrincipalClientId types.String `tfsdk:"service_principal_client_id" tf:"computed,optional"` @@ -60,6 +67,213 @@ func (newState *App) SyncEffectiveFieldsDuringCreateOrUpdate(plan App) { func (newState *App) SyncEffectiveFieldsDuringRead(existingState App) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in App. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a App) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "active_deployment": reflect.TypeOf(AppDeployment{}), + "app_status": reflect.TypeOf(ApplicationStatus{}), + "compute_status": reflect.TypeOf(ComputeStatus{}), + "pending_deployment": reflect.TypeOf(AppDeployment{}), + "resources": reflect.TypeOf(AppResource{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, App +// only implements ToObjectValue() and Type(). +func (o App) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "active_deployment": o.ActiveDeployment, + "app_status": o.AppStatus, + "compute_status": o.ComputeStatus, + "create_time": o.CreateTime, + "creator": o.Creator, + "default_source_code_path": o.DefaultSourceCodePath, + "description": o.Description, + "name": o.Name, + "pending_deployment": o.PendingDeployment, + "resources": o.Resources, + "service_principal_client_id": o.ServicePrincipalClientId, + "service_principal_id": o.ServicePrincipalId, + "service_principal_name": o.ServicePrincipalName, + "update_time": o.UpdateTime, + "updater": o.Updater, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o App) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "active_deployment": basetypes.ListType{ + ElemType: AppDeployment{}.Type(ctx), + }, + "app_status": basetypes.ListType{ + ElemType: ApplicationStatus{}.Type(ctx), + }, + "compute_status": basetypes.ListType{ + ElemType: ComputeStatus{}.Type(ctx), + }, + "create_time": types.StringType, + "creator": types.StringType, + "default_source_code_path": types.StringType, + "description": types.StringType, + "name": types.StringType, + "pending_deployment": basetypes.ListType{ + ElemType: AppDeployment{}.Type(ctx), + }, + "resources": basetypes.ListType{ + ElemType: AppResource{}.Type(ctx), + }, + "service_principal_client_id": types.StringType, + "service_principal_id": types.Int64Type, + "service_principal_name": types.StringType, + "update_time": types.StringType, + "updater": types.StringType, + "url": types.StringType, + }, + } +} + +// GetActiveDeployment returns the value of the ActiveDeployment field in App as +// a AppDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *App) GetActiveDeployment(ctx context.Context) (AppDeployment, bool) { + var e AppDeployment + if o.ActiveDeployment.IsNull() || o.ActiveDeployment.IsUnknown() { + return e, false + } + var v []AppDeployment + d := o.ActiveDeployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetActiveDeployment sets the value of the ActiveDeployment field in App. +func (o *App) SetActiveDeployment(ctx context.Context, v AppDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["active_deployment"] + o.ActiveDeployment = types.ListValueMust(t, vs) +} + +// GetAppStatus returns the value of the AppStatus field in App as +// a ApplicationStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *App) GetAppStatus(ctx context.Context) (ApplicationStatus, bool) { + var e ApplicationStatus + if o.AppStatus.IsNull() || o.AppStatus.IsUnknown() { + return e, false + } + var v []ApplicationStatus + d := o.AppStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAppStatus sets the value of the AppStatus field in App. +func (o *App) SetAppStatus(ctx context.Context, v ApplicationStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["app_status"] + o.AppStatus = types.ListValueMust(t, vs) +} + +// GetComputeStatus returns the value of the ComputeStatus field in App as +// a ComputeStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *App) GetComputeStatus(ctx context.Context) (ComputeStatus, bool) { + var e ComputeStatus + if o.ComputeStatus.IsNull() || o.ComputeStatus.IsUnknown() { + return e, false + } + var v []ComputeStatus + d := o.ComputeStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetComputeStatus sets the value of the ComputeStatus field in App. +func (o *App) SetComputeStatus(ctx context.Context, v ComputeStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["compute_status"] + o.ComputeStatus = types.ListValueMust(t, vs) +} + +// GetPendingDeployment returns the value of the PendingDeployment field in App as +// a AppDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *App) GetPendingDeployment(ctx context.Context) (AppDeployment, bool) { + var e AppDeployment + if o.PendingDeployment.IsNull() || o.PendingDeployment.IsUnknown() { + return e, false + } + var v []AppDeployment + d := o.PendingDeployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPendingDeployment sets the value of the PendingDeployment field in App. +func (o *App) SetPendingDeployment(ctx context.Context, v AppDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pending_deployment"] + o.PendingDeployment = types.ListValueMust(t, vs) +} + +// GetResources returns the value of the Resources field in App as +// a slice of AppResource values. +// If the field is unknown or null, the boolean return value is false. +func (o *App) GetResources(ctx context.Context) ([]AppResource, bool) { + if o.Resources.IsNull() || o.Resources.IsUnknown() { + return nil, false + } + var v []AppResource + d := o.Resources.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResources sets the value of the Resources field in App. +func (o *App) SetResources(ctx context.Context, v []AppResource) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["resources"] + t = t.(attr.TypeWithElementType).ElementType() + o.Resources = types.ListValueMust(t, vs) +} + type AppAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -77,9 +291,46 @@ func (newState *AppAccessControlRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *AppAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState AppAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o AppAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type AppAccessControlResponse struct { // All permissions. - AllPermissions []AppPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -96,13 +347,82 @@ func (newState *AppAccessControlResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *AppAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState AppAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(AppPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o AppAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: AppPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in AppAccessControlResponse as +// a slice of AppPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *AppAccessControlResponse) GetAllPermissions(ctx context.Context) ([]AppPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []AppPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in AppAccessControlResponse. +func (o *AppAccessControlResponse) SetAllPermissions(ctx context.Context, v []AppPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type AppDeployment struct { // The creation time of the deployment. Formatted timestamp in ISO 6801. CreateTime types.String `tfsdk:"create_time" tf:"computed,optional"` // The email of the user creates the deployment. Creator types.String `tfsdk:"creator" tf:"computed,optional"` // The deployment artifacts for an app. - DeploymentArtifacts []AppDeploymentArtifacts `tfsdk:"deployment_artifacts" tf:"optional,object"` + DeploymentArtifacts types.List `tfsdk:"deployment_artifacts" tf:"optional,object"` // The unique id of the deployment. DeploymentId types.String `tfsdk:"deployment_id" tf:"optional"` // The mode of which the deployment will manage the source code. @@ -116,7 +436,7 @@ type AppDeployment struct { // the deployment. SourceCodePath types.String `tfsdk:"source_code_path" tf:"optional"` // Status and status message of the deployment - Status []AppDeploymentStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` // The update time of the deployment. Formatted timestamp in ISO 6801. UpdateTime types.String `tfsdk:"update_time" tf:"computed,optional"` } @@ -127,6 +447,110 @@ func (newState *AppDeployment) SyncEffectiveFieldsDuringCreateOrUpdate(plan AppD func (newState *AppDeployment) SyncEffectiveFieldsDuringRead(existingState AppDeployment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppDeployment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppDeployment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "deployment_artifacts": reflect.TypeOf(AppDeploymentArtifacts{}), + "status": reflect.TypeOf(AppDeploymentStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppDeployment +// only implements ToObjectValue() and Type(). +func (o AppDeployment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "creator": o.Creator, + "deployment_artifacts": o.DeploymentArtifacts, + "deployment_id": o.DeploymentId, + "mode": o.Mode, + "source_code_path": o.SourceCodePath, + "status": o.Status, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppDeployment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "creator": types.StringType, + "deployment_artifacts": basetypes.ListType{ + ElemType: AppDeploymentArtifacts{}.Type(ctx), + }, + "deployment_id": types.StringType, + "mode": types.StringType, + "source_code_path": types.StringType, + "status": basetypes.ListType{ + ElemType: AppDeploymentStatus{}.Type(ctx), + }, + "update_time": types.StringType, + }, + } +} + +// GetDeploymentArtifacts returns the value of the DeploymentArtifacts field in AppDeployment as +// a AppDeploymentArtifacts value. +// If the field is unknown or null, the boolean return value is false. +func (o *AppDeployment) GetDeploymentArtifacts(ctx context.Context) (AppDeploymentArtifacts, bool) { + var e AppDeploymentArtifacts + if o.DeploymentArtifacts.IsNull() || o.DeploymentArtifacts.IsUnknown() { + return e, false + } + var v []AppDeploymentArtifacts + d := o.DeploymentArtifacts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeploymentArtifacts sets the value of the DeploymentArtifacts field in AppDeployment. +func (o *AppDeployment) SetDeploymentArtifacts(ctx context.Context, v AppDeploymentArtifacts) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["deployment_artifacts"] + o.DeploymentArtifacts = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in AppDeployment as +// a AppDeploymentStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *AppDeployment) GetStatus(ctx context.Context) (AppDeploymentStatus, bool) { + var e AppDeploymentStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []AppDeploymentStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in AppDeployment. +func (o *AppDeployment) SetStatus(ctx context.Context, v AppDeploymentStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + type AppDeploymentArtifacts struct { // The snapshotted workspace file system path of the source code loaded by // the deployed app. @@ -139,6 +563,37 @@ func (newState *AppDeploymentArtifacts) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *AppDeploymentArtifacts) SyncEffectiveFieldsDuringRead(existingState AppDeploymentArtifacts) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppDeploymentArtifacts. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppDeploymentArtifacts) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppDeploymentArtifacts +// only implements ToObjectValue() and Type(). +func (o AppDeploymentArtifacts) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "source_code_path": o.SourceCodePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppDeploymentArtifacts) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "source_code_path": types.StringType, + }, + } +} + type AppDeploymentStatus struct { // Message corresponding with the deployment state. Message types.String `tfsdk:"message" tf:"computed,optional"` @@ -152,10 +607,43 @@ func (newState *AppDeploymentStatus) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *AppDeploymentStatus) SyncEffectiveFieldsDuringRead(existingState AppDeploymentStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppDeploymentStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppDeploymentStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppDeploymentStatus +// only implements ToObjectValue() and Type(). +func (o AppDeploymentStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppDeploymentStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + "state": types.StringType, + }, + } +} + type AppPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -166,8 +654,73 @@ func (newState *AppPermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan AppP func (newState *AppPermission) SyncEffectiveFieldsDuringRead(existingState AppPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppPermission +// only implements ToObjectValue() and Type(). +func (o AppPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in AppPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *AppPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in AppPermission. +func (o *AppPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type AppPermissions struct { - AccessControlList []AppAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -180,6 +733,71 @@ func (newState *AppPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan App func (newState *AppPermissions) SyncEffectiveFieldsDuringRead(existingState AppPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AppAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppPermissions +// only implements ToObjectValue() and Type(). +func (o AppPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AppAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in AppPermissions as +// a slice of AppAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *AppPermissions) GetAccessControlList(ctx context.Context) ([]AppAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AppAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in AppPermissions. +func (o *AppPermissions) SetAccessControlList(ctx context.Context, v []AppAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type AppPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -192,8 +810,41 @@ func (newState *AppPermissionsDescription) SyncEffectiveFieldsDuringCreateOrUpda func (newState *AppPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState AppPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o AppPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type AppPermissionsRequest struct { - AccessControlList []AppAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The app for which to get or manage permissions. AppName types.String `tfsdk:"-"` } @@ -204,19 +855,82 @@ func (newState *AppPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *AppPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState AppPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AppAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o AppPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "app_name": o.AppName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AppAccessControlRequest{}.Type(ctx), + }, + "app_name": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in AppPermissionsRequest as +// a slice of AppAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *AppPermissionsRequest) GetAccessControlList(ctx context.Context) ([]AppAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AppAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in AppPermissionsRequest. +func (o *AppPermissionsRequest) SetAccessControlList(ctx context.Context, v []AppAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type AppResource struct { // Description of the App Resource. Description types.String `tfsdk:"description" tf:"optional"` - Job []AppResourceJob `tfsdk:"job" tf:"optional,object"` + Job types.List `tfsdk:"job" tf:"optional,object"` // Name of the App Resource. Name types.String `tfsdk:"name" tf:""` - Secret []AppResourceSecret `tfsdk:"secret" tf:"optional,object"` + Secret types.List `tfsdk:"secret" tf:"optional,object"` - ServingEndpoint []AppResourceServingEndpoint `tfsdk:"serving_endpoint" tf:"optional,object"` + ServingEndpoint types.List `tfsdk:"serving_endpoint" tf:"optional,object"` - SqlWarehouse []AppResourceSqlWarehouse `tfsdk:"sql_warehouse" tf:"optional,object"` + SqlWarehouse types.List `tfsdk:"sql_warehouse" tf:"optional,object"` } func (newState *AppResource) SyncEffectiveFieldsDuringCreateOrUpdate(plan AppResource) { @@ -225,6 +939,164 @@ func (newState *AppResource) SyncEffectiveFieldsDuringCreateOrUpdate(plan AppRes func (newState *AppResource) SyncEffectiveFieldsDuringRead(existingState AppResource) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppResource. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppResource) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "job": reflect.TypeOf(AppResourceJob{}), + "secret": reflect.TypeOf(AppResourceSecret{}), + "serving_endpoint": reflect.TypeOf(AppResourceServingEndpoint{}), + "sql_warehouse": reflect.TypeOf(AppResourceSqlWarehouse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppResource +// only implements ToObjectValue() and Type(). +func (o AppResource) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "job": o.Job, + "name": o.Name, + "secret": o.Secret, + "serving_endpoint": o.ServingEndpoint, + "sql_warehouse": o.SqlWarehouse, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppResource) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "job": basetypes.ListType{ + ElemType: AppResourceJob{}.Type(ctx), + }, + "name": types.StringType, + "secret": basetypes.ListType{ + ElemType: AppResourceSecret{}.Type(ctx), + }, + "serving_endpoint": basetypes.ListType{ + ElemType: AppResourceServingEndpoint{}.Type(ctx), + }, + "sql_warehouse": basetypes.ListType{ + ElemType: AppResourceSqlWarehouse{}.Type(ctx), + }, + }, + } +} + +// GetJob returns the value of the Job field in AppResource as +// a AppResourceJob value. +// If the field is unknown or null, the boolean return value is false. +func (o *AppResource) GetJob(ctx context.Context) (AppResourceJob, bool) { + var e AppResourceJob + if o.Job.IsNull() || o.Job.IsUnknown() { + return e, false + } + var v []AppResourceJob + d := o.Job.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetJob sets the value of the Job field in AppResource. +func (o *AppResource) SetJob(ctx context.Context, v AppResourceJob) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job"] + o.Job = types.ListValueMust(t, vs) +} + +// GetSecret returns the value of the Secret field in AppResource as +// a AppResourceSecret value. +// If the field is unknown or null, the boolean return value is false. +func (o *AppResource) GetSecret(ctx context.Context) (AppResourceSecret, bool) { + var e AppResourceSecret + if o.Secret.IsNull() || o.Secret.IsUnknown() { + return e, false + } + var v []AppResourceSecret + d := o.Secret.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSecret sets the value of the Secret field in AppResource. +func (o *AppResource) SetSecret(ctx context.Context, v AppResourceSecret) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["secret"] + o.Secret = types.ListValueMust(t, vs) +} + +// GetServingEndpoint returns the value of the ServingEndpoint field in AppResource as +// a AppResourceServingEndpoint value. +// If the field is unknown or null, the boolean return value is false. +func (o *AppResource) GetServingEndpoint(ctx context.Context) (AppResourceServingEndpoint, bool) { + var e AppResourceServingEndpoint + if o.ServingEndpoint.IsNull() || o.ServingEndpoint.IsUnknown() { + return e, false + } + var v []AppResourceServingEndpoint + d := o.ServingEndpoint.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetServingEndpoint sets the value of the ServingEndpoint field in AppResource. +func (o *AppResource) SetServingEndpoint(ctx context.Context, v AppResourceServingEndpoint) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["serving_endpoint"] + o.ServingEndpoint = types.ListValueMust(t, vs) +} + +// GetSqlWarehouse returns the value of the SqlWarehouse field in AppResource as +// a AppResourceSqlWarehouse value. +// If the field is unknown or null, the boolean return value is false. +func (o *AppResource) GetSqlWarehouse(ctx context.Context) (AppResourceSqlWarehouse, bool) { + var e AppResourceSqlWarehouse + if o.SqlWarehouse.IsNull() || o.SqlWarehouse.IsUnknown() { + return e, false + } + var v []AppResourceSqlWarehouse + d := o.SqlWarehouse.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlWarehouse sets the value of the SqlWarehouse field in AppResource. +func (o *AppResource) SetSqlWarehouse(ctx context.Context, v AppResourceSqlWarehouse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_warehouse"] + o.SqlWarehouse = types.ListValueMust(t, vs) +} + type AppResourceJob struct { // Id of the job to grant permission on. Id types.String `tfsdk:"id" tf:""` @@ -239,6 +1111,39 @@ func (newState *AppResourceJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan App func (newState *AppResourceJob) SyncEffectiveFieldsDuringRead(existingState AppResourceJob) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppResourceJob. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppResourceJob) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppResourceJob +// only implements ToObjectValue() and Type(). +func (o AppResourceJob) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "permission": o.Permission, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppResourceJob) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "permission": types.StringType, + }, + } +} + type AppResourceSecret struct { // Key of the secret to grant permission on. Key types.String `tfsdk:"key" tf:""` @@ -255,6 +1160,41 @@ func (newState *AppResourceSecret) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AppResourceSecret) SyncEffectiveFieldsDuringRead(existingState AppResourceSecret) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppResourceSecret. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppResourceSecret) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppResourceSecret +// only implements ToObjectValue() and Type(). +func (o AppResourceSecret) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "permission": o.Permission, + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppResourceSecret) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "permission": types.StringType, + "scope": types.StringType, + }, + } +} + type AppResourceServingEndpoint struct { // Name of the serving endpoint to grant permission on. Name types.String `tfsdk:"name" tf:""` @@ -269,6 +1209,39 @@ func (newState *AppResourceServingEndpoint) SyncEffectiveFieldsDuringCreateOrUpd func (newState *AppResourceServingEndpoint) SyncEffectiveFieldsDuringRead(existingState AppResourceServingEndpoint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppResourceServingEndpoint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppResourceServingEndpoint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppResourceServingEndpoint +// only implements ToObjectValue() and Type(). +func (o AppResourceServingEndpoint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "permission": o.Permission, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppResourceServingEndpoint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "permission": types.StringType, + }, + } +} + type AppResourceSqlWarehouse struct { // Id of the SQL warehouse to grant permission on. Id types.String `tfsdk:"id" tf:""` @@ -283,6 +1256,39 @@ func (newState *AppResourceSqlWarehouse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *AppResourceSqlWarehouse) SyncEffectiveFieldsDuringRead(existingState AppResourceSqlWarehouse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AppResourceSqlWarehouse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AppResourceSqlWarehouse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AppResourceSqlWarehouse +// only implements ToObjectValue() and Type(). +func (o AppResourceSqlWarehouse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "permission": o.Permission, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AppResourceSqlWarehouse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "permission": types.StringType, + }, + } +} + type ApplicationStatus struct { // Application status message Message types.String `tfsdk:"message" tf:"computed,optional"` @@ -296,6 +1302,39 @@ func (newState *ApplicationStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ApplicationStatus) SyncEffectiveFieldsDuringRead(existingState ApplicationStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ApplicationStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ApplicationStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ApplicationStatus +// only implements ToObjectValue() and Type(). +func (o ApplicationStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ApplicationStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + "state": types.StringType, + }, + } +} + type ComputeStatus struct { // Compute status message Message types.String `tfsdk:"message" tf:"computed,optional"` @@ -309,9 +1348,42 @@ func (newState *ComputeStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan Comp func (newState *ComputeStatus) SyncEffectiveFieldsDuringRead(existingState ComputeStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ComputeStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ComputeStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ComputeStatus +// only implements ToObjectValue() and Type(). +func (o ComputeStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ComputeStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + "state": types.StringType, + }, + } +} + // Create an app deployment type CreateAppDeploymentRequest struct { - AppDeployment []AppDeployment `tfsdk:"app_deployment" tf:"optional,object"` + AppDeployment types.List `tfsdk:"app_deployment" tf:"optional,object"` // The name of the app. AppName types.String `tfsdk:"-"` } @@ -322,9 +1394,72 @@ func (newState *CreateAppDeploymentRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateAppDeploymentRequest) SyncEffectiveFieldsDuringRead(existingState CreateAppDeploymentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAppDeploymentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAppDeploymentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "app_deployment": reflect.TypeOf(AppDeployment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAppDeploymentRequest +// only implements ToObjectValue() and Type(). +func (o CreateAppDeploymentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_deployment": o.AppDeployment, + "app_name": o.AppName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAppDeploymentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_deployment": basetypes.ListType{ + ElemType: AppDeployment{}.Type(ctx), + }, + "app_name": types.StringType, + }, + } +} + +// GetAppDeployment returns the value of the AppDeployment field in CreateAppDeploymentRequest as +// a AppDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateAppDeploymentRequest) GetAppDeployment(ctx context.Context) (AppDeployment, bool) { + var e AppDeployment + if o.AppDeployment.IsNull() || o.AppDeployment.IsUnknown() { + return e, false + } + var v []AppDeployment + d := o.AppDeployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAppDeployment sets the value of the AppDeployment field in CreateAppDeploymentRequest. +func (o *CreateAppDeploymentRequest) SetAppDeployment(ctx context.Context, v AppDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["app_deployment"] + o.AppDeployment = types.ListValueMust(t, vs) +} + // Create an app type CreateAppRequest struct { - App []App `tfsdk:"app" tf:"optional,object"` + App types.List `tfsdk:"app" tf:"optional,object"` } func (newState *CreateAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateAppRequest) { @@ -333,6 +1468,67 @@ func (newState *CreateAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan C func (newState *CreateAppRequest) SyncEffectiveFieldsDuringRead(existingState CreateAppRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAppRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAppRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "app": reflect.TypeOf(App{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAppRequest +// only implements ToObjectValue() and Type(). +func (o CreateAppRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app": o.App, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAppRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app": basetypes.ListType{ + ElemType: App{}.Type(ctx), + }, + }, + } +} + +// GetApp returns the value of the App field in CreateAppRequest as +// a App value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateAppRequest) GetApp(ctx context.Context) (App, bool) { + var e App + if o.App.IsNull() || o.App.IsUnknown() { + return e, false + } + var v []App + d := o.App.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetApp sets the value of the App field in CreateAppRequest. +func (o *CreateAppRequest) SetApp(ctx context.Context, v App) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["app"] + o.App = types.ListValueMust(t, vs) +} + // Delete an app type DeleteAppRequest struct { // The name of the app. @@ -345,6 +1541,37 @@ func (newState *DeleteAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan D func (newState *DeleteAppRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAppRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAppRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAppRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAppRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAppRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAppRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get an app deployment type GetAppDeploymentRequest struct { // The name of the app. @@ -359,6 +1586,39 @@ func (newState *GetAppDeploymentRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GetAppDeploymentRequest) SyncEffectiveFieldsDuringRead(existingState GetAppDeploymentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAppDeploymentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAppDeploymentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAppDeploymentRequest +// only implements ToObjectValue() and Type(). +func (o GetAppDeploymentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_name": o.AppName, + "deployment_id": o.DeploymentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAppDeploymentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_name": types.StringType, + "deployment_id": types.StringType, + }, + } +} + // Get app permission levels type GetAppPermissionLevelsRequest struct { // The app for which to get or manage permissions. @@ -371,9 +1631,40 @@ func (newState *GetAppPermissionLevelsRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetAppPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetAppPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAppPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAppPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAppPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetAppPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_name": o.AppName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAppPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_name": types.StringType, + }, + } +} + type GetAppPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []AppPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetAppPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetAppPermissionLevelsResponse) { @@ -382,6 +1673,67 @@ func (newState *GetAppPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateO func (newState *GetAppPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetAppPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAppPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAppPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(AppPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAppPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetAppPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAppPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: AppPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetAppPermissionLevelsResponse as +// a slice of AppPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetAppPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]AppPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []AppPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetAppPermissionLevelsResponse. +func (o *GetAppPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []AppPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get app permissions type GetAppPermissionsRequest struct { // The app for which to get or manage permissions. @@ -394,6 +1746,37 @@ func (newState *GetAppPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetAppPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetAppPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAppPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAppPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAppPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetAppPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_name": o.AppName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAppPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_name": types.StringType, + }, + } +} + // Get an app type GetAppRequest struct { // The name of the app. @@ -406,6 +1789,37 @@ func (newState *GetAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetA func (newState *GetAppRequest) SyncEffectiveFieldsDuringRead(existingState GetAppRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAppRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAppRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAppRequest +// only implements ToObjectValue() and Type(). +func (o GetAppRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAppRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // List app deployments type ListAppDeploymentsRequest struct { // The name of the app. @@ -423,9 +1837,44 @@ func (newState *ListAppDeploymentsRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListAppDeploymentsRequest) SyncEffectiveFieldsDuringRead(existingState ListAppDeploymentsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAppDeploymentsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAppDeploymentsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAppDeploymentsRequest +// only implements ToObjectValue() and Type(). +func (o ListAppDeploymentsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_name": o.AppName, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAppDeploymentsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_name": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListAppDeploymentsResponse struct { // Deployment history of the app. - AppDeployments []AppDeployment `tfsdk:"app_deployments" tf:"optional"` + AppDeployments types.List `tfsdk:"app_deployments" tf:"optional"` // Pagination token to request the next page of apps. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -436,6 +1885,69 @@ func (newState *ListAppDeploymentsResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListAppDeploymentsResponse) SyncEffectiveFieldsDuringRead(existingState ListAppDeploymentsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAppDeploymentsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAppDeploymentsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "app_deployments": reflect.TypeOf(AppDeployment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAppDeploymentsResponse +// only implements ToObjectValue() and Type(). +func (o ListAppDeploymentsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_deployments": o.AppDeployments, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAppDeploymentsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_deployments": basetypes.ListType{ + ElemType: AppDeployment{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetAppDeployments returns the value of the AppDeployments field in ListAppDeploymentsResponse as +// a slice of AppDeployment values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAppDeploymentsResponse) GetAppDeployments(ctx context.Context) ([]AppDeployment, bool) { + if o.AppDeployments.IsNull() || o.AppDeployments.IsUnknown() { + return nil, false + } + var v []AppDeployment + d := o.AppDeployments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAppDeployments sets the value of the AppDeployments field in ListAppDeploymentsResponse. +func (o *ListAppDeploymentsResponse) SetAppDeployments(ctx context.Context, v []AppDeployment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["app_deployments"] + t = t.(attr.TypeWithElementType).ElementType() + o.AppDeployments = types.ListValueMust(t, vs) +} + // List apps type ListAppsRequest struct { // Upper bound for items returned. @@ -451,8 +1963,41 @@ func (newState *ListAppsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Li func (newState *ListAppsRequest) SyncEffectiveFieldsDuringRead(existingState ListAppsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAppsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAppsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAppsRequest +// only implements ToObjectValue() and Type(). +func (o ListAppsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAppsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListAppsResponse struct { - Apps []App `tfsdk:"apps" tf:"optional"` + Apps types.List `tfsdk:"apps" tf:"optional"` // Pagination token to request the next page of apps. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -463,6 +2008,69 @@ func (newState *ListAppsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListAppsResponse) SyncEffectiveFieldsDuringRead(existingState ListAppsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAppsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAppsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "apps": reflect.TypeOf(App{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAppsResponse +// only implements ToObjectValue() and Type(). +func (o ListAppsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apps": o.Apps, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAppsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apps": basetypes.ListType{ + ElemType: App{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetApps returns the value of the Apps field in ListAppsResponse as +// a slice of App values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAppsResponse) GetApps(ctx context.Context) ([]App, bool) { + if o.Apps.IsNull() || o.Apps.IsUnknown() { + return nil, false + } + var v []App + d := o.Apps.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetApps sets the value of the Apps field in ListAppsResponse. +func (o *ListAppsResponse) SetApps(ctx context.Context, v []App) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["apps"] + t = t.(attr.TypeWithElementType).ElementType() + o.Apps = types.ListValueMust(t, vs) +} + type StartAppRequest struct { // The name of the app. Name types.String `tfsdk:"-"` @@ -474,6 +2082,37 @@ func (newState *StartAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan St func (newState *StartAppRequest) SyncEffectiveFieldsDuringRead(existingState StartAppRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartAppRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartAppRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartAppRequest +// only implements ToObjectValue() and Type(). +func (o StartAppRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StartAppRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type StopAppRequest struct { // The name of the app. Name types.String `tfsdk:"-"` @@ -485,9 +2124,40 @@ func (newState *StopAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sto func (newState *StopAppRequest) SyncEffectiveFieldsDuringRead(existingState StopAppRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StopAppRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StopAppRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StopAppRequest +// only implements ToObjectValue() and Type(). +func (o StopAppRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StopAppRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Update an app type UpdateAppRequest struct { - App []App `tfsdk:"app" tf:"optional,object"` + App types.List `tfsdk:"app" tf:"optional,object"` // The name of the app. The name must contain only lowercase alphanumeric // characters and hyphens. It must be unique within the workspace. Name types.String `tfsdk:"-"` @@ -498,3 +2168,66 @@ func (newState *UpdateAppRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan U func (newState *UpdateAppRequest) SyncEffectiveFieldsDuringRead(existingState UpdateAppRequest) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAppRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAppRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "app": reflect.TypeOf(App{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAppRequest +// only implements ToObjectValue() and Type(). +func (o UpdateAppRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app": o.App, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAppRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app": basetypes.ListType{ + ElemType: App{}.Type(ctx), + }, + "name": types.StringType, + }, + } +} + +// GetApp returns the value of the App field in UpdateAppRequest as +// a App value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAppRequest) GetApp(ctx context.Context) (App, bool) { + var e App + if o.App.IsNull() || o.App.IsUnknown() { + return e, false + } + var v []App + d := o.App.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetApp sets the value of the App field in UpdateAppRequest. +func (o *UpdateAppRequest) SetApp(ctx context.Context, v App) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["app"] + o.App = types.ListValueMust(t, vs) +} diff --git a/internal/service/billing_tf/model.go b/internal/service/billing_tf/model.go index 7c3ecc7e7..45f387b50 100755 --- a/internal/service/billing_tf/model.go +++ b/internal/service/billing_tf/model.go @@ -11,9 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package billing_tf import ( - "io" + "context" + "reflect" + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type ActionConfiguration struct { @@ -31,10 +36,45 @@ func (newState *ActionConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ActionConfiguration) SyncEffectiveFieldsDuringRead(existingState ActionConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ActionConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ActionConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ActionConfiguration +// only implements ToObjectValue() and Type(). +func (o ActionConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "action_configuration_id": o.ActionConfigurationId, + "action_type": o.ActionType, + "target": o.Target, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ActionConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "action_configuration_id": types.StringType, + "action_type": types.StringType, + "target": types.StringType, + }, + } +} + type AlertConfiguration struct { // Configured actions for this alert. These define what happens when an // alert enters a triggered state. - ActionConfigurations []ActionConfiguration `tfsdk:"action_configurations" tf:"optional"` + ActionConfigurations types.List `tfsdk:"action_configurations" tf:"optional"` // Databricks alert configuration ID. AlertConfigurationId types.String `tfsdk:"alert_configuration_id" tf:"optional"` // The threshold for the budget alert to determine if it is in a triggered @@ -56,12 +96,83 @@ func (newState *AlertConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AlertConfiguration) SyncEffectiveFieldsDuringRead(existingState AlertConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "action_configurations": reflect.TypeOf(ActionConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertConfiguration +// only implements ToObjectValue() and Type(). +func (o AlertConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "action_configurations": o.ActionConfigurations, + "alert_configuration_id": o.AlertConfigurationId, + "quantity_threshold": o.QuantityThreshold, + "quantity_type": o.QuantityType, + "time_period": o.TimePeriod, + "trigger_type": o.TriggerType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "action_configurations": basetypes.ListType{ + ElemType: ActionConfiguration{}.Type(ctx), + }, + "alert_configuration_id": types.StringType, + "quantity_threshold": types.StringType, + "quantity_type": types.StringType, + "time_period": types.StringType, + "trigger_type": types.StringType, + }, + } +} + +// GetActionConfigurations returns the value of the ActionConfigurations field in AlertConfiguration as +// a slice of ActionConfiguration values. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertConfiguration) GetActionConfigurations(ctx context.Context) ([]ActionConfiguration, bool) { + if o.ActionConfigurations.IsNull() || o.ActionConfigurations.IsUnknown() { + return nil, false + } + var v []ActionConfiguration + d := o.ActionConfigurations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetActionConfigurations sets the value of the ActionConfigurations field in AlertConfiguration. +func (o *AlertConfiguration) SetActionConfigurations(ctx context.Context, v []ActionConfiguration) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["action_configurations"] + t = t.(attr.TypeWithElementType).ElementType() + o.ActionConfigurations = types.ListValueMust(t, vs) +} + type BudgetConfiguration struct { // Databricks account ID. AccountId types.String `tfsdk:"account_id" tf:"optional"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. - AlertConfigurations []AlertConfiguration `tfsdk:"alert_configurations" tf:"optional"` + AlertConfigurations types.List `tfsdk:"alert_configurations" tf:"optional"` // Databricks budget configuration ID. BudgetConfigurationId types.String `tfsdk:"budget_configuration_id" tf:"optional"` // Creation time of this budget configuration. @@ -72,7 +183,7 @@ type BudgetConfiguration struct { // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. - Filter []BudgetConfigurationFilter `tfsdk:"filter" tf:"optional,object"` + Filter types.List `tfsdk:"filter" tf:"optional,object"` // Update time of this budget configuration. UpdateTime types.Int64 `tfsdk:"update_time" tf:"optional"` } @@ -83,13 +194,115 @@ func (newState *BudgetConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *BudgetConfiguration) SyncEffectiveFieldsDuringRead(existingState BudgetConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BudgetConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BudgetConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert_configurations": reflect.TypeOf(AlertConfiguration{}), + "filter": reflect.TypeOf(BudgetConfigurationFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BudgetConfiguration +// only implements ToObjectValue() and Type(). +func (o BudgetConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "alert_configurations": o.AlertConfigurations, + "budget_configuration_id": o.BudgetConfigurationId, + "create_time": o.CreateTime, + "display_name": o.DisplayName, + "filter": o.Filter, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BudgetConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "alert_configurations": basetypes.ListType{ + ElemType: AlertConfiguration{}.Type(ctx), + }, + "budget_configuration_id": types.StringType, + "create_time": types.Int64Type, + "display_name": types.StringType, + "filter": basetypes.ListType{ + ElemType: BudgetConfigurationFilter{}.Type(ctx), + }, + "update_time": types.Int64Type, + }, + } +} + +// GetAlertConfigurations returns the value of the AlertConfigurations field in BudgetConfiguration as +// a slice of AlertConfiguration values. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfiguration) GetAlertConfigurations(ctx context.Context) ([]AlertConfiguration, bool) { + if o.AlertConfigurations.IsNull() || o.AlertConfigurations.IsUnknown() { + return nil, false + } + var v []AlertConfiguration + d := o.AlertConfigurations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAlertConfigurations sets the value of the AlertConfigurations field in BudgetConfiguration. +func (o *BudgetConfiguration) SetAlertConfigurations(ctx context.Context, v []AlertConfiguration) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert_configurations"] + t = t.(attr.TypeWithElementType).ElementType() + o.AlertConfigurations = types.ListValueMust(t, vs) +} + +// GetFilter returns the value of the Filter field in BudgetConfiguration as +// a BudgetConfigurationFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfiguration) GetFilter(ctx context.Context) (BudgetConfigurationFilter, bool) { + var e BudgetConfigurationFilter + if o.Filter.IsNull() || o.Filter.IsUnknown() { + return e, false + } + var v []BudgetConfigurationFilter + d := o.Filter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilter sets the value of the Filter field in BudgetConfiguration. +func (o *BudgetConfiguration) SetFilter(ctx context.Context, v BudgetConfigurationFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter"] + o.Filter = types.ListValueMust(t, vs) +} + type BudgetConfigurationFilter struct { // A list of tag keys and values that will limit the budget to usage that // includes those specific custom tags. Tags are case-sensitive and should // be entered exactly as they appear in your usage data. - Tags []BudgetConfigurationFilterTagClause `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // If provided, usage must match with the provided Databricks workspace IDs. - WorkspaceId []BudgetConfigurationFilterWorkspaceIdClause `tfsdk:"workspace_id" tf:"optional,object"` + WorkspaceId types.List `tfsdk:"workspace_id" tf:"optional,object"` } func (newState *BudgetConfigurationFilter) SyncEffectiveFieldsDuringCreateOrUpdate(plan BudgetConfigurationFilter) { @@ -98,10 +311,102 @@ func (newState *BudgetConfigurationFilter) SyncEffectiveFieldsDuringCreateOrUpda func (newState *BudgetConfigurationFilter) SyncEffectiveFieldsDuringRead(existingState BudgetConfigurationFilter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BudgetConfigurationFilter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BudgetConfigurationFilter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(BudgetConfigurationFilterTagClause{}), + "workspace_id": reflect.TypeOf(BudgetConfigurationFilterWorkspaceIdClause{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BudgetConfigurationFilter +// only implements ToObjectValue() and Type(). +func (o BudgetConfigurationFilter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "tags": o.Tags, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BudgetConfigurationFilter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "tags": basetypes.ListType{ + ElemType: BudgetConfigurationFilterTagClause{}.Type(ctx), + }, + "workspace_id": basetypes.ListType{ + ElemType: BudgetConfigurationFilterWorkspaceIdClause{}.Type(ctx), + }, + }, + } +} + +// GetTags returns the value of the Tags field in BudgetConfigurationFilter as +// a slice of BudgetConfigurationFilterTagClause values. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfigurationFilter) GetTags(ctx context.Context) ([]BudgetConfigurationFilterTagClause, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []BudgetConfigurationFilterTagClause + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in BudgetConfigurationFilter. +func (o *BudgetConfigurationFilter) SetTags(ctx context.Context, v []BudgetConfigurationFilterTagClause) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + +// GetWorkspaceId returns the value of the WorkspaceId field in BudgetConfigurationFilter as +// a BudgetConfigurationFilterWorkspaceIdClause value. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfigurationFilter) GetWorkspaceId(ctx context.Context) (BudgetConfigurationFilterWorkspaceIdClause, bool) { + var e BudgetConfigurationFilterWorkspaceIdClause + if o.WorkspaceId.IsNull() || o.WorkspaceId.IsUnknown() { + return e, false + } + var v []BudgetConfigurationFilterWorkspaceIdClause + d := o.WorkspaceId.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkspaceId sets the value of the WorkspaceId field in BudgetConfigurationFilter. +func (o *BudgetConfigurationFilter) SetWorkspaceId(ctx context.Context, v BudgetConfigurationFilterWorkspaceIdClause) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workspace_id"] + o.WorkspaceId = types.ListValueMust(t, vs) +} + type BudgetConfigurationFilterClause struct { Operator types.String `tfsdk:"operator" tf:"optional"` - Values []types.String `tfsdk:"values" tf:"optional"` + Values types.List `tfsdk:"values" tf:"optional"` } func (newState *BudgetConfigurationFilterClause) SyncEffectiveFieldsDuringCreateOrUpdate(plan BudgetConfigurationFilterClause) { @@ -110,10 +415,73 @@ func (newState *BudgetConfigurationFilterClause) SyncEffectiveFieldsDuringCreate func (newState *BudgetConfigurationFilterClause) SyncEffectiveFieldsDuringRead(existingState BudgetConfigurationFilterClause) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BudgetConfigurationFilterClause. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BudgetConfigurationFilterClause) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "values": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BudgetConfigurationFilterClause +// only implements ToObjectValue() and Type(). +func (o BudgetConfigurationFilterClause) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "operator": o.Operator, + "values": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BudgetConfigurationFilterClause) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "operator": types.StringType, + "values": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetValues returns the value of the Values field in BudgetConfigurationFilterClause as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfigurationFilterClause) GetValues(ctx context.Context) ([]types.String, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in BudgetConfigurationFilterClause. +func (o *BudgetConfigurationFilterClause) SetValues(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["values"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type BudgetConfigurationFilterTagClause struct { Key types.String `tfsdk:"key" tf:"optional"` - Value []BudgetConfigurationFilterClause `tfsdk:"value" tf:"optional,object"` + Value types.List `tfsdk:"value" tf:"optional,object"` } func (newState *BudgetConfigurationFilterTagClause) SyncEffectiveFieldsDuringCreateOrUpdate(plan BudgetConfigurationFilterTagClause) { @@ -122,10 +490,73 @@ func (newState *BudgetConfigurationFilterTagClause) SyncEffectiveFieldsDuringCre func (newState *BudgetConfigurationFilterTagClause) SyncEffectiveFieldsDuringRead(existingState BudgetConfigurationFilterTagClause) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BudgetConfigurationFilterTagClause. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BudgetConfigurationFilterTagClause) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "value": reflect.TypeOf(BudgetConfigurationFilterClause{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BudgetConfigurationFilterTagClause +// only implements ToObjectValue() and Type(). +func (o BudgetConfigurationFilterTagClause) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BudgetConfigurationFilterTagClause) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": basetypes.ListType{ + ElemType: BudgetConfigurationFilterClause{}.Type(ctx), + }, + }, + } +} + +// GetValue returns the value of the Value field in BudgetConfigurationFilterTagClause as +// a BudgetConfigurationFilterClause value. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfigurationFilterTagClause) GetValue(ctx context.Context) (BudgetConfigurationFilterClause, bool) { + var e BudgetConfigurationFilterClause + if o.Value.IsNull() || o.Value.IsUnknown() { + return e, false + } + var v []BudgetConfigurationFilterClause + d := o.Value.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetValue sets the value of the Value field in BudgetConfigurationFilterTagClause. +func (o *BudgetConfigurationFilterTagClause) SetValue(ctx context.Context, v BudgetConfigurationFilterClause) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["value"] + o.Value = types.ListValueMust(t, vs) +} + type BudgetConfigurationFilterWorkspaceIdClause struct { Operator types.String `tfsdk:"operator" tf:"optional"` - Values []types.Int64 `tfsdk:"values" tf:"optional"` + Values types.List `tfsdk:"values" tf:"optional"` } func (newState *BudgetConfigurationFilterWorkspaceIdClause) SyncEffectiveFieldsDuringCreateOrUpdate(plan BudgetConfigurationFilterWorkspaceIdClause) { @@ -134,6 +565,69 @@ func (newState *BudgetConfigurationFilterWorkspaceIdClause) SyncEffectiveFieldsD func (newState *BudgetConfigurationFilterWorkspaceIdClause) SyncEffectiveFieldsDuringRead(existingState BudgetConfigurationFilterWorkspaceIdClause) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BudgetConfigurationFilterWorkspaceIdClause. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BudgetConfigurationFilterWorkspaceIdClause) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "values": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BudgetConfigurationFilterWorkspaceIdClause +// only implements ToObjectValue() and Type(). +func (o BudgetConfigurationFilterWorkspaceIdClause) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "operator": o.Operator, + "values": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BudgetConfigurationFilterWorkspaceIdClause) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "operator": types.StringType, + "values": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetValues returns the value of the Values field in BudgetConfigurationFilterWorkspaceIdClause as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *BudgetConfigurationFilterWorkspaceIdClause) GetValues(ctx context.Context) ([]types.Int64, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in BudgetConfigurationFilterWorkspaceIdClause. +func (o *BudgetConfigurationFilterWorkspaceIdClause) SetValues(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["values"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type CreateBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified // workspace ID. Global level usage dashboard shows usage data for all @@ -150,6 +644,39 @@ func (newState *CreateBillingUsageDashboardRequest) SyncEffectiveFieldsDuringCre func (newState *CreateBillingUsageDashboardRequest) SyncEffectiveFieldsDuringRead(existingState CreateBillingUsageDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBillingUsageDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBillingUsageDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBillingUsageDashboardRequest +// only implements ToObjectValue() and Type(). +func (o CreateBillingUsageDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_type": o.DashboardType, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBillingUsageDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_type": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type CreateBillingUsageDashboardResponse struct { // The unique id of the usage dashboard. DashboardId types.String `tfsdk:"dashboard_id" tf:"optional"` @@ -161,19 +688,50 @@ func (newState *CreateBillingUsageDashboardResponse) SyncEffectiveFieldsDuringCr func (newState *CreateBillingUsageDashboardResponse) SyncEffectiveFieldsDuringRead(existingState CreateBillingUsageDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBillingUsageDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBillingUsageDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBillingUsageDashboardResponse +// only implements ToObjectValue() and Type(). +func (o CreateBillingUsageDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBillingUsageDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + type CreateBudgetConfigurationBudget struct { // Databricks account ID. AccountId types.String `tfsdk:"account_id" tf:"optional"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. - AlertConfigurations []CreateBudgetConfigurationBudgetAlertConfigurations `tfsdk:"alert_configurations" tf:"optional"` + AlertConfigurations types.List `tfsdk:"alert_configurations" tf:"optional"` // Human-readable name of budget configuration. Max Length: 128 DisplayName types.String `tfsdk:"display_name" tf:"optional"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. - Filter []BudgetConfigurationFilter `tfsdk:"filter" tf:"optional,object"` + Filter types.List `tfsdk:"filter" tf:"optional,object"` } func (newState *CreateBudgetConfigurationBudget) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateBudgetConfigurationBudget) { @@ -182,6 +740,102 @@ func (newState *CreateBudgetConfigurationBudget) SyncEffectiveFieldsDuringCreate func (newState *CreateBudgetConfigurationBudget) SyncEffectiveFieldsDuringRead(existingState CreateBudgetConfigurationBudget) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBudgetConfigurationBudget. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBudgetConfigurationBudget) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert_configurations": reflect.TypeOf(CreateBudgetConfigurationBudgetAlertConfigurations{}), + "filter": reflect.TypeOf(BudgetConfigurationFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBudgetConfigurationBudget +// only implements ToObjectValue() and Type(). +func (o CreateBudgetConfigurationBudget) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "alert_configurations": o.AlertConfigurations, + "display_name": o.DisplayName, + "filter": o.Filter, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBudgetConfigurationBudget) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "alert_configurations": basetypes.ListType{ + ElemType: CreateBudgetConfigurationBudgetAlertConfigurations{}.Type(ctx), + }, + "display_name": types.StringType, + "filter": basetypes.ListType{ + ElemType: BudgetConfigurationFilter{}.Type(ctx), + }, + }, + } +} + +// GetAlertConfigurations returns the value of the AlertConfigurations field in CreateBudgetConfigurationBudget as +// a slice of CreateBudgetConfigurationBudgetAlertConfigurations values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateBudgetConfigurationBudget) GetAlertConfigurations(ctx context.Context) ([]CreateBudgetConfigurationBudgetAlertConfigurations, bool) { + if o.AlertConfigurations.IsNull() || o.AlertConfigurations.IsUnknown() { + return nil, false + } + var v []CreateBudgetConfigurationBudgetAlertConfigurations + d := o.AlertConfigurations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAlertConfigurations sets the value of the AlertConfigurations field in CreateBudgetConfigurationBudget. +func (o *CreateBudgetConfigurationBudget) SetAlertConfigurations(ctx context.Context, v []CreateBudgetConfigurationBudgetAlertConfigurations) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert_configurations"] + t = t.(attr.TypeWithElementType).ElementType() + o.AlertConfigurations = types.ListValueMust(t, vs) +} + +// GetFilter returns the value of the Filter field in CreateBudgetConfigurationBudget as +// a BudgetConfigurationFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateBudgetConfigurationBudget) GetFilter(ctx context.Context) (BudgetConfigurationFilter, bool) { + var e BudgetConfigurationFilter + if o.Filter.IsNull() || o.Filter.IsUnknown() { + return e, false + } + var v []BudgetConfigurationFilter + d := o.Filter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilter sets the value of the Filter field in CreateBudgetConfigurationBudget. +func (o *CreateBudgetConfigurationBudget) SetFilter(ctx context.Context, v BudgetConfigurationFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter"] + o.Filter = types.ListValueMust(t, vs) +} + type CreateBudgetConfigurationBudgetActionConfigurations struct { // The type of the action. ActionType types.String `tfsdk:"action_type" tf:"optional"` @@ -195,10 +849,43 @@ func (newState *CreateBudgetConfigurationBudgetActionConfigurations) SyncEffecti func (newState *CreateBudgetConfigurationBudgetActionConfigurations) SyncEffectiveFieldsDuringRead(existingState CreateBudgetConfigurationBudgetActionConfigurations) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBudgetConfigurationBudgetActionConfigurations. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBudgetConfigurationBudgetActionConfigurations) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBudgetConfigurationBudgetActionConfigurations +// only implements ToObjectValue() and Type(). +func (o CreateBudgetConfigurationBudgetActionConfigurations) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "action_type": o.ActionType, + "target": o.Target, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBudgetConfigurationBudgetActionConfigurations) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "action_type": types.StringType, + "target": types.StringType, + }, + } +} + type CreateBudgetConfigurationBudgetAlertConfigurations struct { // Configured actions for this alert. These define what happens when an // alert enters a triggered state. - ActionConfigurations []CreateBudgetConfigurationBudgetActionConfigurations `tfsdk:"action_configurations" tf:"optional"` + ActionConfigurations types.List `tfsdk:"action_configurations" tf:"optional"` // The threshold for the budget alert to determine if it is in a triggered // state. The number is evaluated based on `quantity_type`. QuantityThreshold types.String `tfsdk:"quantity_threshold" tf:"optional"` @@ -218,9 +905,78 @@ func (newState *CreateBudgetConfigurationBudgetAlertConfigurations) SyncEffectiv func (newState *CreateBudgetConfigurationBudgetAlertConfigurations) SyncEffectiveFieldsDuringRead(existingState CreateBudgetConfigurationBudgetAlertConfigurations) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBudgetConfigurationBudgetAlertConfigurations. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBudgetConfigurationBudgetAlertConfigurations) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "action_configurations": reflect.TypeOf(CreateBudgetConfigurationBudgetActionConfigurations{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBudgetConfigurationBudgetAlertConfigurations +// only implements ToObjectValue() and Type(). +func (o CreateBudgetConfigurationBudgetAlertConfigurations) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "action_configurations": o.ActionConfigurations, + "quantity_threshold": o.QuantityThreshold, + "quantity_type": o.QuantityType, + "time_period": o.TimePeriod, + "trigger_type": o.TriggerType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBudgetConfigurationBudgetAlertConfigurations) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "action_configurations": basetypes.ListType{ + ElemType: CreateBudgetConfigurationBudgetActionConfigurations{}.Type(ctx), + }, + "quantity_threshold": types.StringType, + "quantity_type": types.StringType, + "time_period": types.StringType, + "trigger_type": types.StringType, + }, + } +} + +// GetActionConfigurations returns the value of the ActionConfigurations field in CreateBudgetConfigurationBudgetAlertConfigurations as +// a slice of CreateBudgetConfigurationBudgetActionConfigurations values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateBudgetConfigurationBudgetAlertConfigurations) GetActionConfigurations(ctx context.Context) ([]CreateBudgetConfigurationBudgetActionConfigurations, bool) { + if o.ActionConfigurations.IsNull() || o.ActionConfigurations.IsUnknown() { + return nil, false + } + var v []CreateBudgetConfigurationBudgetActionConfigurations + d := o.ActionConfigurations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetActionConfigurations sets the value of the ActionConfigurations field in CreateBudgetConfigurationBudgetAlertConfigurations. +func (o *CreateBudgetConfigurationBudgetAlertConfigurations) SetActionConfigurations(ctx context.Context, v []CreateBudgetConfigurationBudgetActionConfigurations) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["action_configurations"] + t = t.(attr.TypeWithElementType).ElementType() + o.ActionConfigurations = types.ListValueMust(t, vs) +} + type CreateBudgetConfigurationRequest struct { // Properties of the new budget configuration. - Budget []CreateBudgetConfigurationBudget `tfsdk:"budget" tf:"object"` + Budget types.List `tfsdk:"budget" tf:"object"` } func (newState *CreateBudgetConfigurationRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateBudgetConfigurationRequest) { @@ -229,9 +985,70 @@ func (newState *CreateBudgetConfigurationRequest) SyncEffectiveFieldsDuringCreat func (newState *CreateBudgetConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState CreateBudgetConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBudgetConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBudgetConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "budget": reflect.TypeOf(CreateBudgetConfigurationBudget{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBudgetConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o CreateBudgetConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget": o.Budget, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBudgetConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget": basetypes.ListType{ + ElemType: CreateBudgetConfigurationBudget{}.Type(ctx), + }, + }, + } +} + +// GetBudget returns the value of the Budget field in CreateBudgetConfigurationRequest as +// a CreateBudgetConfigurationBudget value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateBudgetConfigurationRequest) GetBudget(ctx context.Context) (CreateBudgetConfigurationBudget, bool) { + var e CreateBudgetConfigurationBudget + if o.Budget.IsNull() || o.Budget.IsUnknown() { + return e, false + } + var v []CreateBudgetConfigurationBudget + d := o.Budget.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBudget sets the value of the Budget field in CreateBudgetConfigurationRequest. +func (o *CreateBudgetConfigurationRequest) SetBudget(ctx context.Context, v CreateBudgetConfigurationBudget) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["budget"] + o.Budget = types.ListValueMust(t, vs) +} + type CreateBudgetConfigurationResponse struct { // The created budget configuration. - Budget []BudgetConfiguration `tfsdk:"budget" tf:"optional,object"` + Budget types.List `tfsdk:"budget" tf:"optional,object"` } func (newState *CreateBudgetConfigurationResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateBudgetConfigurationResponse) { @@ -240,6 +1057,67 @@ func (newState *CreateBudgetConfigurationResponse) SyncEffectiveFieldsDuringCrea func (newState *CreateBudgetConfigurationResponse) SyncEffectiveFieldsDuringRead(existingState CreateBudgetConfigurationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateBudgetConfigurationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateBudgetConfigurationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "budget": reflect.TypeOf(BudgetConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateBudgetConfigurationResponse +// only implements ToObjectValue() and Type(). +func (o CreateBudgetConfigurationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget": o.Budget, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateBudgetConfigurationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget": basetypes.ListType{ + ElemType: BudgetConfiguration{}.Type(ctx), + }, + }, + } +} + +// GetBudget returns the value of the Budget field in CreateBudgetConfigurationResponse as +// a BudgetConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateBudgetConfigurationResponse) GetBudget(ctx context.Context) (BudgetConfiguration, bool) { + var e BudgetConfiguration + if o.Budget.IsNull() || o.Budget.IsUnknown() { + return e, false + } + var v []BudgetConfiguration + d := o.Budget.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBudget sets the value of the Budget field in CreateBudgetConfigurationResponse. +func (o *CreateBudgetConfigurationResponse) SetBudget(ctx context.Context, v BudgetConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["budget"] + o.Budget = types.ListValueMust(t, vs) +} + type CreateLogDeliveryConfigurationParams struct { // The optional human-readable name of the log delivery configuration. // Defaults to empty. @@ -309,7 +1187,7 @@ type CreateLogDeliveryConfigurationParams struct { // delivery won't include account level logs. For some types of Databricks // deployments there is only one workspace per account ID, so this field is // unnecessary. - WorkspaceIdsFilter []types.Int64 `tfsdk:"workspace_ids_filter" tf:"optional"` + WorkspaceIdsFilter types.List `tfsdk:"workspace_ids_filter" tf:"optional"` } func (newState *CreateLogDeliveryConfigurationParams) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateLogDeliveryConfigurationParams) { @@ -318,6 +1196,83 @@ func (newState *CreateLogDeliveryConfigurationParams) SyncEffectiveFieldsDuringC func (newState *CreateLogDeliveryConfigurationParams) SyncEffectiveFieldsDuringRead(existingState CreateLogDeliveryConfigurationParams) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateLogDeliveryConfigurationParams. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateLogDeliveryConfigurationParams) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "workspace_ids_filter": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateLogDeliveryConfigurationParams +// only implements ToObjectValue() and Type(). +func (o CreateLogDeliveryConfigurationParams) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "config_name": o.ConfigName, + "credentials_id": o.CredentialsId, + "delivery_path_prefix": o.DeliveryPathPrefix, + "delivery_start_time": o.DeliveryStartTime, + "log_type": o.LogType, + "output_format": o.OutputFormat, + "status": o.Status, + "storage_configuration_id": o.StorageConfigurationId, + "workspace_ids_filter": o.WorkspaceIdsFilter, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateLogDeliveryConfigurationParams) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "config_name": types.StringType, + "credentials_id": types.StringType, + "delivery_path_prefix": types.StringType, + "delivery_start_time": types.StringType, + "log_type": types.StringType, + "output_format": types.StringType, + "status": types.StringType, + "storage_configuration_id": types.StringType, + "workspace_ids_filter": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetWorkspaceIdsFilter returns the value of the WorkspaceIdsFilter field in CreateLogDeliveryConfigurationParams as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateLogDeliveryConfigurationParams) GetWorkspaceIdsFilter(ctx context.Context) ([]types.Int64, bool) { + if o.WorkspaceIdsFilter.IsNull() || o.WorkspaceIdsFilter.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.WorkspaceIdsFilter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWorkspaceIdsFilter sets the value of the WorkspaceIdsFilter field in CreateLogDeliveryConfigurationParams. +func (o *CreateLogDeliveryConfigurationParams) SetWorkspaceIdsFilter(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workspace_ids_filter"] + t = t.(attr.TypeWithElementType).ElementType() + o.WorkspaceIdsFilter = types.ListValueMust(t, vs) +} + // Delete budget type DeleteBudgetConfigurationRequest struct { // The Databricks budget configuration ID. @@ -330,6 +1285,37 @@ func (newState *DeleteBudgetConfigurationRequest) SyncEffectiveFieldsDuringCreat func (newState *DeleteBudgetConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteBudgetConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteBudgetConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteBudgetConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteBudgetConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteBudgetConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget_id": o.BudgetId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteBudgetConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget_id": types.StringType, + }, + } +} + type DeleteBudgetConfigurationResponse struct { } @@ -339,6 +1325,33 @@ func (newState *DeleteBudgetConfigurationResponse) SyncEffectiveFieldsDuringCrea func (newState *DeleteBudgetConfigurationResponse) SyncEffectiveFieldsDuringRead(existingState DeleteBudgetConfigurationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteBudgetConfigurationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteBudgetConfigurationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteBudgetConfigurationResponse +// only implements ToObjectValue() and Type(). +func (o DeleteBudgetConfigurationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteBudgetConfigurationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Return billable usage logs type DownloadRequest struct { // Format: `YYYY-MM`. Last month to return billable usage logs for. This @@ -359,8 +1372,43 @@ func (newState *DownloadRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Do func (newState *DownloadRequest) SyncEffectiveFieldsDuringRead(existingState DownloadRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DownloadRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DownloadRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DownloadRequest +// only implements ToObjectValue() and Type(). +func (o DownloadRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end_month": o.EndMonth, + "personal_data": o.PersonalData, + "start_month": o.StartMonth, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DownloadRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end_month": types.StringType, + "personal_data": types.BoolType, + "start_month": types.StringType, + }, + } +} + type DownloadResponse struct { - Contents io.ReadCloser `tfsdk:"-"` + Contents types.Object `tfsdk:"-"` } func (newState *DownloadResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan DownloadResponse) { @@ -369,6 +1417,37 @@ func (newState *DownloadResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan D func (newState *DownloadResponse) SyncEffectiveFieldsDuringRead(existingState DownloadResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DownloadResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DownloadResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DownloadResponse +// only implements ToObjectValue() and Type(). +func (o DownloadResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "contents": o.Contents, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DownloadResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "contents": types.ObjectType{}, + }, + } +} + // Get usage dashboard type GetBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified @@ -386,6 +1465,39 @@ func (newState *GetBillingUsageDashboardRequest) SyncEffectiveFieldsDuringCreate func (newState *GetBillingUsageDashboardRequest) SyncEffectiveFieldsDuringRead(existingState GetBillingUsageDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetBillingUsageDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetBillingUsageDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetBillingUsageDashboardRequest +// only implements ToObjectValue() and Type(). +func (o GetBillingUsageDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_type": o.DashboardType, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetBillingUsageDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_type": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type GetBillingUsageDashboardResponse struct { // The unique id of the usage dashboard. DashboardId types.String `tfsdk:"dashboard_id" tf:"optional"` @@ -399,6 +1511,39 @@ func (newState *GetBillingUsageDashboardResponse) SyncEffectiveFieldsDuringCreat func (newState *GetBillingUsageDashboardResponse) SyncEffectiveFieldsDuringRead(existingState GetBillingUsageDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetBillingUsageDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetBillingUsageDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetBillingUsageDashboardResponse +// only implements ToObjectValue() and Type(). +func (o GetBillingUsageDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "dashboard_url": o.DashboardUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetBillingUsageDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "dashboard_url": types.StringType, + }, + } +} + // Get budget type GetBudgetConfigurationRequest struct { // The budget configuration ID @@ -411,8 +1556,39 @@ func (newState *GetBudgetConfigurationRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetBudgetConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState GetBudgetConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetBudgetConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetBudgetConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetBudgetConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o GetBudgetConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget_id": o.BudgetId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetBudgetConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget_id": types.StringType, + }, + } +} + type GetBudgetConfigurationResponse struct { - Budget []BudgetConfiguration `tfsdk:"budget" tf:"optional,object"` + Budget types.List `tfsdk:"budget" tf:"optional,object"` } func (newState *GetBudgetConfigurationResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetBudgetConfigurationResponse) { @@ -421,6 +1597,67 @@ func (newState *GetBudgetConfigurationResponse) SyncEffectiveFieldsDuringCreateO func (newState *GetBudgetConfigurationResponse) SyncEffectiveFieldsDuringRead(existingState GetBudgetConfigurationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetBudgetConfigurationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetBudgetConfigurationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "budget": reflect.TypeOf(BudgetConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetBudgetConfigurationResponse +// only implements ToObjectValue() and Type(). +func (o GetBudgetConfigurationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget": o.Budget, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetBudgetConfigurationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget": basetypes.ListType{ + ElemType: BudgetConfiguration{}.Type(ctx), + }, + }, + } +} + +// GetBudget returns the value of the Budget field in GetBudgetConfigurationResponse as +// a BudgetConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetBudgetConfigurationResponse) GetBudget(ctx context.Context) (BudgetConfiguration, bool) { + var e BudgetConfiguration + if o.Budget.IsNull() || o.Budget.IsUnknown() { + return e, false + } + var v []BudgetConfiguration + d := o.Budget.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBudget sets the value of the Budget field in GetBudgetConfigurationResponse. +func (o *GetBudgetConfigurationResponse) SetBudget(ctx context.Context, v BudgetConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["budget"] + o.Budget = types.ListValueMust(t, vs) +} + // Get log delivery configuration type GetLogDeliveryRequest struct { // Databricks log delivery configuration ID @@ -433,6 +1670,37 @@ func (newState *GetLogDeliveryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *GetLogDeliveryRequest) SyncEffectiveFieldsDuringRead(existingState GetLogDeliveryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetLogDeliveryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetLogDeliveryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetLogDeliveryRequest +// only implements ToObjectValue() and Type(). +func (o GetLogDeliveryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_delivery_configuration_id": o.LogDeliveryConfigurationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetLogDeliveryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_delivery_configuration_id": types.StringType, + }, + } +} + // Get all budgets type ListBudgetConfigurationsRequest struct { // A page token received from a previous get all budget configurations call. @@ -447,8 +1715,39 @@ func (newState *ListBudgetConfigurationsRequest) SyncEffectiveFieldsDuringCreate func (newState *ListBudgetConfigurationsRequest) SyncEffectiveFieldsDuringRead(existingState ListBudgetConfigurationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListBudgetConfigurationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListBudgetConfigurationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListBudgetConfigurationsRequest +// only implements ToObjectValue() and Type(). +func (o ListBudgetConfigurationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListBudgetConfigurationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_token": types.StringType, + }, + } +} + type ListBudgetConfigurationsResponse struct { - Budgets []BudgetConfiguration `tfsdk:"budgets" tf:"optional"` + Budgets types.List `tfsdk:"budgets" tf:"optional"` // Token which can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no subsequent budgets. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -460,6 +1759,69 @@ func (newState *ListBudgetConfigurationsResponse) SyncEffectiveFieldsDuringCreat func (newState *ListBudgetConfigurationsResponse) SyncEffectiveFieldsDuringRead(existingState ListBudgetConfigurationsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListBudgetConfigurationsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListBudgetConfigurationsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "budgets": reflect.TypeOf(BudgetConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListBudgetConfigurationsResponse +// only implements ToObjectValue() and Type(). +func (o ListBudgetConfigurationsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budgets": o.Budgets, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListBudgetConfigurationsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budgets": basetypes.ListType{ + ElemType: BudgetConfiguration{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetBudgets returns the value of the Budgets field in ListBudgetConfigurationsResponse as +// a slice of BudgetConfiguration values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListBudgetConfigurationsResponse) GetBudgets(ctx context.Context) ([]BudgetConfiguration, bool) { + if o.Budgets.IsNull() || o.Budgets.IsUnknown() { + return nil, false + } + var v []BudgetConfiguration + d := o.Budgets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetBudgets sets the value of the Budgets field in ListBudgetConfigurationsResponse. +func (o *ListBudgetConfigurationsResponse) SetBudgets(ctx context.Context, v []BudgetConfiguration) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["budgets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Budgets = types.ListValueMust(t, vs) +} + // Get all log delivery configurations type ListLogDeliveryRequest struct { // Filter by credential configuration ID. @@ -476,6 +1838,41 @@ func (newState *ListLogDeliveryRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListLogDeliveryRequest) SyncEffectiveFieldsDuringRead(existingState ListLogDeliveryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListLogDeliveryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListLogDeliveryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListLogDeliveryRequest +// only implements ToObjectValue() and Type(). +func (o ListLogDeliveryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credentials_id": o.CredentialsId, + "status": o.Status, + "storage_configuration_id": o.StorageConfigurationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListLogDeliveryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credentials_id": types.StringType, + "status": types.StringType, + "storage_configuration_id": types.StringType, + }, + } +} + type LogDeliveryConfiguration struct { // The Databricks account ID that hosts the log delivery configuration. AccountId types.String `tfsdk:"account_id" tf:"optional"` @@ -504,7 +1901,7 @@ type LogDeliveryConfiguration struct { // available for usage before March 2019 (`2019-03`). DeliveryStartTime types.String `tfsdk:"delivery_start_time" tf:"optional"` // Databricks log delivery status. - LogDeliveryStatus []LogDeliveryStatus `tfsdk:"log_delivery_status" tf:"optional,object"` + LogDeliveryStatus types.List `tfsdk:"log_delivery_status" tf:"optional,object"` // Log delivery type. Supported values are: // // * `BILLABLE_USAGE` — Configure [billable usage log delivery]. For the @@ -557,7 +1954,7 @@ type LogDeliveryConfiguration struct { // delivery won't include account level logs. For some types of Databricks // deployments there is only one workspace per account ID, so this field is // unnecessary. - WorkspaceIdsFilter []types.Int64 `tfsdk:"workspace_ids_filter" tf:"optional"` + WorkspaceIdsFilter types.List `tfsdk:"workspace_ids_filter" tf:"optional"` } func (newState *LogDeliveryConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogDeliveryConfiguration) { @@ -566,6 +1963,122 @@ func (newState *LogDeliveryConfiguration) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *LogDeliveryConfiguration) SyncEffectiveFieldsDuringRead(existingState LogDeliveryConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogDeliveryConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogDeliveryConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "log_delivery_status": reflect.TypeOf(LogDeliveryStatus{}), + "workspace_ids_filter": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogDeliveryConfiguration +// only implements ToObjectValue() and Type(). +func (o LogDeliveryConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "config_id": o.ConfigId, + "config_name": o.ConfigName, + "creation_time": o.CreationTime, + "credentials_id": o.CredentialsId, + "delivery_path_prefix": o.DeliveryPathPrefix, + "delivery_start_time": o.DeliveryStartTime, + "log_delivery_status": o.LogDeliveryStatus, + "log_type": o.LogType, + "output_format": o.OutputFormat, + "status": o.Status, + "storage_configuration_id": o.StorageConfigurationId, + "update_time": o.UpdateTime, + "workspace_ids_filter": o.WorkspaceIdsFilter, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogDeliveryConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "config_id": types.StringType, + "config_name": types.StringType, + "creation_time": types.Int64Type, + "credentials_id": types.StringType, + "delivery_path_prefix": types.StringType, + "delivery_start_time": types.StringType, + "log_delivery_status": basetypes.ListType{ + ElemType: LogDeliveryStatus{}.Type(ctx), + }, + "log_type": types.StringType, + "output_format": types.StringType, + "status": types.StringType, + "storage_configuration_id": types.StringType, + "update_time": types.Int64Type, + "workspace_ids_filter": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetLogDeliveryStatus returns the value of the LogDeliveryStatus field in LogDeliveryConfiguration as +// a LogDeliveryStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *LogDeliveryConfiguration) GetLogDeliveryStatus(ctx context.Context) (LogDeliveryStatus, bool) { + var e LogDeliveryStatus + if o.LogDeliveryStatus.IsNull() || o.LogDeliveryStatus.IsUnknown() { + return e, false + } + var v []LogDeliveryStatus + d := o.LogDeliveryStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLogDeliveryStatus sets the value of the LogDeliveryStatus field in LogDeliveryConfiguration. +func (o *LogDeliveryConfiguration) SetLogDeliveryStatus(ctx context.Context, v LogDeliveryStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["log_delivery_status"] + o.LogDeliveryStatus = types.ListValueMust(t, vs) +} + +// GetWorkspaceIdsFilter returns the value of the WorkspaceIdsFilter field in LogDeliveryConfiguration as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *LogDeliveryConfiguration) GetWorkspaceIdsFilter(ctx context.Context) ([]types.Int64, bool) { + if o.WorkspaceIdsFilter.IsNull() || o.WorkspaceIdsFilter.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.WorkspaceIdsFilter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWorkspaceIdsFilter sets the value of the WorkspaceIdsFilter field in LogDeliveryConfiguration. +func (o *LogDeliveryConfiguration) SetWorkspaceIdsFilter(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workspace_ids_filter"] + t = t.(attr.TypeWithElementType).ElementType() + o.WorkspaceIdsFilter = types.ListValueMust(t, vs) +} + // Databricks log delivery status. type LogDeliveryStatus struct { // The UTC time for the latest log delivery attempt. @@ -595,6 +2108,43 @@ func (newState *LogDeliveryStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *LogDeliveryStatus) SyncEffectiveFieldsDuringRead(existingState LogDeliveryStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogDeliveryStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogDeliveryStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogDeliveryStatus +// only implements ToObjectValue() and Type(). +func (o LogDeliveryStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "last_attempt_time": o.LastAttemptTime, + "last_successful_attempt_time": o.LastSuccessfulAttemptTime, + "message": o.Message, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogDeliveryStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "last_attempt_time": types.StringType, + "last_successful_attempt_time": types.StringType, + "message": types.StringType, + "status": types.StringType, + }, + } +} + type PatchStatusResponse struct { } @@ -604,12 +2154,39 @@ func (newState *PatchStatusResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *PatchStatusResponse) SyncEffectiveFieldsDuringRead(existingState PatchStatusResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PatchStatusResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PatchStatusResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PatchStatusResponse +// only implements ToObjectValue() and Type(). +func (o PatchStatusResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PatchStatusResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateBudgetConfigurationBudget struct { // Databricks account ID. AccountId types.String `tfsdk:"account_id" tf:"optional"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. - AlertConfigurations []AlertConfiguration `tfsdk:"alert_configurations" tf:"optional"` + AlertConfigurations types.List `tfsdk:"alert_configurations" tf:"optional"` // Databricks budget configuration ID. BudgetConfigurationId types.String `tfsdk:"budget_configuration_id" tf:"optional"` // Human-readable name of budget configuration. Max Length: 128 @@ -618,7 +2195,7 @@ type UpdateBudgetConfigurationBudget struct { // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. - Filter []BudgetConfigurationFilter `tfsdk:"filter" tf:"optional,object"` + Filter types.List `tfsdk:"filter" tf:"optional,object"` } func (newState *UpdateBudgetConfigurationBudget) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateBudgetConfigurationBudget) { @@ -627,10 +2204,108 @@ func (newState *UpdateBudgetConfigurationBudget) SyncEffectiveFieldsDuringCreate func (newState *UpdateBudgetConfigurationBudget) SyncEffectiveFieldsDuringRead(existingState UpdateBudgetConfigurationBudget) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateBudgetConfigurationBudget. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateBudgetConfigurationBudget) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert_configurations": reflect.TypeOf(AlertConfiguration{}), + "filter": reflect.TypeOf(BudgetConfigurationFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateBudgetConfigurationBudget +// only implements ToObjectValue() and Type(). +func (o UpdateBudgetConfigurationBudget) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "alert_configurations": o.AlertConfigurations, + "budget_configuration_id": o.BudgetConfigurationId, + "display_name": o.DisplayName, + "filter": o.Filter, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateBudgetConfigurationBudget) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "alert_configurations": basetypes.ListType{ + ElemType: AlertConfiguration{}.Type(ctx), + }, + "budget_configuration_id": types.StringType, + "display_name": types.StringType, + "filter": basetypes.ListType{ + ElemType: BudgetConfigurationFilter{}.Type(ctx), + }, + }, + } +} + +// GetAlertConfigurations returns the value of the AlertConfigurations field in UpdateBudgetConfigurationBudget as +// a slice of AlertConfiguration values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateBudgetConfigurationBudget) GetAlertConfigurations(ctx context.Context) ([]AlertConfiguration, bool) { + if o.AlertConfigurations.IsNull() || o.AlertConfigurations.IsUnknown() { + return nil, false + } + var v []AlertConfiguration + d := o.AlertConfigurations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAlertConfigurations sets the value of the AlertConfigurations field in UpdateBudgetConfigurationBudget. +func (o *UpdateBudgetConfigurationBudget) SetAlertConfigurations(ctx context.Context, v []AlertConfiguration) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert_configurations"] + t = t.(attr.TypeWithElementType).ElementType() + o.AlertConfigurations = types.ListValueMust(t, vs) +} + +// GetFilter returns the value of the Filter field in UpdateBudgetConfigurationBudget as +// a BudgetConfigurationFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateBudgetConfigurationBudget) GetFilter(ctx context.Context) (BudgetConfigurationFilter, bool) { + var e BudgetConfigurationFilter + if o.Filter.IsNull() || o.Filter.IsUnknown() { + return e, false + } + var v []BudgetConfigurationFilter + d := o.Filter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilter sets the value of the Filter field in UpdateBudgetConfigurationBudget. +func (o *UpdateBudgetConfigurationBudget) SetFilter(ctx context.Context, v BudgetConfigurationFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter"] + o.Filter = types.ListValueMust(t, vs) +} + type UpdateBudgetConfigurationRequest struct { // The updated budget. This will overwrite the budget specified by the // budget ID. - Budget []UpdateBudgetConfigurationBudget `tfsdk:"budget" tf:"object"` + Budget types.List `tfsdk:"budget" tf:"object"` // The Databricks budget configuration ID. BudgetId types.String `tfsdk:"-"` } @@ -641,9 +2316,72 @@ func (newState *UpdateBudgetConfigurationRequest) SyncEffectiveFieldsDuringCreat func (newState *UpdateBudgetConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState UpdateBudgetConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateBudgetConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateBudgetConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "budget": reflect.TypeOf(UpdateBudgetConfigurationBudget{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateBudgetConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o UpdateBudgetConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget": o.Budget, + "budget_id": o.BudgetId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateBudgetConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget": basetypes.ListType{ + ElemType: UpdateBudgetConfigurationBudget{}.Type(ctx), + }, + "budget_id": types.StringType, + }, + } +} + +// GetBudget returns the value of the Budget field in UpdateBudgetConfigurationRequest as +// a UpdateBudgetConfigurationBudget value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateBudgetConfigurationRequest) GetBudget(ctx context.Context) (UpdateBudgetConfigurationBudget, bool) { + var e UpdateBudgetConfigurationBudget + if o.Budget.IsNull() || o.Budget.IsUnknown() { + return e, false + } + var v []UpdateBudgetConfigurationBudget + d := o.Budget.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBudget sets the value of the Budget field in UpdateBudgetConfigurationRequest. +func (o *UpdateBudgetConfigurationRequest) SetBudget(ctx context.Context, v UpdateBudgetConfigurationBudget) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["budget"] + o.Budget = types.ListValueMust(t, vs) +} + type UpdateBudgetConfigurationResponse struct { // The updated budget. - Budget []BudgetConfiguration `tfsdk:"budget" tf:"optional,object"` + Budget types.List `tfsdk:"budget" tf:"optional,object"` } func (newState *UpdateBudgetConfigurationResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateBudgetConfigurationResponse) { @@ -652,6 +2390,67 @@ func (newState *UpdateBudgetConfigurationResponse) SyncEffectiveFieldsDuringCrea func (newState *UpdateBudgetConfigurationResponse) SyncEffectiveFieldsDuringRead(existingState UpdateBudgetConfigurationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateBudgetConfigurationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateBudgetConfigurationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "budget": reflect.TypeOf(BudgetConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateBudgetConfigurationResponse +// only implements ToObjectValue() and Type(). +func (o UpdateBudgetConfigurationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget": o.Budget, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateBudgetConfigurationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget": basetypes.ListType{ + ElemType: BudgetConfiguration{}.Type(ctx), + }, + }, + } +} + +// GetBudget returns the value of the Budget field in UpdateBudgetConfigurationResponse as +// a BudgetConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateBudgetConfigurationResponse) GetBudget(ctx context.Context) (BudgetConfiguration, bool) { + var e BudgetConfiguration + if o.Budget.IsNull() || o.Budget.IsUnknown() { + return e, false + } + var v []BudgetConfiguration + d := o.Budget.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBudget sets the value of the Budget field in UpdateBudgetConfigurationResponse. +func (o *UpdateBudgetConfigurationResponse) SetBudget(ctx context.Context, v BudgetConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["budget"] + o.Budget = types.ListValueMust(t, vs) +} + type UpdateLogDeliveryConfigurationStatusRequest struct { // Databricks log delivery configuration ID LogDeliveryConfigurationId types.String `tfsdk:"-"` @@ -669,8 +2468,41 @@ func (newState *UpdateLogDeliveryConfigurationStatusRequest) SyncEffectiveFields func (newState *UpdateLogDeliveryConfigurationStatusRequest) SyncEffectiveFieldsDuringRead(existingState UpdateLogDeliveryConfigurationStatusRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateLogDeliveryConfigurationStatusRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateLogDeliveryConfigurationStatusRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateLogDeliveryConfigurationStatusRequest +// only implements ToObjectValue() and Type(). +func (o UpdateLogDeliveryConfigurationStatusRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_delivery_configuration_id": o.LogDeliveryConfigurationId, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateLogDeliveryConfigurationStatusRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_delivery_configuration_id": types.StringType, + "status": types.StringType, + }, + } +} + type WrappedCreateLogDeliveryConfiguration struct { - LogDeliveryConfiguration []CreateLogDeliveryConfigurationParams `tfsdk:"log_delivery_configuration" tf:"optional,object"` + LogDeliveryConfiguration types.List `tfsdk:"log_delivery_configuration" tf:"optional,object"` } func (newState *WrappedCreateLogDeliveryConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(plan WrappedCreateLogDeliveryConfiguration) { @@ -679,8 +2511,69 @@ func (newState *WrappedCreateLogDeliveryConfiguration) SyncEffectiveFieldsDuring func (newState *WrappedCreateLogDeliveryConfiguration) SyncEffectiveFieldsDuringRead(existingState WrappedCreateLogDeliveryConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WrappedCreateLogDeliveryConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WrappedCreateLogDeliveryConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "log_delivery_configuration": reflect.TypeOf(CreateLogDeliveryConfigurationParams{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WrappedCreateLogDeliveryConfiguration +// only implements ToObjectValue() and Type(). +func (o WrappedCreateLogDeliveryConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_delivery_configuration": o.LogDeliveryConfiguration, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WrappedCreateLogDeliveryConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_delivery_configuration": basetypes.ListType{ + ElemType: CreateLogDeliveryConfigurationParams{}.Type(ctx), + }, + }, + } +} + +// GetLogDeliveryConfiguration returns the value of the LogDeliveryConfiguration field in WrappedCreateLogDeliveryConfiguration as +// a CreateLogDeliveryConfigurationParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *WrappedCreateLogDeliveryConfiguration) GetLogDeliveryConfiguration(ctx context.Context) (CreateLogDeliveryConfigurationParams, bool) { + var e CreateLogDeliveryConfigurationParams + if o.LogDeliveryConfiguration.IsNull() || o.LogDeliveryConfiguration.IsUnknown() { + return e, false + } + var v []CreateLogDeliveryConfigurationParams + d := o.LogDeliveryConfiguration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLogDeliveryConfiguration sets the value of the LogDeliveryConfiguration field in WrappedCreateLogDeliveryConfiguration. +func (o *WrappedCreateLogDeliveryConfiguration) SetLogDeliveryConfiguration(ctx context.Context, v CreateLogDeliveryConfigurationParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["log_delivery_configuration"] + o.LogDeliveryConfiguration = types.ListValueMust(t, vs) +} + type WrappedLogDeliveryConfiguration struct { - LogDeliveryConfiguration []LogDeliveryConfiguration `tfsdk:"log_delivery_configuration" tf:"optional,object"` + LogDeliveryConfiguration types.List `tfsdk:"log_delivery_configuration" tf:"optional,object"` } func (newState *WrappedLogDeliveryConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(plan WrappedLogDeliveryConfiguration) { @@ -689,8 +2582,69 @@ func (newState *WrappedLogDeliveryConfiguration) SyncEffectiveFieldsDuringCreate func (newState *WrappedLogDeliveryConfiguration) SyncEffectiveFieldsDuringRead(existingState WrappedLogDeliveryConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WrappedLogDeliveryConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WrappedLogDeliveryConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "log_delivery_configuration": reflect.TypeOf(LogDeliveryConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WrappedLogDeliveryConfiguration +// only implements ToObjectValue() and Type(). +func (o WrappedLogDeliveryConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_delivery_configuration": o.LogDeliveryConfiguration, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WrappedLogDeliveryConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_delivery_configuration": basetypes.ListType{ + ElemType: LogDeliveryConfiguration{}.Type(ctx), + }, + }, + } +} + +// GetLogDeliveryConfiguration returns the value of the LogDeliveryConfiguration field in WrappedLogDeliveryConfiguration as +// a LogDeliveryConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *WrappedLogDeliveryConfiguration) GetLogDeliveryConfiguration(ctx context.Context) (LogDeliveryConfiguration, bool) { + var e LogDeliveryConfiguration + if o.LogDeliveryConfiguration.IsNull() || o.LogDeliveryConfiguration.IsUnknown() { + return e, false + } + var v []LogDeliveryConfiguration + d := o.LogDeliveryConfiguration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLogDeliveryConfiguration sets the value of the LogDeliveryConfiguration field in WrappedLogDeliveryConfiguration. +func (o *WrappedLogDeliveryConfiguration) SetLogDeliveryConfiguration(ctx context.Context, v LogDeliveryConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["log_delivery_configuration"] + o.LogDeliveryConfiguration = types.ListValueMust(t, vs) +} + type WrappedLogDeliveryConfigurations struct { - LogDeliveryConfigurations []LogDeliveryConfiguration `tfsdk:"log_delivery_configurations" tf:"optional"` + LogDeliveryConfigurations types.List `tfsdk:"log_delivery_configurations" tf:"optional"` } func (newState *WrappedLogDeliveryConfigurations) SyncEffectiveFieldsDuringCreateOrUpdate(plan WrappedLogDeliveryConfigurations) { @@ -698,3 +2652,64 @@ func (newState *WrappedLogDeliveryConfigurations) SyncEffectiveFieldsDuringCreat func (newState *WrappedLogDeliveryConfigurations) SyncEffectiveFieldsDuringRead(existingState WrappedLogDeliveryConfigurations) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WrappedLogDeliveryConfigurations. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WrappedLogDeliveryConfigurations) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "log_delivery_configurations": reflect.TypeOf(LogDeliveryConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WrappedLogDeliveryConfigurations +// only implements ToObjectValue() and Type(). +func (o WrappedLogDeliveryConfigurations) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_delivery_configurations": o.LogDeliveryConfigurations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WrappedLogDeliveryConfigurations) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_delivery_configurations": basetypes.ListType{ + ElemType: LogDeliveryConfiguration{}.Type(ctx), + }, + }, + } +} + +// GetLogDeliveryConfigurations returns the value of the LogDeliveryConfigurations field in WrappedLogDeliveryConfigurations as +// a slice of LogDeliveryConfiguration values. +// If the field is unknown or null, the boolean return value is false. +func (o *WrappedLogDeliveryConfigurations) GetLogDeliveryConfigurations(ctx context.Context) ([]LogDeliveryConfiguration, bool) { + if o.LogDeliveryConfigurations.IsNull() || o.LogDeliveryConfigurations.IsUnknown() { + return nil, false + } + var v []LogDeliveryConfiguration + d := o.LogDeliveryConfigurations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLogDeliveryConfigurations sets the value of the LogDeliveryConfigurations field in WrappedLogDeliveryConfigurations. +func (o *WrappedLogDeliveryConfigurations) SetLogDeliveryConfigurations(ctx context.Context, v []LogDeliveryConfiguration) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["log_delivery_configurations"] + t = t.(attr.TypeWithElementType).ElementType() + o.LogDeliveryConfigurations = types.ListValueMust(t, vs) +} diff --git a/internal/service/catalog_tf/model.go b/internal/service/catalog_tf/model.go index eb62e58b3..2c1bf7ab2 100755 --- a/internal/service/catalog_tf/model.go +++ b/internal/service/catalog_tf/model.go @@ -11,11 +11,18 @@ We use go-native types for lists and maps intentionally for the ease for convert package catalog_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AccountsCreateMetastore struct { - MetastoreInfo []CreateMetastore `tfsdk:"metastore_info" tf:"optional,object"` + MetastoreInfo types.List `tfsdk:"metastore_info" tf:"optional,object"` } func (newState *AccountsCreateMetastore) SyncEffectiveFieldsDuringCreateOrUpdate(plan AccountsCreateMetastore) { @@ -24,8 +31,69 @@ func (newState *AccountsCreateMetastore) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *AccountsCreateMetastore) SyncEffectiveFieldsDuringRead(existingState AccountsCreateMetastore) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsCreateMetastore. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsCreateMetastore) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastore_info": reflect.TypeOf(CreateMetastore{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsCreateMetastore +// only implements ToObjectValue() and Type(). +func (o AccountsCreateMetastore) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_info": o.MetastoreInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsCreateMetastore) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_info": basetypes.ListType{ + ElemType: CreateMetastore{}.Type(ctx), + }, + }, + } +} + +// GetMetastoreInfo returns the value of the MetastoreInfo field in AccountsCreateMetastore as +// a CreateMetastore value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsCreateMetastore) GetMetastoreInfo(ctx context.Context) (CreateMetastore, bool) { + var e CreateMetastore + if o.MetastoreInfo.IsNull() || o.MetastoreInfo.IsUnknown() { + return e, false + } + var v []CreateMetastore + d := o.MetastoreInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetastoreInfo sets the value of the MetastoreInfo field in AccountsCreateMetastore. +func (o *AccountsCreateMetastore) SetMetastoreInfo(ctx context.Context, v CreateMetastore) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastore_info"] + o.MetastoreInfo = types.ListValueMust(t, vs) +} + type AccountsCreateMetastoreAssignment struct { - MetastoreAssignment []CreateMetastoreAssignment `tfsdk:"metastore_assignment" tf:"optional,object"` + MetastoreAssignment types.List `tfsdk:"metastore_assignment" tf:"optional,object"` // Unity Catalog metastore ID MetastoreId types.String `tfsdk:"-"` // Workspace ID. @@ -38,8 +106,73 @@ func (newState *AccountsCreateMetastoreAssignment) SyncEffectiveFieldsDuringCrea func (newState *AccountsCreateMetastoreAssignment) SyncEffectiveFieldsDuringRead(existingState AccountsCreateMetastoreAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsCreateMetastoreAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsCreateMetastoreAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastore_assignment": reflect.TypeOf(CreateMetastoreAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsCreateMetastoreAssignment +// only implements ToObjectValue() and Type(). +func (o AccountsCreateMetastoreAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_assignment": o.MetastoreAssignment, + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsCreateMetastoreAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_assignment": basetypes.ListType{ + ElemType: CreateMetastoreAssignment{}.Type(ctx), + }, + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + +// GetMetastoreAssignment returns the value of the MetastoreAssignment field in AccountsCreateMetastoreAssignment as +// a CreateMetastoreAssignment value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsCreateMetastoreAssignment) GetMetastoreAssignment(ctx context.Context) (CreateMetastoreAssignment, bool) { + var e CreateMetastoreAssignment + if o.MetastoreAssignment.IsNull() || o.MetastoreAssignment.IsUnknown() { + return e, false + } + var v []CreateMetastoreAssignment + d := o.MetastoreAssignment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetastoreAssignment sets the value of the MetastoreAssignment field in AccountsCreateMetastoreAssignment. +func (o *AccountsCreateMetastoreAssignment) SetMetastoreAssignment(ctx context.Context, v CreateMetastoreAssignment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastore_assignment"] + o.MetastoreAssignment = types.ListValueMust(t, vs) +} + type AccountsCreateStorageCredential struct { - CredentialInfo []CreateStorageCredential `tfsdk:"credential_info" tf:"optional,object"` + CredentialInfo types.List `tfsdk:"credential_info" tf:"optional,object"` // Unity Catalog metastore ID MetastoreId types.String `tfsdk:"-"` } @@ -50,8 +183,71 @@ func (newState *AccountsCreateStorageCredential) SyncEffectiveFieldsDuringCreate func (newState *AccountsCreateStorageCredential) SyncEffectiveFieldsDuringRead(existingState AccountsCreateStorageCredential) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsCreateStorageCredential. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsCreateStorageCredential) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "credential_info": reflect.TypeOf(CreateStorageCredential{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsCreateStorageCredential +// only implements ToObjectValue() and Type(). +func (o AccountsCreateStorageCredential) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_info": o.CredentialInfo, + "metastore_id": o.MetastoreId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsCreateStorageCredential) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_info": basetypes.ListType{ + ElemType: CreateStorageCredential{}.Type(ctx), + }, + "metastore_id": types.StringType, + }, + } +} + +// GetCredentialInfo returns the value of the CredentialInfo field in AccountsCreateStorageCredential as +// a CreateStorageCredential value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsCreateStorageCredential) GetCredentialInfo(ctx context.Context) (CreateStorageCredential, bool) { + var e CreateStorageCredential + if o.CredentialInfo.IsNull() || o.CredentialInfo.IsUnknown() { + return e, false + } + var v []CreateStorageCredential + d := o.CredentialInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCredentialInfo sets the value of the CredentialInfo field in AccountsCreateStorageCredential. +func (o *AccountsCreateStorageCredential) SetCredentialInfo(ctx context.Context, v CreateStorageCredential) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["credential_info"] + o.CredentialInfo = types.ListValueMust(t, vs) +} + type AccountsMetastoreAssignment struct { - MetastoreAssignment []MetastoreAssignment `tfsdk:"metastore_assignment" tf:"optional,object"` + MetastoreAssignment types.List `tfsdk:"metastore_assignment" tf:"optional,object"` } func (newState *AccountsMetastoreAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(plan AccountsMetastoreAssignment) { @@ -60,8 +256,69 @@ func (newState *AccountsMetastoreAssignment) SyncEffectiveFieldsDuringCreateOrUp func (newState *AccountsMetastoreAssignment) SyncEffectiveFieldsDuringRead(existingState AccountsMetastoreAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsMetastoreAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsMetastoreAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastore_assignment": reflect.TypeOf(MetastoreAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsMetastoreAssignment +// only implements ToObjectValue() and Type(). +func (o AccountsMetastoreAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_assignment": o.MetastoreAssignment, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsMetastoreAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_assignment": basetypes.ListType{ + ElemType: MetastoreAssignment{}.Type(ctx), + }, + }, + } +} + +// GetMetastoreAssignment returns the value of the MetastoreAssignment field in AccountsMetastoreAssignment as +// a MetastoreAssignment value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsMetastoreAssignment) GetMetastoreAssignment(ctx context.Context) (MetastoreAssignment, bool) { + var e MetastoreAssignment + if o.MetastoreAssignment.IsNull() || o.MetastoreAssignment.IsUnknown() { + return e, false + } + var v []MetastoreAssignment + d := o.MetastoreAssignment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetastoreAssignment sets the value of the MetastoreAssignment field in AccountsMetastoreAssignment. +func (o *AccountsMetastoreAssignment) SetMetastoreAssignment(ctx context.Context, v MetastoreAssignment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastore_assignment"] + o.MetastoreAssignment = types.ListValueMust(t, vs) +} + type AccountsMetastoreInfo struct { - MetastoreInfo []MetastoreInfo `tfsdk:"metastore_info" tf:"optional,object"` + MetastoreInfo types.List `tfsdk:"metastore_info" tf:"optional,object"` } func (newState *AccountsMetastoreInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan AccountsMetastoreInfo) { @@ -70,8 +327,69 @@ func (newState *AccountsMetastoreInfo) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *AccountsMetastoreInfo) SyncEffectiveFieldsDuringRead(existingState AccountsMetastoreInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsMetastoreInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsMetastoreInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastore_info": reflect.TypeOf(MetastoreInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsMetastoreInfo +// only implements ToObjectValue() and Type(). +func (o AccountsMetastoreInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_info": o.MetastoreInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsMetastoreInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_info": basetypes.ListType{ + ElemType: MetastoreInfo{}.Type(ctx), + }, + }, + } +} + +// GetMetastoreInfo returns the value of the MetastoreInfo field in AccountsMetastoreInfo as +// a MetastoreInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsMetastoreInfo) GetMetastoreInfo(ctx context.Context) (MetastoreInfo, bool) { + var e MetastoreInfo + if o.MetastoreInfo.IsNull() || o.MetastoreInfo.IsUnknown() { + return e, false + } + var v []MetastoreInfo + d := o.MetastoreInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetastoreInfo sets the value of the MetastoreInfo field in AccountsMetastoreInfo. +func (o *AccountsMetastoreInfo) SetMetastoreInfo(ctx context.Context, v MetastoreInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastore_info"] + o.MetastoreInfo = types.ListValueMust(t, vs) +} + type AccountsStorageCredentialInfo struct { - CredentialInfo []StorageCredentialInfo `tfsdk:"credential_info" tf:"optional,object"` + CredentialInfo types.List `tfsdk:"credential_info" tf:"optional,object"` } func (newState *AccountsStorageCredentialInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan AccountsStorageCredentialInfo) { @@ -80,11 +398,72 @@ func (newState *AccountsStorageCredentialInfo) SyncEffectiveFieldsDuringCreateOr func (newState *AccountsStorageCredentialInfo) SyncEffectiveFieldsDuringRead(existingState AccountsStorageCredentialInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsStorageCredentialInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsStorageCredentialInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "credential_info": reflect.TypeOf(StorageCredentialInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsStorageCredentialInfo +// only implements ToObjectValue() and Type(). +func (o AccountsStorageCredentialInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_info": o.CredentialInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsStorageCredentialInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_info": basetypes.ListType{ + ElemType: StorageCredentialInfo{}.Type(ctx), + }, + }, + } +} + +// GetCredentialInfo returns the value of the CredentialInfo field in AccountsStorageCredentialInfo as +// a StorageCredentialInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsStorageCredentialInfo) GetCredentialInfo(ctx context.Context) (StorageCredentialInfo, bool) { + var e StorageCredentialInfo + if o.CredentialInfo.IsNull() || o.CredentialInfo.IsUnknown() { + return e, false + } + var v []StorageCredentialInfo + d := o.CredentialInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCredentialInfo sets the value of the CredentialInfo field in AccountsStorageCredentialInfo. +func (o *AccountsStorageCredentialInfo) SetCredentialInfo(ctx context.Context, v StorageCredentialInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["credential_info"] + o.CredentialInfo = types.ListValueMust(t, vs) +} + type AccountsUpdateMetastore struct { // Unity Catalog metastore ID MetastoreId types.String `tfsdk:"-"` - MetastoreInfo []UpdateMetastore `tfsdk:"metastore_info" tf:"optional,object"` + MetastoreInfo types.List `tfsdk:"metastore_info" tf:"optional,object"` } func (newState *AccountsUpdateMetastore) SyncEffectiveFieldsDuringCreateOrUpdate(plan AccountsUpdateMetastore) { @@ -93,8 +472,71 @@ func (newState *AccountsUpdateMetastore) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *AccountsUpdateMetastore) SyncEffectiveFieldsDuringRead(existingState AccountsUpdateMetastore) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsUpdateMetastore. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsUpdateMetastore) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastore_info": reflect.TypeOf(UpdateMetastore{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsUpdateMetastore +// only implements ToObjectValue() and Type(). +func (o AccountsUpdateMetastore) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + "metastore_info": o.MetastoreInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsUpdateMetastore) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + "metastore_info": basetypes.ListType{ + ElemType: UpdateMetastore{}.Type(ctx), + }, + }, + } +} + +// GetMetastoreInfo returns the value of the MetastoreInfo field in AccountsUpdateMetastore as +// a UpdateMetastore value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsUpdateMetastore) GetMetastoreInfo(ctx context.Context) (UpdateMetastore, bool) { + var e UpdateMetastore + if o.MetastoreInfo.IsNull() || o.MetastoreInfo.IsUnknown() { + return e, false + } + var v []UpdateMetastore + d := o.MetastoreInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetastoreInfo sets the value of the MetastoreInfo field in AccountsUpdateMetastore. +func (o *AccountsUpdateMetastore) SetMetastoreInfo(ctx context.Context, v UpdateMetastore) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastore_info"] + o.MetastoreInfo = types.ListValueMust(t, vs) +} + type AccountsUpdateMetastoreAssignment struct { - MetastoreAssignment []UpdateMetastoreAssignment `tfsdk:"metastore_assignment" tf:"optional,object"` + MetastoreAssignment types.List `tfsdk:"metastore_assignment" tf:"optional,object"` // Unity Catalog metastore ID MetastoreId types.String `tfsdk:"-"` // Workspace ID. @@ -107,8 +549,73 @@ func (newState *AccountsUpdateMetastoreAssignment) SyncEffectiveFieldsDuringCrea func (newState *AccountsUpdateMetastoreAssignment) SyncEffectiveFieldsDuringRead(existingState AccountsUpdateMetastoreAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsUpdateMetastoreAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsUpdateMetastoreAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastore_assignment": reflect.TypeOf(UpdateMetastoreAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsUpdateMetastoreAssignment +// only implements ToObjectValue() and Type(). +func (o AccountsUpdateMetastoreAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_assignment": o.MetastoreAssignment, + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsUpdateMetastoreAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_assignment": basetypes.ListType{ + ElemType: UpdateMetastoreAssignment{}.Type(ctx), + }, + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + +// GetMetastoreAssignment returns the value of the MetastoreAssignment field in AccountsUpdateMetastoreAssignment as +// a UpdateMetastoreAssignment value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsUpdateMetastoreAssignment) GetMetastoreAssignment(ctx context.Context) (UpdateMetastoreAssignment, bool) { + var e UpdateMetastoreAssignment + if o.MetastoreAssignment.IsNull() || o.MetastoreAssignment.IsUnknown() { + return e, false + } + var v []UpdateMetastoreAssignment + d := o.MetastoreAssignment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetastoreAssignment sets the value of the MetastoreAssignment field in AccountsUpdateMetastoreAssignment. +func (o *AccountsUpdateMetastoreAssignment) SetMetastoreAssignment(ctx context.Context, v UpdateMetastoreAssignment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastore_assignment"] + o.MetastoreAssignment = types.ListValueMust(t, vs) +} + type AccountsUpdateStorageCredential struct { - CredentialInfo []UpdateStorageCredential `tfsdk:"credential_info" tf:"optional,object"` + CredentialInfo types.List `tfsdk:"credential_info" tf:"optional,object"` // Unity Catalog metastore ID MetastoreId types.String `tfsdk:"-"` // Name of the storage credential. @@ -121,9 +628,74 @@ func (newState *AccountsUpdateStorageCredential) SyncEffectiveFieldsDuringCreate func (newState *AccountsUpdateStorageCredential) SyncEffectiveFieldsDuringRead(existingState AccountsUpdateStorageCredential) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccountsUpdateStorageCredential. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccountsUpdateStorageCredential) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "credential_info": reflect.TypeOf(UpdateStorageCredential{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccountsUpdateStorageCredential +// only implements ToObjectValue() and Type(). +func (o AccountsUpdateStorageCredential) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_info": o.CredentialInfo, + "metastore_id": o.MetastoreId, + "storage_credential_name": o.StorageCredentialName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccountsUpdateStorageCredential) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_info": basetypes.ListType{ + ElemType: UpdateStorageCredential{}.Type(ctx), + }, + "metastore_id": types.StringType, + "storage_credential_name": types.StringType, + }, + } +} + +// GetCredentialInfo returns the value of the CredentialInfo field in AccountsUpdateStorageCredential as +// a UpdateStorageCredential value. +// If the field is unknown or null, the boolean return value is false. +func (o *AccountsUpdateStorageCredential) GetCredentialInfo(ctx context.Context) (UpdateStorageCredential, bool) { + var e UpdateStorageCredential + if o.CredentialInfo.IsNull() || o.CredentialInfo.IsUnknown() { + return e, false + } + var v []UpdateStorageCredential + d := o.CredentialInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCredentialInfo sets the value of the CredentialInfo field in AccountsUpdateStorageCredential. +func (o *AccountsUpdateStorageCredential) SetCredentialInfo(ctx context.Context, v UpdateStorageCredential) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["credential_info"] + o.CredentialInfo = types.ListValueMust(t, vs) +} + type ArtifactAllowlistInfo struct { // A list of allowed artifact match patterns. - ArtifactMatchers []ArtifactMatcher `tfsdk:"artifact_matchers" tf:"optional"` + ArtifactMatchers types.List `tfsdk:"artifact_matchers" tf:"optional"` // Time at which this artifact allowlist was set, in epoch milliseconds. CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` // Username of the user who set the artifact allowlist. @@ -138,6 +710,73 @@ func (newState *ArtifactAllowlistInfo) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ArtifactAllowlistInfo) SyncEffectiveFieldsDuringRead(existingState ArtifactAllowlistInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ArtifactAllowlistInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ArtifactAllowlistInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "artifact_matchers": reflect.TypeOf(ArtifactMatcher{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ArtifactAllowlistInfo +// only implements ToObjectValue() and Type(). +func (o ArtifactAllowlistInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_matchers": o.ArtifactMatchers, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "metastore_id": o.MetastoreId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ArtifactAllowlistInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_matchers": basetypes.ListType{ + ElemType: ArtifactMatcher{}.Type(ctx), + }, + "created_at": types.Int64Type, + "created_by": types.StringType, + "metastore_id": types.StringType, + }, + } +} + +// GetArtifactMatchers returns the value of the ArtifactMatchers field in ArtifactAllowlistInfo as +// a slice of ArtifactMatcher values. +// If the field is unknown or null, the boolean return value is false. +func (o *ArtifactAllowlistInfo) GetArtifactMatchers(ctx context.Context) ([]ArtifactMatcher, bool) { + if o.ArtifactMatchers.IsNull() || o.ArtifactMatchers.IsUnknown() { + return nil, false + } + var v []ArtifactMatcher + d := o.ArtifactMatchers.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetArtifactMatchers sets the value of the ArtifactMatchers field in ArtifactAllowlistInfo. +func (o *ArtifactAllowlistInfo) SetArtifactMatchers(ctx context.Context, v []ArtifactMatcher) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["artifact_matchers"] + t = t.(attr.TypeWithElementType).ElementType() + o.ArtifactMatchers = types.ListValueMust(t, vs) +} + type ArtifactMatcher struct { // The artifact path or maven coordinate Artifact types.String `tfsdk:"artifact" tf:""` @@ -151,6 +790,39 @@ func (newState *ArtifactMatcher) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ar func (newState *ArtifactMatcher) SyncEffectiveFieldsDuringRead(existingState ArtifactMatcher) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ArtifactMatcher. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ArtifactMatcher) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ArtifactMatcher +// only implements ToObjectValue() and Type(). +func (o ArtifactMatcher) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact": o.Artifact, + "match_type": o.MatchType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ArtifactMatcher) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact": types.StringType, + "match_type": types.StringType, + }, + } +} + type AssignResponse struct { } @@ -160,6 +832,33 @@ func (newState *AssignResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ass func (newState *AssignResponse) SyncEffectiveFieldsDuringRead(existingState AssignResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AssignResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AssignResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AssignResponse +// only implements ToObjectValue() and Type(). +func (o AssignResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o AssignResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // AWS temporary credentials for API authentication. Read more at // https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. type AwsCredentials struct { @@ -181,6 +880,43 @@ func (newState *AwsCredentials) SyncEffectiveFieldsDuringCreateOrUpdate(plan Aws func (newState *AwsCredentials) SyncEffectiveFieldsDuringRead(existingState AwsCredentials) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsCredentials. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsCredentials) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsCredentials +// only implements ToObjectValue() and Type(). +func (o AwsCredentials) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_key_id": o.AccessKeyId, + "access_point": o.AccessPoint, + "secret_access_key": o.SecretAccessKey, + "session_token": o.SessionToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsCredentials) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_key_id": types.StringType, + "access_point": types.StringType, + "secret_access_key": types.StringType, + "session_token": types.StringType, + }, + } +} + // The AWS IAM role configuration type AwsIamRole struct { // The external ID used in role assumption to prevent the confused deputy @@ -200,6 +936,41 @@ func (newState *AwsIamRole) SyncEffectiveFieldsDuringCreateOrUpdate(plan AwsIamR func (newState *AwsIamRole) SyncEffectiveFieldsDuringRead(existingState AwsIamRole) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsIamRole. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsIamRole) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsIamRole +// only implements ToObjectValue() and Type(). +func (o AwsIamRole) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "external_id": o.ExternalId, + "role_arn": o.RoleArn, + "unity_catalog_iam_arn": o.UnityCatalogIamArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsIamRole) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "external_id": types.StringType, + "role_arn": types.StringType, + "unity_catalog_iam_arn": types.StringType, + }, + } +} + type AwsIamRoleRequest struct { // The Amazon Resource Name (ARN) of the AWS IAM role for S3 data access. RoleArn types.String `tfsdk:"role_arn" tf:""` @@ -211,6 +982,37 @@ func (newState *AwsIamRoleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AwsIamRoleRequest) SyncEffectiveFieldsDuringRead(existingState AwsIamRoleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsIamRoleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsIamRoleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsIamRoleRequest +// only implements ToObjectValue() and Type(). +func (o AwsIamRoleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "role_arn": o.RoleArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsIamRoleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "role_arn": types.StringType, + }, + } +} + type AwsIamRoleResponse struct { // The external ID used in role assumption to prevent confused deputy // problem.. @@ -228,6 +1030,41 @@ func (newState *AwsIamRoleResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AwsIamRoleResponse) SyncEffectiveFieldsDuringRead(existingState AwsIamRoleResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsIamRoleResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsIamRoleResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsIamRoleResponse +// only implements ToObjectValue() and Type(). +func (o AwsIamRoleResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "external_id": o.ExternalId, + "role_arn": o.RoleArn, + "unity_catalog_iam_arn": o.UnityCatalogIamArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsIamRoleResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "external_id": types.StringType, + "role_arn": types.StringType, + "unity_catalog_iam_arn": types.StringType, + }, + } +} + // Azure Active Directory token, essentially the Oauth token for Azure Service // Principal or Managed Identity. Read more at // https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token @@ -243,6 +1080,37 @@ func (newState *AzureActiveDirectoryToken) SyncEffectiveFieldsDuringCreateOrUpda func (newState *AzureActiveDirectoryToken) SyncEffectiveFieldsDuringRead(existingState AzureActiveDirectoryToken) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureActiveDirectoryToken. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureActiveDirectoryToken) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureActiveDirectoryToken +// only implements ToObjectValue() and Type(). +func (o AzureActiveDirectoryToken) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aad_token": o.AadToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureActiveDirectoryToken) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aad_token": types.StringType, + }, + } +} + // The Azure managed identity configuration. type AzureManagedIdentity struct { // The Azure resource ID of the Azure Databricks Access Connector. Use the @@ -269,6 +1137,41 @@ func (newState *AzureManagedIdentity) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *AzureManagedIdentity) SyncEffectiveFieldsDuringRead(existingState AzureManagedIdentity) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureManagedIdentity. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureManagedIdentity) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureManagedIdentity +// only implements ToObjectValue() and Type(). +func (o AzureManagedIdentity) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_connector_id": o.AccessConnectorId, + "credential_id": o.CredentialId, + "managed_identity_id": o.ManagedIdentityId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureManagedIdentity) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_connector_id": types.StringType, + "credential_id": types.StringType, + "managed_identity_id": types.StringType, + }, + } +} + type AzureManagedIdentityRequest struct { // The Azure resource ID of the Azure Databricks Access Connector. Use the // format @@ -289,6 +1192,39 @@ func (newState *AzureManagedIdentityRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *AzureManagedIdentityRequest) SyncEffectiveFieldsDuringRead(existingState AzureManagedIdentityRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureManagedIdentityRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureManagedIdentityRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureManagedIdentityRequest +// only implements ToObjectValue() and Type(). +func (o AzureManagedIdentityRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_connector_id": o.AccessConnectorId, + "managed_identity_id": o.ManagedIdentityId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureManagedIdentityRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_connector_id": types.StringType, + "managed_identity_id": types.StringType, + }, + } +} + type AzureManagedIdentityResponse struct { // The Azure resource ID of the Azure Databricks Access Connector. Use the // format @@ -311,6 +1247,41 @@ func (newState *AzureManagedIdentityResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *AzureManagedIdentityResponse) SyncEffectiveFieldsDuringRead(existingState AzureManagedIdentityResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureManagedIdentityResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureManagedIdentityResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureManagedIdentityResponse +// only implements ToObjectValue() and Type(). +func (o AzureManagedIdentityResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_connector_id": o.AccessConnectorId, + "credential_id": o.CredentialId, + "managed_identity_id": o.ManagedIdentityId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureManagedIdentityResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_connector_id": types.StringType, + "credential_id": types.StringType, + "managed_identity_id": types.StringType, + }, + } +} + // The Azure service principal configuration. Only applicable when purpose is // **STORAGE**. type AzureServicePrincipal struct { @@ -330,6 +1301,41 @@ func (newState *AzureServicePrincipal) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *AzureServicePrincipal) SyncEffectiveFieldsDuringRead(existingState AzureServicePrincipal) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureServicePrincipal. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureServicePrincipal) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureServicePrincipal +// only implements ToObjectValue() and Type(). +func (o AzureServicePrincipal) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "application_id": o.ApplicationId, + "client_secret": o.ClientSecret, + "directory_id": o.DirectoryId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureServicePrincipal) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "application_id": types.StringType, + "client_secret": types.StringType, + "directory_id": types.StringType, + }, + } +} + // Azure temporary credentials for API authentication. Read more at // https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas type AzureUserDelegationSas struct { @@ -343,6 +1349,37 @@ func (newState *AzureUserDelegationSas) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *AzureUserDelegationSas) SyncEffectiveFieldsDuringRead(existingState AzureUserDelegationSas) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureUserDelegationSas. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureUserDelegationSas) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureUserDelegationSas +// only implements ToObjectValue() and Type(). +func (o AzureUserDelegationSas) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "sas_token": o.SasToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureUserDelegationSas) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "sas_token": types.StringType, + }, + } +} + // Cancel refresh type CancelRefreshRequest struct { // ID of the refresh. @@ -357,6 +1394,39 @@ func (newState *CancelRefreshRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *CancelRefreshRequest) SyncEffectiveFieldsDuringRead(existingState CancelRefreshRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelRefreshRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelRefreshRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelRefreshRequest +// only implements ToObjectValue() and Type(). +func (o CancelRefreshRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "refresh_id": o.RefreshId, + "table_name": o.TableName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelRefreshRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "refresh_id": types.StringType, + "table_name": types.StringType, + }, + } +} + type CancelRefreshResponse struct { } @@ -366,6 +1436,33 @@ func (newState *CancelRefreshResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CancelRefreshResponse) SyncEffectiveFieldsDuringRead(existingState CancelRefreshResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelRefreshResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelRefreshResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelRefreshResponse +// only implements ToObjectValue() and Type(). +func (o CancelRefreshResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelRefreshResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type CatalogInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is @@ -382,7 +1479,7 @@ type CatalogInfo struct { // Username of catalog creator. CreatedBy types.String `tfsdk:"created_by" tf:"optional"` - EffectivePredictiveOptimizationFlag []EffectivePredictiveOptimizationFlag `tfsdk:"effective_predictive_optimization_flag" tf:"optional,object"` + EffectivePredictiveOptimizationFlag types.List `tfsdk:"effective_predictive_optimization_flag" tf:"optional,object"` // Whether predictive optimization should be enabled for this object and // objects under it. EnablePredictiveOptimization types.String `tfsdk:"enable_predictive_optimization" tf:"optional"` @@ -396,18 +1493,18 @@ type CatalogInfo struct { // Name of catalog. Name types.String `tfsdk:"name" tf:"optional"` // A map of key-value properties attached to the securable. - Options map[string]types.String `tfsdk:"options" tf:"optional"` + Options types.Map `tfsdk:"options" tf:"optional"` // Username of current owner of catalog. Owner types.String `tfsdk:"owner" tf:"optional"` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` // The name of delta sharing provider. // // A Delta Sharing catalog is a catalog that is based on a Delta share on a // remote sharing server. ProviderName types.String `tfsdk:"provider_name" tf:"optional"` // Status of an asynchronously provisioned resource. - ProvisioningInfo []ProvisioningInfo `tfsdk:"provisioning_info" tf:"optional,object"` + ProvisioningInfo types.List `tfsdk:"provisioning_info" tf:"optional,object"` // Kind of catalog securable. SecurableKind types.String `tfsdk:"securable_kind" tf:"optional"` @@ -430,6 +1527,200 @@ func (newState *CatalogInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Catalo func (newState *CatalogInfo) SyncEffectiveFieldsDuringRead(existingState CatalogInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CatalogInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CatalogInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "effective_predictive_optimization_flag": reflect.TypeOf(EffectivePredictiveOptimizationFlag{}), + "options": reflect.TypeOf(types.String{}), + "properties": reflect.TypeOf(types.String{}), + "provisioning_info": reflect.TypeOf(ProvisioningInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CatalogInfo +// only implements ToObjectValue() and Type(). +func (o CatalogInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "browse_only": o.BrowseOnly, + "catalog_type": o.CatalogType, + "comment": o.Comment, + "connection_name": o.ConnectionName, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "effective_predictive_optimization_flag": o.EffectivePredictiveOptimizationFlag, + "enable_predictive_optimization": o.EnablePredictiveOptimization, + "full_name": o.FullName, + "isolation_mode": o.IsolationMode, + "metastore_id": o.MetastoreId, + "name": o.Name, + "options": o.Options, + "owner": o.Owner, + "properties": o.Properties, + "provider_name": o.ProviderName, + "provisioning_info": o.ProvisioningInfo, + "securable_kind": o.SecurableKind, + "securable_type": o.SecurableType, + "share_name": o.ShareName, + "storage_location": o.StorageLocation, + "storage_root": o.StorageRoot, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CatalogInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "browse_only": types.BoolType, + "catalog_type": types.StringType, + "comment": types.StringType, + "connection_name": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "effective_predictive_optimization_flag": basetypes.ListType{ + ElemType: EffectivePredictiveOptimizationFlag{}.Type(ctx), + }, + "enable_predictive_optimization": types.StringType, + "full_name": types.StringType, + "isolation_mode": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "options": basetypes.MapType{ + ElemType: types.StringType, + }, + "owner": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "provider_name": types.StringType, + "provisioning_info": basetypes.ListType{ + ElemType: ProvisioningInfo{}.Type(ctx), + }, + "securable_kind": types.StringType, + "securable_type": types.StringType, + "share_name": types.StringType, + "storage_location": types.StringType, + "storage_root": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetEffectivePredictiveOptimizationFlag returns the value of the EffectivePredictiveOptimizationFlag field in CatalogInfo as +// a EffectivePredictiveOptimizationFlag value. +// If the field is unknown or null, the boolean return value is false. +func (o *CatalogInfo) GetEffectivePredictiveOptimizationFlag(ctx context.Context) (EffectivePredictiveOptimizationFlag, bool) { + var e EffectivePredictiveOptimizationFlag + if o.EffectivePredictiveOptimizationFlag.IsNull() || o.EffectivePredictiveOptimizationFlag.IsUnknown() { + return e, false + } + var v []EffectivePredictiveOptimizationFlag + d := o.EffectivePredictiveOptimizationFlag.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEffectivePredictiveOptimizationFlag sets the value of the EffectivePredictiveOptimizationFlag field in CatalogInfo. +func (o *CatalogInfo) SetEffectivePredictiveOptimizationFlag(ctx context.Context, v EffectivePredictiveOptimizationFlag) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["effective_predictive_optimization_flag"] + o.EffectivePredictiveOptimizationFlag = types.ListValueMust(t, vs) +} + +// GetOptions returns the value of the Options field in CatalogInfo as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CatalogInfo) GetOptions(ctx context.Context) (map[string]types.String, bool) { + if o.Options.IsNull() || o.Options.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOptions sets the value of the Options field in CatalogInfo. +func (o *CatalogInfo) SetOptions(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + t = t.(attr.TypeWithElementType).ElementType() + o.Options = types.MapValueMust(t, vs) +} + +// GetProperties returns the value of the Properties field in CatalogInfo as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CatalogInfo) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in CatalogInfo. +func (o *CatalogInfo) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + +// GetProvisioningInfo returns the value of the ProvisioningInfo field in CatalogInfo as +// a ProvisioningInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CatalogInfo) GetProvisioningInfo(ctx context.Context) (ProvisioningInfo, bool) { + var e ProvisioningInfo + if o.ProvisioningInfo.IsNull() || o.ProvisioningInfo.IsUnknown() { + return e, false + } + var v []ProvisioningInfo + d := o.ProvisioningInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvisioningInfo sets the value of the ProvisioningInfo field in CatalogInfo. +func (o *CatalogInfo) SetProvisioningInfo(ctx context.Context, v ProvisioningInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provisioning_info"] + o.ProvisioningInfo = types.ListValueMust(t, vs) +} + type CloudflareApiToken struct { // The Cloudflare access key id of the token. AccessKeyId types.String `tfsdk:"access_key_id" tf:""` @@ -445,11 +1736,46 @@ func (newState *CloudflareApiToken) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CloudflareApiToken) SyncEffectiveFieldsDuringRead(existingState CloudflareApiToken) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CloudflareApiToken. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CloudflareApiToken) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CloudflareApiToken +// only implements ToObjectValue() and Type(). +func (o CloudflareApiToken) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_key_id": o.AccessKeyId, + "account_id": o.AccountId, + "secret_access_key": o.SecretAccessKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CloudflareApiToken) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_key_id": types.StringType, + "account_id": types.StringType, + "secret_access_key": types.StringType, + }, + } +} + type ColumnInfo struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` - Mask []ColumnMask `tfsdk:"mask" tf:"optional,object"` + Mask types.List `tfsdk:"mask" tf:"optional,object"` // Name of Column. Name types.String `tfsdk:"name" tf:"optional"` // Whether field may be Null (default: true). @@ -478,6 +1804,89 @@ func (newState *ColumnInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ColumnI func (newState *ColumnInfo) SyncEffectiveFieldsDuringRead(existingState ColumnInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ColumnInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ColumnInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "mask": reflect.TypeOf(ColumnMask{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ColumnInfo +// only implements ToObjectValue() and Type(). +func (o ColumnInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "mask": o.Mask, + "name": o.Name, + "nullable": o.Nullable, + "partition_index": o.PartitionIndex, + "position": o.Position, + "type_interval_type": o.TypeIntervalType, + "type_json": o.TypeJson, + "type_name": o.TypeName, + "type_precision": o.TypePrecision, + "type_scale": o.TypeScale, + "type_text": o.TypeText, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ColumnInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "mask": basetypes.ListType{ + ElemType: ColumnMask{}.Type(ctx), + }, + "name": types.StringType, + "nullable": types.BoolType, + "partition_index": types.Int64Type, + "position": types.Int64Type, + "type_interval_type": types.StringType, + "type_json": types.StringType, + "type_name": types.StringType, + "type_precision": types.Int64Type, + "type_scale": types.Int64Type, + "type_text": types.StringType, + }, + } +} + +// GetMask returns the value of the Mask field in ColumnInfo as +// a ColumnMask value. +// If the field is unknown or null, the boolean return value is false. +func (o *ColumnInfo) GetMask(ctx context.Context) (ColumnMask, bool) { + var e ColumnMask + if o.Mask.IsNull() || o.Mask.IsUnknown() { + return e, false + } + var v []ColumnMask + d := o.Mask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMask sets the value of the Mask field in ColumnInfo. +func (o *ColumnInfo) SetMask(ctx context.Context, v ColumnMask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["mask"] + o.Mask = types.ListValueMust(t, vs) +} + type ColumnMask struct { // The full name of the column mask SQL UDF. FunctionName types.String `tfsdk:"function_name" tf:"optional"` @@ -485,7 +1894,7 @@ type ColumnMask struct { // mask function. The first arg of the mask function should be of the type // of the column being masked and the types of the rest of the args should // match the types of columns in 'using_column_names'. - UsingColumnNames []types.String `tfsdk:"using_column_names" tf:"optional"` + UsingColumnNames types.List `tfsdk:"using_column_names" tf:"optional"` } func (newState *ColumnMask) SyncEffectiveFieldsDuringCreateOrUpdate(plan ColumnMask) { @@ -494,6 +1903,69 @@ func (newState *ColumnMask) SyncEffectiveFieldsDuringCreateOrUpdate(plan ColumnM func (newState *ColumnMask) SyncEffectiveFieldsDuringRead(existingState ColumnMask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ColumnMask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ColumnMask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "using_column_names": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ColumnMask +// only implements ToObjectValue() and Type(). +func (o ColumnMask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "function_name": o.FunctionName, + "using_column_names": o.UsingColumnNames, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ColumnMask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "function_name": types.StringType, + "using_column_names": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetUsingColumnNames returns the value of the UsingColumnNames field in ColumnMask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ColumnMask) GetUsingColumnNames(ctx context.Context) ([]types.String, bool) { + if o.UsingColumnNames.IsNull() || o.UsingColumnNames.IsUnknown() { + return nil, false + } + var v []types.String + d := o.UsingColumnNames.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUsingColumnNames sets the value of the UsingColumnNames field in ColumnMask. +func (o *ColumnMask) SetUsingColumnNames(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["using_column_names"] + t = t.(attr.TypeWithElementType).ElementType() + o.UsingColumnNames = types.ListValueMust(t, vs) +} + type ConnectionInfo struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -514,14 +1986,14 @@ type ConnectionInfo struct { // Name of the connection. Name types.String `tfsdk:"name" tf:"optional"` // A map of key-value properties attached to the securable. - Options map[string]types.String `tfsdk:"options" tf:"optional"` + Options types.Map `tfsdk:"options" tf:"optional"` // Username of current owner of the connection. Owner types.String `tfsdk:"owner" tf:"optional"` // An object containing map of key-value properties attached to the // connection. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` // Status of an asynchronously provisioned resource. - ProvisioningInfo []ProvisioningInfo `tfsdk:"provisioning_info" tf:"optional,object"` + ProvisioningInfo types.List `tfsdk:"provisioning_info" tf:"optional,object"` // If the connection is read only. ReadOnly types.Bool `tfsdk:"read_only" tf:"optional"` // Kind of connection securable. @@ -542,11 +2014,166 @@ func (newState *ConnectionInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Con func (newState *ConnectionInfo) SyncEffectiveFieldsDuringRead(existingState ConnectionInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ConnectionInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ConnectionInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(types.String{}), + "properties": reflect.TypeOf(types.String{}), + "provisioning_info": reflect.TypeOf(ProvisioningInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ConnectionInfo +// only implements ToObjectValue() and Type(). +func (o ConnectionInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "connection_id": o.ConnectionId, + "connection_type": o.ConnectionType, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "credential_type": o.CredentialType, + "full_name": o.FullName, + "metastore_id": o.MetastoreId, + "name": o.Name, + "options": o.Options, + "owner": o.Owner, + "properties": o.Properties, + "provisioning_info": o.ProvisioningInfo, + "read_only": o.ReadOnly, + "securable_kind": o.SecurableKind, + "securable_type": o.SecurableType, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ConnectionInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "connection_id": types.StringType, + "connection_type": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "credential_type": types.StringType, + "full_name": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "options": basetypes.MapType{ + ElemType: types.StringType, + }, + "owner": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "provisioning_info": basetypes.ListType{ + ElemType: ProvisioningInfo{}.Type(ctx), + }, + "read_only": types.BoolType, + "securable_kind": types.StringType, + "securable_type": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "url": types.StringType, + }, + } +} + +// GetOptions returns the value of the Options field in ConnectionInfo as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ConnectionInfo) GetOptions(ctx context.Context) (map[string]types.String, bool) { + if o.Options.IsNull() || o.Options.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOptions sets the value of the Options field in ConnectionInfo. +func (o *ConnectionInfo) SetOptions(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + t = t.(attr.TypeWithElementType).ElementType() + o.Options = types.MapValueMust(t, vs) +} + +// GetProperties returns the value of the Properties field in ConnectionInfo as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ConnectionInfo) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in ConnectionInfo. +func (o *ConnectionInfo) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + +// GetProvisioningInfo returns the value of the ProvisioningInfo field in ConnectionInfo as +// a ProvisioningInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ConnectionInfo) GetProvisioningInfo(ctx context.Context) (ProvisioningInfo, bool) { + var e ProvisioningInfo + if o.ProvisioningInfo.IsNull() || o.ProvisioningInfo.IsUnknown() { + return e, false + } + var v []ProvisioningInfo + d := o.ProvisioningInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvisioningInfo sets the value of the ProvisioningInfo field in ConnectionInfo. +func (o *ConnectionInfo) SetProvisioningInfo(ctx context.Context, v ProvisioningInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provisioning_info"] + o.ProvisioningInfo = types.ListValueMust(t, vs) +} + // Detailed status of an online table. Shown if the online table is in the // ONLINE_CONTINUOUS_UPDATE or the ONLINE_UPDATING_PIPELINE_RESOURCES state. type ContinuousUpdateStatus struct { // Progress of the initial data synchronization. - InitialPipelineSyncProgress []PipelineProgress `tfsdk:"initial_pipeline_sync_progress" tf:"optional,object"` + InitialPipelineSyncProgress types.List `tfsdk:"initial_pipeline_sync_progress" tf:"optional,object"` // The last source table Delta version that was synced to the online table. // Note that this Delta version may not be completely synced to the online // table yet. @@ -562,6 +2189,71 @@ func (newState *ContinuousUpdateStatus) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ContinuousUpdateStatus) SyncEffectiveFieldsDuringRead(existingState ContinuousUpdateStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ContinuousUpdateStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ContinuousUpdateStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "initial_pipeline_sync_progress": reflect.TypeOf(PipelineProgress{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ContinuousUpdateStatus +// only implements ToObjectValue() and Type(). +func (o ContinuousUpdateStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "initial_pipeline_sync_progress": o.InitialPipelineSyncProgress, + "last_processed_commit_version": o.LastProcessedCommitVersion, + "timestamp": o.Timestamp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ContinuousUpdateStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "initial_pipeline_sync_progress": basetypes.ListType{ + ElemType: PipelineProgress{}.Type(ctx), + }, + "last_processed_commit_version": types.Int64Type, + "timestamp": types.StringType, + }, + } +} + +// GetInitialPipelineSyncProgress returns the value of the InitialPipelineSyncProgress field in ContinuousUpdateStatus as +// a PipelineProgress value. +// If the field is unknown or null, the boolean return value is false. +func (o *ContinuousUpdateStatus) GetInitialPipelineSyncProgress(ctx context.Context) (PipelineProgress, bool) { + var e PipelineProgress + if o.InitialPipelineSyncProgress.IsNull() || o.InitialPipelineSyncProgress.IsUnknown() { + return e, false + } + var v []PipelineProgress + d := o.InitialPipelineSyncProgress.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInitialPipelineSyncProgress sets the value of the InitialPipelineSyncProgress field in ContinuousUpdateStatus. +func (o *ContinuousUpdateStatus) SetInitialPipelineSyncProgress(ctx context.Context, v PipelineProgress) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["initial_pipeline_sync_progress"] + o.InitialPipelineSyncProgress = types.ListValueMust(t, vs) +} + type CreateCatalog struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -570,9 +2262,9 @@ type CreateCatalog struct { // Name of catalog. Name types.String `tfsdk:"name" tf:""` // A map of key-value properties attached to the securable. - Options map[string]types.String `tfsdk:"options" tf:"optional"` + Options types.Map `tfsdk:"options" tf:"optional"` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` // The name of delta sharing provider. // // A Delta Sharing catalog is a catalog that is based on a Delta share on a @@ -590,6 +2282,110 @@ func (newState *CreateCatalog) SyncEffectiveFieldsDuringCreateOrUpdate(plan Crea func (newState *CreateCatalog) SyncEffectiveFieldsDuringRead(existingState CreateCatalog) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCatalog. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCatalog) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(types.String{}), + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCatalog +// only implements ToObjectValue() and Type(). +func (o CreateCatalog) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "connection_name": o.ConnectionName, + "name": o.Name, + "options": o.Options, + "properties": o.Properties, + "provider_name": o.ProviderName, + "share_name": o.ShareName, + "storage_root": o.StorageRoot, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCatalog) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "connection_name": types.StringType, + "name": types.StringType, + "options": basetypes.MapType{ + ElemType: types.StringType, + }, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "provider_name": types.StringType, + "share_name": types.StringType, + "storage_root": types.StringType, + }, + } +} + +// GetOptions returns the value of the Options field in CreateCatalog as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCatalog) GetOptions(ctx context.Context) (map[string]types.String, bool) { + if o.Options.IsNull() || o.Options.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOptions sets the value of the Options field in CreateCatalog. +func (o *CreateCatalog) SetOptions(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + t = t.(attr.TypeWithElementType).ElementType() + o.Options = types.MapValueMust(t, vs) +} + +// GetProperties returns the value of the Properties field in CreateCatalog as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCatalog) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in CreateCatalog. +func (o *CreateCatalog) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type CreateConnection struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -598,10 +2394,10 @@ type CreateConnection struct { // Name of the connection. Name types.String `tfsdk:"name" tf:""` // A map of key-value properties attached to the securable. - Options map[string]types.String `tfsdk:"options" tf:""` + Options types.Map `tfsdk:"options" tf:""` // An object containing map of key-value properties attached to the // connection. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` // If the connection is read only. ReadOnly types.Bool `tfsdk:"read_only" tf:"optional"` } @@ -612,19 +2408,119 @@ func (newState *CreateConnection) SyncEffectiveFieldsDuringCreateOrUpdate(plan C func (newState *CreateConnection) SyncEffectiveFieldsDuringRead(existingState CreateConnection) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateConnection. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateConnection) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(types.String{}), + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateConnection +// only implements ToObjectValue() and Type(). +func (o CreateConnection) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "connection_type": o.ConnectionType, + "name": o.Name, + "options": o.Options, + "properties": o.Properties, + "read_only": o.ReadOnly, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateConnection) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "connection_type": types.StringType, + "name": types.StringType, + "options": basetypes.MapType{ + ElemType: types.StringType, + }, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "read_only": types.BoolType, + }, + } +} + +// GetOptions returns the value of the Options field in CreateConnection as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateConnection) GetOptions(ctx context.Context) (map[string]types.String, bool) { + if o.Options.IsNull() || o.Options.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOptions sets the value of the Options field in CreateConnection. +func (o *CreateConnection) SetOptions(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + t = t.(attr.TypeWithElementType).ElementType() + o.Options = types.MapValueMust(t, vs) +} + +// GetProperties returns the value of the Properties field in CreateConnection as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateConnection) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in CreateConnection. +func (o *CreateConnection) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type CreateCredentialRequest struct { // The AWS IAM role configuration - AwsIamRole []AwsIamRole `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentity `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. Only applicable when purpose // is **STORAGE**. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // Comment associated with the credential. Comment types.String `tfsdk:"comment" tf:"optional"` // GCP long-lived credential. Databricks-created Google Cloud Storage // service account. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccount `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // The credential name. The name must be unique among storage and service // credentials within the metastore. Name types.String `tfsdk:"name" tf:""` @@ -644,6 +2540,170 @@ func (newState *CreateCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateCredentialRequest) SyncEffectiveFieldsDuringRead(existingState CreateCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRole{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentity{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccount{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCredentialRequest +// only implements ToObjectValue() and Type(). +func (o CreateCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "comment": o.Comment, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "name": o.Name, + "purpose": o.Purpose, + "read_only": o.ReadOnly, + "skip_validation": o.SkipValidation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRole{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentity{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "comment": types.StringType, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccount{}.Type(ctx), + }, + "name": types.StringType, + "purpose": types.StringType, + "read_only": types.BoolType, + "skip_validation": types.BoolType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in CreateCredentialRequest as +// a AwsIamRole value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCredentialRequest) GetAwsIamRole(ctx context.Context) (AwsIamRole, bool) { + var e AwsIamRole + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRole + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in CreateCredentialRequest. +func (o *CreateCredentialRequest) SetAwsIamRole(ctx context.Context, v AwsIamRole) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in CreateCredentialRequest as +// a AzureManagedIdentity value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCredentialRequest) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentity, bool) { + var e AzureManagedIdentity + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentity + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in CreateCredentialRequest. +func (o *CreateCredentialRequest) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentity) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in CreateCredentialRequest as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCredentialRequest) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in CreateCredentialRequest. +func (o *CreateCredentialRequest) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in CreateCredentialRequest as +// a DatabricksGcpServiceAccount value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCredentialRequest) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccount, bool) { + var e DatabricksGcpServiceAccount + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccount + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in CreateCredentialRequest. +func (o *CreateCredentialRequest) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccount) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + type CreateExternalLocation struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint types.String `tfsdk:"access_point" tf:"optional"` @@ -652,7 +2712,7 @@ type CreateExternalLocation struct { // Name of the storage credential used with this location. CredentialName types.String `tfsdk:"credential_name" tf:""` // Encryption options that apply to clients connecting to cloud storage. - EncryptionDetails []EncryptionDetails `tfsdk:"encryption_details" tf:"optional,object"` + EncryptionDetails types.List `tfsdk:"encryption_details" tf:"optional,object"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. @@ -674,6 +2734,83 @@ func (newState *CreateExternalLocation) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateExternalLocation) SyncEffectiveFieldsDuringRead(existingState CreateExternalLocation) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExternalLocation. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExternalLocation) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "encryption_details": reflect.TypeOf(EncryptionDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExternalLocation +// only implements ToObjectValue() and Type(). +func (o CreateExternalLocation) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_point": o.AccessPoint, + "comment": o.Comment, + "credential_name": o.CredentialName, + "encryption_details": o.EncryptionDetails, + "fallback": o.Fallback, + "name": o.Name, + "read_only": o.ReadOnly, + "skip_validation": o.SkipValidation, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExternalLocation) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_point": types.StringType, + "comment": types.StringType, + "credential_name": types.StringType, + "encryption_details": basetypes.ListType{ + ElemType: EncryptionDetails{}.Type(ctx), + }, + "fallback": types.BoolType, + "name": types.StringType, + "read_only": types.BoolType, + "skip_validation": types.BoolType, + "url": types.StringType, + }, + } +} + +// GetEncryptionDetails returns the value of the EncryptionDetails field in CreateExternalLocation as +// a EncryptionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateExternalLocation) GetEncryptionDetails(ctx context.Context) (EncryptionDetails, bool) { + var e EncryptionDetails + if o.EncryptionDetails.IsNull() || o.EncryptionDetails.IsUnknown() { + return e, false + } + var v []EncryptionDetails + d := o.EncryptionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEncryptionDetails sets the value of the EncryptionDetails field in CreateExternalLocation. +func (o *CreateExternalLocation) SetEncryptionDetails(ctx context.Context, v EncryptionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["encryption_details"] + o.EncryptionDetails = types.ListValueMust(t, vs) +} + type CreateFunction struct { // Name of parent catalog. CatalogName types.String `tfsdk:"catalog_name" tf:""` @@ -688,7 +2825,7 @@ type CreateFunction struct { // Pretty printed function data type. FullDataType types.String `tfsdk:"full_data_type" tf:""` - InputParams []FunctionParameterInfos `tfsdk:"input_params" tf:"object"` + InputParams types.List `tfsdk:"input_params" tf:"object"` // Whether the function is deterministic. IsDeterministic types.Bool `tfsdk:"is_deterministic" tf:""` // Function null call. @@ -700,7 +2837,7 @@ type CreateFunction struct { // JSON-serialized key-value pair map, encoded (escaped) as a string. Properties types.String `tfsdk:"properties" tf:"optional"` // Table function return parameters. - ReturnParams []FunctionParameterInfos `tfsdk:"return_params" tf:"optional,object"` + ReturnParams types.List `tfsdk:"return_params" tf:"optional,object"` // Function language. When **EXTERNAL** is used, the language of the routine // function should be specified in the __external_language__ field, and the // __return_params__ of the function cannot be used (as **TABLE** return @@ -710,7 +2847,7 @@ type CreateFunction struct { // Function body. RoutineDefinition types.String `tfsdk:"routine_definition" tf:""` // Function dependencies. - RoutineDependencies []DependencyList `tfsdk:"routine_dependencies" tf:"optional,object"` + RoutineDependencies types.List `tfsdk:"routine_dependencies" tf:"optional,object"` // Name of parent schema relative to its parent catalog. SchemaName types.String `tfsdk:"schema_name" tf:""` // Function security type. @@ -729,9 +2866,168 @@ func (newState *CreateFunction) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateFunction) SyncEffectiveFieldsDuringRead(existingState CreateFunction) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateFunction. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateFunction) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "input_params": reflect.TypeOf(FunctionParameterInfos{}), + "return_params": reflect.TypeOf(FunctionParameterInfos{}), + "routine_dependencies": reflect.TypeOf(DependencyList{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateFunction +// only implements ToObjectValue() and Type(). +func (o CreateFunction) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "comment": o.Comment, + "data_type": o.DataType, + "external_language": o.ExternalLanguage, + "external_name": o.ExternalName, + "full_data_type": o.FullDataType, + "input_params": o.InputParams, + "is_deterministic": o.IsDeterministic, + "is_null_call": o.IsNullCall, + "name": o.Name, + "parameter_style": o.ParameterStyle, + "properties": o.Properties, + "return_params": o.ReturnParams, + "routine_body": o.RoutineBody, + "routine_definition": o.RoutineDefinition, + "routine_dependencies": o.RoutineDependencies, + "schema_name": o.SchemaName, + "security_type": o.SecurityType, + "specific_name": o.SpecificName, + "sql_data_access": o.SqlDataAccess, + "sql_path": o.SqlPath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateFunction) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "comment": types.StringType, + "data_type": types.StringType, + "external_language": types.StringType, + "external_name": types.StringType, + "full_data_type": types.StringType, + "input_params": basetypes.ListType{ + ElemType: FunctionParameterInfos{}.Type(ctx), + }, + "is_deterministic": types.BoolType, + "is_null_call": types.BoolType, + "name": types.StringType, + "parameter_style": types.StringType, + "properties": types.StringType, + "return_params": basetypes.ListType{ + ElemType: FunctionParameterInfos{}.Type(ctx), + }, + "routine_body": types.StringType, + "routine_definition": types.StringType, + "routine_dependencies": basetypes.ListType{ + ElemType: DependencyList{}.Type(ctx), + }, + "schema_name": types.StringType, + "security_type": types.StringType, + "specific_name": types.StringType, + "sql_data_access": types.StringType, + "sql_path": types.StringType, + }, + } +} + +// GetInputParams returns the value of the InputParams field in CreateFunction as +// a FunctionParameterInfos value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateFunction) GetInputParams(ctx context.Context) (FunctionParameterInfos, bool) { + var e FunctionParameterInfos + if o.InputParams.IsNull() || o.InputParams.IsUnknown() { + return e, false + } + var v []FunctionParameterInfos + d := o.InputParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInputParams sets the value of the InputParams field in CreateFunction. +func (o *CreateFunction) SetInputParams(ctx context.Context, v FunctionParameterInfos) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["input_params"] + o.InputParams = types.ListValueMust(t, vs) +} + +// GetReturnParams returns the value of the ReturnParams field in CreateFunction as +// a FunctionParameterInfos value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateFunction) GetReturnParams(ctx context.Context) (FunctionParameterInfos, bool) { + var e FunctionParameterInfos + if o.ReturnParams.IsNull() || o.ReturnParams.IsUnknown() { + return e, false + } + var v []FunctionParameterInfos + d := o.ReturnParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetReturnParams sets the value of the ReturnParams field in CreateFunction. +func (o *CreateFunction) SetReturnParams(ctx context.Context, v FunctionParameterInfos) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["return_params"] + o.ReturnParams = types.ListValueMust(t, vs) +} + +// GetRoutineDependencies returns the value of the RoutineDependencies field in CreateFunction as +// a DependencyList value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateFunction) GetRoutineDependencies(ctx context.Context) (DependencyList, bool) { + var e DependencyList + if o.RoutineDependencies.IsNull() || o.RoutineDependencies.IsUnknown() { + return e, false + } + var v []DependencyList + d := o.RoutineDependencies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRoutineDependencies sets the value of the RoutineDependencies field in CreateFunction. +func (o *CreateFunction) SetRoutineDependencies(ctx context.Context, v DependencyList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["routine_dependencies"] + o.RoutineDependencies = types.ListValueMust(t, vs) +} + type CreateFunctionRequest struct { // Partial __FunctionInfo__ specifying the function to be created. - FunctionInfo []CreateFunction `tfsdk:"function_info" tf:"object"` + FunctionInfo types.List `tfsdk:"function_info" tf:"object"` } func (newState *CreateFunctionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateFunctionRequest) { @@ -740,6 +3036,67 @@ func (newState *CreateFunctionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateFunctionRequest) SyncEffectiveFieldsDuringRead(existingState CreateFunctionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateFunctionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateFunctionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "function_info": reflect.TypeOf(CreateFunction{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateFunctionRequest +// only implements ToObjectValue() and Type(). +func (o CreateFunctionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "function_info": o.FunctionInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateFunctionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "function_info": basetypes.ListType{ + ElemType: CreateFunction{}.Type(ctx), + }, + }, + } +} + +// GetFunctionInfo returns the value of the FunctionInfo field in CreateFunctionRequest as +// a CreateFunction value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateFunctionRequest) GetFunctionInfo(ctx context.Context) (CreateFunction, bool) { + var e CreateFunction + if o.FunctionInfo.IsNull() || o.FunctionInfo.IsUnknown() { + return e, false + } + var v []CreateFunction + d := o.FunctionInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFunctionInfo sets the value of the FunctionInfo field in CreateFunctionRequest. +func (o *CreateFunctionRequest) SetFunctionInfo(ctx context.Context, v CreateFunction) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["function_info"] + o.FunctionInfo = types.ListValueMust(t, vs) +} + type CreateMetastore struct { // The user-specified name of the metastore. Name types.String `tfsdk:"name" tf:""` @@ -758,6 +3115,41 @@ func (newState *CreateMetastore) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cr func (newState *CreateMetastore) SyncEffectiveFieldsDuringRead(existingState CreateMetastore) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateMetastore. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateMetastore) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateMetastore +// only implements ToObjectValue() and Type(). +func (o CreateMetastore) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "region": o.Region, + "storage_root": o.StorageRoot, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateMetastore) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "region": types.StringType, + "storage_root": types.StringType, + }, + } +} + type CreateMetastoreAssignment struct { // The name of the default catalog in the metastore. This field is // depracted. Please use "Default Namespace API" to configure the default @@ -775,6 +3167,41 @@ func (newState *CreateMetastoreAssignment) SyncEffectiveFieldsDuringCreateOrUpda func (newState *CreateMetastoreAssignment) SyncEffectiveFieldsDuringRead(existingState CreateMetastoreAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateMetastoreAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateMetastoreAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateMetastoreAssignment +// only implements ToObjectValue() and Type(). +func (o CreateMetastoreAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default_catalog_name": o.DefaultCatalogName, + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateMetastoreAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default_catalog_name": types.StringType, + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type CreateMonitor struct { // The directory to store monitoring assets (e.g. dashboard, metric tables). AssetsDir types.String `tfsdk:"assets_dir" tf:""` @@ -785,17 +3212,17 @@ type CreateMonitor struct { // Custom metrics to compute on the monitored table. These can be aggregate // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). - CustomMetrics []MonitorMetric `tfsdk:"custom_metrics" tf:"optional"` + CustomMetrics types.List `tfsdk:"custom_metrics" tf:"optional"` // The data classification config for the monitor. - DataClassificationConfig []MonitorDataClassificationConfig `tfsdk:"data_classification_config" tf:"optional,object"` + DataClassificationConfig types.List `tfsdk:"data_classification_config" tf:"optional,object"` // Configuration for monitoring inference logs. - InferenceLog []MonitorInferenceLog `tfsdk:"inference_log" tf:"optional,object"` + InferenceLog types.List `tfsdk:"inference_log" tf:"optional,object"` // The notification settings for the monitor. - Notifications []MonitorNotifications `tfsdk:"notifications" tf:"optional,object"` + Notifications types.List `tfsdk:"notifications" tf:"optional,object"` // Schema where output metric tables are created. OutputSchemaName types.String `tfsdk:"output_schema_name" tf:""` // The schedule for automatically updating and refreshing metric tables. - Schedule []MonitorCronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // Whether to skip creating a default dashboard summarizing data quality // metrics. SkipBuiltinDashboard types.Bool `tfsdk:"skip_builtin_dashboard" tf:"optional"` @@ -804,13 +3231,13 @@ type CreateMonitor struct { // slice for each predicate and its complements. For high-cardinality // columns, only the top 100 unique values by frequency will generate // slices. - SlicingExprs []types.String `tfsdk:"slicing_exprs" tf:"optional"` + SlicingExprs types.List `tfsdk:"slicing_exprs" tf:"optional"` // Configuration for monitoring snapshot tables. - Snapshot []MonitorSnapshot `tfsdk:"snapshot" tf:"optional,object"` + Snapshot types.List `tfsdk:"snapshot" tf:"optional,object"` // Full name of the table. TableName types.String `tfsdk:"-"` // Configuration for monitoring time series tables. - TimeSeries []MonitorTimeSeries `tfsdk:"time_series" tf:"optional,object"` + TimeSeries types.List `tfsdk:"time_series" tf:"optional,object"` // Optional argument to specify the warehouse for dashboard creation. If not // specified, the first running warehouse will be used. WarehouseId types.String `tfsdk:"warehouse_id" tf:"optional"` @@ -822,10 +3249,300 @@ func (newState *CreateMonitor) SyncEffectiveFieldsDuringCreateOrUpdate(plan Crea func (newState *CreateMonitor) SyncEffectiveFieldsDuringRead(existingState CreateMonitor) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateMonitor. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateMonitor) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "custom_metrics": reflect.TypeOf(MonitorMetric{}), + "data_classification_config": reflect.TypeOf(MonitorDataClassificationConfig{}), + "inference_log": reflect.TypeOf(MonitorInferenceLog{}), + "notifications": reflect.TypeOf(MonitorNotifications{}), + "schedule": reflect.TypeOf(MonitorCronSchedule{}), + "slicing_exprs": reflect.TypeOf(types.String{}), + "snapshot": reflect.TypeOf(MonitorSnapshot{}), + "time_series": reflect.TypeOf(MonitorTimeSeries{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateMonitor +// only implements ToObjectValue() and Type(). +func (o CreateMonitor) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assets_dir": o.AssetsDir, + "baseline_table_name": o.BaselineTableName, + "custom_metrics": o.CustomMetrics, + "data_classification_config": o.DataClassificationConfig, + "inference_log": o.InferenceLog, + "notifications": o.Notifications, + "output_schema_name": o.OutputSchemaName, + "schedule": o.Schedule, + "skip_builtin_dashboard": o.SkipBuiltinDashboard, + "slicing_exprs": o.SlicingExprs, + "snapshot": o.Snapshot, + "table_name": o.TableName, + "time_series": o.TimeSeries, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateMonitor) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assets_dir": types.StringType, + "baseline_table_name": types.StringType, + "custom_metrics": basetypes.ListType{ + ElemType: MonitorMetric{}.Type(ctx), + }, + "data_classification_config": basetypes.ListType{ + ElemType: MonitorDataClassificationConfig{}.Type(ctx), + }, + "inference_log": basetypes.ListType{ + ElemType: MonitorInferenceLog{}.Type(ctx), + }, + "notifications": basetypes.ListType{ + ElemType: MonitorNotifications{}.Type(ctx), + }, + "output_schema_name": types.StringType, + "schedule": basetypes.ListType{ + ElemType: MonitorCronSchedule{}.Type(ctx), + }, + "skip_builtin_dashboard": types.BoolType, + "slicing_exprs": basetypes.ListType{ + ElemType: types.StringType, + }, + "snapshot": basetypes.ListType{ + ElemType: MonitorSnapshot{}.Type(ctx), + }, + "table_name": types.StringType, + "time_series": basetypes.ListType{ + ElemType: MonitorTimeSeries{}.Type(ctx), + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetCustomMetrics returns the value of the CustomMetrics field in CreateMonitor as +// a slice of MonitorMetric values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetCustomMetrics(ctx context.Context) ([]MonitorMetric, bool) { + if o.CustomMetrics.IsNull() || o.CustomMetrics.IsUnknown() { + return nil, false + } + var v []MonitorMetric + d := o.CustomMetrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomMetrics sets the value of the CustomMetrics field in CreateMonitor. +func (o *CreateMonitor) SetCustomMetrics(ctx context.Context, v []MonitorMetric) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_metrics"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomMetrics = types.ListValueMust(t, vs) +} + +// GetDataClassificationConfig returns the value of the DataClassificationConfig field in CreateMonitor as +// a MonitorDataClassificationConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetDataClassificationConfig(ctx context.Context) (MonitorDataClassificationConfig, bool) { + var e MonitorDataClassificationConfig + if o.DataClassificationConfig.IsNull() || o.DataClassificationConfig.IsUnknown() { + return e, false + } + var v []MonitorDataClassificationConfig + d := o.DataClassificationConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataClassificationConfig sets the value of the DataClassificationConfig field in CreateMonitor. +func (o *CreateMonitor) SetDataClassificationConfig(ctx context.Context, v MonitorDataClassificationConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_classification_config"] + o.DataClassificationConfig = types.ListValueMust(t, vs) +} + +// GetInferenceLog returns the value of the InferenceLog field in CreateMonitor as +// a MonitorInferenceLog value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetInferenceLog(ctx context.Context) (MonitorInferenceLog, bool) { + var e MonitorInferenceLog + if o.InferenceLog.IsNull() || o.InferenceLog.IsUnknown() { + return e, false + } + var v []MonitorInferenceLog + d := o.InferenceLog.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInferenceLog sets the value of the InferenceLog field in CreateMonitor. +func (o *CreateMonitor) SetInferenceLog(ctx context.Context, v MonitorInferenceLog) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inference_log"] + o.InferenceLog = types.ListValueMust(t, vs) +} + +// GetNotifications returns the value of the Notifications field in CreateMonitor as +// a MonitorNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetNotifications(ctx context.Context) (MonitorNotifications, bool) { + var e MonitorNotifications + if o.Notifications.IsNull() || o.Notifications.IsUnknown() { + return e, false + } + var v []MonitorNotifications + d := o.Notifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotifications sets the value of the Notifications field in CreateMonitor. +func (o *CreateMonitor) SetNotifications(ctx context.Context, v MonitorNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notifications"] + o.Notifications = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in CreateMonitor as +// a MonitorCronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetSchedule(ctx context.Context) (MonitorCronSchedule, bool) { + var e MonitorCronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []MonitorCronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in CreateMonitor. +func (o *CreateMonitor) SetSchedule(ctx context.Context, v MonitorCronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetSlicingExprs returns the value of the SlicingExprs field in CreateMonitor as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetSlicingExprs(ctx context.Context) ([]types.String, bool) { + if o.SlicingExprs.IsNull() || o.SlicingExprs.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SlicingExprs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSlicingExprs sets the value of the SlicingExprs field in CreateMonitor. +func (o *CreateMonitor) SetSlicingExprs(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["slicing_exprs"] + t = t.(attr.TypeWithElementType).ElementType() + o.SlicingExprs = types.ListValueMust(t, vs) +} + +// GetSnapshot returns the value of the Snapshot field in CreateMonitor as +// a MonitorSnapshot value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetSnapshot(ctx context.Context) (MonitorSnapshot, bool) { + var e MonitorSnapshot + if o.Snapshot.IsNull() || o.Snapshot.IsUnknown() { + return e, false + } + var v []MonitorSnapshot + d := o.Snapshot.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSnapshot sets the value of the Snapshot field in CreateMonitor. +func (o *CreateMonitor) SetSnapshot(ctx context.Context, v MonitorSnapshot) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["snapshot"] + o.Snapshot = types.ListValueMust(t, vs) +} + +// GetTimeSeries returns the value of the TimeSeries field in CreateMonitor as +// a MonitorTimeSeries value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateMonitor) GetTimeSeries(ctx context.Context) (MonitorTimeSeries, bool) { + var e MonitorTimeSeries + if o.TimeSeries.IsNull() || o.TimeSeries.IsUnknown() { + return e, false + } + var v []MonitorTimeSeries + d := o.TimeSeries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTimeSeries sets the value of the TimeSeries field in CreateMonitor. +func (o *CreateMonitor) SetTimeSeries(ctx context.Context, v MonitorTimeSeries) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["time_series"] + o.TimeSeries = types.ListValueMust(t, vs) +} + // Create an Online Table type CreateOnlineTableRequest struct { // Online Table information. - Table []OnlineTable `tfsdk:"table" tf:"optional,object"` + Table types.List `tfsdk:"table" tf:"optional,object"` } func (newState *CreateOnlineTableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateOnlineTableRequest) { @@ -834,6 +3551,67 @@ func (newState *CreateOnlineTableRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CreateOnlineTableRequest) SyncEffectiveFieldsDuringRead(existingState CreateOnlineTableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateOnlineTableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateOnlineTableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "table": reflect.TypeOf(OnlineTable{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateOnlineTableRequest +// only implements ToObjectValue() and Type(). +func (o CreateOnlineTableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table": o.Table, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateOnlineTableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table": basetypes.ListType{ + ElemType: OnlineTable{}.Type(ctx), + }, + }, + } +} + +// GetTable returns the value of the Table field in CreateOnlineTableRequest as +// a OnlineTable value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateOnlineTableRequest) GetTable(ctx context.Context) (OnlineTable, bool) { + var e OnlineTable + if o.Table.IsNull() || o.Table.IsUnknown() { + return e, false + } + var v []OnlineTable + d := o.Table.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTable sets the value of the Table field in CreateOnlineTableRequest. +func (o *CreateOnlineTableRequest) SetTable(ctx context.Context, v OnlineTable) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table"] + o.Table = types.ListValueMust(t, vs) +} + type CreateRegisteredModelRequest struct { // The name of the catalog where the schema and the registered model reside CatalogName types.String `tfsdk:"catalog_name" tf:""` @@ -854,6 +3632,45 @@ func (newState *CreateRegisteredModelRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *CreateRegisteredModelRequest) SyncEffectiveFieldsDuringRead(existingState CreateRegisteredModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRegisteredModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRegisteredModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRegisteredModelRequest +// only implements ToObjectValue() and Type(). +func (o CreateRegisteredModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "comment": o.Comment, + "name": o.Name, + "schema_name": o.SchemaName, + "storage_location": o.StorageLocation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRegisteredModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "comment": types.StringType, + "name": types.StringType, + "schema_name": types.StringType, + "storage_location": types.StringType, + }, + } +} + type CreateResponse struct { } @@ -863,6 +3680,33 @@ func (newState *CreateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateResponse) SyncEffectiveFieldsDuringRead(existingState CreateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateResponse +// only implements ToObjectValue() and Type(). +func (o CreateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type CreateSchema struct { // Name of parent catalog. CatalogName types.String `tfsdk:"catalog_name" tf:""` @@ -871,7 +3715,7 @@ type CreateSchema struct { // Name of schema, relative to parent catalog. Name types.String `tfsdk:"name" tf:""` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` // Storage root URL for managed tables within schema. StorageRoot types.String `tfsdk:"storage_root" tf:"optional"` } @@ -882,19 +3726,88 @@ func (newState *CreateSchema) SyncEffectiveFieldsDuringCreateOrUpdate(plan Creat func (newState *CreateSchema) SyncEffectiveFieldsDuringRead(existingState CreateSchema) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateSchema. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateSchema) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateSchema +// only implements ToObjectValue() and Type(). +func (o CreateSchema) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "comment": o.Comment, + "name": o.Name, + "properties": o.Properties, + "storage_root": o.StorageRoot, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateSchema) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "comment": types.StringType, + "name": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "storage_root": types.StringType, + }, + } +} + +// GetProperties returns the value of the Properties field in CreateSchema as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateSchema) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in CreateSchema. +func (o *CreateSchema) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type CreateStorageCredential struct { // The AWS IAM role configuration. - AwsIamRole []AwsIamRoleRequest `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentityRequest `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // The Cloudflare API token configuration. - CloudflareApiToken []CloudflareApiToken `tfsdk:"cloudflare_api_token" tf:"optional,object"` + CloudflareApiToken types.List `tfsdk:"cloudflare_api_token" tf:"optional,object"` // Comment associated with the credential. Comment types.String `tfsdk:"comment" tf:"optional"` // The Databricks managed GCP service account configuration. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccountRequest `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // The credential name. The name must be unique within the metastore. Name types.String `tfsdk:"name" tf:""` // Whether the storage credential is only usable for read operations. @@ -910,11 +3823,204 @@ func (newState *CreateStorageCredential) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateStorageCredential) SyncEffectiveFieldsDuringRead(existingState CreateStorageCredential) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateStorageCredential. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateStorageCredential) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRoleRequest{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentityRequest{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "cloudflare_api_token": reflect.TypeOf(CloudflareApiToken{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccountRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateStorageCredential +// only implements ToObjectValue() and Type(). +func (o CreateStorageCredential) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "cloudflare_api_token": o.CloudflareApiToken, + "comment": o.Comment, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "name": o.Name, + "read_only": o.ReadOnly, + "skip_validation": o.SkipValidation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateStorageCredential) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRoleRequest{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentityRequest{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "cloudflare_api_token": basetypes.ListType{ + ElemType: CloudflareApiToken{}.Type(ctx), + }, + "comment": types.StringType, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccountRequest{}.Type(ctx), + }, + "name": types.StringType, + "read_only": types.BoolType, + "skip_validation": types.BoolType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in CreateStorageCredential as +// a AwsIamRoleRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateStorageCredential) GetAwsIamRole(ctx context.Context) (AwsIamRoleRequest, bool) { + var e AwsIamRoleRequest + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRoleRequest + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in CreateStorageCredential. +func (o *CreateStorageCredential) SetAwsIamRole(ctx context.Context, v AwsIamRoleRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in CreateStorageCredential as +// a AzureManagedIdentityRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateStorageCredential) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentityRequest, bool) { + var e AzureManagedIdentityRequest + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentityRequest + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in CreateStorageCredential. +func (o *CreateStorageCredential) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentityRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in CreateStorageCredential as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateStorageCredential) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in CreateStorageCredential. +func (o *CreateStorageCredential) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetCloudflareApiToken returns the value of the CloudflareApiToken field in CreateStorageCredential as +// a CloudflareApiToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateStorageCredential) GetCloudflareApiToken(ctx context.Context) (CloudflareApiToken, bool) { + var e CloudflareApiToken + if o.CloudflareApiToken.IsNull() || o.CloudflareApiToken.IsUnknown() { + return e, false + } + var v []CloudflareApiToken + d := o.CloudflareApiToken.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloudflareApiToken sets the value of the CloudflareApiToken field in CreateStorageCredential. +func (o *CreateStorageCredential) SetCloudflareApiToken(ctx context.Context, v CloudflareApiToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cloudflare_api_token"] + o.CloudflareApiToken = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in CreateStorageCredential as +// a DatabricksGcpServiceAccountRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateStorageCredential) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccountRequest, bool) { + var e DatabricksGcpServiceAccountRequest + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccountRequest + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in CreateStorageCredential. +func (o *CreateStorageCredential) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccountRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + type CreateTableConstraint struct { // A table constraint, as defined by *one* of the following fields being // set: __primary_key_constraint__, __foreign_key_constraint__, // __named_table_constraint__. - Constraint []TableConstraint `tfsdk:"constraint" tf:"object"` + Constraint types.List `tfsdk:"constraint" tf:"object"` // The full name of the table referenced by the constraint. FullNameArg types.String `tfsdk:"full_name_arg" tf:""` } @@ -925,6 +4031,69 @@ func (newState *CreateTableConstraint) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateTableConstraint) SyncEffectiveFieldsDuringRead(existingState CreateTableConstraint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateTableConstraint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateTableConstraint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "constraint": reflect.TypeOf(TableConstraint{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateTableConstraint +// only implements ToObjectValue() and Type(). +func (o CreateTableConstraint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "constraint": o.Constraint, + "full_name_arg": o.FullNameArg, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateTableConstraint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "constraint": basetypes.ListType{ + ElemType: TableConstraint{}.Type(ctx), + }, + "full_name_arg": types.StringType, + }, + } +} + +// GetConstraint returns the value of the Constraint field in CreateTableConstraint as +// a TableConstraint value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateTableConstraint) GetConstraint(ctx context.Context) (TableConstraint, bool) { + var e TableConstraint + if o.Constraint.IsNull() || o.Constraint.IsUnknown() { + return e, false + } + var v []TableConstraint + d := o.Constraint.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConstraint sets the value of the Constraint field in CreateTableConstraint. +func (o *CreateTableConstraint) SetConstraint(ctx context.Context, v TableConstraint) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["constraint"] + o.Constraint = types.ListValueMust(t, vs) +} + type CreateVolumeRequestContent struct { // The name of the catalog where the schema and the volume are CatalogName types.String `tfsdk:"catalog_name" tf:""` @@ -946,14 +4115,55 @@ func (newState *CreateVolumeRequestContent) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateVolumeRequestContent) SyncEffectiveFieldsDuringRead(existingState CreateVolumeRequestContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateVolumeRequestContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateVolumeRequestContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateVolumeRequestContent +// only implements ToObjectValue() and Type(). +func (o CreateVolumeRequestContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "comment": o.Comment, + "name": o.Name, + "schema_name": o.SchemaName, + "storage_location": o.StorageLocation, + "volume_type": o.VolumeType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateVolumeRequestContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "comment": types.StringType, + "name": types.StringType, + "schema_name": types.StringType, + "storage_location": types.StringType, + "volume_type": types.StringType, + }, + } +} + type CredentialInfo struct { // The AWS IAM role configuration - AwsIamRole []AwsIamRole `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentity `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. Only applicable when purpose // is **STORAGE**. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // Comment associated with the credential. Comment types.String `tfsdk:"comment" tf:"optional"` // Time at which this credential was created, in epoch milliseconds. @@ -962,7 +4172,7 @@ type CredentialInfo struct { CreatedBy types.String `tfsdk:"created_by" tf:"optional"` // GCP long-lived credential. Databricks-created Google Cloud Storage // service account. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccount `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // The full name of the credential. FullName types.String `tfsdk:"full_name" tf:"optional"` // The unique identifier of the credential. @@ -997,6 +4207,188 @@ func (newState *CredentialInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CredentialInfo) SyncEffectiveFieldsDuringRead(existingState CredentialInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CredentialInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CredentialInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRole{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentity{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccount{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CredentialInfo +// only implements ToObjectValue() and Type(). +func (o CredentialInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "full_name": o.FullName, + "id": o.Id, + "isolation_mode": o.IsolationMode, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "purpose": o.Purpose, + "read_only": o.ReadOnly, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "used_for_managed_storage": o.UsedForManagedStorage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CredentialInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRole{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentity{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccount{}.Type(ctx), + }, + "full_name": types.StringType, + "id": types.StringType, + "isolation_mode": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "purpose": types.StringType, + "read_only": types.BoolType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "used_for_managed_storage": types.BoolType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in CredentialInfo as +// a AwsIamRole value. +// If the field is unknown or null, the boolean return value is false. +func (o *CredentialInfo) GetAwsIamRole(ctx context.Context) (AwsIamRole, bool) { + var e AwsIamRole + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRole + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in CredentialInfo. +func (o *CredentialInfo) SetAwsIamRole(ctx context.Context, v AwsIamRole) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in CredentialInfo as +// a AzureManagedIdentity value. +// If the field is unknown or null, the boolean return value is false. +func (o *CredentialInfo) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentity, bool) { + var e AzureManagedIdentity + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentity + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in CredentialInfo. +func (o *CredentialInfo) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentity) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in CredentialInfo as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *CredentialInfo) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in CredentialInfo. +func (o *CredentialInfo) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in CredentialInfo as +// a DatabricksGcpServiceAccount value. +// If the field is unknown or null, the boolean return value is false. +func (o *CredentialInfo) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccount, bool) { + var e DatabricksGcpServiceAccount + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccount + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in CredentialInfo. +func (o *CredentialInfo) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccount) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + type CredentialValidationResult struct { // Error message would exist when the result does not equal to **PASS**. Message types.String `tfsdk:"message" tf:"optional"` @@ -1010,10 +4402,43 @@ func (newState *CredentialValidationResult) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CredentialValidationResult) SyncEffectiveFieldsDuringRead(existingState CredentialValidationResult) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CredentialValidationResult. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CredentialValidationResult) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CredentialValidationResult +// only implements ToObjectValue() and Type(). +func (o CredentialValidationResult) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + "result": o.Result, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CredentialValidationResult) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + "result": types.StringType, + }, + } +} + // Currently assigned workspaces type CurrentWorkspaceBindings struct { // A list of workspace IDs. - Workspaces []types.Int64 `tfsdk:"workspaces" tf:"optional"` + Workspaces types.List `tfsdk:"workspaces" tf:"optional"` } func (newState *CurrentWorkspaceBindings) SyncEffectiveFieldsDuringCreateOrUpdate(plan CurrentWorkspaceBindings) { @@ -1022,6 +4447,67 @@ func (newState *CurrentWorkspaceBindings) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CurrentWorkspaceBindings) SyncEffectiveFieldsDuringRead(existingState CurrentWorkspaceBindings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CurrentWorkspaceBindings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CurrentWorkspaceBindings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "workspaces": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CurrentWorkspaceBindings +// only implements ToObjectValue() and Type(). +func (o CurrentWorkspaceBindings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspaces": o.Workspaces, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CurrentWorkspaceBindings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspaces": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetWorkspaces returns the value of the Workspaces field in CurrentWorkspaceBindings as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *CurrentWorkspaceBindings) GetWorkspaces(ctx context.Context) ([]types.Int64, bool) { + if o.Workspaces.IsNull() || o.Workspaces.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.Workspaces.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWorkspaces sets the value of the Workspaces field in CurrentWorkspaceBindings. +func (o *CurrentWorkspaceBindings) SetWorkspaces(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workspaces"] + t = t.(attr.TypeWithElementType).ElementType() + o.Workspaces = types.ListValueMust(t, vs) +} + // GCP long-lived credential. Databricks-created Google Cloud Storage service // account. type DatabricksGcpServiceAccount struct { @@ -1042,6 +4528,41 @@ func (newState *DatabricksGcpServiceAccount) SyncEffectiveFieldsDuringCreateOrUp func (newState *DatabricksGcpServiceAccount) SyncEffectiveFieldsDuringRead(existingState DatabricksGcpServiceAccount) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DatabricksGcpServiceAccount. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DatabricksGcpServiceAccount) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DatabricksGcpServiceAccount +// only implements ToObjectValue() and Type(). +func (o DatabricksGcpServiceAccount) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + "email": o.Email, + "private_key_id": o.PrivateKeyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DatabricksGcpServiceAccount) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.StringType, + "email": types.StringType, + "private_key_id": types.StringType, + }, + } +} + type DatabricksGcpServiceAccountRequest struct { } @@ -1051,6 +4572,33 @@ func (newState *DatabricksGcpServiceAccountRequest) SyncEffectiveFieldsDuringCre func (newState *DatabricksGcpServiceAccountRequest) SyncEffectiveFieldsDuringRead(existingState DatabricksGcpServiceAccountRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DatabricksGcpServiceAccountRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DatabricksGcpServiceAccountRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DatabricksGcpServiceAccountRequest +// only implements ToObjectValue() and Type(). +func (o DatabricksGcpServiceAccountRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DatabricksGcpServiceAccountRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DatabricksGcpServiceAccountResponse struct { // The Databricks internal ID that represents this service account. This is // an output-only field. @@ -1065,6 +4613,39 @@ func (newState *DatabricksGcpServiceAccountResponse) SyncEffectiveFieldsDuringCr func (newState *DatabricksGcpServiceAccountResponse) SyncEffectiveFieldsDuringRead(existingState DatabricksGcpServiceAccountResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DatabricksGcpServiceAccountResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DatabricksGcpServiceAccountResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DatabricksGcpServiceAccountResponse +// only implements ToObjectValue() and Type(). +func (o DatabricksGcpServiceAccountResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + "email": o.Email, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DatabricksGcpServiceAccountResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.StringType, + "email": types.StringType, + }, + } +} + // Delete a metastore assignment type DeleteAccountMetastoreAssignmentRequest struct { // Unity Catalog metastore ID @@ -1079,6 +4660,39 @@ func (newState *DeleteAccountMetastoreAssignmentRequest) SyncEffectiveFieldsDuri func (newState *DeleteAccountMetastoreAssignmentRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountMetastoreAssignmentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountMetastoreAssignmentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountMetastoreAssignmentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountMetastoreAssignmentRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountMetastoreAssignmentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountMetastoreAssignmentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + // Delete a metastore type DeleteAccountMetastoreRequest struct { // Force deletion even if the metastore is not empty. Default is false. @@ -1093,6 +4707,39 @@ func (newState *DeleteAccountMetastoreRequest) SyncEffectiveFieldsDuringCreateOr func (newState *DeleteAccountMetastoreRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountMetastoreRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountMetastoreRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountMetastoreRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountMetastoreRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountMetastoreRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "metastore_id": o.MetastoreId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountMetastoreRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "metastore_id": types.StringType, + }, + } +} + // Delete a storage credential type DeleteAccountStorageCredentialRequest struct { // Force deletion even if the Storage Credential is not empty. Default is @@ -1110,6 +4757,41 @@ func (newState *DeleteAccountStorageCredentialRequest) SyncEffectiveFieldsDuring func (newState *DeleteAccountStorageCredentialRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountStorageCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountStorageCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountStorageCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountStorageCredentialRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountStorageCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "metastore_id": o.MetastoreId, + "storage_credential_name": o.StorageCredentialName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountStorageCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "metastore_id": types.StringType, + "storage_credential_name": types.StringType, + }, + } +} + // Delete a Registered Model Alias type DeleteAliasRequest struct { // The name of the alias @@ -1124,6 +4806,39 @@ func (newState *DeleteAliasRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteAliasRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAliasRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAliasRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAliasRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAliasRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAliasRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alias": o.Alias, + "full_name": o.FullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAliasRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alias": types.StringType, + "full_name": types.StringType, + }, + } +} + type DeleteAliasResponse struct { } @@ -1133,6 +4848,33 @@ func (newState *DeleteAliasResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DeleteAliasResponse) SyncEffectiveFieldsDuringRead(existingState DeleteAliasResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAliasResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAliasResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAliasResponse +// only implements ToObjectValue() and Type(). +func (o DeleteAliasResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAliasResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a catalog type DeleteCatalogRequest struct { // Force deletion even if the catalog is not empty. @@ -1147,6 +4889,39 @@ func (newState *DeleteCatalogRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteCatalogRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCatalogRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCatalogRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCatalogRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCatalogRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCatalogRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCatalogRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "name": types.StringType, + }, + } +} + // Delete a connection type DeleteConnectionRequest struct { // The name of the connection to be deleted. @@ -1159,6 +4934,37 @@ func (newState *DeleteConnectionRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *DeleteConnectionRequest) SyncEffectiveFieldsDuringRead(existingState DeleteConnectionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteConnectionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteConnectionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteConnectionRequest +// only implements ToObjectValue() and Type(). +func (o DeleteConnectionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteConnectionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Delete a credential type DeleteCredentialRequest struct { // Force an update even if there are dependent services (when purpose is @@ -1175,6 +4981,39 @@ func (newState *DeleteCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *DeleteCredentialRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCredentialRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "name_arg": o.NameArg, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "name_arg": types.StringType, + }, + } +} + type DeleteCredentialResponse struct { } @@ -1184,6 +5023,33 @@ func (newState *DeleteCredentialResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *DeleteCredentialResponse) SyncEffectiveFieldsDuringRead(existingState DeleteCredentialResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCredentialResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCredentialResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCredentialResponse +// only implements ToObjectValue() and Type(). +func (o DeleteCredentialResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCredentialResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete an external location type DeleteExternalLocationRequest struct { // Force deletion even if there are dependent external tables or mounts. @@ -1198,6 +5064,39 @@ func (newState *DeleteExternalLocationRequest) SyncEffectiveFieldsDuringCreateOr func (newState *DeleteExternalLocationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteExternalLocationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExternalLocationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExternalLocationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExternalLocationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteExternalLocationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExternalLocationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "name": types.StringType, + }, + } +} + // Delete a function type DeleteFunctionRequest struct { // Force deletion even if the function is notempty. @@ -1213,6 +5112,39 @@ func (newState *DeleteFunctionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteFunctionRequest) SyncEffectiveFieldsDuringRead(existingState DeleteFunctionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteFunctionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteFunctionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteFunctionRequest +// only implements ToObjectValue() and Type(). +func (o DeleteFunctionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteFunctionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "name": types.StringType, + }, + } +} + // Delete a metastore type DeleteMetastoreRequest struct { // Force deletion even if the metastore is not empty. Default is false. @@ -1227,6 +5159,39 @@ func (newState *DeleteMetastoreRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteMetastoreRequest) SyncEffectiveFieldsDuringRead(existingState DeleteMetastoreRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteMetastoreRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteMetastoreRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteMetastoreRequest +// only implements ToObjectValue() and Type(). +func (o DeleteMetastoreRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteMetastoreRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "id": types.StringType, + }, + } +} + // Delete a Model Version type DeleteModelVersionRequest struct { // The three-level (fully qualified) name of the model version @@ -1241,6 +5206,39 @@ func (newState *DeleteModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState DeleteModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o DeleteModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "version": types.Int64Type, + }, + } +} + // Delete an Online Table type DeleteOnlineTableRequest struct { // Full three-part (catalog, schema, table) name of the table. @@ -1253,6 +5251,37 @@ func (newState *DeleteOnlineTableRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *DeleteOnlineTableRequest) SyncEffectiveFieldsDuringRead(existingState DeleteOnlineTableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteOnlineTableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteOnlineTableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteOnlineTableRequest +// only implements ToObjectValue() and Type(). +func (o DeleteOnlineTableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteOnlineTableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Delete a table monitor type DeleteQualityMonitorRequest struct { // Full name of the table. @@ -1265,6 +5294,37 @@ func (newState *DeleteQualityMonitorRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *DeleteQualityMonitorRequest) SyncEffectiveFieldsDuringRead(existingState DeleteQualityMonitorRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteQualityMonitorRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteQualityMonitorRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteQualityMonitorRequest +// only implements ToObjectValue() and Type(). +func (o DeleteQualityMonitorRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_name": o.TableName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteQualityMonitorRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_name": types.StringType, + }, + } +} + // Delete a Registered Model type DeleteRegisteredModelRequest struct { // The three-level (fully qualified) name of the registered model @@ -1277,6 +5337,37 @@ func (newState *DeleteRegisteredModelRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteRegisteredModelRequest) SyncEffectiveFieldsDuringRead(existingState DeleteRegisteredModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRegisteredModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRegisteredModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRegisteredModelRequest +// only implements ToObjectValue() and Type(). +func (o DeleteRegisteredModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRegisteredModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -1286,6 +5377,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a schema type DeleteSchemaRequest struct { // Force deletion even if the schema is not empty. @@ -1300,6 +5418,39 @@ func (newState *DeleteSchemaRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DeleteSchemaRequest) SyncEffectiveFieldsDuringRead(existingState DeleteSchemaRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteSchemaRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteSchemaRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteSchemaRequest +// only implements ToObjectValue() and Type(). +func (o DeleteSchemaRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "full_name": o.FullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteSchemaRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "full_name": types.StringType, + }, + } +} + // Delete a credential type DeleteStorageCredentialRequest struct { // Force deletion even if there are dependent external locations or external @@ -1315,6 +5466,39 @@ func (newState *DeleteStorageCredentialRequest) SyncEffectiveFieldsDuringCreateO func (newState *DeleteStorageCredentialRequest) SyncEffectiveFieldsDuringRead(existingState DeleteStorageCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteStorageCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteStorageCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteStorageCredentialRequest +// only implements ToObjectValue() and Type(). +func (o DeleteStorageCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "force": o.Force, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteStorageCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "force": types.BoolType, + "name": types.StringType, + }, + } +} + // Delete a table constraint type DeleteTableConstraintRequest struct { // If true, try deleting all child constraints of the current constraint. If @@ -1333,6 +5517,41 @@ func (newState *DeleteTableConstraintRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteTableConstraintRequest) SyncEffectiveFieldsDuringRead(existingState DeleteTableConstraintRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTableConstraintRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTableConstraintRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTableConstraintRequest +// only implements ToObjectValue() and Type(). +func (o DeleteTableConstraintRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cascade": o.Cascade, + "constraint_name": o.ConstraintName, + "full_name": o.FullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTableConstraintRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cascade": types.BoolType, + "constraint_name": types.StringType, + "full_name": types.StringType, + }, + } +} + // Delete a table type DeleteTableRequest struct { // Full name of the table. @@ -1345,6 +5564,37 @@ func (newState *DeleteTableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteTableRequest) SyncEffectiveFieldsDuringRead(existingState DeleteTableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTableRequest +// only implements ToObjectValue() and Type(). +func (o DeleteTableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + }, + } +} + // Delete a Volume type DeleteVolumeRequest struct { // The three-level (fully qualified) name of the volume @@ -1357,12 +5607,43 @@ func (newState *DeleteVolumeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DeleteVolumeRequest) SyncEffectiveFieldsDuringRead(existingState DeleteVolumeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteVolumeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteVolumeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteVolumeRequest +// only implements ToObjectValue() and Type(). +func (o DeleteVolumeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteVolumeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Properties pertaining to the current state of the delta table as given by the // commit server. This does not contain **delta.*** (input) properties in // __TableInfo.properties__. type DeltaRuntimePropertiesKvPairs struct { // A map of key-value properties attached to the securable. - DeltaRuntimeProperties map[string]types.String `tfsdk:"delta_runtime_properties" tf:""` + DeltaRuntimeProperties types.Map `tfsdk:"delta_runtime_properties" tf:""` } func (newState *DeltaRuntimePropertiesKvPairs) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeltaRuntimePropertiesKvPairs) { @@ -1371,13 +5652,74 @@ func (newState *DeltaRuntimePropertiesKvPairs) SyncEffectiveFieldsDuringCreateOr func (newState *DeltaRuntimePropertiesKvPairs) SyncEffectiveFieldsDuringRead(existingState DeltaRuntimePropertiesKvPairs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeltaRuntimePropertiesKvPairs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeltaRuntimePropertiesKvPairs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "delta_runtime_properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeltaRuntimePropertiesKvPairs +// only implements ToObjectValue() and Type(). +func (o DeltaRuntimePropertiesKvPairs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "delta_runtime_properties": o.DeltaRuntimeProperties, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeltaRuntimePropertiesKvPairs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "delta_runtime_properties": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDeltaRuntimeProperties returns the value of the DeltaRuntimeProperties field in DeltaRuntimePropertiesKvPairs as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeltaRuntimePropertiesKvPairs) GetDeltaRuntimeProperties(ctx context.Context) (map[string]types.String, bool) { + if o.DeltaRuntimeProperties.IsNull() || o.DeltaRuntimeProperties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.DeltaRuntimeProperties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDeltaRuntimeProperties sets the value of the DeltaRuntimeProperties field in DeltaRuntimePropertiesKvPairs. +func (o *DeltaRuntimePropertiesKvPairs) SetDeltaRuntimeProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["delta_runtime_properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.DeltaRuntimeProperties = types.MapValueMust(t, vs) +} + // A dependency of a SQL object. Either the __table__ field or the __function__ // field must be defined. type Dependency struct { // A function that is dependent on a SQL object. - Function []FunctionDependency `tfsdk:"function" tf:"optional,object"` + Function types.List `tfsdk:"function" tf:"optional,object"` // A table that is dependent on a SQL object. - Table []TableDependency `tfsdk:"table" tf:"optional,object"` + Table types.List `tfsdk:"table" tf:"optional,object"` } func (newState *Dependency) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dependency) { @@ -1386,10 +5728,102 @@ func (newState *Dependency) SyncEffectiveFieldsDuringCreateOrUpdate(plan Depende func (newState *Dependency) SyncEffectiveFieldsDuringRead(existingState Dependency) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Dependency. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Dependency) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "function": reflect.TypeOf(FunctionDependency{}), + "table": reflect.TypeOf(TableDependency{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Dependency +// only implements ToObjectValue() and Type(). +func (o Dependency) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "function": o.Function, + "table": o.Table, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Dependency) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "function": basetypes.ListType{ + ElemType: FunctionDependency{}.Type(ctx), + }, + "table": basetypes.ListType{ + ElemType: TableDependency{}.Type(ctx), + }, + }, + } +} + +// GetFunction returns the value of the Function field in Dependency as +// a FunctionDependency value. +// If the field is unknown or null, the boolean return value is false. +func (o *Dependency) GetFunction(ctx context.Context) (FunctionDependency, bool) { + var e FunctionDependency + if o.Function.IsNull() || o.Function.IsUnknown() { + return e, false + } + var v []FunctionDependency + d := o.Function.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFunction sets the value of the Function field in Dependency. +func (o *Dependency) SetFunction(ctx context.Context, v FunctionDependency) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["function"] + o.Function = types.ListValueMust(t, vs) +} + +// GetTable returns the value of the Table field in Dependency as +// a TableDependency value. +// If the field is unknown or null, the boolean return value is false. +func (o *Dependency) GetTable(ctx context.Context) (TableDependency, bool) { + var e TableDependency + if o.Table.IsNull() || o.Table.IsUnknown() { + return e, false + } + var v []TableDependency + d := o.Table.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTable sets the value of the Table field in Dependency. +func (o *Dependency) SetTable(ctx context.Context, v TableDependency) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table"] + o.Table = types.ListValueMust(t, vs) +} + // A list of dependencies. type DependencyList struct { // Array of dependencies. - Dependencies []Dependency `tfsdk:"dependencies" tf:"optional"` + Dependencies types.List `tfsdk:"dependencies" tf:"optional"` } func (newState *DependencyList) SyncEffectiveFieldsDuringCreateOrUpdate(plan DependencyList) { @@ -1398,6 +5832,67 @@ func (newState *DependencyList) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dep func (newState *DependencyList) SyncEffectiveFieldsDuringRead(existingState DependencyList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DependencyList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DependencyList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dependencies": reflect.TypeOf(Dependency{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DependencyList +// only implements ToObjectValue() and Type(). +func (o DependencyList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dependencies": o.Dependencies, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DependencyList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dependencies": basetypes.ListType{ + ElemType: Dependency{}.Type(ctx), + }, + }, + } +} + +// GetDependencies returns the value of the Dependencies field in DependencyList as +// a slice of Dependency values. +// If the field is unknown or null, the boolean return value is false. +func (o *DependencyList) GetDependencies(ctx context.Context) ([]Dependency, bool) { + if o.Dependencies.IsNull() || o.Dependencies.IsUnknown() { + return nil, false + } + var v []Dependency + d := o.Dependencies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDependencies sets the value of the Dependencies field in DependencyList. +func (o *DependencyList) SetDependencies(ctx context.Context, v []Dependency) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dependencies"] + t = t.(attr.TypeWithElementType).ElementType() + o.Dependencies = types.ListValueMust(t, vs) +} + // Disable a system schema type DisableRequest struct { // The metastore ID under which the system schema lives. @@ -1412,6 +5907,39 @@ func (newState *DisableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dis func (newState *DisableRequest) SyncEffectiveFieldsDuringRead(existingState DisableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DisableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DisableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DisableRequest +// only implements ToObjectValue() and Type(). +func (o DisableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + "schema_name": o.SchemaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DisableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + "schema_name": types.StringType, + }, + } +} + type DisableResponse struct { } @@ -1421,10 +5949,37 @@ func (newState *DisableResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Di func (newState *DisableResponse) SyncEffectiveFieldsDuringRead(existingState DisableResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DisableResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DisableResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DisableResponse +// only implements ToObjectValue() and Type(). +func (o DisableResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DisableResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EffectivePermissionsList struct { // The privileges conveyed to each principal (either directly or via // inheritance) - PrivilegeAssignments []EffectivePrivilegeAssignment `tfsdk:"privilege_assignments" tf:"optional"` + PrivilegeAssignments types.List `tfsdk:"privilege_assignments" tf:"optional"` } func (newState *EffectivePermissionsList) SyncEffectiveFieldsDuringCreateOrUpdate(plan EffectivePermissionsList) { @@ -1433,6 +5988,67 @@ func (newState *EffectivePermissionsList) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *EffectivePermissionsList) SyncEffectiveFieldsDuringRead(existingState EffectivePermissionsList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EffectivePermissionsList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EffectivePermissionsList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "privilege_assignments": reflect.TypeOf(EffectivePrivilegeAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EffectivePermissionsList +// only implements ToObjectValue() and Type(). +func (o EffectivePermissionsList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "privilege_assignments": o.PrivilegeAssignments, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EffectivePermissionsList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "privilege_assignments": basetypes.ListType{ + ElemType: EffectivePrivilegeAssignment{}.Type(ctx), + }, + }, + } +} + +// GetPrivilegeAssignments returns the value of the PrivilegeAssignments field in EffectivePermissionsList as +// a slice of EffectivePrivilegeAssignment values. +// If the field is unknown or null, the boolean return value is false. +func (o *EffectivePermissionsList) GetPrivilegeAssignments(ctx context.Context) ([]EffectivePrivilegeAssignment, bool) { + if o.PrivilegeAssignments.IsNull() || o.PrivilegeAssignments.IsUnknown() { + return nil, false + } + var v []EffectivePrivilegeAssignment + d := o.PrivilegeAssignments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrivilegeAssignments sets the value of the PrivilegeAssignments field in EffectivePermissionsList. +func (o *EffectivePermissionsList) SetPrivilegeAssignments(ctx context.Context, v []EffectivePrivilegeAssignment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["privilege_assignments"] + t = t.(attr.TypeWithElementType).ElementType() + o.PrivilegeAssignments = types.ListValueMust(t, vs) +} + type EffectivePredictiveOptimizationFlag struct { // The name of the object from which the flag was inherited. If there was no // inheritance, this field is left blank. @@ -1451,6 +6067,41 @@ func (newState *EffectivePredictiveOptimizationFlag) SyncEffectiveFieldsDuringCr func (newState *EffectivePredictiveOptimizationFlag) SyncEffectiveFieldsDuringRead(existingState EffectivePredictiveOptimizationFlag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EffectivePredictiveOptimizationFlag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EffectivePredictiveOptimizationFlag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EffectivePredictiveOptimizationFlag +// only implements ToObjectValue() and Type(). +func (o EffectivePredictiveOptimizationFlag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited_from_name": o.InheritedFromName, + "inherited_from_type": o.InheritedFromType, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EffectivePredictiveOptimizationFlag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited_from_name": types.StringType, + "inherited_from_type": types.StringType, + "value": types.StringType, + }, + } +} + type EffectivePrivilege struct { // The full name of the object that conveys this privilege via inheritance. // This field is omitted when privilege is not inherited (it's assigned to @@ -1470,12 +6121,47 @@ func (newState *EffectivePrivilege) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *EffectivePrivilege) SyncEffectiveFieldsDuringRead(existingState EffectivePrivilege) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EffectivePrivilege. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EffectivePrivilege) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EffectivePrivilege +// only implements ToObjectValue() and Type(). +func (o EffectivePrivilege) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited_from_name": o.InheritedFromName, + "inherited_from_type": o.InheritedFromType, + "privilege": o.Privilege, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EffectivePrivilege) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited_from_name": types.StringType, + "inherited_from_type": types.StringType, + "privilege": types.StringType, + }, + } +} + type EffectivePrivilegeAssignment struct { // The principal (user email address or group name). Principal types.String `tfsdk:"principal" tf:"optional"` // The privileges conveyed to the principal (either directly or via // inheritance). - Privileges []EffectivePrivilege `tfsdk:"privileges" tf:"optional"` + Privileges types.List `tfsdk:"privileges" tf:"optional"` } func (newState *EffectivePrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(plan EffectivePrivilegeAssignment) { @@ -1484,6 +6170,69 @@ func (newState *EffectivePrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrU func (newState *EffectivePrivilegeAssignment) SyncEffectiveFieldsDuringRead(existingState EffectivePrivilegeAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EffectivePrivilegeAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EffectivePrivilegeAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "privileges": reflect.TypeOf(EffectivePrivilege{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EffectivePrivilegeAssignment +// only implements ToObjectValue() and Type(). +func (o EffectivePrivilegeAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principal": o.Principal, + "privileges": o.Privileges, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EffectivePrivilegeAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principal": types.StringType, + "privileges": basetypes.ListType{ + ElemType: EffectivePrivilege{}.Type(ctx), + }, + }, + } +} + +// GetPrivileges returns the value of the Privileges field in EffectivePrivilegeAssignment as +// a slice of EffectivePrivilege values. +// If the field is unknown or null, the boolean return value is false. +func (o *EffectivePrivilegeAssignment) GetPrivileges(ctx context.Context) ([]EffectivePrivilege, bool) { + if o.Privileges.IsNull() || o.Privileges.IsUnknown() { + return nil, false + } + var v []EffectivePrivilege + d := o.Privileges.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrivileges sets the value of the Privileges field in EffectivePrivilegeAssignment. +func (o *EffectivePrivilegeAssignment) SetPrivileges(ctx context.Context, v []EffectivePrivilege) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["privileges"] + t = t.(attr.TypeWithElementType).ElementType() + o.Privileges = types.ListValueMust(t, vs) +} + // Enable a system schema type EnableRequest struct { // The metastore ID under which the system schema lives. @@ -1498,6 +6247,39 @@ func (newState *EnableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Enab func (newState *EnableRequest) SyncEffectiveFieldsDuringRead(existingState EnableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnableRequest +// only implements ToObjectValue() and Type(). +func (o EnableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + "schema_name": o.SchemaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + "schema_name": types.StringType, + }, + } +} + type EnableResponse struct { } @@ -1507,10 +6289,37 @@ func (newState *EnableResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ena func (newState *EnableResponse) SyncEffectiveFieldsDuringRead(existingState EnableResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnableResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnableResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnableResponse +// only implements ToObjectValue() and Type(). +func (o EnableResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EnableResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Encryption options that apply to clients connecting to cloud storage. type EncryptionDetails struct { // Server-Side Encryption properties for clients communicating with AWS s3. - SseEncryptionDetails []SseEncryptionDetails `tfsdk:"sse_encryption_details" tf:"optional,object"` + SseEncryptionDetails types.List `tfsdk:"sse_encryption_details" tf:"optional,object"` } func (newState *EncryptionDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan EncryptionDetails) { @@ -1519,6 +6328,67 @@ func (newState *EncryptionDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *EncryptionDetails) SyncEffectiveFieldsDuringRead(existingState EncryptionDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EncryptionDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EncryptionDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sse_encryption_details": reflect.TypeOf(SseEncryptionDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EncryptionDetails +// only implements ToObjectValue() and Type(). +func (o EncryptionDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "sse_encryption_details": o.SseEncryptionDetails, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EncryptionDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "sse_encryption_details": basetypes.ListType{ + ElemType: SseEncryptionDetails{}.Type(ctx), + }, + }, + } +} + +// GetSseEncryptionDetails returns the value of the SseEncryptionDetails field in EncryptionDetails as +// a SseEncryptionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *EncryptionDetails) GetSseEncryptionDetails(ctx context.Context) (SseEncryptionDetails, bool) { + var e SseEncryptionDetails + if o.SseEncryptionDetails.IsNull() || o.SseEncryptionDetails.IsUnknown() { + return e, false + } + var v []SseEncryptionDetails + d := o.SseEncryptionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSseEncryptionDetails sets the value of the SseEncryptionDetails field in EncryptionDetails. +func (o *EncryptionDetails) SetSseEncryptionDetails(ctx context.Context, v SseEncryptionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sse_encryption_details"] + o.SseEncryptionDetails = types.ListValueMust(t, vs) +} + // Get boolean reflecting if table exists type ExistsRequest struct { // Full name of the table. @@ -1531,6 +6401,37 @@ func (newState *ExistsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exis func (newState *ExistsRequest) SyncEffectiveFieldsDuringRead(existingState ExistsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExistsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExistsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExistsRequest +// only implements ToObjectValue() and Type(). +func (o ExistsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExistsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + }, + } +} + type ExternalLocationInfo struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint types.String `tfsdk:"access_point" tf:"optional"` @@ -1549,7 +6450,7 @@ type ExternalLocationInfo struct { // Name of the storage credential used with this location. CredentialName types.String `tfsdk:"credential_name" tf:"optional"` // Encryption options that apply to clients connecting to cloud storage. - EncryptionDetails []EncryptionDetails `tfsdk:"encryption_details" tf:"optional,object"` + EncryptionDetails types.List `tfsdk:"encryption_details" tf:"optional,object"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. @@ -1579,6 +6480,99 @@ func (newState *ExternalLocationInfo) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ExternalLocationInfo) SyncEffectiveFieldsDuringRead(existingState ExternalLocationInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExternalLocationInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExternalLocationInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "encryption_details": reflect.TypeOf(EncryptionDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExternalLocationInfo +// only implements ToObjectValue() and Type(). +func (o ExternalLocationInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_point": o.AccessPoint, + "browse_only": o.BrowseOnly, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "credential_id": o.CredentialId, + "credential_name": o.CredentialName, + "encryption_details": o.EncryptionDetails, + "fallback": o.Fallback, + "isolation_mode": o.IsolationMode, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "read_only": o.ReadOnly, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExternalLocationInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_point": types.StringType, + "browse_only": types.BoolType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "credential_id": types.StringType, + "credential_name": types.StringType, + "encryption_details": basetypes.ListType{ + ElemType: EncryptionDetails{}.Type(ctx), + }, + "fallback": types.BoolType, + "isolation_mode": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "read_only": types.BoolType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "url": types.StringType, + }, + } +} + +// GetEncryptionDetails returns the value of the EncryptionDetails field in ExternalLocationInfo as +// a EncryptionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalLocationInfo) GetEncryptionDetails(ctx context.Context) (EncryptionDetails, bool) { + var e EncryptionDetails + if o.EncryptionDetails.IsNull() || o.EncryptionDetails.IsUnknown() { + return e, false + } + var v []EncryptionDetails + d := o.EncryptionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEncryptionDetails sets the value of the EncryptionDetails field in ExternalLocationInfo. +func (o *ExternalLocationInfo) SetEncryptionDetails(ctx context.Context, v EncryptionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["encryption_details"] + o.EncryptionDetails = types.ListValueMust(t, vs) +} + // Detailed status of an online table. Shown if the online table is in the // OFFLINE_FAILED or the ONLINE_PIPELINE_FAILED state. type FailedStatus struct { @@ -1599,13 +6593,46 @@ func (newState *FailedStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan Faile func (newState *FailedStatus) SyncEffectiveFieldsDuringRead(existingState FailedStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FailedStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FailedStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FailedStatus +// only implements ToObjectValue() and Type(). +func (o FailedStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "last_processed_commit_version": o.LastProcessedCommitVersion, + "timestamp": o.Timestamp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FailedStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "last_processed_commit_version": types.Int64Type, + "timestamp": types.StringType, + }, + } +} + type ForeignKeyConstraint struct { // Column names for this constraint. - ChildColumns []types.String `tfsdk:"child_columns" tf:""` + ChildColumns types.List `tfsdk:"child_columns" tf:""` // The name of the constraint. Name types.String `tfsdk:"name" tf:""` // Column names for this constraint. - ParentColumns []types.String `tfsdk:"parent_columns" tf:""` + ParentColumns types.List `tfsdk:"parent_columns" tf:""` // The full name of the parent constraint. ParentTable types.String `tfsdk:"parent_table" tf:""` } @@ -1616,6 +6643,102 @@ func (newState *ForeignKeyConstraint) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ForeignKeyConstraint) SyncEffectiveFieldsDuringRead(existingState ForeignKeyConstraint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ForeignKeyConstraint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ForeignKeyConstraint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "child_columns": reflect.TypeOf(types.String{}), + "parent_columns": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ForeignKeyConstraint +// only implements ToObjectValue() and Type(). +func (o ForeignKeyConstraint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "child_columns": o.ChildColumns, + "name": o.Name, + "parent_columns": o.ParentColumns, + "parent_table": o.ParentTable, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ForeignKeyConstraint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "child_columns": basetypes.ListType{ + ElemType: types.StringType, + }, + "name": types.StringType, + "parent_columns": basetypes.ListType{ + ElemType: types.StringType, + }, + "parent_table": types.StringType, + }, + } +} + +// GetChildColumns returns the value of the ChildColumns field in ForeignKeyConstraint as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ForeignKeyConstraint) GetChildColumns(ctx context.Context) ([]types.String, bool) { + if o.ChildColumns.IsNull() || o.ChildColumns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ChildColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChildColumns sets the value of the ChildColumns field in ForeignKeyConstraint. +func (o *ForeignKeyConstraint) SetChildColumns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["child_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.ChildColumns = types.ListValueMust(t, vs) +} + +// GetParentColumns returns the value of the ParentColumns field in ForeignKeyConstraint as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ForeignKeyConstraint) GetParentColumns(ctx context.Context) ([]types.String, bool) { + if o.ParentColumns.IsNull() || o.ParentColumns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ParentColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParentColumns sets the value of the ParentColumns field in ForeignKeyConstraint. +func (o *ForeignKeyConstraint) SetParentColumns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parent_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.ParentColumns = types.ListValueMust(t, vs) +} + // A function that is dependent on a SQL object. type FunctionDependency struct { // Full name of the dependent function, in the form of @@ -1629,6 +6752,37 @@ func (newState *FunctionDependency) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *FunctionDependency) SyncEffectiveFieldsDuringRead(existingState FunctionDependency) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FunctionDependency. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FunctionDependency) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FunctionDependency +// only implements ToObjectValue() and Type(). +func (o FunctionDependency) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "function_full_name": o.FunctionFullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FunctionDependency) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "function_full_name": types.StringType, + }, + } +} + type FunctionInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is @@ -1656,7 +6810,7 @@ type FunctionInfo struct { // Id of Function, relative to parent schema. FunctionId types.String `tfsdk:"function_id" tf:"optional"` - InputParams []FunctionParameterInfos `tfsdk:"input_params" tf:"optional,object"` + InputParams types.List `tfsdk:"input_params" tf:"optional,object"` // Whether the function is deterministic. IsDeterministic types.Bool `tfsdk:"is_deterministic" tf:"optional"` // Function null call. @@ -1672,7 +6826,7 @@ type FunctionInfo struct { // JSON-serialized key-value pair map, encoded (escaped) as a string. Properties types.String `tfsdk:"properties" tf:"optional"` // Table function return parameters. - ReturnParams []FunctionParameterInfos `tfsdk:"return_params" tf:"optional,object"` + ReturnParams types.List `tfsdk:"return_params" tf:"optional,object"` // Function language. When **EXTERNAL** is used, the language of the routine // function should be specified in the __external_language__ field, and the // __return_params__ of the function cannot be used (as **TABLE** return @@ -1682,7 +6836,7 @@ type FunctionInfo struct { // Function body. RoutineDefinition types.String `tfsdk:"routine_definition" tf:"optional"` // Function dependencies. - RoutineDependencies []DependencyList `tfsdk:"routine_dependencies" tf:"optional,object"` + RoutineDependencies types.List `tfsdk:"routine_dependencies" tf:"optional,object"` // Name of parent schema relative to its parent catalog. SchemaName types.String `tfsdk:"schema_name" tf:"optional"` // Function security type. @@ -1705,6 +6859,183 @@ func (newState *FunctionInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Funct func (newState *FunctionInfo) SyncEffectiveFieldsDuringRead(existingState FunctionInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FunctionInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FunctionInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "input_params": reflect.TypeOf(FunctionParameterInfos{}), + "return_params": reflect.TypeOf(FunctionParameterInfos{}), + "routine_dependencies": reflect.TypeOf(DependencyList{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FunctionInfo +// only implements ToObjectValue() and Type(). +func (o FunctionInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "browse_only": o.BrowseOnly, + "catalog_name": o.CatalogName, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "data_type": o.DataType, + "external_language": o.ExternalLanguage, + "external_name": o.ExternalName, + "full_data_type": o.FullDataType, + "full_name": o.FullName, + "function_id": o.FunctionId, + "input_params": o.InputParams, + "is_deterministic": o.IsDeterministic, + "is_null_call": o.IsNullCall, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "parameter_style": o.ParameterStyle, + "properties": o.Properties, + "return_params": o.ReturnParams, + "routine_body": o.RoutineBody, + "routine_definition": o.RoutineDefinition, + "routine_dependencies": o.RoutineDependencies, + "schema_name": o.SchemaName, + "security_type": o.SecurityType, + "specific_name": o.SpecificName, + "sql_data_access": o.SqlDataAccess, + "sql_path": o.SqlPath, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FunctionInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "browse_only": types.BoolType, + "catalog_name": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "data_type": types.StringType, + "external_language": types.StringType, + "external_name": types.StringType, + "full_data_type": types.StringType, + "full_name": types.StringType, + "function_id": types.StringType, + "input_params": basetypes.ListType{ + ElemType: FunctionParameterInfos{}.Type(ctx), + }, + "is_deterministic": types.BoolType, + "is_null_call": types.BoolType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "parameter_style": types.StringType, + "properties": types.StringType, + "return_params": basetypes.ListType{ + ElemType: FunctionParameterInfos{}.Type(ctx), + }, + "routine_body": types.StringType, + "routine_definition": types.StringType, + "routine_dependencies": basetypes.ListType{ + ElemType: DependencyList{}.Type(ctx), + }, + "schema_name": types.StringType, + "security_type": types.StringType, + "specific_name": types.StringType, + "sql_data_access": types.StringType, + "sql_path": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetInputParams returns the value of the InputParams field in FunctionInfo as +// a FunctionParameterInfos value. +// If the field is unknown or null, the boolean return value is false. +func (o *FunctionInfo) GetInputParams(ctx context.Context) (FunctionParameterInfos, bool) { + var e FunctionParameterInfos + if o.InputParams.IsNull() || o.InputParams.IsUnknown() { + return e, false + } + var v []FunctionParameterInfos + d := o.InputParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInputParams sets the value of the InputParams field in FunctionInfo. +func (o *FunctionInfo) SetInputParams(ctx context.Context, v FunctionParameterInfos) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["input_params"] + o.InputParams = types.ListValueMust(t, vs) +} + +// GetReturnParams returns the value of the ReturnParams field in FunctionInfo as +// a FunctionParameterInfos value. +// If the field is unknown or null, the boolean return value is false. +func (o *FunctionInfo) GetReturnParams(ctx context.Context) (FunctionParameterInfos, bool) { + var e FunctionParameterInfos + if o.ReturnParams.IsNull() || o.ReturnParams.IsUnknown() { + return e, false + } + var v []FunctionParameterInfos + d := o.ReturnParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetReturnParams sets the value of the ReturnParams field in FunctionInfo. +func (o *FunctionInfo) SetReturnParams(ctx context.Context, v FunctionParameterInfos) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["return_params"] + o.ReturnParams = types.ListValueMust(t, vs) +} + +// GetRoutineDependencies returns the value of the RoutineDependencies field in FunctionInfo as +// a DependencyList value. +// If the field is unknown or null, the boolean return value is false. +func (o *FunctionInfo) GetRoutineDependencies(ctx context.Context) (DependencyList, bool) { + var e DependencyList + if o.RoutineDependencies.IsNull() || o.RoutineDependencies.IsUnknown() { + return e, false + } + var v []DependencyList + d := o.RoutineDependencies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRoutineDependencies sets the value of the RoutineDependencies field in FunctionInfo. +func (o *FunctionInfo) SetRoutineDependencies(ctx context.Context, v DependencyList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["routine_dependencies"] + o.RoutineDependencies = types.ListValueMust(t, vs) +} + type FunctionParameterInfo struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -1738,10 +7069,63 @@ func (newState *FunctionParameterInfo) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *FunctionParameterInfo) SyncEffectiveFieldsDuringRead(existingState FunctionParameterInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FunctionParameterInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FunctionParameterInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FunctionParameterInfo +// only implements ToObjectValue() and Type(). +func (o FunctionParameterInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "parameter_default": o.ParameterDefault, + "parameter_mode": o.ParameterMode, + "parameter_type": o.ParameterType, + "position": o.Position, + "type_interval_type": o.TypeIntervalType, + "type_json": o.TypeJson, + "type_name": o.TypeName, + "type_precision": o.TypePrecision, + "type_scale": o.TypeScale, + "type_text": o.TypeText, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FunctionParameterInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "parameter_default": types.StringType, + "parameter_mode": types.StringType, + "parameter_type": types.StringType, + "position": types.Int64Type, + "type_interval_type": types.StringType, + "type_json": types.StringType, + "type_name": types.StringType, + "type_precision": types.Int64Type, + "type_scale": types.Int64Type, + "type_text": types.StringType, + }, + } +} + type FunctionParameterInfos struct { // The array of __FunctionParameterInfo__ definitions of the function's // parameters. - Parameters []FunctionParameterInfo `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` } func (newState *FunctionParameterInfos) SyncEffectiveFieldsDuringCreateOrUpdate(plan FunctionParameterInfos) { @@ -1750,6 +7134,67 @@ func (newState *FunctionParameterInfos) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *FunctionParameterInfos) SyncEffectiveFieldsDuringRead(existingState FunctionParameterInfos) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FunctionParameterInfos. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FunctionParameterInfos) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(FunctionParameterInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FunctionParameterInfos +// only implements ToObjectValue() and Type(). +func (o FunctionParameterInfos) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FunctionParameterInfos) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "parameters": basetypes.ListType{ + ElemType: FunctionParameterInfo{}.Type(ctx), + }, + }, + } +} + +// GetParameters returns the value of the Parameters field in FunctionParameterInfos as +// a slice of FunctionParameterInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *FunctionParameterInfos) GetParameters(ctx context.Context) ([]FunctionParameterInfo, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []FunctionParameterInfo + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in FunctionParameterInfos. +func (o *FunctionParameterInfos) SetParameters(ctx context.Context, v []FunctionParameterInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + // GCP temporary credentials for API authentication. Read more at // https://developers.google.com/identity/protocols/oauth2/service-account type GcpOauthToken struct { @@ -1762,12 +7207,43 @@ func (newState *GcpOauthToken) SyncEffectiveFieldsDuringCreateOrUpdate(plan GcpO func (newState *GcpOauthToken) SyncEffectiveFieldsDuringRead(existingState GcpOauthToken) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcpOauthToken. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcpOauthToken) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcpOauthToken +// only implements ToObjectValue() and Type(). +func (o GcpOauthToken) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "oauth_token": o.OauthToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcpOauthToken) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "oauth_token": types.StringType, + }, + } +} + // The Azure cloud options to customize the requested temporary credential type GenerateTemporaryServiceCredentialAzureOptions struct { // The resources to which the temporary Azure credential should apply. These // resources are the scopes that are passed to the token provider (see // https://learn.microsoft.com/python/api/azure-core/azure.core.credentials.tokencredential?view=azure-python) - Resources []types.String `tfsdk:"resources" tf:"optional"` + Resources types.List `tfsdk:"resources" tf:"optional"` } func (newState *GenerateTemporaryServiceCredentialAzureOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan GenerateTemporaryServiceCredentialAzureOptions) { @@ -1776,12 +7252,73 @@ func (newState *GenerateTemporaryServiceCredentialAzureOptions) SyncEffectiveFie func (newState *GenerateTemporaryServiceCredentialAzureOptions) SyncEffectiveFieldsDuringRead(existingState GenerateTemporaryServiceCredentialAzureOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenerateTemporaryServiceCredentialAzureOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenerateTemporaryServiceCredentialAzureOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "resources": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenerateTemporaryServiceCredentialAzureOptions +// only implements ToObjectValue() and Type(). +func (o GenerateTemporaryServiceCredentialAzureOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "resources": o.Resources, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenerateTemporaryServiceCredentialAzureOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "resources": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetResources returns the value of the Resources field in GenerateTemporaryServiceCredentialAzureOptions as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryServiceCredentialAzureOptions) GetResources(ctx context.Context) ([]types.String, bool) { + if o.Resources.IsNull() || o.Resources.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Resources.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResources sets the value of the Resources field in GenerateTemporaryServiceCredentialAzureOptions. +func (o *GenerateTemporaryServiceCredentialAzureOptions) SetResources(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["resources"] + t = t.(attr.TypeWithElementType).ElementType() + o.Resources = types.ListValueMust(t, vs) +} + // The GCP cloud options to customize the requested temporary credential type GenerateTemporaryServiceCredentialGcpOptions struct { // The scopes to which the temporary GCP credential should apply. These // resources are the scopes that are passed to the token provider (see // https://google-auth.readthedocs.io/en/latest/reference/google.auth.html#google.auth.credentials.Credentials) - Scopes []types.String `tfsdk:"scopes" tf:"optional"` + Scopes types.List `tfsdk:"scopes" tf:"optional"` } func (newState *GenerateTemporaryServiceCredentialGcpOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan GenerateTemporaryServiceCredentialGcpOptions) { @@ -1790,14 +7327,75 @@ func (newState *GenerateTemporaryServiceCredentialGcpOptions) SyncEffectiveField func (newState *GenerateTemporaryServiceCredentialGcpOptions) SyncEffectiveFieldsDuringRead(existingState GenerateTemporaryServiceCredentialGcpOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenerateTemporaryServiceCredentialGcpOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenerateTemporaryServiceCredentialGcpOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "scopes": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenerateTemporaryServiceCredentialGcpOptions +// only implements ToObjectValue() and Type(). +func (o GenerateTemporaryServiceCredentialGcpOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "scopes": o.Scopes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenerateTemporaryServiceCredentialGcpOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "scopes": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetScopes returns the value of the Scopes field in GenerateTemporaryServiceCredentialGcpOptions as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryServiceCredentialGcpOptions) GetScopes(ctx context.Context) ([]types.String, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in GenerateTemporaryServiceCredentialGcpOptions. +func (o *GenerateTemporaryServiceCredentialGcpOptions) SetScopes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + type GenerateTemporaryServiceCredentialRequest struct { // The Azure cloud options to customize the requested temporary credential - AzureOptions []GenerateTemporaryServiceCredentialAzureOptions `tfsdk:"azure_options" tf:"optional,object"` + AzureOptions types.List `tfsdk:"azure_options" tf:"optional,object"` // The name of the service credential used to generate a temporary // credential CredentialName types.String `tfsdk:"credential_name" tf:""` // The GCP cloud options to customize the requested temporary credential - GcpOptions []GenerateTemporaryServiceCredentialGcpOptions `tfsdk:"gcp_options" tf:"optional,object"` + GcpOptions types.List `tfsdk:"gcp_options" tf:"optional,object"` } func (newState *GenerateTemporaryServiceCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GenerateTemporaryServiceCredentialRequest) { @@ -1806,6 +7404,100 @@ func (newState *GenerateTemporaryServiceCredentialRequest) SyncEffectiveFieldsDu func (newState *GenerateTemporaryServiceCredentialRequest) SyncEffectiveFieldsDuringRead(existingState GenerateTemporaryServiceCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenerateTemporaryServiceCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenerateTemporaryServiceCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "azure_options": reflect.TypeOf(GenerateTemporaryServiceCredentialAzureOptions{}), + "gcp_options": reflect.TypeOf(GenerateTemporaryServiceCredentialGcpOptions{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenerateTemporaryServiceCredentialRequest +// only implements ToObjectValue() and Type(). +func (o GenerateTemporaryServiceCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "azure_options": o.AzureOptions, + "credential_name": o.CredentialName, + "gcp_options": o.GcpOptions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenerateTemporaryServiceCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "azure_options": basetypes.ListType{ + ElemType: GenerateTemporaryServiceCredentialAzureOptions{}.Type(ctx), + }, + "credential_name": types.StringType, + "gcp_options": basetypes.ListType{ + ElemType: GenerateTemporaryServiceCredentialGcpOptions{}.Type(ctx), + }, + }, + } +} + +// GetAzureOptions returns the value of the AzureOptions field in GenerateTemporaryServiceCredentialRequest as +// a GenerateTemporaryServiceCredentialAzureOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryServiceCredentialRequest) GetAzureOptions(ctx context.Context) (GenerateTemporaryServiceCredentialAzureOptions, bool) { + var e GenerateTemporaryServiceCredentialAzureOptions + if o.AzureOptions.IsNull() || o.AzureOptions.IsUnknown() { + return e, false + } + var v []GenerateTemporaryServiceCredentialAzureOptions + d := o.AzureOptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureOptions sets the value of the AzureOptions field in GenerateTemporaryServiceCredentialRequest. +func (o *GenerateTemporaryServiceCredentialRequest) SetAzureOptions(ctx context.Context, v GenerateTemporaryServiceCredentialAzureOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_options"] + o.AzureOptions = types.ListValueMust(t, vs) +} + +// GetGcpOptions returns the value of the GcpOptions field in GenerateTemporaryServiceCredentialRequest as +// a GenerateTemporaryServiceCredentialGcpOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryServiceCredentialRequest) GetGcpOptions(ctx context.Context) (GenerateTemporaryServiceCredentialGcpOptions, bool) { + var e GenerateTemporaryServiceCredentialGcpOptions + if o.GcpOptions.IsNull() || o.GcpOptions.IsUnknown() { + return e, false + } + var v []GenerateTemporaryServiceCredentialGcpOptions + d := o.GcpOptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpOptions sets the value of the GcpOptions field in GenerateTemporaryServiceCredentialRequest. +func (o *GenerateTemporaryServiceCredentialRequest) SetGcpOptions(ctx context.Context, v GenerateTemporaryServiceCredentialGcpOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_options"] + o.GcpOptions = types.ListValueMust(t, vs) +} + type GenerateTemporaryTableCredentialRequest struct { // The operation performed against the table data, either READ or // READ_WRITE. If READ_WRITE is specified, the credentials returned will @@ -1821,26 +7513,59 @@ func (newState *GenerateTemporaryTableCredentialRequest) SyncEffectiveFieldsDuri func (newState *GenerateTemporaryTableCredentialRequest) SyncEffectiveFieldsDuringRead(existingState GenerateTemporaryTableCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenerateTemporaryTableCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenerateTemporaryTableCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenerateTemporaryTableCredentialRequest +// only implements ToObjectValue() and Type(). +func (o GenerateTemporaryTableCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "operation": o.Operation, + "table_id": o.TableId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenerateTemporaryTableCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "operation": types.StringType, + "table_id": types.StringType, + }, + } +} + type GenerateTemporaryTableCredentialResponse struct { // AWS temporary credentials for API authentication. Read more at // https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. - AwsTempCredentials []AwsCredentials `tfsdk:"aws_temp_credentials" tf:"optional,object"` + AwsTempCredentials types.List `tfsdk:"aws_temp_credentials" tf:"optional,object"` // Azure Active Directory token, essentially the Oauth token for Azure // Service Principal or Managed Identity. Read more at // https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token - AzureAad []AzureActiveDirectoryToken `tfsdk:"azure_aad" tf:"optional,object"` + AzureAad types.List `tfsdk:"azure_aad" tf:"optional,object"` // Azure temporary credentials for API authentication. Read more at // https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas - AzureUserDelegationSas []AzureUserDelegationSas `tfsdk:"azure_user_delegation_sas" tf:"optional,object"` + AzureUserDelegationSas types.List `tfsdk:"azure_user_delegation_sas" tf:"optional,object"` // Server time when the credential will expire, in epoch milliseconds. The // API client is advised to cache the credential given this expiration time. ExpirationTime types.Int64 `tfsdk:"expiration_time" tf:"optional"` // GCP temporary credentials for API authentication. Read more at // https://developers.google.com/identity/protocols/oauth2/service-account - GcpOauthToken []GcpOauthToken `tfsdk:"gcp_oauth_token" tf:"optional,object"` + GcpOauthToken types.List `tfsdk:"gcp_oauth_token" tf:"optional,object"` // R2 temporary credentials for API authentication. Read more at // https://developers.cloudflare.com/r2/api/s3/tokens/. - R2TempCredentials []R2Credentials `tfsdk:"r2_temp_credentials" tf:"optional,object"` + R2TempCredentials types.List `tfsdk:"r2_temp_credentials" tf:"optional,object"` // The URL of the storage path accessible by the temporary credential. Url types.String `tfsdk:"url" tf:"optional"` } @@ -1851,6 +7576,195 @@ func (newState *GenerateTemporaryTableCredentialResponse) SyncEffectiveFieldsDur func (newState *GenerateTemporaryTableCredentialResponse) SyncEffectiveFieldsDuringRead(existingState GenerateTemporaryTableCredentialResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenerateTemporaryTableCredentialResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenerateTemporaryTableCredentialResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_temp_credentials": reflect.TypeOf(AwsCredentials{}), + "azure_aad": reflect.TypeOf(AzureActiveDirectoryToken{}), + "azure_user_delegation_sas": reflect.TypeOf(AzureUserDelegationSas{}), + "gcp_oauth_token": reflect.TypeOf(GcpOauthToken{}), + "r2_temp_credentials": reflect.TypeOf(R2Credentials{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenerateTemporaryTableCredentialResponse +// only implements ToObjectValue() and Type(). +func (o GenerateTemporaryTableCredentialResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_temp_credentials": o.AwsTempCredentials, + "azure_aad": o.AzureAad, + "azure_user_delegation_sas": o.AzureUserDelegationSas, + "expiration_time": o.ExpirationTime, + "gcp_oauth_token": o.GcpOauthToken, + "r2_temp_credentials": o.R2TempCredentials, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenerateTemporaryTableCredentialResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_temp_credentials": basetypes.ListType{ + ElemType: AwsCredentials{}.Type(ctx), + }, + "azure_aad": basetypes.ListType{ + ElemType: AzureActiveDirectoryToken{}.Type(ctx), + }, + "azure_user_delegation_sas": basetypes.ListType{ + ElemType: AzureUserDelegationSas{}.Type(ctx), + }, + "expiration_time": types.Int64Type, + "gcp_oauth_token": basetypes.ListType{ + ElemType: GcpOauthToken{}.Type(ctx), + }, + "r2_temp_credentials": basetypes.ListType{ + ElemType: R2Credentials{}.Type(ctx), + }, + "url": types.StringType, + }, + } +} + +// GetAwsTempCredentials returns the value of the AwsTempCredentials field in GenerateTemporaryTableCredentialResponse as +// a AwsCredentials value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryTableCredentialResponse) GetAwsTempCredentials(ctx context.Context) (AwsCredentials, bool) { + var e AwsCredentials + if o.AwsTempCredentials.IsNull() || o.AwsTempCredentials.IsUnknown() { + return e, false + } + var v []AwsCredentials + d := o.AwsTempCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsTempCredentials sets the value of the AwsTempCredentials field in GenerateTemporaryTableCredentialResponse. +func (o *GenerateTemporaryTableCredentialResponse) SetAwsTempCredentials(ctx context.Context, v AwsCredentials) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_temp_credentials"] + o.AwsTempCredentials = types.ListValueMust(t, vs) +} + +// GetAzureAad returns the value of the AzureAad field in GenerateTemporaryTableCredentialResponse as +// a AzureActiveDirectoryToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryTableCredentialResponse) GetAzureAad(ctx context.Context) (AzureActiveDirectoryToken, bool) { + var e AzureActiveDirectoryToken + if o.AzureAad.IsNull() || o.AzureAad.IsUnknown() { + return e, false + } + var v []AzureActiveDirectoryToken + d := o.AzureAad.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAad sets the value of the AzureAad field in GenerateTemporaryTableCredentialResponse. +func (o *GenerateTemporaryTableCredentialResponse) SetAzureAad(ctx context.Context, v AzureActiveDirectoryToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_aad"] + o.AzureAad = types.ListValueMust(t, vs) +} + +// GetAzureUserDelegationSas returns the value of the AzureUserDelegationSas field in GenerateTemporaryTableCredentialResponse as +// a AzureUserDelegationSas value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryTableCredentialResponse) GetAzureUserDelegationSas(ctx context.Context) (AzureUserDelegationSas, bool) { + var e AzureUserDelegationSas + if o.AzureUserDelegationSas.IsNull() || o.AzureUserDelegationSas.IsUnknown() { + return e, false + } + var v []AzureUserDelegationSas + d := o.AzureUserDelegationSas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureUserDelegationSas sets the value of the AzureUserDelegationSas field in GenerateTemporaryTableCredentialResponse. +func (o *GenerateTemporaryTableCredentialResponse) SetAzureUserDelegationSas(ctx context.Context, v AzureUserDelegationSas) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_user_delegation_sas"] + o.AzureUserDelegationSas = types.ListValueMust(t, vs) +} + +// GetGcpOauthToken returns the value of the GcpOauthToken field in GenerateTemporaryTableCredentialResponse as +// a GcpOauthToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryTableCredentialResponse) GetGcpOauthToken(ctx context.Context) (GcpOauthToken, bool) { + var e GcpOauthToken + if o.GcpOauthToken.IsNull() || o.GcpOauthToken.IsUnknown() { + return e, false + } + var v []GcpOauthToken + d := o.GcpOauthToken.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpOauthToken sets the value of the GcpOauthToken field in GenerateTemporaryTableCredentialResponse. +func (o *GenerateTemporaryTableCredentialResponse) SetGcpOauthToken(ctx context.Context, v GcpOauthToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_oauth_token"] + o.GcpOauthToken = types.ListValueMust(t, vs) +} + +// GetR2TempCredentials returns the value of the R2TempCredentials field in GenerateTemporaryTableCredentialResponse as +// a R2Credentials value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenerateTemporaryTableCredentialResponse) GetR2TempCredentials(ctx context.Context) (R2Credentials, bool) { + var e R2Credentials + if o.R2TempCredentials.IsNull() || o.R2TempCredentials.IsUnknown() { + return e, false + } + var v []R2Credentials + d := o.R2TempCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetR2TempCredentials sets the value of the R2TempCredentials field in GenerateTemporaryTableCredentialResponse. +func (o *GenerateTemporaryTableCredentialResponse) SetR2TempCredentials(ctx context.Context, v R2Credentials) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["r2_temp_credentials"] + o.R2TempCredentials = types.ListValueMust(t, vs) +} + // Gets the metastore assignment for a workspace type GetAccountMetastoreAssignmentRequest struct { // Workspace ID. @@ -1863,6 +7777,37 @@ func (newState *GetAccountMetastoreAssignmentRequest) SyncEffectiveFieldsDuringC func (newState *GetAccountMetastoreAssignmentRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountMetastoreAssignmentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountMetastoreAssignmentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountMetastoreAssignmentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountMetastoreAssignmentRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountMetastoreAssignmentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountMetastoreAssignmentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_id": types.Int64Type, + }, + } +} + // Get a metastore type GetAccountMetastoreRequest struct { // Unity Catalog metastore ID @@ -1875,6 +7820,37 @@ func (newState *GetAccountMetastoreRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetAccountMetastoreRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountMetastoreRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountMetastoreRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountMetastoreRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountMetastoreRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountMetastoreRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountMetastoreRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + }, + } +} + // Gets the named storage credential type GetAccountStorageCredentialRequest struct { // Unity Catalog metastore ID @@ -1889,6 +7865,39 @@ func (newState *GetAccountStorageCredentialRequest) SyncEffectiveFieldsDuringCre func (newState *GetAccountStorageCredentialRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountStorageCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountStorageCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountStorageCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountStorageCredentialRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountStorageCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + "storage_credential_name": o.StorageCredentialName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountStorageCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + "storage_credential_name": types.StringType, + }, + } +} + // Get an artifact allowlist type GetArtifactAllowlistRequest struct { // The artifact type of the allowlist. @@ -1901,6 +7910,37 @@ func (newState *GetArtifactAllowlistRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetArtifactAllowlistRequest) SyncEffectiveFieldsDuringRead(existingState GetArtifactAllowlistRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetArtifactAllowlistRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetArtifactAllowlistRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetArtifactAllowlistRequest +// only implements ToObjectValue() and Type(). +func (o GetArtifactAllowlistRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_type": o.ArtifactType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetArtifactAllowlistRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_type": types.StringType, + }, + } +} + // Get securable workspace bindings type GetBindingsRequest struct { // Maximum number of workspace bindings to return. - When set to 0, the page @@ -1924,6 +7964,43 @@ func (newState *GetBindingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetBindingsRequest) SyncEffectiveFieldsDuringRead(existingState GetBindingsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetBindingsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetBindingsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetBindingsRequest +// only implements ToObjectValue() and Type(). +func (o GetBindingsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + "securable_name": o.SecurableName, + "securable_type": o.SecurableType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetBindingsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + "securable_name": types.StringType, + "securable_type": types.StringType, + }, + } +} + // Get Model Version By Alias type GetByAliasRequest struct { // The name of the alias @@ -1941,6 +8018,41 @@ func (newState *GetByAliasRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetByAliasRequest) SyncEffectiveFieldsDuringRead(existingState GetByAliasRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetByAliasRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetByAliasRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetByAliasRequest +// only implements ToObjectValue() and Type(). +func (o GetByAliasRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alias": o.Alias, + "full_name": o.FullName, + "include_aliases": o.IncludeAliases, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetByAliasRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alias": types.StringType, + "full_name": types.StringType, + "include_aliases": types.BoolType, + }, + } +} + // Get a catalog type GetCatalogRequest struct { // Whether to include catalogs in the response for which the principal can @@ -1956,6 +8068,39 @@ func (newState *GetCatalogRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetCatalogRequest) SyncEffectiveFieldsDuringRead(existingState GetCatalogRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCatalogRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCatalogRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCatalogRequest +// only implements ToObjectValue() and Type(). +func (o GetCatalogRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_browse": o.IncludeBrowse, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCatalogRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_browse": types.BoolType, + "name": types.StringType, + }, + } +} + // Get a connection type GetConnectionRequest struct { // Name of the connection. @@ -1968,6 +8113,37 @@ func (newState *GetConnectionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GetConnectionRequest) SyncEffectiveFieldsDuringRead(existingState GetConnectionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetConnectionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetConnectionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetConnectionRequest +// only implements ToObjectValue() and Type(). +func (o GetConnectionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetConnectionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get a credential type GetCredentialRequest struct { // Name of the credential. @@ -1980,6 +8156,37 @@ func (newState *GetCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GetCredentialRequest) SyncEffectiveFieldsDuringRead(existingState GetCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCredentialRequest +// only implements ToObjectValue() and Type(). +func (o GetCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name_arg": o.NameArg, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name_arg": types.StringType, + }, + } +} + // Get effective permissions type GetEffectiveRequest struct { // Full name of securable. @@ -1997,6 +8204,41 @@ func (newState *GetEffectiveRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetEffectiveRequest) SyncEffectiveFieldsDuringRead(existingState GetEffectiveRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEffectiveRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEffectiveRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEffectiveRequest +// only implements ToObjectValue() and Type(). +func (o GetEffectiveRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "principal": o.Principal, + "securable_type": o.SecurableType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEffectiveRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "principal": types.StringType, + "securable_type": types.StringType, + }, + } +} + // Get an external location type GetExternalLocationRequest struct { // Whether to include external locations in the response for which the @@ -2012,6 +8254,39 @@ func (newState *GetExternalLocationRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetExternalLocationRequest) SyncEffectiveFieldsDuringRead(existingState GetExternalLocationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExternalLocationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExternalLocationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExternalLocationRequest +// only implements ToObjectValue() and Type(). +func (o GetExternalLocationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_browse": o.IncludeBrowse, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExternalLocationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_browse": types.BoolType, + "name": types.StringType, + }, + } +} + // Get a function type GetFunctionRequest struct { // Whether to include functions in the response for which the principal can @@ -2028,6 +8303,39 @@ func (newState *GetFunctionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetFunctionRequest) SyncEffectiveFieldsDuringRead(existingState GetFunctionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetFunctionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetFunctionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetFunctionRequest +// only implements ToObjectValue() and Type(). +func (o GetFunctionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_browse": o.IncludeBrowse, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetFunctionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_browse": types.BoolType, + "name": types.StringType, + }, + } +} + // Get permissions type GetGrantRequest struct { // Full name of securable. @@ -2045,6 +8353,41 @@ func (newState *GetGrantRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetGrantRequest) SyncEffectiveFieldsDuringRead(existingState GetGrantRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetGrantRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetGrantRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetGrantRequest +// only implements ToObjectValue() and Type(). +func (o GetGrantRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "principal": o.Principal, + "securable_type": o.SecurableType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetGrantRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "principal": types.StringType, + "securable_type": types.StringType, + }, + } +} + // Get a metastore type GetMetastoreRequest struct { // Unique ID of the metastore. @@ -2057,6 +8400,37 @@ func (newState *GetMetastoreRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetMetastoreRequest) SyncEffectiveFieldsDuringRead(existingState GetMetastoreRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetMetastoreRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetMetastoreRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetMetastoreRequest +// only implements ToObjectValue() and Type(). +func (o GetMetastoreRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetMetastoreRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetMetastoreSummaryResponse struct { // Cloud vendor of the metastore home shard (e.g., `aws`, `azure`, `gcp`). Cloud types.String `tfsdk:"cloud" tf:"optional"` @@ -2108,6 +8482,73 @@ func (newState *GetMetastoreSummaryResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetMetastoreSummaryResponse) SyncEffectiveFieldsDuringRead(existingState GetMetastoreSummaryResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetMetastoreSummaryResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetMetastoreSummaryResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetMetastoreSummaryResponse +// only implements ToObjectValue() and Type(). +func (o GetMetastoreSummaryResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cloud": o.Cloud, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "default_data_access_config_id": o.DefaultDataAccessConfigId, + "delta_sharing_organization_name": o.DeltaSharingOrganizationName, + "delta_sharing_recipient_token_lifetime_in_seconds": o.DeltaSharingRecipientTokenLifetimeInSeconds, + "delta_sharing_scope": o.DeltaSharingScope, + "external_access_enabled": o.ExternalAccessEnabled, + "global_metastore_id": o.GlobalMetastoreId, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "privilege_model_version": o.PrivilegeModelVersion, + "region": o.Region, + "storage_root": o.StorageRoot, + "storage_root_credential_id": o.StorageRootCredentialId, + "storage_root_credential_name": o.StorageRootCredentialName, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetMetastoreSummaryResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cloud": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "default_data_access_config_id": types.StringType, + "delta_sharing_organization_name": types.StringType, + "delta_sharing_recipient_token_lifetime_in_seconds": types.Int64Type, + "delta_sharing_scope": types.StringType, + "external_access_enabled": types.BoolType, + "global_metastore_id": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "privilege_model_version": types.StringType, + "region": types.StringType, + "storage_root": types.StringType, + "storage_root_credential_id": types.StringType, + "storage_root_credential_name": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + // Get a Model Version type GetModelVersionRequest struct { // The three-level (fully qualified) name of the model version @@ -2128,6 +8569,43 @@ func (newState *GetModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState GetModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o GetModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "include_aliases": o.IncludeAliases, + "include_browse": o.IncludeBrowse, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "include_aliases": types.BoolType, + "include_browse": types.BoolType, + "version": types.Int64Type, + }, + } +} + // Get an Online Table type GetOnlineTableRequest struct { // Full three-part (catalog, schema, table) name of the table. @@ -2140,6 +8618,37 @@ func (newState *GetOnlineTableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *GetOnlineTableRequest) SyncEffectiveFieldsDuringRead(existingState GetOnlineTableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetOnlineTableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetOnlineTableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetOnlineTableRequest +// only implements ToObjectValue() and Type(). +func (o GetOnlineTableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetOnlineTableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get a table monitor type GetQualityMonitorRequest struct { // Full name of the table. @@ -2152,6 +8661,37 @@ func (newState *GetQualityMonitorRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetQualityMonitorRequest) SyncEffectiveFieldsDuringRead(existingState GetQualityMonitorRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetQualityMonitorRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetQualityMonitorRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetQualityMonitorRequest +// only implements ToObjectValue() and Type(). +func (o GetQualityMonitorRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_name": o.TableName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetQualityMonitorRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_name": types.StringType, + }, + } +} + // Get information for a single resource quota. type GetQuotaRequest struct { // Full name of the parent resource. Provide the metastore ID if the parent @@ -2170,9 +8710,44 @@ func (newState *GetQuotaRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetQuotaRequest) SyncEffectiveFieldsDuringRead(existingState GetQuotaRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetQuotaRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetQuotaRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetQuotaRequest +// only implements ToObjectValue() and Type(). +func (o GetQuotaRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "parent_full_name": o.ParentFullName, + "parent_securable_type": o.ParentSecurableType, + "quota_name": o.QuotaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetQuotaRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "parent_full_name": types.StringType, + "parent_securable_type": types.StringType, + "quota_name": types.StringType, + }, + } +} + type GetQuotaResponse struct { // The returned QuotaInfo. - QuotaInfo []QuotaInfo `tfsdk:"quota_info" tf:"optional,object"` + QuotaInfo types.List `tfsdk:"quota_info" tf:"optional,object"` } func (newState *GetQuotaResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetQuotaResponse) { @@ -2181,6 +8756,67 @@ func (newState *GetQuotaResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetQuotaResponse) SyncEffectiveFieldsDuringRead(existingState GetQuotaResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetQuotaResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetQuotaResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "quota_info": reflect.TypeOf(QuotaInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetQuotaResponse +// only implements ToObjectValue() and Type(). +func (o GetQuotaResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "quota_info": o.QuotaInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetQuotaResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "quota_info": basetypes.ListType{ + ElemType: QuotaInfo{}.Type(ctx), + }, + }, + } +} + +// GetQuotaInfo returns the value of the QuotaInfo field in GetQuotaResponse as +// a QuotaInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetQuotaResponse) GetQuotaInfo(ctx context.Context) (QuotaInfo, bool) { + var e QuotaInfo + if o.QuotaInfo.IsNull() || o.QuotaInfo.IsUnknown() { + return e, false + } + var v []QuotaInfo + d := o.QuotaInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuotaInfo sets the value of the QuotaInfo field in GetQuotaResponse. +func (o *GetQuotaResponse) SetQuotaInfo(ctx context.Context, v QuotaInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["quota_info"] + o.QuotaInfo = types.ListValueMust(t, vs) +} + // Get refresh type GetRefreshRequest struct { // ID of the refresh. @@ -2195,6 +8831,39 @@ func (newState *GetRefreshRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetRefreshRequest) SyncEffectiveFieldsDuringRead(existingState GetRefreshRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRefreshRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRefreshRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRefreshRequest +// only implements ToObjectValue() and Type(). +func (o GetRefreshRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "refresh_id": o.RefreshId, + "table_name": o.TableName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRefreshRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "refresh_id": types.StringType, + "table_name": types.StringType, + }, + } +} + // Get a Registered Model type GetRegisteredModelRequest struct { // The three-level (fully qualified) name of the registered model @@ -2212,6 +8881,41 @@ func (newState *GetRegisteredModelRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GetRegisteredModelRequest) SyncEffectiveFieldsDuringRead(existingState GetRegisteredModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRegisteredModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRegisteredModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRegisteredModelRequest +// only implements ToObjectValue() and Type(). +func (o GetRegisteredModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "include_aliases": o.IncludeAliases, + "include_browse": o.IncludeBrowse, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRegisteredModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "include_aliases": types.BoolType, + "include_browse": types.BoolType, + }, + } +} + // Get a schema type GetSchemaRequest struct { // Full name of the schema. @@ -2227,6 +8931,39 @@ func (newState *GetSchemaRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetSchemaRequest) SyncEffectiveFieldsDuringRead(existingState GetSchemaRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetSchemaRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetSchemaRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetSchemaRequest +// only implements ToObjectValue() and Type(). +func (o GetSchemaRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "include_browse": o.IncludeBrowse, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetSchemaRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "include_browse": types.BoolType, + }, + } +} + // Get a credential type GetStorageCredentialRequest struct { // Name of the storage credential. @@ -2239,6 +8976,37 @@ func (newState *GetStorageCredentialRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetStorageCredentialRequest) SyncEffectiveFieldsDuringRead(existingState GetStorageCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStorageCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStorageCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStorageCredentialRequest +// only implements ToObjectValue() and Type(). +func (o GetStorageCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStorageCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get a table type GetTableRequest struct { // Full name of the table. @@ -2258,6 +9026,43 @@ func (newState *GetTableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetTableRequest) SyncEffectiveFieldsDuringRead(existingState GetTableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetTableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetTableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetTableRequest +// only implements ToObjectValue() and Type(). +func (o GetTableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "include_browse": o.IncludeBrowse, + "include_delta_metadata": o.IncludeDeltaMetadata, + "include_manifest_capabilities": o.IncludeManifestCapabilities, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetTableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "include_browse": types.BoolType, + "include_delta_metadata": types.BoolType, + "include_manifest_capabilities": types.BoolType, + }, + } +} + // Get catalog workspace bindings type GetWorkspaceBindingRequest struct { // The name of the catalog. @@ -2270,6 +9075,37 @@ func (newState *GetWorkspaceBindingRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetWorkspaceBindingRequest) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceBindingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceBindingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceBindingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceBindingRequest +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceBindingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceBindingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get all workspaces assigned to a metastore type ListAccountMetastoreAssignmentsRequest struct { // Unity Catalog metastore ID @@ -2282,9 +9118,40 @@ func (newState *ListAccountMetastoreAssignmentsRequest) SyncEffectiveFieldsDurin func (newState *ListAccountMetastoreAssignmentsRequest) SyncEffectiveFieldsDuringRead(existingState ListAccountMetastoreAssignmentsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountMetastoreAssignmentsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountMetastoreAssignmentsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountMetastoreAssignmentsRequest +// only implements ToObjectValue() and Type(). +func (o ListAccountMetastoreAssignmentsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountMetastoreAssignmentsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + }, + } +} + // The list of workspaces to which the given metastore is assigned. type ListAccountMetastoreAssignmentsResponse struct { - WorkspaceIds []types.Int64 `tfsdk:"workspace_ids" tf:"optional"` + WorkspaceIds types.List `tfsdk:"workspace_ids" tf:"optional"` } func (newState *ListAccountMetastoreAssignmentsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAccountMetastoreAssignmentsResponse) { @@ -2293,6 +9160,67 @@ func (newState *ListAccountMetastoreAssignmentsResponse) SyncEffectiveFieldsDuri func (newState *ListAccountMetastoreAssignmentsResponse) SyncEffectiveFieldsDuringRead(existingState ListAccountMetastoreAssignmentsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountMetastoreAssignmentsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountMetastoreAssignmentsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "workspace_ids": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountMetastoreAssignmentsResponse +// only implements ToObjectValue() and Type(). +func (o ListAccountMetastoreAssignmentsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_ids": o.WorkspaceIds, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountMetastoreAssignmentsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_ids": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetWorkspaceIds returns the value of the WorkspaceIds field in ListAccountMetastoreAssignmentsResponse as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAccountMetastoreAssignmentsResponse) GetWorkspaceIds(ctx context.Context) ([]types.Int64, bool) { + if o.WorkspaceIds.IsNull() || o.WorkspaceIds.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.WorkspaceIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWorkspaceIds sets the value of the WorkspaceIds field in ListAccountMetastoreAssignmentsResponse. +func (o *ListAccountMetastoreAssignmentsResponse) SetWorkspaceIds(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workspace_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.WorkspaceIds = types.ListValueMust(t, vs) +} + // Get all storage credentials assigned to a metastore type ListAccountStorageCredentialsRequest struct { // Unity Catalog metastore ID @@ -2305,9 +9233,40 @@ func (newState *ListAccountStorageCredentialsRequest) SyncEffectiveFieldsDuringC func (newState *ListAccountStorageCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState ListAccountStorageCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountStorageCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountStorageCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountStorageCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o ListAccountStorageCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountStorageCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + }, + } +} + type ListAccountStorageCredentialsResponse struct { // An array of metastore storage credentials. - StorageCredentials []StorageCredentialInfo `tfsdk:"storage_credentials" tf:"optional"` + StorageCredentials types.List `tfsdk:"storage_credentials" tf:"optional"` } func (newState *ListAccountStorageCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAccountStorageCredentialsResponse) { @@ -2316,6 +9275,67 @@ func (newState *ListAccountStorageCredentialsResponse) SyncEffectiveFieldsDuring func (newState *ListAccountStorageCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState ListAccountStorageCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountStorageCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountStorageCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "storage_credentials": reflect.TypeOf(StorageCredentialInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountStorageCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o ListAccountStorageCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "storage_credentials": o.StorageCredentials, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountStorageCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "storage_credentials": basetypes.ListType{ + ElemType: StorageCredentialInfo{}.Type(ctx), + }, + }, + } +} + +// GetStorageCredentials returns the value of the StorageCredentials field in ListAccountStorageCredentialsResponse as +// a slice of StorageCredentialInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAccountStorageCredentialsResponse) GetStorageCredentials(ctx context.Context) ([]StorageCredentialInfo, bool) { + if o.StorageCredentials.IsNull() || o.StorageCredentials.IsUnknown() { + return nil, false + } + var v []StorageCredentialInfo + d := o.StorageCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStorageCredentials sets the value of the StorageCredentials field in ListAccountStorageCredentialsResponse. +func (o *ListAccountStorageCredentialsResponse) SetStorageCredentials(ctx context.Context, v []StorageCredentialInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["storage_credentials"] + t = t.(attr.TypeWithElementType).ElementType() + o.StorageCredentials = types.ListValueMust(t, vs) +} + // List catalogs type ListCatalogsRequest struct { // Whether to include catalogs in the response for which the principal can @@ -2341,9 +9361,44 @@ func (newState *ListCatalogsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListCatalogsRequest) SyncEffectiveFieldsDuringRead(existingState ListCatalogsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCatalogsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCatalogsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCatalogsRequest +// only implements ToObjectValue() and Type(). +func (o ListCatalogsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCatalogsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListCatalogsResponse struct { // An array of catalog information objects. - Catalogs []CatalogInfo `tfsdk:"catalogs" tf:"optional"` + Catalogs types.List `tfsdk:"catalogs" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -2356,6 +9411,69 @@ func (newState *ListCatalogsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListCatalogsResponse) SyncEffectiveFieldsDuringRead(existingState ListCatalogsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCatalogsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCatalogsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "catalogs": reflect.TypeOf(CatalogInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCatalogsResponse +// only implements ToObjectValue() and Type(). +func (o ListCatalogsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalogs": o.Catalogs, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCatalogsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalogs": basetypes.ListType{ + ElemType: CatalogInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetCatalogs returns the value of the Catalogs field in ListCatalogsResponse as +// a slice of CatalogInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListCatalogsResponse) GetCatalogs(ctx context.Context) ([]CatalogInfo, bool) { + if o.Catalogs.IsNull() || o.Catalogs.IsUnknown() { + return nil, false + } + var v []CatalogInfo + d := o.Catalogs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCatalogs sets the value of the Catalogs field in ListCatalogsResponse. +func (o *ListCatalogsResponse) SetCatalogs(ctx context.Context, v []CatalogInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["catalogs"] + t = t.(attr.TypeWithElementType).ElementType() + o.Catalogs = types.ListValueMust(t, vs) +} + // List connections type ListConnectionsRequest struct { // Maximum number of connections to return. - If not set, all connections @@ -2375,9 +9493,42 @@ func (newState *ListConnectionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListConnectionsRequest) SyncEffectiveFieldsDuringRead(existingState ListConnectionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListConnectionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListConnectionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListConnectionsRequest +// only implements ToObjectValue() and Type(). +func (o ListConnectionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListConnectionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListConnectionsResponse struct { // An array of connection information objects. - Connections []ConnectionInfo `tfsdk:"connections" tf:"optional"` + Connections types.List `tfsdk:"connections" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -2390,6 +9541,69 @@ func (newState *ListConnectionsResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListConnectionsResponse) SyncEffectiveFieldsDuringRead(existingState ListConnectionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListConnectionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListConnectionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "connections": reflect.TypeOf(ConnectionInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListConnectionsResponse +// only implements ToObjectValue() and Type(). +func (o ListConnectionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "connections": o.Connections, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListConnectionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "connections": basetypes.ListType{ + ElemType: ConnectionInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetConnections returns the value of the Connections field in ListConnectionsResponse as +// a slice of ConnectionInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListConnectionsResponse) GetConnections(ctx context.Context) ([]ConnectionInfo, bool) { + if o.Connections.IsNull() || o.Connections.IsUnknown() { + return nil, false + } + var v []ConnectionInfo + d := o.Connections.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetConnections sets the value of the Connections field in ListConnectionsResponse. +func (o *ListConnectionsResponse) SetConnections(ctx context.Context, v []ConnectionInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["connections"] + t = t.(attr.TypeWithElementType).ElementType() + o.Connections = types.ListValueMust(t, vs) +} + // List credentials type ListCredentialsRequest struct { // Maximum number of credentials to return. - If not set, the default max @@ -2410,8 +9624,43 @@ func (newState *ListCredentialsRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState ListCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o ListCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + "purpose": o.Purpose, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + "purpose": types.StringType, + }, + } +} + type ListCredentialsResponse struct { - Credentials []CredentialInfo `tfsdk:"credentials" tf:"optional"` + Credentials types.List `tfsdk:"credentials" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -2424,6 +9673,69 @@ func (newState *ListCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState ListCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "credentials": reflect.TypeOf(CredentialInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o ListCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credentials": o.Credentials, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credentials": basetypes.ListType{ + ElemType: CredentialInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetCredentials returns the value of the Credentials field in ListCredentialsResponse as +// a slice of CredentialInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListCredentialsResponse) GetCredentials(ctx context.Context) ([]CredentialInfo, bool) { + if o.Credentials.IsNull() || o.Credentials.IsUnknown() { + return nil, false + } + var v []CredentialInfo + d := o.Credentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCredentials sets the value of the Credentials field in ListCredentialsResponse. +func (o *ListCredentialsResponse) SetCredentials(ctx context.Context, v []CredentialInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["credentials"] + t = t.(attr.TypeWithElementType).ElementType() + o.Credentials = types.ListValueMust(t, vs) +} + // List external locations type ListExternalLocationsRequest struct { // Whether to include external locations in the response for which the @@ -2446,9 +9758,44 @@ func (newState *ListExternalLocationsRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *ListExternalLocationsRequest) SyncEffectiveFieldsDuringRead(existingState ListExternalLocationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExternalLocationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExternalLocationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExternalLocationsRequest +// only implements ToObjectValue() and Type(). +func (o ListExternalLocationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExternalLocationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListExternalLocationsResponse struct { // An array of external locations. - ExternalLocations []ExternalLocationInfo `tfsdk:"external_locations" tf:"optional"` + ExternalLocations types.List `tfsdk:"external_locations" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -2461,6 +9808,69 @@ func (newState *ListExternalLocationsResponse) SyncEffectiveFieldsDuringCreateOr func (newState *ListExternalLocationsResponse) SyncEffectiveFieldsDuringRead(existingState ListExternalLocationsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExternalLocationsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExternalLocationsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "external_locations": reflect.TypeOf(ExternalLocationInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExternalLocationsResponse +// only implements ToObjectValue() and Type(). +func (o ListExternalLocationsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "external_locations": o.ExternalLocations, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExternalLocationsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "external_locations": basetypes.ListType{ + ElemType: ExternalLocationInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetExternalLocations returns the value of the ExternalLocations field in ListExternalLocationsResponse as +// a slice of ExternalLocationInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListExternalLocationsResponse) GetExternalLocations(ctx context.Context) ([]ExternalLocationInfo, bool) { + if o.ExternalLocations.IsNull() || o.ExternalLocations.IsUnknown() { + return nil, false + } + var v []ExternalLocationInfo + d := o.ExternalLocations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExternalLocations sets the value of the ExternalLocations field in ListExternalLocationsResponse. +func (o *ListExternalLocationsResponse) SetExternalLocations(ctx context.Context, v []ExternalLocationInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["external_locations"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExternalLocations = types.ListValueMust(t, vs) +} + // List functions type ListFunctionsRequest struct { // Name of parent catalog for functions of interest. @@ -2487,9 +9897,48 @@ func (newState *ListFunctionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListFunctionsRequest) SyncEffectiveFieldsDuringRead(existingState ListFunctionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFunctionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFunctionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFunctionsRequest +// only implements ToObjectValue() and Type(). +func (o ListFunctionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + "schema_name": o.SchemaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFunctionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + "schema_name": types.StringType, + }, + } +} + type ListFunctionsResponse struct { // An array of function information objects. - Functions []FunctionInfo `tfsdk:"functions" tf:"optional"` + Functions types.List `tfsdk:"functions" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -2502,9 +9951,72 @@ func (newState *ListFunctionsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListFunctionsResponse) SyncEffectiveFieldsDuringRead(existingState ListFunctionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFunctionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFunctionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "functions": reflect.TypeOf(FunctionInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFunctionsResponse +// only implements ToObjectValue() and Type(). +func (o ListFunctionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "functions": o.Functions, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFunctionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "functions": basetypes.ListType{ + ElemType: FunctionInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetFunctions returns the value of the Functions field in ListFunctionsResponse as +// a slice of FunctionInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListFunctionsResponse) GetFunctions(ctx context.Context) ([]FunctionInfo, bool) { + if o.Functions.IsNull() || o.Functions.IsUnknown() { + return nil, false + } + var v []FunctionInfo + d := o.Functions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFunctions sets the value of the Functions field in ListFunctionsResponse. +func (o *ListFunctionsResponse) SetFunctions(ctx context.Context, v []FunctionInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["functions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Functions = types.ListValueMust(t, vs) +} + type ListMetastoresResponse struct { // An array of metastore information objects. - Metastores []MetastoreInfo `tfsdk:"metastores" tf:"optional"` + Metastores types.List `tfsdk:"metastores" tf:"optional"` } func (newState *ListMetastoresResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListMetastoresResponse) { @@ -2513,6 +10025,67 @@ func (newState *ListMetastoresResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListMetastoresResponse) SyncEffectiveFieldsDuringRead(existingState ListMetastoresResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListMetastoresResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListMetastoresResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metastores": reflect.TypeOf(MetastoreInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListMetastoresResponse +// only implements ToObjectValue() and Type(). +func (o ListMetastoresResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastores": o.Metastores, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListMetastoresResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastores": basetypes.ListType{ + ElemType: MetastoreInfo{}.Type(ctx), + }, + }, + } +} + +// GetMetastores returns the value of the Metastores field in ListMetastoresResponse as +// a slice of MetastoreInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListMetastoresResponse) GetMetastores(ctx context.Context) ([]MetastoreInfo, bool) { + if o.Metastores.IsNull() || o.Metastores.IsUnknown() { + return nil, false + } + var v []MetastoreInfo + d := o.Metastores.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMetastores sets the value of the Metastores field in ListMetastoresResponse. +func (o *ListMetastoresResponse) SetMetastores(ctx context.Context, v []MetastoreInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metastores"] + t = t.(attr.TypeWithElementType).ElementType() + o.Metastores = types.ListValueMust(t, vs) +} + // List Model Versions type ListModelVersionsRequest struct { // The full three-level name of the registered model under which to list @@ -2539,8 +10112,45 @@ func (newState *ListModelVersionsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListModelVersionsRequest) SyncEffectiveFieldsDuringRead(existingState ListModelVersionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListModelVersionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListModelVersionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListModelVersionsRequest +// only implements ToObjectValue() and Type(). +func (o ListModelVersionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListModelVersionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListModelVersionsResponse struct { - ModelVersions []ModelVersionInfo `tfsdk:"model_versions" tf:"optional"` + ModelVersions types.List `tfsdk:"model_versions" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -2553,6 +10163,69 @@ func (newState *ListModelVersionsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListModelVersionsResponse) SyncEffectiveFieldsDuringRead(existingState ListModelVersionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListModelVersionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListModelVersionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_versions": reflect.TypeOf(ModelVersionInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListModelVersionsResponse +// only implements ToObjectValue() and Type(). +func (o ListModelVersionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_versions": o.ModelVersions, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListModelVersionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_versions": basetypes.ListType{ + ElemType: ModelVersionInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetModelVersions returns the value of the ModelVersions field in ListModelVersionsResponse as +// a slice of ModelVersionInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListModelVersionsResponse) GetModelVersions(ctx context.Context) ([]ModelVersionInfo, bool) { + if o.ModelVersions.IsNull() || o.ModelVersions.IsUnknown() { + return nil, false + } + var v []ModelVersionInfo + d := o.ModelVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetModelVersions sets the value of the ModelVersions field in ListModelVersionsResponse. +func (o *ListModelVersionsResponse) SetModelVersions(ctx context.Context, v []ModelVersionInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.ModelVersions = types.ListValueMust(t, vs) +} + // List all resource quotas under a metastore. type ListQuotasRequest struct { // The number of quotas to return. @@ -2567,13 +10240,46 @@ func (newState *ListQuotasRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListQuotasRequest) SyncEffectiveFieldsDuringRead(existingState ListQuotasRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQuotasRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQuotasRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQuotasRequest +// only implements ToObjectValue() and Type(). +func (o ListQuotasRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQuotasRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListQuotasResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of returned QuotaInfos. - Quotas []QuotaInfo `tfsdk:"quotas" tf:"optional"` + Quotas types.List `tfsdk:"quotas" tf:"optional"` } func (newState *ListQuotasResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListQuotasResponse) { @@ -2582,6 +10288,69 @@ func (newState *ListQuotasResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListQuotasResponse) SyncEffectiveFieldsDuringRead(existingState ListQuotasResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQuotasResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQuotasResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "quotas": reflect.TypeOf(QuotaInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQuotasResponse +// only implements ToObjectValue() and Type(). +func (o ListQuotasResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "quotas": o.Quotas, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQuotasResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "quotas": basetypes.ListType{ + ElemType: QuotaInfo{}.Type(ctx), + }, + }, + } +} + +// GetQuotas returns the value of the Quotas field in ListQuotasResponse as +// a slice of QuotaInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListQuotasResponse) GetQuotas(ctx context.Context) ([]QuotaInfo, bool) { + if o.Quotas.IsNull() || o.Quotas.IsUnknown() { + return nil, false + } + var v []QuotaInfo + d := o.Quotas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetQuotas sets the value of the Quotas field in ListQuotasResponse. +func (o *ListQuotasResponse) SetQuotas(ctx context.Context, v []QuotaInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["quotas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Quotas = types.ListValueMust(t, vs) +} + // List refreshes type ListRefreshesRequest struct { // Full name of the table. @@ -2594,6 +10363,37 @@ func (newState *ListRefreshesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListRefreshesRequest) SyncEffectiveFieldsDuringRead(existingState ListRefreshesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRefreshesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRefreshesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRefreshesRequest +// only implements ToObjectValue() and Type(). +func (o ListRefreshesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_name": o.TableName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRefreshesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_name": types.StringType, + }, + } +} + // List Registered Models type ListRegisteredModelsRequest struct { // The identifier of the catalog under which to list registered models. If @@ -2633,12 +10433,51 @@ func (newState *ListRegisteredModelsRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *ListRegisteredModelsRequest) SyncEffectiveFieldsDuringRead(existingState ListRegisteredModelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRegisteredModelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRegisteredModelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRegisteredModelsRequest +// only implements ToObjectValue() and Type(). +func (o ListRegisteredModelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + "schema_name": o.SchemaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRegisteredModelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + "schema_name": types.StringType, + }, + } +} + type ListRegisteredModelsResponse struct { // Opaque token for pagination. Omitted if there are no more results. // page_token should be set to this value for fetching the next page. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - RegisteredModels []RegisteredModelInfo `tfsdk:"registered_models" tf:"optional"` + RegisteredModels types.List `tfsdk:"registered_models" tf:"optional"` } func (newState *ListRegisteredModelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListRegisteredModelsResponse) { @@ -2647,6 +10486,69 @@ func (newState *ListRegisteredModelsResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *ListRegisteredModelsResponse) SyncEffectiveFieldsDuringRead(existingState ListRegisteredModelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRegisteredModelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRegisteredModelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "registered_models": reflect.TypeOf(RegisteredModelInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRegisteredModelsResponse +// only implements ToObjectValue() and Type(). +func (o ListRegisteredModelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "registered_models": o.RegisteredModels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRegisteredModelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "registered_models": basetypes.ListType{ + ElemType: RegisteredModelInfo{}.Type(ctx), + }, + }, + } +} + +// GetRegisteredModels returns the value of the RegisteredModels field in ListRegisteredModelsResponse as +// a slice of RegisteredModelInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListRegisteredModelsResponse) GetRegisteredModels(ctx context.Context) ([]RegisteredModelInfo, bool) { + if o.RegisteredModels.IsNull() || o.RegisteredModels.IsUnknown() { + return nil, false + } + var v []RegisteredModelInfo + d := o.RegisteredModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRegisteredModels sets the value of the RegisteredModels field in ListRegisteredModelsResponse. +func (o *ListRegisteredModelsResponse) SetRegisteredModels(ctx context.Context, v []RegisteredModelInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["registered_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.RegisteredModels = types.ListValueMust(t, vs) +} + // List schemas type ListSchemasRequest struct { // Parent catalog for schemas of interest. @@ -2671,13 +10573,50 @@ func (newState *ListSchemasRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListSchemasRequest) SyncEffectiveFieldsDuringRead(existingState ListSchemasRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSchemasRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSchemasRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSchemasRequest +// only implements ToObjectValue() and Type(). +func (o ListSchemasRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSchemasRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListSchemasResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of schema information objects. - Schemas []SchemaInfo `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` } func (newState *ListSchemasResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListSchemasResponse) { @@ -2686,6 +10625,69 @@ func (newState *ListSchemasResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListSchemasResponse) SyncEffectiveFieldsDuringRead(existingState ListSchemasResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSchemasResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSchemasResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "schemas": reflect.TypeOf(SchemaInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSchemasResponse +// only implements ToObjectValue() and Type(). +func (o ListSchemasResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "schemas": o.Schemas, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSchemasResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "schemas": basetypes.ListType{ + ElemType: SchemaInfo{}.Type(ctx), + }, + }, + } +} + +// GetSchemas returns the value of the Schemas field in ListSchemasResponse as +// a slice of SchemaInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListSchemasResponse) GetSchemas(ctx context.Context) ([]SchemaInfo, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []SchemaInfo + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in ListSchemasResponse. +func (o *ListSchemasResponse) SetSchemas(ctx context.Context, v []SchemaInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + // List credentials type ListStorageCredentialsRequest struct { // Maximum number of storage credentials to return. If not set, all the @@ -2705,13 +10707,46 @@ func (newState *ListStorageCredentialsRequest) SyncEffectiveFieldsDuringCreateOr func (newState *ListStorageCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState ListStorageCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListStorageCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListStorageCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListStorageCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o ListStorageCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListStorageCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListStorageCredentialsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - StorageCredentials []StorageCredentialInfo `tfsdk:"storage_credentials" tf:"optional"` + StorageCredentials types.List `tfsdk:"storage_credentials" tf:"optional"` } func (newState *ListStorageCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListStorageCredentialsResponse) { @@ -2720,6 +10755,69 @@ func (newState *ListStorageCredentialsResponse) SyncEffectiveFieldsDuringCreateO func (newState *ListStorageCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState ListStorageCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListStorageCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListStorageCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "storage_credentials": reflect.TypeOf(StorageCredentialInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListStorageCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o ListStorageCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "storage_credentials": o.StorageCredentials, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListStorageCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "storage_credentials": basetypes.ListType{ + ElemType: StorageCredentialInfo{}.Type(ctx), + }, + }, + } +} + +// GetStorageCredentials returns the value of the StorageCredentials field in ListStorageCredentialsResponse as +// a slice of StorageCredentialInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListStorageCredentialsResponse) GetStorageCredentials(ctx context.Context) ([]StorageCredentialInfo, bool) { + if o.StorageCredentials.IsNull() || o.StorageCredentials.IsUnknown() { + return nil, false + } + var v []StorageCredentialInfo + d := o.StorageCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStorageCredentials sets the value of the StorageCredentials field in ListStorageCredentialsResponse. +func (o *ListStorageCredentialsResponse) SetStorageCredentials(ctx context.Context, v []StorageCredentialInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["storage_credentials"] + t = t.(attr.TypeWithElementType).ElementType() + o.StorageCredentials = types.ListValueMust(t, vs) +} + // List table summaries type ListSummariesRequest struct { // Name of parent catalog for tables of interest. @@ -2750,6 +10848,47 @@ func (newState *ListSummariesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListSummariesRequest) SyncEffectiveFieldsDuringRead(existingState ListSummariesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSummariesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSummariesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSummariesRequest +// only implements ToObjectValue() and Type(). +func (o ListSummariesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "include_manifest_capabilities": o.IncludeManifestCapabilities, + "max_results": o.MaxResults, + "page_token": o.PageToken, + "schema_name_pattern": o.SchemaNamePattern, + "table_name_pattern": o.TableNamePattern, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSummariesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "include_manifest_capabilities": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + "schema_name_pattern": types.StringType, + "table_name_pattern": types.StringType, + }, + } +} + // List system schemas type ListSystemSchemasRequest struct { // Maximum number of schemas to return. - When set to 0, the page length is @@ -2771,13 +10910,48 @@ func (newState *ListSystemSchemasRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListSystemSchemasRequest) SyncEffectiveFieldsDuringRead(existingState ListSystemSchemasRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSystemSchemasRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSystemSchemasRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSystemSchemasRequest +// only implements ToObjectValue() and Type(). +func (o ListSystemSchemasRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "metastore_id": o.MetastoreId, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSystemSchemasRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "metastore_id": types.StringType, + "page_token": types.StringType, + }, + } +} + type ListSystemSchemasResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of system schema information objects. - Schemas []SystemSchemaInfo `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` } func (newState *ListSystemSchemasResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListSystemSchemasResponse) { @@ -2786,13 +10960,76 @@ func (newState *ListSystemSchemasResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListSystemSchemasResponse) SyncEffectiveFieldsDuringRead(existingState ListSystemSchemasResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSystemSchemasResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSystemSchemasResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "schemas": reflect.TypeOf(SystemSchemaInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSystemSchemasResponse +// only implements ToObjectValue() and Type(). +func (o ListSystemSchemasResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "schemas": o.Schemas, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSystemSchemasResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "schemas": basetypes.ListType{ + ElemType: SystemSchemaInfo{}.Type(ctx), + }, + }, + } +} + +// GetSchemas returns the value of the Schemas field in ListSystemSchemasResponse as +// a slice of SystemSchemaInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListSystemSchemasResponse) GetSchemas(ctx context.Context) ([]SystemSchemaInfo, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []SystemSchemaInfo + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in ListSystemSchemasResponse. +func (o *ListSystemSchemasResponse) SetSchemas(ctx context.Context, v []SystemSchemaInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + type ListTableSummariesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // List of table summaries. - Tables []TableSummary `tfsdk:"tables" tf:"optional"` + Tables types.List `tfsdk:"tables" tf:"optional"` } func (newState *ListTableSummariesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListTableSummariesResponse) { @@ -2801,6 +11038,69 @@ func (newState *ListTableSummariesResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListTableSummariesResponse) SyncEffectiveFieldsDuringRead(existingState ListTableSummariesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTableSummariesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTableSummariesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tables": reflect.TypeOf(TableSummary{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTableSummariesResponse +// only implements ToObjectValue() and Type(). +func (o ListTableSummariesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "tables": o.Tables, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTableSummariesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "tables": basetypes.ListType{ + ElemType: TableSummary{}.Type(ctx), + }, + }, + } +} + +// GetTables returns the value of the Tables field in ListTableSummariesResponse as +// a slice of TableSummary values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListTableSummariesResponse) GetTables(ctx context.Context) ([]TableSummary, bool) { + if o.Tables.IsNull() || o.Tables.IsUnknown() { + return nil, false + } + var v []TableSummary + d := o.Tables.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTables sets the value of the Tables field in ListTableSummariesResponse. +func (o *ListTableSummariesResponse) SetTables(ctx context.Context, v []TableSummary) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tables"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tables = types.ListValueMust(t, vs) +} + // List tables type ListTablesRequest struct { // Name of parent catalog for tables of interest. @@ -2838,13 +11138,62 @@ func (newState *ListTablesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListTablesRequest) SyncEffectiveFieldsDuringRead(existingState ListTablesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTablesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTablesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTablesRequest +// only implements ToObjectValue() and Type(). +func (o ListTablesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "include_browse": o.IncludeBrowse, + "include_delta_metadata": o.IncludeDeltaMetadata, + "include_manifest_capabilities": o.IncludeManifestCapabilities, + "max_results": o.MaxResults, + "omit_columns": o.OmitColumns, + "omit_properties": o.OmitProperties, + "omit_username": o.OmitUsername, + "page_token": o.PageToken, + "schema_name": o.SchemaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTablesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "include_browse": types.BoolType, + "include_delta_metadata": types.BoolType, + "include_manifest_capabilities": types.BoolType, + "max_results": types.Int64Type, + "omit_columns": types.BoolType, + "omit_properties": types.BoolType, + "omit_username": types.BoolType, + "page_token": types.StringType, + "schema_name": types.StringType, + }, + } +} + type ListTablesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of table information objects. - Tables []TableInfo `tfsdk:"tables" tf:"optional"` + Tables types.List `tfsdk:"tables" tf:"optional"` } func (newState *ListTablesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListTablesResponse) { @@ -2853,6 +11202,69 @@ func (newState *ListTablesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListTablesResponse) SyncEffectiveFieldsDuringRead(existingState ListTablesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTablesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTablesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tables": reflect.TypeOf(TableInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTablesResponse +// only implements ToObjectValue() and Type(). +func (o ListTablesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "tables": o.Tables, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTablesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "tables": basetypes.ListType{ + ElemType: TableInfo{}.Type(ctx), + }, + }, + } +} + +// GetTables returns the value of the Tables field in ListTablesResponse as +// a slice of TableInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListTablesResponse) GetTables(ctx context.Context) ([]TableInfo, bool) { + if o.Tables.IsNull() || o.Tables.IsUnknown() { + return nil, false + } + var v []TableInfo + d := o.Tables.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTables sets the value of the Tables field in ListTablesResponse. +func (o *ListTablesResponse) SetTables(ctx context.Context, v []TableInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tables"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tables = types.ListValueMust(t, vs) +} + // List Volumes type ListVolumesRequest struct { // The identifier of the catalog @@ -2886,13 +11298,52 @@ func (newState *ListVolumesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListVolumesRequest) SyncEffectiveFieldsDuringRead(existingState ListVolumesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListVolumesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListVolumesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListVolumesRequest +// only implements ToObjectValue() and Type(). +func (o ListVolumesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "include_browse": o.IncludeBrowse, + "max_results": o.MaxResults, + "page_token": o.PageToken, + "schema_name": o.SchemaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListVolumesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "include_browse": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + "schema_name": types.StringType, + }, + } +} + type ListVolumesResponseContent struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request to retrieve the next page of results. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Volumes []VolumeInfo `tfsdk:"volumes" tf:"optional"` + Volumes types.List `tfsdk:"volumes" tf:"optional"` } func (newState *ListVolumesResponseContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListVolumesResponseContent) { @@ -2901,6 +11352,69 @@ func (newState *ListVolumesResponseContent) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListVolumesResponseContent) SyncEffectiveFieldsDuringRead(existingState ListVolumesResponseContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListVolumesResponseContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListVolumesResponseContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "volumes": reflect.TypeOf(VolumeInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListVolumesResponseContent +// only implements ToObjectValue() and Type(). +func (o ListVolumesResponseContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "volumes": o.Volumes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListVolumesResponseContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "volumes": basetypes.ListType{ + ElemType: VolumeInfo{}.Type(ctx), + }, + }, + } +} + +// GetVolumes returns the value of the Volumes field in ListVolumesResponseContent as +// a slice of VolumeInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListVolumesResponseContent) GetVolumes(ctx context.Context) ([]VolumeInfo, bool) { + if o.Volumes.IsNull() || o.Volumes.IsUnknown() { + return nil, false + } + var v []VolumeInfo + d := o.Volumes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetVolumes sets the value of the Volumes field in ListVolumesResponseContent. +func (o *ListVolumesResponseContent) SetVolumes(ctx context.Context, v []VolumeInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["volumes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Volumes = types.ListValueMust(t, vs) +} + type MetastoreAssignment struct { // The name of the default catalog in the metastore. DefaultCatalogName types.String `tfsdk:"default_catalog_name" tf:"optional"` @@ -2916,6 +11430,41 @@ func (newState *MetastoreAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *MetastoreAssignment) SyncEffectiveFieldsDuringRead(existingState MetastoreAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MetastoreAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MetastoreAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MetastoreAssignment +// only implements ToObjectValue() and Type(). +func (o MetastoreAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default_catalog_name": o.DefaultCatalogName, + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MetastoreAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default_catalog_name": types.StringType, + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type MetastoreInfo struct { // Cloud vendor of the metastore home shard (e.g., `aws`, `azure`, `gcp`). Cloud types.String `tfsdk:"cloud" tf:"optional"` @@ -2967,9 +11516,76 @@ func (newState *MetastoreInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Meta func (newState *MetastoreInfo) SyncEffectiveFieldsDuringRead(existingState MetastoreInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MetastoreInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MetastoreInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MetastoreInfo +// only implements ToObjectValue() and Type(). +func (o MetastoreInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cloud": o.Cloud, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "default_data_access_config_id": o.DefaultDataAccessConfigId, + "delta_sharing_organization_name": o.DeltaSharingOrganizationName, + "delta_sharing_recipient_token_lifetime_in_seconds": o.DeltaSharingRecipientTokenLifetimeInSeconds, + "delta_sharing_scope": o.DeltaSharingScope, + "external_access_enabled": o.ExternalAccessEnabled, + "global_metastore_id": o.GlobalMetastoreId, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "privilege_model_version": o.PrivilegeModelVersion, + "region": o.Region, + "storage_root": o.StorageRoot, + "storage_root_credential_id": o.StorageRootCredentialId, + "storage_root_credential_name": o.StorageRootCredentialName, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MetastoreInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cloud": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "default_data_access_config_id": types.StringType, + "delta_sharing_organization_name": types.StringType, + "delta_sharing_recipient_token_lifetime_in_seconds": types.Int64Type, + "delta_sharing_scope": types.StringType, + "external_access_enabled": types.BoolType, + "global_metastore_id": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "privilege_model_version": types.StringType, + "region": types.StringType, + "storage_root": types.StringType, + "storage_root_credential_id": types.StringType, + "storage_root_credential_name": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + type ModelVersionInfo struct { // List of aliases associated with the model version - Aliases []RegisteredModelAlias `tfsdk:"aliases" tf:"optional"` + Aliases types.List `tfsdk:"aliases" tf:"optional"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. @@ -2990,7 +11606,7 @@ type ModelVersionInfo struct { // parent schema ModelName types.String `tfsdk:"model_name" tf:"optional"` // Model version dependencies, for feature-store packaged models - ModelVersionDependencies []DependencyList `tfsdk:"model_version_dependencies" tf:"optional,object"` + ModelVersionDependencies types.List `tfsdk:"model_version_dependencies" tf:"optional,object"` // MLflow run ID used when creating the model version, if ``source`` was // generated by an experiment run stored in an MLflow tracking server RunId types.String `tfsdk:"run_id" tf:"optional"` @@ -3026,6 +11642,132 @@ func (newState *ModelVersionInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan M func (newState *ModelVersionInfo) SyncEffectiveFieldsDuringRead(existingState ModelVersionInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelVersionInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelVersionInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aliases": reflect.TypeOf(RegisteredModelAlias{}), + "model_version_dependencies": reflect.TypeOf(DependencyList{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelVersionInfo +// only implements ToObjectValue() and Type(). +func (o ModelVersionInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aliases": o.Aliases, + "browse_only": o.BrowseOnly, + "catalog_name": o.CatalogName, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "id": o.Id, + "metastore_id": o.MetastoreId, + "model_name": o.ModelName, + "model_version_dependencies": o.ModelVersionDependencies, + "run_id": o.RunId, + "run_workspace_id": o.RunWorkspaceId, + "schema_name": o.SchemaName, + "source": o.Source, + "status": o.Status, + "storage_location": o.StorageLocation, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelVersionInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aliases": basetypes.ListType{ + ElemType: RegisteredModelAlias{}.Type(ctx), + }, + "browse_only": types.BoolType, + "catalog_name": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "id": types.StringType, + "metastore_id": types.StringType, + "model_name": types.StringType, + "model_version_dependencies": basetypes.ListType{ + ElemType: DependencyList{}.Type(ctx), + }, + "run_id": types.StringType, + "run_workspace_id": types.Int64Type, + "schema_name": types.StringType, + "source": types.StringType, + "status": types.StringType, + "storage_location": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "version": types.Int64Type, + }, + } +} + +// GetAliases returns the value of the Aliases field in ModelVersionInfo as +// a slice of RegisteredModelAlias values. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelVersionInfo) GetAliases(ctx context.Context) ([]RegisteredModelAlias, bool) { + if o.Aliases.IsNull() || o.Aliases.IsUnknown() { + return nil, false + } + var v []RegisteredModelAlias + d := o.Aliases.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAliases sets the value of the Aliases field in ModelVersionInfo. +func (o *ModelVersionInfo) SetAliases(ctx context.Context, v []RegisteredModelAlias) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aliases"] + t = t.(attr.TypeWithElementType).ElementType() + o.Aliases = types.ListValueMust(t, vs) +} + +// GetModelVersionDependencies returns the value of the ModelVersionDependencies field in ModelVersionInfo as +// a DependencyList value. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelVersionInfo) GetModelVersionDependencies(ctx context.Context) (DependencyList, bool) { + var e DependencyList + if o.ModelVersionDependencies.IsNull() || o.ModelVersionDependencies.IsUnknown() { + return e, false + } + var v []DependencyList + d := o.ModelVersionDependencies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetModelVersionDependencies sets the value of the ModelVersionDependencies field in ModelVersionInfo. +func (o *ModelVersionInfo) SetModelVersionDependencies(ctx context.Context, v DependencyList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_version_dependencies"] + o.ModelVersionDependencies = types.ListValueMust(t, vs) +} + type MonitorCronSchedule struct { // Read only field that indicates whether a schedule is paused or not. PauseStatus types.String `tfsdk:"pause_status" tf:"optional"` @@ -3044,6 +11786,41 @@ func (newState *MonitorCronSchedule) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *MonitorCronSchedule) SyncEffectiveFieldsDuringRead(existingState MonitorCronSchedule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorCronSchedule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorCronSchedule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorCronSchedule +// only implements ToObjectValue() and Type(). +func (o MonitorCronSchedule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pause_status": o.PauseStatus, + "quartz_cron_expression": o.QuartzCronExpression, + "timezone_id": o.TimezoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorCronSchedule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pause_status": types.StringType, + "quartz_cron_expression": types.StringType, + "timezone_id": types.StringType, + }, + } +} + type MonitorDataClassificationConfig struct { // Whether data classification is enabled. Enabled types.Bool `tfsdk:"enabled" tf:"optional"` @@ -3055,10 +11832,41 @@ func (newState *MonitorDataClassificationConfig) SyncEffectiveFieldsDuringCreate func (newState *MonitorDataClassificationConfig) SyncEffectiveFieldsDuringRead(existingState MonitorDataClassificationConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorDataClassificationConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorDataClassificationConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorDataClassificationConfig +// only implements ToObjectValue() and Type(). +func (o MonitorDataClassificationConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorDataClassificationConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + }, + } +} + type MonitorDestination struct { // The list of email addresses to send the notification to. A maximum of 5 // email addresses is supported. - EmailAddresses []types.String `tfsdk:"email_addresses" tf:"optional"` + EmailAddresses types.List `tfsdk:"email_addresses" tf:"optional"` } func (newState *MonitorDestination) SyncEffectiveFieldsDuringCreateOrUpdate(plan MonitorDestination) { @@ -3067,12 +11875,73 @@ func (newState *MonitorDestination) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *MonitorDestination) SyncEffectiveFieldsDuringRead(existingState MonitorDestination) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorDestination. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorDestination) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "email_addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorDestination +// only implements ToObjectValue() and Type(). +func (o MonitorDestination) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "email_addresses": o.EmailAddresses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorDestination) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "email_addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetEmailAddresses returns the value of the EmailAddresses field in MonitorDestination as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorDestination) GetEmailAddresses(ctx context.Context) ([]types.String, bool) { + if o.EmailAddresses.IsNull() || o.EmailAddresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.EmailAddresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmailAddresses sets the value of the EmailAddresses field in MonitorDestination. +func (o *MonitorDestination) SetEmailAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmailAddresses = types.ListValueMust(t, vs) +} + type MonitorInferenceLog struct { // Granularities for aggregating data into time windows based on their // timestamp. Currently the following static granularities are supported: // {``"5 minutes"``, ``"30 minutes"``, ``"1 hour"``, ``"1 day"``, ``" // week(s)"``, ``"1 month"``, ``"1 year"``}. - Granularities []types.String `tfsdk:"granularities" tf:""` + Granularities types.List `tfsdk:"granularities" tf:""` // Optional column that contains the ground truth for the prediction. LabelCol types.String `tfsdk:"label_col" tf:"optional"` // Column that contains the id of the model generating the predictions. @@ -3104,6 +11973,79 @@ func (newState *MonitorInferenceLog) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *MonitorInferenceLog) SyncEffectiveFieldsDuringRead(existingState MonitorInferenceLog) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorInferenceLog. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorInferenceLog) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "granularities": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorInferenceLog +// only implements ToObjectValue() and Type(). +func (o MonitorInferenceLog) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "granularities": o.Granularities, + "label_col": o.LabelCol, + "model_id_col": o.ModelIdCol, + "prediction_col": o.PredictionCol, + "prediction_proba_col": o.PredictionProbaCol, + "problem_type": o.ProblemType, + "timestamp_col": o.TimestampCol, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorInferenceLog) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "granularities": basetypes.ListType{ + ElemType: types.StringType, + }, + "label_col": types.StringType, + "model_id_col": types.StringType, + "prediction_col": types.StringType, + "prediction_proba_col": types.StringType, + "problem_type": types.StringType, + "timestamp_col": types.StringType, + }, + } +} + +// GetGranularities returns the value of the Granularities field in MonitorInferenceLog as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInferenceLog) GetGranularities(ctx context.Context) ([]types.String, bool) { + if o.Granularities.IsNull() || o.Granularities.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Granularities.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGranularities sets the value of the Granularities field in MonitorInferenceLog. +func (o *MonitorInferenceLog) SetGranularities(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["granularities"] + t = t.(attr.TypeWithElementType).ElementType() + o.Granularities = types.ListValueMust(t, vs) +} + type MonitorInfo struct { // The directory to store monitoring assets (e.g. dashboard, metric tables). AssetsDir types.String `tfsdk:"assets_dir" tf:"optional"` @@ -3114,46 +12056,46 @@ type MonitorInfo struct { // Custom metrics to compute on the monitored table. These can be aggregate // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). - CustomMetrics []MonitorMetric `tfsdk:"custom_metrics" tf:"optional"` + CustomMetrics types.List `tfsdk:"custom_metrics" tf:"optional"` // Id of dashboard that visualizes the computed metrics. This can be empty // if the monitor is in PENDING state. DashboardId types.String `tfsdk:"dashboard_id" tf:"optional"` // The data classification config for the monitor. - DataClassificationConfig []MonitorDataClassificationConfig `tfsdk:"data_classification_config" tf:"optional,object"` + DataClassificationConfig types.List `tfsdk:"data_classification_config" tf:"optional,object"` // The full name of the drift metrics table. Format: // __catalog_name__.__schema_name__.__table_name__. DriftMetricsTableName types.String `tfsdk:"drift_metrics_table_name" tf:""` // Configuration for monitoring inference logs. - InferenceLog []MonitorInferenceLog `tfsdk:"inference_log" tf:"optional,object"` + InferenceLog types.List `tfsdk:"inference_log" tf:"optional,object"` // The latest failure message of the monitor (if any). LatestMonitorFailureMsg types.String `tfsdk:"latest_monitor_failure_msg" tf:"optional"` // The version of the monitor config (e.g. 1,2,3). If negative, the monitor // may be corrupted. MonitorVersion types.String `tfsdk:"monitor_version" tf:""` // The notification settings for the monitor. - Notifications []MonitorNotifications `tfsdk:"notifications" tf:"optional,object"` + Notifications types.List `tfsdk:"notifications" tf:"optional,object"` // Schema where output metric tables are created. OutputSchemaName types.String `tfsdk:"output_schema_name" tf:"optional"` // The full name of the profile metrics table. Format: // __catalog_name__.__schema_name__.__table_name__. ProfileMetricsTableName types.String `tfsdk:"profile_metrics_table_name" tf:""` // The schedule for automatically updating and refreshing metric tables. - Schedule []MonitorCronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // List of column expressions to slice data with for targeted analysis. The // data is grouped by each expression independently, resulting in a separate // slice for each predicate and its complements. For high-cardinality // columns, only the top 100 unique values by frequency will generate // slices. - SlicingExprs []types.String `tfsdk:"slicing_exprs" tf:"optional"` + SlicingExprs types.List `tfsdk:"slicing_exprs" tf:"optional"` // Configuration for monitoring snapshot tables. - Snapshot []MonitorSnapshot `tfsdk:"snapshot" tf:"optional,object"` + Snapshot types.List `tfsdk:"snapshot" tf:"optional,object"` // The status of the monitor. Status types.String `tfsdk:"status" tf:""` // The full name of the table to monitor. Format: // __catalog_name__.__schema_name__.__table_name__. TableName types.String `tfsdk:"table_name" tf:""` // Configuration for monitoring time series tables. - TimeSeries []MonitorTimeSeries `tfsdk:"time_series" tf:"optional,object"` + TimeSeries types.List `tfsdk:"time_series" tf:"optional,object"` } func (newState *MonitorInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan MonitorInfo) { @@ -3162,6 +12104,304 @@ func (newState *MonitorInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Monito func (newState *MonitorInfo) SyncEffectiveFieldsDuringRead(existingState MonitorInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "custom_metrics": reflect.TypeOf(MonitorMetric{}), + "data_classification_config": reflect.TypeOf(MonitorDataClassificationConfig{}), + "inference_log": reflect.TypeOf(MonitorInferenceLog{}), + "notifications": reflect.TypeOf(MonitorNotifications{}), + "schedule": reflect.TypeOf(MonitorCronSchedule{}), + "slicing_exprs": reflect.TypeOf(types.String{}), + "snapshot": reflect.TypeOf(MonitorSnapshot{}), + "time_series": reflect.TypeOf(MonitorTimeSeries{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorInfo +// only implements ToObjectValue() and Type(). +func (o MonitorInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assets_dir": o.AssetsDir, + "baseline_table_name": o.BaselineTableName, + "custom_metrics": o.CustomMetrics, + "dashboard_id": o.DashboardId, + "data_classification_config": o.DataClassificationConfig, + "drift_metrics_table_name": o.DriftMetricsTableName, + "inference_log": o.InferenceLog, + "latest_monitor_failure_msg": o.LatestMonitorFailureMsg, + "monitor_version": o.MonitorVersion, + "notifications": o.Notifications, + "output_schema_name": o.OutputSchemaName, + "profile_metrics_table_name": o.ProfileMetricsTableName, + "schedule": o.Schedule, + "slicing_exprs": o.SlicingExprs, + "snapshot": o.Snapshot, + "status": o.Status, + "table_name": o.TableName, + "time_series": o.TimeSeries, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assets_dir": types.StringType, + "baseline_table_name": types.StringType, + "custom_metrics": basetypes.ListType{ + ElemType: MonitorMetric{}.Type(ctx), + }, + "dashboard_id": types.StringType, + "data_classification_config": basetypes.ListType{ + ElemType: MonitorDataClassificationConfig{}.Type(ctx), + }, + "drift_metrics_table_name": types.StringType, + "inference_log": basetypes.ListType{ + ElemType: MonitorInferenceLog{}.Type(ctx), + }, + "latest_monitor_failure_msg": types.StringType, + "monitor_version": types.StringType, + "notifications": basetypes.ListType{ + ElemType: MonitorNotifications{}.Type(ctx), + }, + "output_schema_name": types.StringType, + "profile_metrics_table_name": types.StringType, + "schedule": basetypes.ListType{ + ElemType: MonitorCronSchedule{}.Type(ctx), + }, + "slicing_exprs": basetypes.ListType{ + ElemType: types.StringType, + }, + "snapshot": basetypes.ListType{ + ElemType: MonitorSnapshot{}.Type(ctx), + }, + "status": types.StringType, + "table_name": types.StringType, + "time_series": basetypes.ListType{ + ElemType: MonitorTimeSeries{}.Type(ctx), + }, + }, + } +} + +// GetCustomMetrics returns the value of the CustomMetrics field in MonitorInfo as +// a slice of MonitorMetric values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetCustomMetrics(ctx context.Context) ([]MonitorMetric, bool) { + if o.CustomMetrics.IsNull() || o.CustomMetrics.IsUnknown() { + return nil, false + } + var v []MonitorMetric + d := o.CustomMetrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomMetrics sets the value of the CustomMetrics field in MonitorInfo. +func (o *MonitorInfo) SetCustomMetrics(ctx context.Context, v []MonitorMetric) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_metrics"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomMetrics = types.ListValueMust(t, vs) +} + +// GetDataClassificationConfig returns the value of the DataClassificationConfig field in MonitorInfo as +// a MonitorDataClassificationConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetDataClassificationConfig(ctx context.Context) (MonitorDataClassificationConfig, bool) { + var e MonitorDataClassificationConfig + if o.DataClassificationConfig.IsNull() || o.DataClassificationConfig.IsUnknown() { + return e, false + } + var v []MonitorDataClassificationConfig + d := o.DataClassificationConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataClassificationConfig sets the value of the DataClassificationConfig field in MonitorInfo. +func (o *MonitorInfo) SetDataClassificationConfig(ctx context.Context, v MonitorDataClassificationConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_classification_config"] + o.DataClassificationConfig = types.ListValueMust(t, vs) +} + +// GetInferenceLog returns the value of the InferenceLog field in MonitorInfo as +// a MonitorInferenceLog value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetInferenceLog(ctx context.Context) (MonitorInferenceLog, bool) { + var e MonitorInferenceLog + if o.InferenceLog.IsNull() || o.InferenceLog.IsUnknown() { + return e, false + } + var v []MonitorInferenceLog + d := o.InferenceLog.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInferenceLog sets the value of the InferenceLog field in MonitorInfo. +func (o *MonitorInfo) SetInferenceLog(ctx context.Context, v MonitorInferenceLog) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inference_log"] + o.InferenceLog = types.ListValueMust(t, vs) +} + +// GetNotifications returns the value of the Notifications field in MonitorInfo as +// a MonitorNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetNotifications(ctx context.Context) (MonitorNotifications, bool) { + var e MonitorNotifications + if o.Notifications.IsNull() || o.Notifications.IsUnknown() { + return e, false + } + var v []MonitorNotifications + d := o.Notifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotifications sets the value of the Notifications field in MonitorInfo. +func (o *MonitorInfo) SetNotifications(ctx context.Context, v MonitorNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notifications"] + o.Notifications = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in MonitorInfo as +// a MonitorCronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetSchedule(ctx context.Context) (MonitorCronSchedule, bool) { + var e MonitorCronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []MonitorCronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in MonitorInfo. +func (o *MonitorInfo) SetSchedule(ctx context.Context, v MonitorCronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetSlicingExprs returns the value of the SlicingExprs field in MonitorInfo as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetSlicingExprs(ctx context.Context) ([]types.String, bool) { + if o.SlicingExprs.IsNull() || o.SlicingExprs.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SlicingExprs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSlicingExprs sets the value of the SlicingExprs field in MonitorInfo. +func (o *MonitorInfo) SetSlicingExprs(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["slicing_exprs"] + t = t.(attr.TypeWithElementType).ElementType() + o.SlicingExprs = types.ListValueMust(t, vs) +} + +// GetSnapshot returns the value of the Snapshot field in MonitorInfo as +// a MonitorSnapshot value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetSnapshot(ctx context.Context) (MonitorSnapshot, bool) { + var e MonitorSnapshot + if o.Snapshot.IsNull() || o.Snapshot.IsUnknown() { + return e, false + } + var v []MonitorSnapshot + d := o.Snapshot.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSnapshot sets the value of the Snapshot field in MonitorInfo. +func (o *MonitorInfo) SetSnapshot(ctx context.Context, v MonitorSnapshot) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["snapshot"] + o.Snapshot = types.ListValueMust(t, vs) +} + +// GetTimeSeries returns the value of the TimeSeries field in MonitorInfo as +// a MonitorTimeSeries value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorInfo) GetTimeSeries(ctx context.Context) (MonitorTimeSeries, bool) { + var e MonitorTimeSeries + if o.TimeSeries.IsNull() || o.TimeSeries.IsUnknown() { + return e, false + } + var v []MonitorTimeSeries + d := o.TimeSeries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTimeSeries sets the value of the TimeSeries field in MonitorInfo. +func (o *MonitorInfo) SetTimeSeries(ctx context.Context, v MonitorTimeSeries) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["time_series"] + o.TimeSeries = types.ListValueMust(t, vs) +} + type MonitorMetric struct { // Jinja template for a SQL expression that specifies how to compute the // metric. See [create metric definition]. @@ -3171,7 +12411,7 @@ type MonitorMetric struct { // A list of column names in the input table the metric should be computed // for. Can use ``":table"`` to indicate that the metric needs information // from multiple columns. - InputColumns []types.String `tfsdk:"input_columns" tf:""` + InputColumns types.List `tfsdk:"input_columns" tf:""` // Name of the metric in the output tables. Name types.String `tfsdk:"name" tf:""` // The output type of the custom metric. @@ -3186,7 +12426,7 @@ type MonitorMetric struct { // table - CUSTOM_METRIC_TYPE_DERIVED: depend on previously computed // aggregate metrics - CUSTOM_METRIC_TYPE_DRIFT: depend on previously // computed aggregate or derived metrics - Type types.String `tfsdk:"type" tf:""` + Type_ types.String `tfsdk:"type" tf:""` } func (newState *MonitorMetric) SyncEffectiveFieldsDuringCreateOrUpdate(plan MonitorMetric) { @@ -3195,12 +12435,81 @@ func (newState *MonitorMetric) SyncEffectiveFieldsDuringCreateOrUpdate(plan Moni func (newState *MonitorMetric) SyncEffectiveFieldsDuringRead(existingState MonitorMetric) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorMetric. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorMetric) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "input_columns": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorMetric +// only implements ToObjectValue() and Type(). +func (o MonitorMetric) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "definition": o.Definition, + "input_columns": o.InputColumns, + "name": o.Name, + "output_data_type": o.OutputDataType, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorMetric) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "definition": types.StringType, + "input_columns": basetypes.ListType{ + ElemType: types.StringType, + }, + "name": types.StringType, + "output_data_type": types.StringType, + "type": types.StringType, + }, + } +} + +// GetInputColumns returns the value of the InputColumns field in MonitorMetric as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorMetric) GetInputColumns(ctx context.Context) ([]types.String, bool) { + if o.InputColumns.IsNull() || o.InputColumns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InputColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInputColumns sets the value of the InputColumns field in MonitorMetric. +func (o *MonitorMetric) SetInputColumns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["input_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.InputColumns = types.ListValueMust(t, vs) +} + type MonitorNotifications struct { // Who to send notifications to on monitor failure. - OnFailure []MonitorDestination `tfsdk:"on_failure" tf:"optional,object"` + OnFailure types.List `tfsdk:"on_failure" tf:"optional,object"` // Who to send notifications to when new data classification tags are // detected. - OnNewClassificationTagDetected []MonitorDestination `tfsdk:"on_new_classification_tag_detected" tf:"optional,object"` + OnNewClassificationTagDetected types.List `tfsdk:"on_new_classification_tag_detected" tf:"optional,object"` } func (newState *MonitorNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(plan MonitorNotifications) { @@ -3209,6 +12518,98 @@ func (newState *MonitorNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *MonitorNotifications) SyncEffectiveFieldsDuringRead(existingState MonitorNotifications) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorNotifications. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorNotifications) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "on_failure": reflect.TypeOf(MonitorDestination{}), + "on_new_classification_tag_detected": reflect.TypeOf(MonitorDestination{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorNotifications +// only implements ToObjectValue() and Type(). +func (o MonitorNotifications) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "on_failure": o.OnFailure, + "on_new_classification_tag_detected": o.OnNewClassificationTagDetected, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorNotifications) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "on_failure": basetypes.ListType{ + ElemType: MonitorDestination{}.Type(ctx), + }, + "on_new_classification_tag_detected": basetypes.ListType{ + ElemType: MonitorDestination{}.Type(ctx), + }, + }, + } +} + +// GetOnFailure returns the value of the OnFailure field in MonitorNotifications as +// a MonitorDestination value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorNotifications) GetOnFailure(ctx context.Context) (MonitorDestination, bool) { + var e MonitorDestination + if o.OnFailure.IsNull() || o.OnFailure.IsUnknown() { + return e, false + } + var v []MonitorDestination + d := o.OnFailure.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOnFailure sets the value of the OnFailure field in MonitorNotifications. +func (o *MonitorNotifications) SetOnFailure(ctx context.Context, v MonitorDestination) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_failure"] + o.OnFailure = types.ListValueMust(t, vs) +} + +// GetOnNewClassificationTagDetected returns the value of the OnNewClassificationTagDetected field in MonitorNotifications as +// a MonitorDestination value. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorNotifications) GetOnNewClassificationTagDetected(ctx context.Context) (MonitorDestination, bool) { + var e MonitorDestination + if o.OnNewClassificationTagDetected.IsNull() || o.OnNewClassificationTagDetected.IsUnknown() { + return e, false + } + var v []MonitorDestination + d := o.OnNewClassificationTagDetected.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOnNewClassificationTagDetected sets the value of the OnNewClassificationTagDetected field in MonitorNotifications. +func (o *MonitorNotifications) SetOnNewClassificationTagDetected(ctx context.Context, v MonitorDestination) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_new_classification_tag_detected"] + o.OnNewClassificationTagDetected = types.ListValueMust(t, vs) +} + type MonitorRefreshInfo struct { // Time at which refresh operation completed (milliseconds since 1/1/1970 // UTC). @@ -3233,9 +12634,50 @@ func (newState *MonitorRefreshInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *MonitorRefreshInfo) SyncEffectiveFieldsDuringRead(existingState MonitorRefreshInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorRefreshInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorRefreshInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorRefreshInfo +// only implements ToObjectValue() and Type(). +func (o MonitorRefreshInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end_time_ms": o.EndTimeMs, + "message": o.Message, + "refresh_id": o.RefreshId, + "start_time_ms": o.StartTimeMs, + "state": o.State, + "trigger": o.Trigger, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorRefreshInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end_time_ms": types.Int64Type, + "message": types.StringType, + "refresh_id": types.Int64Type, + "start_time_ms": types.Int64Type, + "state": types.StringType, + "trigger": types.StringType, + }, + } +} + type MonitorRefreshListResponse struct { // List of refreshes. - Refreshes []MonitorRefreshInfo `tfsdk:"refreshes" tf:"optional"` + Refreshes types.List `tfsdk:"refreshes" tf:"optional"` } func (newState *MonitorRefreshListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan MonitorRefreshListResponse) { @@ -3244,6 +12686,67 @@ func (newState *MonitorRefreshListResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *MonitorRefreshListResponse) SyncEffectiveFieldsDuringRead(existingState MonitorRefreshListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorRefreshListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorRefreshListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "refreshes": reflect.TypeOf(MonitorRefreshInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorRefreshListResponse +// only implements ToObjectValue() and Type(). +func (o MonitorRefreshListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "refreshes": o.Refreshes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorRefreshListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "refreshes": basetypes.ListType{ + ElemType: MonitorRefreshInfo{}.Type(ctx), + }, + }, + } +} + +// GetRefreshes returns the value of the Refreshes field in MonitorRefreshListResponse as +// a slice of MonitorRefreshInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorRefreshListResponse) GetRefreshes(ctx context.Context) ([]MonitorRefreshInfo, bool) { + if o.Refreshes.IsNull() || o.Refreshes.IsUnknown() { + return nil, false + } + var v []MonitorRefreshInfo + d := o.Refreshes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRefreshes sets the value of the Refreshes field in MonitorRefreshListResponse. +func (o *MonitorRefreshListResponse) SetRefreshes(ctx context.Context, v []MonitorRefreshInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["refreshes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Refreshes = types.ListValueMust(t, vs) +} + type MonitorSnapshot struct { } @@ -3253,12 +12756,39 @@ func (newState *MonitorSnapshot) SyncEffectiveFieldsDuringCreateOrUpdate(plan Mo func (newState *MonitorSnapshot) SyncEffectiveFieldsDuringRead(existingState MonitorSnapshot) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorSnapshot. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorSnapshot) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorSnapshot +// only implements ToObjectValue() and Type(). +func (o MonitorSnapshot) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorSnapshot) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type MonitorTimeSeries struct { // Granularities for aggregating data into time windows based on their // timestamp. Currently the following static granularities are supported: // {``"5 minutes"``, ``"30 minutes"``, ``"1 hour"``, ``"1 day"``, ``" // week(s)"``, ``"1 month"``, ``"1 year"``}. - Granularities []types.String `tfsdk:"granularities" tf:""` + Granularities types.List `tfsdk:"granularities" tf:""` // Column that contains the timestamps of requests. The column must be one // of the following: - A ``TimestampType`` column - A column whose values // can be converted to timestamps through the pyspark ``to_timestamp`` @@ -3274,6 +12804,69 @@ func (newState *MonitorTimeSeries) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *MonitorTimeSeries) SyncEffectiveFieldsDuringRead(existingState MonitorTimeSeries) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MonitorTimeSeries. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MonitorTimeSeries) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "granularities": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MonitorTimeSeries +// only implements ToObjectValue() and Type(). +func (o MonitorTimeSeries) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "granularities": o.Granularities, + "timestamp_col": o.TimestampCol, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MonitorTimeSeries) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "granularities": basetypes.ListType{ + ElemType: types.StringType, + }, + "timestamp_col": types.StringType, + }, + } +} + +// GetGranularities returns the value of the Granularities field in MonitorTimeSeries as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *MonitorTimeSeries) GetGranularities(ctx context.Context) ([]types.String, bool) { + if o.Granularities.IsNull() || o.Granularities.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Granularities.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGranularities sets the value of the Granularities field in MonitorTimeSeries. +func (o *MonitorTimeSeries) SetGranularities(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["granularities"] + t = t.(attr.TypeWithElementType).ElementType() + o.Granularities = types.ListValueMust(t, vs) +} + type NamedTableConstraint struct { // The name of the constraint. Name types.String `tfsdk:"name" tf:""` @@ -3285,14 +12878,45 @@ func (newState *NamedTableConstraint) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *NamedTableConstraint) SyncEffectiveFieldsDuringRead(existingState NamedTableConstraint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NamedTableConstraint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NamedTableConstraint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NamedTableConstraint +// only implements ToObjectValue() and Type(). +func (o NamedTableConstraint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NamedTableConstraint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Online Table information. type OnlineTable struct { // Full three-part (catalog, schema, table) name of the table. Name types.String `tfsdk:"name" tf:"optional"` // Specification of the online table. - Spec []OnlineTableSpec `tfsdk:"spec" tf:"optional,object"` + Spec types.List `tfsdk:"spec" tf:"optional,object"` // Online Table data synchronization status - Status []OnlineTableStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` // Data serving REST API URL for this table TableServingUrl types.String `tfsdk:"table_serving_url" tf:"computed,optional"` // The provisioning state of the online table entity in Unity Catalog. This @@ -3308,6 +12932,104 @@ func (newState *OnlineTable) SyncEffectiveFieldsDuringCreateOrUpdate(plan Online func (newState *OnlineTable) SyncEffectiveFieldsDuringRead(existingState OnlineTable) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OnlineTable. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OnlineTable) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "spec": reflect.TypeOf(OnlineTableSpec{}), + "status": reflect.TypeOf(OnlineTableStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OnlineTable +// only implements ToObjectValue() and Type(). +func (o OnlineTable) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "spec": o.Spec, + "status": o.Status, + "table_serving_url": o.TableServingUrl, + "unity_catalog_provisioning_state": o.UnityCatalogProvisioningState, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o OnlineTable) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "spec": basetypes.ListType{ + ElemType: OnlineTableSpec{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: OnlineTableStatus{}.Type(ctx), + }, + "table_serving_url": types.StringType, + "unity_catalog_provisioning_state": types.StringType, + }, + } +} + +// GetSpec returns the value of the Spec field in OnlineTable as +// a OnlineTableSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTable) GetSpec(ctx context.Context) (OnlineTableSpec, bool) { + var e OnlineTableSpec + if o.Spec.IsNull() || o.Spec.IsUnknown() { + return e, false + } + var v []OnlineTableSpec + d := o.Spec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSpec sets the value of the Spec field in OnlineTable. +func (o *OnlineTable) SetSpec(ctx context.Context, v OnlineTableSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spec"] + o.Spec = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in OnlineTable as +// a OnlineTableStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTable) GetStatus(ctx context.Context) (OnlineTableStatus, bool) { + var e OnlineTableStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []OnlineTableStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in OnlineTable. +func (o *OnlineTable) SetStatus(ctx context.Context, v OnlineTableStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + // Specification of an online table. type OnlineTableSpec struct { // Whether to create a full-copy pipeline -- a pipeline that stops after @@ -3322,12 +13044,12 @@ type OnlineTableSpec struct { // the caller. PipelineId types.String `tfsdk:"pipeline_id" tf:"computed,optional"` // Primary Key columns to be used for data insert/update in the destination. - PrimaryKeyColumns []types.String `tfsdk:"primary_key_columns" tf:"optional"` + PrimaryKeyColumns types.List `tfsdk:"primary_key_columns" tf:"optional"` // Pipeline runs continuously after generating the initial data. - RunContinuously []OnlineTableSpecContinuousSchedulingPolicy `tfsdk:"run_continuously" tf:"optional,object"` + RunContinuously types.List `tfsdk:"run_continuously" tf:"optional,object"` // Pipeline stops after generating the initial data and can be triggered // later (manually, through a cron job or through data triggers) - RunTriggered []OnlineTableSpecTriggeredSchedulingPolicy `tfsdk:"run_triggered" tf:"optional,object"` + RunTriggered types.List `tfsdk:"run_triggered" tf:"optional,object"` // Three-part (catalog, schema, table) name of the source Delta table. SourceTableFullName types.String `tfsdk:"source_table_full_name" tf:"optional"` // Time series key to deduplicate (tie-break) rows with the same primary @@ -3341,6 +13063,137 @@ func (newState *OnlineTableSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan On func (newState *OnlineTableSpec) SyncEffectiveFieldsDuringRead(existingState OnlineTableSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OnlineTableSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OnlineTableSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "primary_key_columns": reflect.TypeOf(types.String{}), + "run_continuously": reflect.TypeOf(OnlineTableSpecContinuousSchedulingPolicy{}), + "run_triggered": reflect.TypeOf(OnlineTableSpecTriggeredSchedulingPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OnlineTableSpec +// only implements ToObjectValue() and Type(). +func (o OnlineTableSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "perform_full_copy": o.PerformFullCopy, + "pipeline_id": o.PipelineId, + "primary_key_columns": o.PrimaryKeyColumns, + "run_continuously": o.RunContinuously, + "run_triggered": o.RunTriggered, + "source_table_full_name": o.SourceTableFullName, + "timeseries_key": o.TimeseriesKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o OnlineTableSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "perform_full_copy": types.BoolType, + "pipeline_id": types.StringType, + "primary_key_columns": basetypes.ListType{ + ElemType: types.StringType, + }, + "run_continuously": basetypes.ListType{ + ElemType: OnlineTableSpecContinuousSchedulingPolicy{}.Type(ctx), + }, + "run_triggered": basetypes.ListType{ + ElemType: OnlineTableSpecTriggeredSchedulingPolicy{}.Type(ctx), + }, + "source_table_full_name": types.StringType, + "timeseries_key": types.StringType, + }, + } +} + +// GetPrimaryKeyColumns returns the value of the PrimaryKeyColumns field in OnlineTableSpec as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableSpec) GetPrimaryKeyColumns(ctx context.Context) ([]types.String, bool) { + if o.PrimaryKeyColumns.IsNull() || o.PrimaryKeyColumns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PrimaryKeyColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrimaryKeyColumns sets the value of the PrimaryKeyColumns field in OnlineTableSpec. +func (o *OnlineTableSpec) SetPrimaryKeyColumns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["primary_key_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.PrimaryKeyColumns = types.ListValueMust(t, vs) +} + +// GetRunContinuously returns the value of the RunContinuously field in OnlineTableSpec as +// a OnlineTableSpecContinuousSchedulingPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableSpec) GetRunContinuously(ctx context.Context) (OnlineTableSpecContinuousSchedulingPolicy, bool) { + var e OnlineTableSpecContinuousSchedulingPolicy + if o.RunContinuously.IsNull() || o.RunContinuously.IsUnknown() { + return e, false + } + var v []OnlineTableSpecContinuousSchedulingPolicy + d := o.RunContinuously.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunContinuously sets the value of the RunContinuously field in OnlineTableSpec. +func (o *OnlineTableSpec) SetRunContinuously(ctx context.Context, v OnlineTableSpecContinuousSchedulingPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_continuously"] + o.RunContinuously = types.ListValueMust(t, vs) +} + +// GetRunTriggered returns the value of the RunTriggered field in OnlineTableSpec as +// a OnlineTableSpecTriggeredSchedulingPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableSpec) GetRunTriggered(ctx context.Context) (OnlineTableSpecTriggeredSchedulingPolicy, bool) { + var e OnlineTableSpecTriggeredSchedulingPolicy + if o.RunTriggered.IsNull() || o.RunTriggered.IsUnknown() { + return e, false + } + var v []OnlineTableSpecTriggeredSchedulingPolicy + d := o.RunTriggered.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunTriggered sets the value of the RunTriggered field in OnlineTableSpec. +func (o *OnlineTableSpec) SetRunTriggered(ctx context.Context, v OnlineTableSpecTriggeredSchedulingPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_triggered"] + o.RunTriggered = types.ListValueMust(t, vs) +} + type OnlineTableSpecContinuousSchedulingPolicy struct { } @@ -3350,6 +13203,33 @@ func (newState *OnlineTableSpecContinuousSchedulingPolicy) SyncEffectiveFieldsDu func (newState *OnlineTableSpecContinuousSchedulingPolicy) SyncEffectiveFieldsDuringRead(existingState OnlineTableSpecContinuousSchedulingPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OnlineTableSpecContinuousSchedulingPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OnlineTableSpecContinuousSchedulingPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OnlineTableSpecContinuousSchedulingPolicy +// only implements ToObjectValue() and Type(). +func (o OnlineTableSpecContinuousSchedulingPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o OnlineTableSpecContinuousSchedulingPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type OnlineTableSpecTriggeredSchedulingPolicy struct { } @@ -3359,25 +13239,52 @@ func (newState *OnlineTableSpecTriggeredSchedulingPolicy) SyncEffectiveFieldsDur func (newState *OnlineTableSpecTriggeredSchedulingPolicy) SyncEffectiveFieldsDuringRead(existingState OnlineTableSpecTriggeredSchedulingPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OnlineTableSpecTriggeredSchedulingPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OnlineTableSpecTriggeredSchedulingPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OnlineTableSpecTriggeredSchedulingPolicy +// only implements ToObjectValue() and Type(). +func (o OnlineTableSpecTriggeredSchedulingPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o OnlineTableSpecTriggeredSchedulingPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Status of an online table. type OnlineTableStatus struct { // Detailed status of an online table. Shown if the online table is in the // ONLINE_CONTINUOUS_UPDATE or the ONLINE_UPDATING_PIPELINE_RESOURCES state. - ContinuousUpdateStatus []ContinuousUpdateStatus `tfsdk:"continuous_update_status" tf:"optional,object"` + ContinuousUpdateStatus types.List `tfsdk:"continuous_update_status" tf:"optional,object"` // The state of the online table. DetailedState types.String `tfsdk:"detailed_state" tf:"optional"` // Detailed status of an online table. Shown if the online table is in the // OFFLINE_FAILED or the ONLINE_PIPELINE_FAILED state. - FailedStatus []FailedStatus `tfsdk:"failed_status" tf:"optional,object"` + FailedStatus types.List `tfsdk:"failed_status" tf:"optional,object"` // A text description of the current state of the online table. Message types.String `tfsdk:"message" tf:"optional"` // Detailed status of an online table. Shown if the online table is in the // PROVISIONING_PIPELINE_RESOURCES or the PROVISIONING_INITIAL_SNAPSHOT // state. - ProvisioningStatus []ProvisioningStatus `tfsdk:"provisioning_status" tf:"optional,object"` + ProvisioningStatus types.List `tfsdk:"provisioning_status" tf:"optional,object"` // Detailed status of an online table. Shown if the online table is in the // ONLINE_TRIGGERED_UPDATE or the ONLINE_NO_PENDING_UPDATE state. - TriggeredUpdateStatus []TriggeredUpdateStatus `tfsdk:"triggered_update_status" tf:"optional,object"` + TriggeredUpdateStatus types.List `tfsdk:"triggered_update_status" tf:"optional,object"` } func (newState *OnlineTableStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan OnlineTableStatus) { @@ -3386,13 +13293,171 @@ func (newState *OnlineTableStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *OnlineTableStatus) SyncEffectiveFieldsDuringRead(existingState OnlineTableStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OnlineTableStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OnlineTableStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "continuous_update_status": reflect.TypeOf(ContinuousUpdateStatus{}), + "failed_status": reflect.TypeOf(FailedStatus{}), + "provisioning_status": reflect.TypeOf(ProvisioningStatus{}), + "triggered_update_status": reflect.TypeOf(TriggeredUpdateStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OnlineTableStatus +// only implements ToObjectValue() and Type(). +func (o OnlineTableStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "continuous_update_status": o.ContinuousUpdateStatus, + "detailed_state": o.DetailedState, + "failed_status": o.FailedStatus, + "message": o.Message, + "provisioning_status": o.ProvisioningStatus, + "triggered_update_status": o.TriggeredUpdateStatus, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o OnlineTableStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "continuous_update_status": basetypes.ListType{ + ElemType: ContinuousUpdateStatus{}.Type(ctx), + }, + "detailed_state": types.StringType, + "failed_status": basetypes.ListType{ + ElemType: FailedStatus{}.Type(ctx), + }, + "message": types.StringType, + "provisioning_status": basetypes.ListType{ + ElemType: ProvisioningStatus{}.Type(ctx), + }, + "triggered_update_status": basetypes.ListType{ + ElemType: TriggeredUpdateStatus{}.Type(ctx), + }, + }, + } +} + +// GetContinuousUpdateStatus returns the value of the ContinuousUpdateStatus field in OnlineTableStatus as +// a ContinuousUpdateStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableStatus) GetContinuousUpdateStatus(ctx context.Context) (ContinuousUpdateStatus, bool) { + var e ContinuousUpdateStatus + if o.ContinuousUpdateStatus.IsNull() || o.ContinuousUpdateStatus.IsUnknown() { + return e, false + } + var v []ContinuousUpdateStatus + d := o.ContinuousUpdateStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetContinuousUpdateStatus sets the value of the ContinuousUpdateStatus field in OnlineTableStatus. +func (o *OnlineTableStatus) SetContinuousUpdateStatus(ctx context.Context, v ContinuousUpdateStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["continuous_update_status"] + o.ContinuousUpdateStatus = types.ListValueMust(t, vs) +} + +// GetFailedStatus returns the value of the FailedStatus field in OnlineTableStatus as +// a FailedStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableStatus) GetFailedStatus(ctx context.Context) (FailedStatus, bool) { + var e FailedStatus + if o.FailedStatus.IsNull() || o.FailedStatus.IsUnknown() { + return e, false + } + var v []FailedStatus + d := o.FailedStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFailedStatus sets the value of the FailedStatus field in OnlineTableStatus. +func (o *OnlineTableStatus) SetFailedStatus(ctx context.Context, v FailedStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["failed_status"] + o.FailedStatus = types.ListValueMust(t, vs) +} + +// GetProvisioningStatus returns the value of the ProvisioningStatus field in OnlineTableStatus as +// a ProvisioningStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableStatus) GetProvisioningStatus(ctx context.Context) (ProvisioningStatus, bool) { + var e ProvisioningStatus + if o.ProvisioningStatus.IsNull() || o.ProvisioningStatus.IsUnknown() { + return e, false + } + var v []ProvisioningStatus + d := o.ProvisioningStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvisioningStatus sets the value of the ProvisioningStatus field in OnlineTableStatus. +func (o *OnlineTableStatus) SetProvisioningStatus(ctx context.Context, v ProvisioningStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provisioning_status"] + o.ProvisioningStatus = types.ListValueMust(t, vs) +} + +// GetTriggeredUpdateStatus returns the value of the TriggeredUpdateStatus field in OnlineTableStatus as +// a TriggeredUpdateStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *OnlineTableStatus) GetTriggeredUpdateStatus(ctx context.Context) (TriggeredUpdateStatus, bool) { + var e TriggeredUpdateStatus + if o.TriggeredUpdateStatus.IsNull() || o.TriggeredUpdateStatus.IsUnknown() { + return e, false + } + var v []TriggeredUpdateStatus + d := o.TriggeredUpdateStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTriggeredUpdateStatus sets the value of the TriggeredUpdateStatus field in OnlineTableStatus. +func (o *OnlineTableStatus) SetTriggeredUpdateStatus(ctx context.Context, v TriggeredUpdateStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["triggered_update_status"] + o.TriggeredUpdateStatus = types.ListValueMust(t, vs) +} + type PermissionsChange struct { // The set of privileges to add. - Add []types.String `tfsdk:"add" tf:"optional"` + Add types.List `tfsdk:"add" tf:"optional"` // The principal whose privileges we are changing. Principal types.String `tfsdk:"principal" tf:"optional"` // The set of privileges to remove. - Remove []types.String `tfsdk:"remove" tf:"optional"` + Remove types.List `tfsdk:"remove" tf:"optional"` } func (newState *PermissionsChange) SyncEffectiveFieldsDuringCreateOrUpdate(plan PermissionsChange) { @@ -3401,9 +13466,103 @@ func (newState *PermissionsChange) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PermissionsChange) SyncEffectiveFieldsDuringRead(existingState PermissionsChange) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionsChange. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionsChange) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "add": reflect.TypeOf(types.String{}), + "remove": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionsChange +// only implements ToObjectValue() and Type(). +func (o PermissionsChange) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "add": o.Add, + "principal": o.Principal, + "remove": o.Remove, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionsChange) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "add": basetypes.ListType{ + ElemType: types.StringType, + }, + "principal": types.StringType, + "remove": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAdd returns the value of the Add field in PermissionsChange as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionsChange) GetAdd(ctx context.Context) ([]types.String, bool) { + if o.Add.IsNull() || o.Add.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Add.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAdd sets the value of the Add field in PermissionsChange. +func (o *PermissionsChange) SetAdd(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["add"] + t = t.(attr.TypeWithElementType).ElementType() + o.Add = types.ListValueMust(t, vs) +} + +// GetRemove returns the value of the Remove field in PermissionsChange as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionsChange) GetRemove(ctx context.Context) ([]types.String, bool) { + if o.Remove.IsNull() || o.Remove.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Remove.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRemove sets the value of the Remove field in PermissionsChange. +func (o *PermissionsChange) SetRemove(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["remove"] + t = t.(attr.TypeWithElementType).ElementType() + o.Remove = types.ListValueMust(t, vs) +} + type PermissionsList struct { // The privileges assigned to each principal - PrivilegeAssignments []PrivilegeAssignment `tfsdk:"privilege_assignments" tf:"optional"` + PrivilegeAssignments types.List `tfsdk:"privilege_assignments" tf:"optional"` } func (newState *PermissionsList) SyncEffectiveFieldsDuringCreateOrUpdate(plan PermissionsList) { @@ -3412,6 +13571,67 @@ func (newState *PermissionsList) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pe func (newState *PermissionsList) SyncEffectiveFieldsDuringRead(existingState PermissionsList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionsList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionsList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "privilege_assignments": reflect.TypeOf(PrivilegeAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionsList +// only implements ToObjectValue() and Type(). +func (o PermissionsList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "privilege_assignments": o.PrivilegeAssignments, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionsList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "privilege_assignments": basetypes.ListType{ + ElemType: PrivilegeAssignment{}.Type(ctx), + }, + }, + } +} + +// GetPrivilegeAssignments returns the value of the PrivilegeAssignments field in PermissionsList as +// a slice of PrivilegeAssignment values. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionsList) GetPrivilegeAssignments(ctx context.Context) ([]PrivilegeAssignment, bool) { + if o.PrivilegeAssignments.IsNull() || o.PrivilegeAssignments.IsUnknown() { + return nil, false + } + var v []PrivilegeAssignment + d := o.PrivilegeAssignments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrivilegeAssignments sets the value of the PrivilegeAssignments field in PermissionsList. +func (o *PermissionsList) SetPrivilegeAssignments(ctx context.Context, v []PrivilegeAssignment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["privilege_assignments"] + t = t.(attr.TypeWithElementType).ElementType() + o.PrivilegeAssignments = types.ListValueMust(t, vs) +} + // Progress information of the Online Table data synchronization pipeline. type PipelineProgress struct { // The estimated time remaining to complete this update in seconds. @@ -3434,9 +13654,48 @@ func (newState *PipelineProgress) SyncEffectiveFieldsDuringCreateOrUpdate(plan P func (newState *PipelineProgress) SyncEffectiveFieldsDuringRead(existingState PipelineProgress) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineProgress. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineProgress) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineProgress +// only implements ToObjectValue() and Type(). +func (o PipelineProgress) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "estimated_completion_time_seconds": o.EstimatedCompletionTimeSeconds, + "latest_version_currently_processing": o.LatestVersionCurrentlyProcessing, + "sync_progress_completion": o.SyncProgressCompletion, + "synced_row_count": o.SyncedRowCount, + "total_row_count": o.TotalRowCount, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineProgress) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "estimated_completion_time_seconds": types.Float64Type, + "latest_version_currently_processing": types.Int64Type, + "sync_progress_completion": types.Float64Type, + "synced_row_count": types.Int64Type, + "total_row_count": types.Int64Type, + }, + } +} + type PrimaryKeyConstraint struct { // Column names for this constraint. - ChildColumns []types.String `tfsdk:"child_columns" tf:""` + ChildColumns types.List `tfsdk:"child_columns" tf:""` // The name of the constraint. Name types.String `tfsdk:"name" tf:""` } @@ -3447,11 +13706,74 @@ func (newState *PrimaryKeyConstraint) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *PrimaryKeyConstraint) SyncEffectiveFieldsDuringRead(existingState PrimaryKeyConstraint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PrimaryKeyConstraint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PrimaryKeyConstraint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "child_columns": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PrimaryKeyConstraint +// only implements ToObjectValue() and Type(). +func (o PrimaryKeyConstraint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "child_columns": o.ChildColumns, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PrimaryKeyConstraint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "child_columns": basetypes.ListType{ + ElemType: types.StringType, + }, + "name": types.StringType, + }, + } +} + +// GetChildColumns returns the value of the ChildColumns field in PrimaryKeyConstraint as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PrimaryKeyConstraint) GetChildColumns(ctx context.Context) ([]types.String, bool) { + if o.ChildColumns.IsNull() || o.ChildColumns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ChildColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChildColumns sets the value of the ChildColumns field in PrimaryKeyConstraint. +func (o *PrimaryKeyConstraint) SetChildColumns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["child_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.ChildColumns = types.ListValueMust(t, vs) +} + type PrivilegeAssignment struct { // The principal (user email address or group name). Principal types.String `tfsdk:"principal" tf:"optional"` // The privileges assigned to the principal. - Privileges []types.String `tfsdk:"privileges" tf:"optional"` + Privileges types.List `tfsdk:"privileges" tf:"optional"` } func (newState *PrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(plan PrivilegeAssignment) { @@ -3460,6 +13782,69 @@ func (newState *PrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *PrivilegeAssignment) SyncEffectiveFieldsDuringRead(existingState PrivilegeAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PrivilegeAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PrivilegeAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "privileges": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PrivilegeAssignment +// only implements ToObjectValue() and Type(). +func (o PrivilegeAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principal": o.Principal, + "privileges": o.Privileges, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PrivilegeAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principal": types.StringType, + "privileges": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPrivileges returns the value of the Privileges field in PrivilegeAssignment as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PrivilegeAssignment) GetPrivileges(ctx context.Context) ([]types.String, bool) { + if o.Privileges.IsNull() || o.Privileges.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Privileges.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrivileges sets the value of the Privileges field in PrivilegeAssignment. +func (o *PrivilegeAssignment) SetPrivileges(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["privileges"] + t = t.(attr.TypeWithElementType).ElementType() + o.Privileges = types.ListValueMust(t, vs) +} + // Status of an asynchronously provisioned resource. type ProvisioningInfo struct { State types.String `tfsdk:"state" tf:"optional"` @@ -3471,12 +13856,43 @@ func (newState *ProvisioningInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan P func (newState *ProvisioningInfo) SyncEffectiveFieldsDuringRead(existingState ProvisioningInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ProvisioningInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ProvisioningInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ProvisioningInfo +// only implements ToObjectValue() and Type(). +func (o ProvisioningInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ProvisioningInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "state": types.StringType, + }, + } +} + // Detailed status of an online table. Shown if the online table is in the // PROVISIONING_PIPELINE_RESOURCES or the PROVISIONING_INITIAL_SNAPSHOT state. type ProvisioningStatus struct { // Details about initial data synchronization. Only populated when in the // PROVISIONING_INITIAL_SNAPSHOT state. - InitialPipelineSyncProgress []PipelineProgress `tfsdk:"initial_pipeline_sync_progress" tf:"optional,object"` + InitialPipelineSyncProgress types.List `tfsdk:"initial_pipeline_sync_progress" tf:"optional,object"` } func (newState *ProvisioningStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan ProvisioningStatus) { @@ -3485,6 +13901,67 @@ func (newState *ProvisioningStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ProvisioningStatus) SyncEffectiveFieldsDuringRead(existingState ProvisioningStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ProvisioningStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ProvisioningStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "initial_pipeline_sync_progress": reflect.TypeOf(PipelineProgress{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ProvisioningStatus +// only implements ToObjectValue() and Type(). +func (o ProvisioningStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "initial_pipeline_sync_progress": o.InitialPipelineSyncProgress, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ProvisioningStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "initial_pipeline_sync_progress": basetypes.ListType{ + ElemType: PipelineProgress{}.Type(ctx), + }, + }, + } +} + +// GetInitialPipelineSyncProgress returns the value of the InitialPipelineSyncProgress field in ProvisioningStatus as +// a PipelineProgress value. +// If the field is unknown or null, the boolean return value is false. +func (o *ProvisioningStatus) GetInitialPipelineSyncProgress(ctx context.Context) (PipelineProgress, bool) { + var e PipelineProgress + if o.InitialPipelineSyncProgress.IsNull() || o.InitialPipelineSyncProgress.IsUnknown() { + return e, false + } + var v []PipelineProgress + d := o.InitialPipelineSyncProgress.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInitialPipelineSyncProgress sets the value of the InitialPipelineSyncProgress field in ProvisioningStatus. +func (o *ProvisioningStatus) SetInitialPipelineSyncProgress(ctx context.Context, v PipelineProgress) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["initial_pipeline_sync_progress"] + o.InitialPipelineSyncProgress = types.ListValueMust(t, vs) +} + type QuotaInfo struct { // The timestamp that indicates when the quota count was last updated. LastRefreshedAt types.Int64 `tfsdk:"last_refreshed_at" tf:"optional"` @@ -3507,6 +13984,47 @@ func (newState *QuotaInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan QuotaInf func (newState *QuotaInfo) SyncEffectiveFieldsDuringRead(existingState QuotaInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QuotaInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QuotaInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QuotaInfo +// only implements ToObjectValue() and Type(). +func (o QuotaInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "last_refreshed_at": o.LastRefreshedAt, + "parent_full_name": o.ParentFullName, + "parent_securable_type": o.ParentSecurableType, + "quota_count": o.QuotaCount, + "quota_limit": o.QuotaLimit, + "quota_name": o.QuotaName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QuotaInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "last_refreshed_at": types.Int64Type, + "parent_full_name": types.StringType, + "parent_securable_type": types.StringType, + "quota_count": types.Int64Type, + "quota_limit": types.Int64Type, + "quota_name": types.StringType, + }, + } +} + // R2 temporary credentials for API authentication. Read more at // https://developers.cloudflare.com/r2/api/s3/tokens/. type R2Credentials struct { @@ -3524,6 +14042,41 @@ func (newState *R2Credentials) SyncEffectiveFieldsDuringCreateOrUpdate(plan R2Cr func (newState *R2Credentials) SyncEffectiveFieldsDuringRead(existingState R2Credentials) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in R2Credentials. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a R2Credentials) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, R2Credentials +// only implements ToObjectValue() and Type(). +func (o R2Credentials) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_key_id": o.AccessKeyId, + "secret_access_key": o.SecretAccessKey, + "session_token": o.SessionToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o R2Credentials) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_key_id": types.StringType, + "secret_access_key": types.StringType, + "session_token": types.StringType, + }, + } +} + // Get a Volume type ReadVolumeRequest struct { // Whether to include volumes in the response for which the principal can @@ -3539,6 +14092,39 @@ func (newState *ReadVolumeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ReadVolumeRequest) SyncEffectiveFieldsDuringRead(existingState ReadVolumeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReadVolumeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReadVolumeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReadVolumeRequest +// only implements ToObjectValue() and Type(). +func (o ReadVolumeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_browse": o.IncludeBrowse, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ReadVolumeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_browse": types.BoolType, + "name": types.StringType, + }, + } +} + type RegenerateDashboardRequest struct { // Full name of the table. TableName types.String `tfsdk:"-"` @@ -3553,6 +14139,39 @@ func (newState *RegenerateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *RegenerateDashboardRequest) SyncEffectiveFieldsDuringRead(existingState RegenerateDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegenerateDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegenerateDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegenerateDashboardRequest +// only implements ToObjectValue() and Type(). +func (o RegenerateDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_name": o.TableName, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegenerateDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_name": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + type RegenerateDashboardResponse struct { // Id of the regenerated monitoring dashboard. DashboardId types.String `tfsdk:"dashboard_id" tf:"optional"` @@ -3566,6 +14185,39 @@ func (newState *RegenerateDashboardResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *RegenerateDashboardResponse) SyncEffectiveFieldsDuringRead(existingState RegenerateDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegenerateDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegenerateDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegenerateDashboardResponse +// only implements ToObjectValue() and Type(). +func (o RegenerateDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "parent_folder": o.ParentFolder, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegenerateDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "parent_folder": types.StringType, + }, + } +} + // Registered model alias. type RegisteredModelAlias struct { // Name of the alias, e.g. 'champion' or 'latest_stable' @@ -3580,9 +14232,42 @@ func (newState *RegisteredModelAlias) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *RegisteredModelAlias) SyncEffectiveFieldsDuringRead(existingState RegisteredModelAlias) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelAlias. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelAlias) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelAlias +// only implements ToObjectValue() and Type(). +func (o RegisteredModelAlias) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alias_name": o.AliasName, + "version_num": o.VersionNum, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelAlias) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alias_name": types.StringType, + "version_num": types.Int64Type, + }, + } +} + type RegisteredModelInfo struct { // List of aliases associated with the registered model - Aliases []RegisteredModelAlias `tfsdk:"aliases" tf:"optional"` + Aliases types.List `tfsdk:"aliases" tf:"optional"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. @@ -3622,6 +14307,93 @@ func (newState *RegisteredModelInfo) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *RegisteredModelInfo) SyncEffectiveFieldsDuringRead(existingState RegisteredModelInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aliases": reflect.TypeOf(RegisteredModelAlias{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelInfo +// only implements ToObjectValue() and Type(). +func (o RegisteredModelInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aliases": o.Aliases, + "browse_only": o.BrowseOnly, + "catalog_name": o.CatalogName, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "full_name": o.FullName, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "schema_name": o.SchemaName, + "storage_location": o.StorageLocation, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aliases": basetypes.ListType{ + ElemType: RegisteredModelAlias{}.Type(ctx), + }, + "browse_only": types.BoolType, + "catalog_name": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "full_name": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "schema_name": types.StringType, + "storage_location": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetAliases returns the value of the Aliases field in RegisteredModelInfo as +// a slice of RegisteredModelAlias values. +// If the field is unknown or null, the boolean return value is false. +func (o *RegisteredModelInfo) GetAliases(ctx context.Context) ([]RegisteredModelAlias, bool) { + if o.Aliases.IsNull() || o.Aliases.IsUnknown() { + return nil, false + } + var v []RegisteredModelAlias + d := o.Aliases.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAliases sets the value of the Aliases field in RegisteredModelInfo. +func (o *RegisteredModelInfo) SetAliases(ctx context.Context, v []RegisteredModelAlias) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aliases"] + t = t.(attr.TypeWithElementType).ElementType() + o.Aliases = types.ListValueMust(t, vs) +} + // Queue a metric refresh for a monitor type RunRefreshRequest struct { // Full name of the table. @@ -3634,6 +14406,37 @@ func (newState *RunRefreshRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RunRefreshRequest) SyncEffectiveFieldsDuringRead(existingState RunRefreshRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunRefreshRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunRefreshRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunRefreshRequest +// only implements ToObjectValue() and Type(). +func (o RunRefreshRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_name": o.TableName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunRefreshRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_name": types.StringType, + }, + } +} + type SchemaInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is @@ -3650,7 +14453,7 @@ type SchemaInfo struct { // Username of schema creator. CreatedBy types.String `tfsdk:"created_by" tf:"optional"` - EffectivePredictiveOptimizationFlag []EffectivePredictiveOptimizationFlag `tfsdk:"effective_predictive_optimization_flag" tf:"optional,object"` + EffectivePredictiveOptimizationFlag types.List `tfsdk:"effective_predictive_optimization_flag" tf:"optional,object"` // Whether predictive optimization should be enabled for this object and // objects under it. EnablePredictiveOptimization types.String `tfsdk:"enable_predictive_optimization" tf:"optional"` @@ -3663,7 +14466,7 @@ type SchemaInfo struct { // Username of current owner of schema. Owner types.String `tfsdk:"owner" tf:"optional"` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` // The unique identifier of the schema. SchemaId types.String `tfsdk:"schema_id" tf:"optional"` // Storage location for managed tables within schema. @@ -3682,9 +14485,133 @@ func (newState *SchemaInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan SchemaI func (newState *SchemaInfo) SyncEffectiveFieldsDuringRead(existingState SchemaInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SchemaInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SchemaInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "effective_predictive_optimization_flag": reflect.TypeOf(EffectivePredictiveOptimizationFlag{}), + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SchemaInfo +// only implements ToObjectValue() and Type(). +func (o SchemaInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "browse_only": o.BrowseOnly, + "catalog_name": o.CatalogName, + "catalog_type": o.CatalogType, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "effective_predictive_optimization_flag": o.EffectivePredictiveOptimizationFlag, + "enable_predictive_optimization": o.EnablePredictiveOptimization, + "full_name": o.FullName, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "properties": o.Properties, + "schema_id": o.SchemaId, + "storage_location": o.StorageLocation, + "storage_root": o.StorageRoot, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SchemaInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "browse_only": types.BoolType, + "catalog_name": types.StringType, + "catalog_type": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "effective_predictive_optimization_flag": basetypes.ListType{ + ElemType: EffectivePredictiveOptimizationFlag{}.Type(ctx), + }, + "enable_predictive_optimization": types.StringType, + "full_name": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "schema_id": types.StringType, + "storage_location": types.StringType, + "storage_root": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetEffectivePredictiveOptimizationFlag returns the value of the EffectivePredictiveOptimizationFlag field in SchemaInfo as +// a EffectivePredictiveOptimizationFlag value. +// If the field is unknown or null, the boolean return value is false. +func (o *SchemaInfo) GetEffectivePredictiveOptimizationFlag(ctx context.Context) (EffectivePredictiveOptimizationFlag, bool) { + var e EffectivePredictiveOptimizationFlag + if o.EffectivePredictiveOptimizationFlag.IsNull() || o.EffectivePredictiveOptimizationFlag.IsUnknown() { + return e, false + } + var v []EffectivePredictiveOptimizationFlag + d := o.EffectivePredictiveOptimizationFlag.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEffectivePredictiveOptimizationFlag sets the value of the EffectivePredictiveOptimizationFlag field in SchemaInfo. +func (o *SchemaInfo) SetEffectivePredictiveOptimizationFlag(ctx context.Context, v EffectivePredictiveOptimizationFlag) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["effective_predictive_optimization_flag"] + o.EffectivePredictiveOptimizationFlag = types.ListValueMust(t, vs) +} + +// GetProperties returns the value of the Properties field in SchemaInfo as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SchemaInfo) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in SchemaInfo. +func (o *SchemaInfo) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type SetArtifactAllowlist struct { // A list of allowed artifact match patterns. - ArtifactMatchers []ArtifactMatcher `tfsdk:"artifact_matchers" tf:""` + ArtifactMatchers types.List `tfsdk:"artifact_matchers" tf:""` // The artifact type of the allowlist. ArtifactType types.String `tfsdk:"-"` } @@ -3695,6 +14622,69 @@ func (newState *SetArtifactAllowlist) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *SetArtifactAllowlist) SyncEffectiveFieldsDuringRead(existingState SetArtifactAllowlist) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetArtifactAllowlist. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetArtifactAllowlist) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "artifact_matchers": reflect.TypeOf(ArtifactMatcher{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetArtifactAllowlist +// only implements ToObjectValue() and Type(). +func (o SetArtifactAllowlist) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_matchers": o.ArtifactMatchers, + "artifact_type": o.ArtifactType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetArtifactAllowlist) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_matchers": basetypes.ListType{ + ElemType: ArtifactMatcher{}.Type(ctx), + }, + "artifact_type": types.StringType, + }, + } +} + +// GetArtifactMatchers returns the value of the ArtifactMatchers field in SetArtifactAllowlist as +// a slice of ArtifactMatcher values. +// If the field is unknown or null, the boolean return value is false. +func (o *SetArtifactAllowlist) GetArtifactMatchers(ctx context.Context) ([]ArtifactMatcher, bool) { + if o.ArtifactMatchers.IsNull() || o.ArtifactMatchers.IsUnknown() { + return nil, false + } + var v []ArtifactMatcher + d := o.ArtifactMatchers.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetArtifactMatchers sets the value of the ArtifactMatchers field in SetArtifactAllowlist. +func (o *SetArtifactAllowlist) SetArtifactMatchers(ctx context.Context, v []ArtifactMatcher) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["artifact_matchers"] + t = t.(attr.TypeWithElementType).ElementType() + o.ArtifactMatchers = types.ListValueMust(t, vs) +} + type SetRegisteredModelAliasRequest struct { // The name of the alias Alias types.String `tfsdk:"alias" tf:""` @@ -3710,6 +14700,41 @@ func (newState *SetRegisteredModelAliasRequest) SyncEffectiveFieldsDuringCreateO func (newState *SetRegisteredModelAliasRequest) SyncEffectiveFieldsDuringRead(existingState SetRegisteredModelAliasRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetRegisteredModelAliasRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetRegisteredModelAliasRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetRegisteredModelAliasRequest +// only implements ToObjectValue() and Type(). +func (o SetRegisteredModelAliasRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alias": o.Alias, + "full_name": o.FullName, + "version_num": o.VersionNum, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetRegisteredModelAliasRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alias": types.StringType, + "full_name": types.StringType, + "version_num": types.Int64Type, + }, + } +} + // Server-Side Encryption properties for clients communicating with AWS s3. type SseEncryptionDetails struct { // The type of key encryption to use (affects headers from s3 client). @@ -3725,15 +14750,48 @@ func (newState *SseEncryptionDetails) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *SseEncryptionDetails) SyncEffectiveFieldsDuringRead(existingState SseEncryptionDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SseEncryptionDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SseEncryptionDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SseEncryptionDetails +// only implements ToObjectValue() and Type(). +func (o SseEncryptionDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "algorithm": o.Algorithm, + "aws_kms_key_arn": o.AwsKmsKeyArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SseEncryptionDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "algorithm": types.StringType, + "aws_kms_key_arn": types.StringType, + }, + } +} + type StorageCredentialInfo struct { // The AWS IAM role configuration. - AwsIamRole []AwsIamRoleResponse `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentityResponse `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // The Cloudflare API token configuration. - CloudflareApiToken []CloudflareApiToken `tfsdk:"cloudflare_api_token" tf:"optional,object"` + CloudflareApiToken types.List `tfsdk:"cloudflare_api_token" tf:"optional,object"` // Comment associated with the credential. Comment types.String `tfsdk:"comment" tf:"optional"` // Time at which this Credential was created, in epoch milliseconds. @@ -3741,7 +14799,7 @@ type StorageCredentialInfo struct { // Username of credential creator. CreatedBy types.String `tfsdk:"created_by" tf:"optional"` // The Databricks managed GCP service account configuration. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccountResponse `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // The full name of the credential. FullName types.String `tfsdk:"full_name" tf:"optional"` // The unique identifier of the credential. @@ -3771,6 +14829,217 @@ func (newState *StorageCredentialInfo) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *StorageCredentialInfo) SyncEffectiveFieldsDuringRead(existingState StorageCredentialInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StorageCredentialInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StorageCredentialInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRoleResponse{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentityResponse{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "cloudflare_api_token": reflect.TypeOf(CloudflareApiToken{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccountResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StorageCredentialInfo +// only implements ToObjectValue() and Type(). +func (o StorageCredentialInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "cloudflare_api_token": o.CloudflareApiToken, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "full_name": o.FullName, + "id": o.Id, + "isolation_mode": o.IsolationMode, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "read_only": o.ReadOnly, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "used_for_managed_storage": o.UsedForManagedStorage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StorageCredentialInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRoleResponse{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentityResponse{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "cloudflare_api_token": basetypes.ListType{ + ElemType: CloudflareApiToken{}.Type(ctx), + }, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccountResponse{}.Type(ctx), + }, + "full_name": types.StringType, + "id": types.StringType, + "isolation_mode": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "read_only": types.BoolType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "used_for_managed_storage": types.BoolType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in StorageCredentialInfo as +// a AwsIamRoleResponse value. +// If the field is unknown or null, the boolean return value is false. +func (o *StorageCredentialInfo) GetAwsIamRole(ctx context.Context) (AwsIamRoleResponse, bool) { + var e AwsIamRoleResponse + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRoleResponse + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in StorageCredentialInfo. +func (o *StorageCredentialInfo) SetAwsIamRole(ctx context.Context, v AwsIamRoleResponse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in StorageCredentialInfo as +// a AzureManagedIdentityResponse value. +// If the field is unknown or null, the boolean return value is false. +func (o *StorageCredentialInfo) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentityResponse, bool) { + var e AzureManagedIdentityResponse + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentityResponse + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in StorageCredentialInfo. +func (o *StorageCredentialInfo) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentityResponse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in StorageCredentialInfo as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *StorageCredentialInfo) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in StorageCredentialInfo. +func (o *StorageCredentialInfo) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetCloudflareApiToken returns the value of the CloudflareApiToken field in StorageCredentialInfo as +// a CloudflareApiToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *StorageCredentialInfo) GetCloudflareApiToken(ctx context.Context) (CloudflareApiToken, bool) { + var e CloudflareApiToken + if o.CloudflareApiToken.IsNull() || o.CloudflareApiToken.IsUnknown() { + return e, false + } + var v []CloudflareApiToken + d := o.CloudflareApiToken.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloudflareApiToken sets the value of the CloudflareApiToken field in StorageCredentialInfo. +func (o *StorageCredentialInfo) SetCloudflareApiToken(ctx context.Context, v CloudflareApiToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cloudflare_api_token"] + o.CloudflareApiToken = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in StorageCredentialInfo as +// a DatabricksGcpServiceAccountResponse value. +// If the field is unknown or null, the boolean return value is false. +func (o *StorageCredentialInfo) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccountResponse, bool) { + var e DatabricksGcpServiceAccountResponse + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccountResponse + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in StorageCredentialInfo. +func (o *StorageCredentialInfo) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccountResponse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + type SystemSchemaInfo struct { // Name of the system schema. Schema types.String `tfsdk:"schema" tf:"optional"` @@ -3785,15 +15054,48 @@ func (newState *SystemSchemaInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *SystemSchemaInfo) SyncEffectiveFieldsDuringRead(existingState SystemSchemaInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SystemSchemaInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SystemSchemaInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SystemSchemaInfo +// only implements ToObjectValue() and Type(). +func (o SystemSchemaInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "schema": o.Schema, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SystemSchemaInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "schema": types.StringType, + "state": types.StringType, + }, + } +} + // A table constraint, as defined by *one* of the following fields being set: // __primary_key_constraint__, __foreign_key_constraint__, // __named_table_constraint__. type TableConstraint struct { - ForeignKeyConstraint []ForeignKeyConstraint `tfsdk:"foreign_key_constraint" tf:"optional,object"` + ForeignKeyConstraint types.List `tfsdk:"foreign_key_constraint" tf:"optional,object"` - NamedTableConstraint []NamedTableConstraint `tfsdk:"named_table_constraint" tf:"optional,object"` + NamedTableConstraint types.List `tfsdk:"named_table_constraint" tf:"optional,object"` - PrimaryKeyConstraint []PrimaryKeyConstraint `tfsdk:"primary_key_constraint" tf:"optional,object"` + PrimaryKeyConstraint types.List `tfsdk:"primary_key_constraint" tf:"optional,object"` } func (newState *TableConstraint) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableConstraint) { @@ -3802,6 +15104,129 @@ func (newState *TableConstraint) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ta func (newState *TableConstraint) SyncEffectiveFieldsDuringRead(existingState TableConstraint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableConstraint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableConstraint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "foreign_key_constraint": reflect.TypeOf(ForeignKeyConstraint{}), + "named_table_constraint": reflect.TypeOf(NamedTableConstraint{}), + "primary_key_constraint": reflect.TypeOf(PrimaryKeyConstraint{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableConstraint +// only implements ToObjectValue() and Type(). +func (o TableConstraint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "foreign_key_constraint": o.ForeignKeyConstraint, + "named_table_constraint": o.NamedTableConstraint, + "primary_key_constraint": o.PrimaryKeyConstraint, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableConstraint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "foreign_key_constraint": basetypes.ListType{ + ElemType: ForeignKeyConstraint{}.Type(ctx), + }, + "named_table_constraint": basetypes.ListType{ + ElemType: NamedTableConstraint{}.Type(ctx), + }, + "primary_key_constraint": basetypes.ListType{ + ElemType: PrimaryKeyConstraint{}.Type(ctx), + }, + }, + } +} + +// GetForeignKeyConstraint returns the value of the ForeignKeyConstraint field in TableConstraint as +// a ForeignKeyConstraint value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableConstraint) GetForeignKeyConstraint(ctx context.Context) (ForeignKeyConstraint, bool) { + var e ForeignKeyConstraint + if o.ForeignKeyConstraint.IsNull() || o.ForeignKeyConstraint.IsUnknown() { + return e, false + } + var v []ForeignKeyConstraint + d := o.ForeignKeyConstraint.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetForeignKeyConstraint sets the value of the ForeignKeyConstraint field in TableConstraint. +func (o *TableConstraint) SetForeignKeyConstraint(ctx context.Context, v ForeignKeyConstraint) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["foreign_key_constraint"] + o.ForeignKeyConstraint = types.ListValueMust(t, vs) +} + +// GetNamedTableConstraint returns the value of the NamedTableConstraint field in TableConstraint as +// a NamedTableConstraint value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableConstraint) GetNamedTableConstraint(ctx context.Context) (NamedTableConstraint, bool) { + var e NamedTableConstraint + if o.NamedTableConstraint.IsNull() || o.NamedTableConstraint.IsUnknown() { + return e, false + } + var v []NamedTableConstraint + d := o.NamedTableConstraint.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNamedTableConstraint sets the value of the NamedTableConstraint field in TableConstraint. +func (o *TableConstraint) SetNamedTableConstraint(ctx context.Context, v NamedTableConstraint) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["named_table_constraint"] + o.NamedTableConstraint = types.ListValueMust(t, vs) +} + +// GetPrimaryKeyConstraint returns the value of the PrimaryKeyConstraint field in TableConstraint as +// a PrimaryKeyConstraint value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableConstraint) GetPrimaryKeyConstraint(ctx context.Context) (PrimaryKeyConstraint, bool) { + var e PrimaryKeyConstraint + if o.PrimaryKeyConstraint.IsNull() || o.PrimaryKeyConstraint.IsUnknown() { + return e, false + } + var v []PrimaryKeyConstraint + d := o.PrimaryKeyConstraint.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPrimaryKeyConstraint sets the value of the PrimaryKeyConstraint field in TableConstraint. +func (o *TableConstraint) SetPrimaryKeyConstraint(ctx context.Context, v PrimaryKeyConstraint) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["primary_key_constraint"] + o.PrimaryKeyConstraint = types.ListValueMust(t, vs) +} + // A table that is dependent on a SQL object. type TableDependency struct { // Full name of the dependent table, in the form of @@ -3815,6 +15240,37 @@ func (newState *TableDependency) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ta func (newState *TableDependency) SyncEffectiveFieldsDuringRead(existingState TableDependency) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableDependency. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableDependency) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableDependency +// only implements ToObjectValue() and Type(). +func (o TableDependency) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_full_name": o.TableFullName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableDependency) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_full_name": types.StringType, + }, + } +} + type TableExistsResponse struct { // Whether the table exists or not. TableExists types.Bool `tfsdk:"table_exists" tf:"optional"` @@ -3826,6 +15282,37 @@ func (newState *TableExistsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *TableExistsResponse) SyncEffectiveFieldsDuringRead(existingState TableExistsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableExistsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableExistsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableExistsResponse +// only implements ToObjectValue() and Type(). +func (o TableExistsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "table_exists": o.TableExists, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableExistsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "table_exists": types.BoolType, + }, + } +} + type TableInfo struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint types.String `tfsdk:"access_point" tf:"optional"` @@ -3836,7 +15323,7 @@ type TableInfo struct { // Name of parent catalog. CatalogName types.String `tfsdk:"catalog_name" tf:"optional"` // The array of __ColumnInfo__ definitions of the table's columns. - Columns []ColumnInfo `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` // Time at which this table was created, in epoch milliseconds. @@ -3851,14 +15338,14 @@ type TableInfo struct { // omitted if table is not deleted. DeletedAt types.Int64 `tfsdk:"deleted_at" tf:"optional"` // Information pertaining to current state of the delta table. - DeltaRuntimePropertiesKvpairs []DeltaRuntimePropertiesKvPairs `tfsdk:"delta_runtime_properties_kvpairs" tf:"optional,object"` + DeltaRuntimePropertiesKvpairs types.List `tfsdk:"delta_runtime_properties_kvpairs" tf:"optional,object"` - EffectivePredictiveOptimizationFlag []EffectivePredictiveOptimizationFlag `tfsdk:"effective_predictive_optimization_flag" tf:"optional,object"` + EffectivePredictiveOptimizationFlag types.List `tfsdk:"effective_predictive_optimization_flag" tf:"optional,object"` // Whether predictive optimization should be enabled for this object and // objects under it. EnablePredictiveOptimization types.String `tfsdk:"enable_predictive_optimization" tf:"optional"` // Encryption options that apply to clients connecting to cloud storage. - EncryptionDetails []EncryptionDetails `tfsdk:"encryption_details" tf:"optional,object"` + EncryptionDetails types.List `tfsdk:"encryption_details" tf:"optional,object"` // Full name of table, in form of // __catalog_name__.__schema_name__.__table_name__ FullName types.String `tfsdk:"full_name" tf:"optional"` @@ -3872,9 +15359,9 @@ type TableInfo struct { // (Materialized View, Streaming Table, etc.). PipelineId types.String `tfsdk:"pipeline_id" tf:"optional"` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` - RowFilter []TableRowFilter `tfsdk:"row_filter" tf:"optional,object"` + RowFilter types.List `tfsdk:"row_filter" tf:"optional,object"` // Name of parent schema relative to its parent catalog. SchemaName types.String `tfsdk:"schema_name" tf:"optional"` // List of schemes whose objects can be referenced without qualification. @@ -3886,7 +15373,7 @@ type TableInfo struct { StorageLocation types.String `tfsdk:"storage_location" tf:"optional"` // List of table constraints. Note: this field is not set in the output of // the __listTables__ API. - TableConstraints []TableConstraint `tfsdk:"table_constraints" tf:"optional"` + TableConstraints types.List `tfsdk:"table_constraints" tf:"optional"` // The unique identifier of the table. TableId types.String `tfsdk:"table_id" tf:"optional"` @@ -3903,7 +15390,7 @@ type TableInfo struct { // provided; - when DependencyList is an empty list, the dependency is // provided but is empty; - when DependencyList is not an empty list, // dependencies are provided and recorded. - ViewDependencies []DependencyList `tfsdk:"view_dependencies" tf:"optional,object"` + ViewDependencies types.List `tfsdk:"view_dependencies" tf:"optional,object"` } func (newState *TableInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableInfo) { @@ -3912,13 +15399,339 @@ func (newState *TableInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableInf func (newState *TableInfo) SyncEffectiveFieldsDuringRead(existingState TableInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(ColumnInfo{}), + "delta_runtime_properties_kvpairs": reflect.TypeOf(DeltaRuntimePropertiesKvPairs{}), + "effective_predictive_optimization_flag": reflect.TypeOf(EffectivePredictiveOptimizationFlag{}), + "encryption_details": reflect.TypeOf(EncryptionDetails{}), + "properties": reflect.TypeOf(types.String{}), + "row_filter": reflect.TypeOf(TableRowFilter{}), + "table_constraints": reflect.TypeOf(TableConstraint{}), + "view_dependencies": reflect.TypeOf(DependencyList{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableInfo +// only implements ToObjectValue() and Type(). +func (o TableInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_point": o.AccessPoint, + "browse_only": o.BrowseOnly, + "catalog_name": o.CatalogName, + "columns": o.Columns, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "data_access_configuration_id": o.DataAccessConfigurationId, + "data_source_format": o.DataSourceFormat, + "deleted_at": o.DeletedAt, + "delta_runtime_properties_kvpairs": o.DeltaRuntimePropertiesKvpairs, + "effective_predictive_optimization_flag": o.EffectivePredictiveOptimizationFlag, + "enable_predictive_optimization": o.EnablePredictiveOptimization, + "encryption_details": o.EncryptionDetails, + "full_name": o.FullName, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "pipeline_id": o.PipelineId, + "properties": o.Properties, + "row_filter": o.RowFilter, + "schema_name": o.SchemaName, + "sql_path": o.SqlPath, + "storage_credential_name": o.StorageCredentialName, + "storage_location": o.StorageLocation, + "table_constraints": o.TableConstraints, + "table_id": o.TableId, + "table_type": o.TableType, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "view_definition": o.ViewDefinition, + "view_dependencies": o.ViewDependencies, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_point": types.StringType, + "browse_only": types.BoolType, + "catalog_name": types.StringType, + "columns": basetypes.ListType{ + ElemType: ColumnInfo{}.Type(ctx), + }, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "data_access_configuration_id": types.StringType, + "data_source_format": types.StringType, + "deleted_at": types.Int64Type, + "delta_runtime_properties_kvpairs": basetypes.ListType{ + ElemType: DeltaRuntimePropertiesKvPairs{}.Type(ctx), + }, + "effective_predictive_optimization_flag": basetypes.ListType{ + ElemType: EffectivePredictiveOptimizationFlag{}.Type(ctx), + }, + "enable_predictive_optimization": types.StringType, + "encryption_details": basetypes.ListType{ + ElemType: EncryptionDetails{}.Type(ctx), + }, + "full_name": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "pipeline_id": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + "row_filter": basetypes.ListType{ + ElemType: TableRowFilter{}.Type(ctx), + }, + "schema_name": types.StringType, + "sql_path": types.StringType, + "storage_credential_name": types.StringType, + "storage_location": types.StringType, + "table_constraints": basetypes.ListType{ + ElemType: TableConstraint{}.Type(ctx), + }, + "table_id": types.StringType, + "table_type": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "view_definition": types.StringType, + "view_dependencies": basetypes.ListType{ + ElemType: DependencyList{}.Type(ctx), + }, + }, + } +} + +// GetColumns returns the value of the Columns field in TableInfo as +// a slice of ColumnInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetColumns(ctx context.Context) ([]ColumnInfo, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []ColumnInfo + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in TableInfo. +func (o *TableInfo) SetColumns(ctx context.Context, v []ColumnInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + +// GetDeltaRuntimePropertiesKvpairs returns the value of the DeltaRuntimePropertiesKvpairs field in TableInfo as +// a DeltaRuntimePropertiesKvPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetDeltaRuntimePropertiesKvpairs(ctx context.Context) (DeltaRuntimePropertiesKvPairs, bool) { + var e DeltaRuntimePropertiesKvPairs + if o.DeltaRuntimePropertiesKvpairs.IsNull() || o.DeltaRuntimePropertiesKvpairs.IsUnknown() { + return e, false + } + var v []DeltaRuntimePropertiesKvPairs + d := o.DeltaRuntimePropertiesKvpairs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeltaRuntimePropertiesKvpairs sets the value of the DeltaRuntimePropertiesKvpairs field in TableInfo. +func (o *TableInfo) SetDeltaRuntimePropertiesKvpairs(ctx context.Context, v DeltaRuntimePropertiesKvPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["delta_runtime_properties_kvpairs"] + o.DeltaRuntimePropertiesKvpairs = types.ListValueMust(t, vs) +} + +// GetEffectivePredictiveOptimizationFlag returns the value of the EffectivePredictiveOptimizationFlag field in TableInfo as +// a EffectivePredictiveOptimizationFlag value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetEffectivePredictiveOptimizationFlag(ctx context.Context) (EffectivePredictiveOptimizationFlag, bool) { + var e EffectivePredictiveOptimizationFlag + if o.EffectivePredictiveOptimizationFlag.IsNull() || o.EffectivePredictiveOptimizationFlag.IsUnknown() { + return e, false + } + var v []EffectivePredictiveOptimizationFlag + d := o.EffectivePredictiveOptimizationFlag.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEffectivePredictiveOptimizationFlag sets the value of the EffectivePredictiveOptimizationFlag field in TableInfo. +func (o *TableInfo) SetEffectivePredictiveOptimizationFlag(ctx context.Context, v EffectivePredictiveOptimizationFlag) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["effective_predictive_optimization_flag"] + o.EffectivePredictiveOptimizationFlag = types.ListValueMust(t, vs) +} + +// GetEncryptionDetails returns the value of the EncryptionDetails field in TableInfo as +// a EncryptionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetEncryptionDetails(ctx context.Context) (EncryptionDetails, bool) { + var e EncryptionDetails + if o.EncryptionDetails.IsNull() || o.EncryptionDetails.IsUnknown() { + return e, false + } + var v []EncryptionDetails + d := o.EncryptionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEncryptionDetails sets the value of the EncryptionDetails field in TableInfo. +func (o *TableInfo) SetEncryptionDetails(ctx context.Context, v EncryptionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["encryption_details"] + o.EncryptionDetails = types.ListValueMust(t, vs) +} + +// GetProperties returns the value of the Properties field in TableInfo as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in TableInfo. +func (o *TableInfo) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + +// GetRowFilter returns the value of the RowFilter field in TableInfo as +// a TableRowFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetRowFilter(ctx context.Context) (TableRowFilter, bool) { + var e TableRowFilter + if o.RowFilter.IsNull() || o.RowFilter.IsUnknown() { + return e, false + } + var v []TableRowFilter + d := o.RowFilter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRowFilter sets the value of the RowFilter field in TableInfo. +func (o *TableInfo) SetRowFilter(ctx context.Context, v TableRowFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["row_filter"] + o.RowFilter = types.ListValueMust(t, vs) +} + +// GetTableConstraints returns the value of the TableConstraints field in TableInfo as +// a slice of TableConstraint values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetTableConstraints(ctx context.Context) ([]TableConstraint, bool) { + if o.TableConstraints.IsNull() || o.TableConstraints.IsUnknown() { + return nil, false + } + var v []TableConstraint + d := o.TableConstraints.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTableConstraints sets the value of the TableConstraints field in TableInfo. +func (o *TableInfo) SetTableConstraints(ctx context.Context, v []TableConstraint) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_constraints"] + t = t.(attr.TypeWithElementType).ElementType() + o.TableConstraints = types.ListValueMust(t, vs) +} + +// GetViewDependencies returns the value of the ViewDependencies field in TableInfo as +// a DependencyList value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableInfo) GetViewDependencies(ctx context.Context) (DependencyList, bool) { + var e DependencyList + if o.ViewDependencies.IsNull() || o.ViewDependencies.IsUnknown() { + return e, false + } + var v []DependencyList + d := o.ViewDependencies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetViewDependencies sets the value of the ViewDependencies field in TableInfo. +func (o *TableInfo) SetViewDependencies(ctx context.Context, v DependencyList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["view_dependencies"] + o.ViewDependencies = types.ListValueMust(t, vs) +} + type TableRowFilter struct { // The full name of the row filter SQL UDF. FunctionName types.String `tfsdk:"function_name" tf:""` // The list of table columns to be passed as input to the row filter // function. The column types should match the types of the filter function // arguments. - InputColumnNames []types.String `tfsdk:"input_column_names" tf:""` + InputColumnNames types.List `tfsdk:"input_column_names" tf:""` } func (newState *TableRowFilter) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableRowFilter) { @@ -3927,6 +15740,69 @@ func (newState *TableRowFilter) SyncEffectiveFieldsDuringCreateOrUpdate(plan Tab func (newState *TableRowFilter) SyncEffectiveFieldsDuringRead(existingState TableRowFilter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableRowFilter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableRowFilter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "input_column_names": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableRowFilter +// only implements ToObjectValue() and Type(). +func (o TableRowFilter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "function_name": o.FunctionName, + "input_column_names": o.InputColumnNames, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableRowFilter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "function_name": types.StringType, + "input_column_names": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetInputColumnNames returns the value of the InputColumnNames field in TableRowFilter as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableRowFilter) GetInputColumnNames(ctx context.Context) ([]types.String, bool) { + if o.InputColumnNames.IsNull() || o.InputColumnNames.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InputColumnNames.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInputColumnNames sets the value of the InputColumnNames field in TableRowFilter. +func (o *TableRowFilter) SetInputColumnNames(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["input_column_names"] + t = t.(attr.TypeWithElementType).ElementType() + o.InputColumnNames = types.ListValueMust(t, vs) +} + type TableSummary struct { // The full name of the table. FullName types.String `tfsdk:"full_name" tf:"optional"` @@ -3940,14 +15816,47 @@ func (newState *TableSummary) SyncEffectiveFieldsDuringCreateOrUpdate(plan Table func (newState *TableSummary) SyncEffectiveFieldsDuringRead(existingState TableSummary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableSummary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableSummary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableSummary +// only implements ToObjectValue() and Type(). +func (o TableSummary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "table_type": o.TableType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableSummary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "table_type": types.StringType, + }, + } +} + type TemporaryCredentials struct { // AWS temporary credentials for API authentication. Read more at // https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. - AwsTempCredentials []AwsCredentials `tfsdk:"aws_temp_credentials" tf:"optional,object"` + AwsTempCredentials types.List `tfsdk:"aws_temp_credentials" tf:"optional,object"` // Azure Active Directory token, essentially the Oauth token for Azure // Service Principal or Managed Identity. Read more at // https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token - AzureAad []AzureActiveDirectoryToken `tfsdk:"azure_aad" tf:"optional,object"` + AzureAad types.List `tfsdk:"azure_aad" tf:"optional,object"` // Server time when the credential will expire, in epoch milliseconds. The // API client is advised to cache the credential given this expiration time. ExpirationTime types.Int64 `tfsdk:"expiration_time" tf:"optional"` @@ -3959,6 +15868,100 @@ func (newState *TemporaryCredentials) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *TemporaryCredentials) SyncEffectiveFieldsDuringRead(existingState TemporaryCredentials) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TemporaryCredentials. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TemporaryCredentials) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_temp_credentials": reflect.TypeOf(AwsCredentials{}), + "azure_aad": reflect.TypeOf(AzureActiveDirectoryToken{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TemporaryCredentials +// only implements ToObjectValue() and Type(). +func (o TemporaryCredentials) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_temp_credentials": o.AwsTempCredentials, + "azure_aad": o.AzureAad, + "expiration_time": o.ExpirationTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TemporaryCredentials) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_temp_credentials": basetypes.ListType{ + ElemType: AwsCredentials{}.Type(ctx), + }, + "azure_aad": basetypes.ListType{ + ElemType: AzureActiveDirectoryToken{}.Type(ctx), + }, + "expiration_time": types.Int64Type, + }, + } +} + +// GetAwsTempCredentials returns the value of the AwsTempCredentials field in TemporaryCredentials as +// a AwsCredentials value. +// If the field is unknown or null, the boolean return value is false. +func (o *TemporaryCredentials) GetAwsTempCredentials(ctx context.Context) (AwsCredentials, bool) { + var e AwsCredentials + if o.AwsTempCredentials.IsNull() || o.AwsTempCredentials.IsUnknown() { + return e, false + } + var v []AwsCredentials + d := o.AwsTempCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsTempCredentials sets the value of the AwsTempCredentials field in TemporaryCredentials. +func (o *TemporaryCredentials) SetAwsTempCredentials(ctx context.Context, v AwsCredentials) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_temp_credentials"] + o.AwsTempCredentials = types.ListValueMust(t, vs) +} + +// GetAzureAad returns the value of the AzureAad field in TemporaryCredentials as +// a AzureActiveDirectoryToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *TemporaryCredentials) GetAzureAad(ctx context.Context) (AzureActiveDirectoryToken, bool) { + var e AzureActiveDirectoryToken + if o.AzureAad.IsNull() || o.AzureAad.IsUnknown() { + return e, false + } + var v []AzureActiveDirectoryToken + d := o.AzureAad.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAad sets the value of the AzureAad field in TemporaryCredentials. +func (o *TemporaryCredentials) SetAzureAad(ctx context.Context, v AzureActiveDirectoryToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_aad"] + o.AzureAad = types.ListValueMust(t, vs) +} + // Detailed status of an online table. Shown if the online table is in the // ONLINE_TRIGGERED_UPDATE or the ONLINE_NO_PENDING_UPDATE state. type TriggeredUpdateStatus struct { @@ -3970,7 +15973,7 @@ type TriggeredUpdateStatus struct { // table to the online table. Timestamp types.String `tfsdk:"timestamp" tf:"optional"` // Progress of the active data synchronization pipeline. - TriggeredUpdateProgress []PipelineProgress `tfsdk:"triggered_update_progress" tf:"optional,object"` + TriggeredUpdateProgress types.List `tfsdk:"triggered_update_progress" tf:"optional,object"` } func (newState *TriggeredUpdateStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan TriggeredUpdateStatus) { @@ -3979,6 +15982,71 @@ func (newState *TriggeredUpdateStatus) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *TriggeredUpdateStatus) SyncEffectiveFieldsDuringRead(existingState TriggeredUpdateStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TriggeredUpdateStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TriggeredUpdateStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "triggered_update_progress": reflect.TypeOf(PipelineProgress{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TriggeredUpdateStatus +// only implements ToObjectValue() and Type(). +func (o TriggeredUpdateStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "last_processed_commit_version": o.LastProcessedCommitVersion, + "timestamp": o.Timestamp, + "triggered_update_progress": o.TriggeredUpdateProgress, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TriggeredUpdateStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "last_processed_commit_version": types.Int64Type, + "timestamp": types.StringType, + "triggered_update_progress": basetypes.ListType{ + ElemType: PipelineProgress{}.Type(ctx), + }, + }, + } +} + +// GetTriggeredUpdateProgress returns the value of the TriggeredUpdateProgress field in TriggeredUpdateStatus as +// a PipelineProgress value. +// If the field is unknown or null, the boolean return value is false. +func (o *TriggeredUpdateStatus) GetTriggeredUpdateProgress(ctx context.Context) (PipelineProgress, bool) { + var e PipelineProgress + if o.TriggeredUpdateProgress.IsNull() || o.TriggeredUpdateProgress.IsUnknown() { + return e, false + } + var v []PipelineProgress + d := o.TriggeredUpdateProgress.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTriggeredUpdateProgress sets the value of the TriggeredUpdateProgress field in TriggeredUpdateStatus. +func (o *TriggeredUpdateStatus) SetTriggeredUpdateProgress(ctx context.Context, v PipelineProgress) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["triggered_update_progress"] + o.TriggeredUpdateProgress = types.ListValueMust(t, vs) +} + // Delete an assignment type UnassignRequest struct { // Query for the ID of the metastore to delete. @@ -3993,6 +16061,39 @@ func (newState *UnassignRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Un func (newState *UnassignRequest) SyncEffectiveFieldsDuringRead(existingState UnassignRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UnassignRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UnassignRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UnassignRequest +// only implements ToObjectValue() and Type(). +func (o UnassignRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UnassignRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type UnassignResponse struct { } @@ -4002,6 +16103,33 @@ func (newState *UnassignResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan U func (newState *UnassignResponse) SyncEffectiveFieldsDuringRead(existingState UnassignResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UnassignResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UnassignResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UnassignResponse +// only implements ToObjectValue() and Type(). +func (o UnassignResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UnassignResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateAssignmentResponse struct { } @@ -4011,6 +16139,33 @@ func (newState *UpdateAssignmentResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *UpdateAssignmentResponse) SyncEffectiveFieldsDuringRead(existingState UpdateAssignmentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAssignmentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAssignmentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAssignmentResponse +// only implements ToObjectValue() and Type(). +func (o UpdateAssignmentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAssignmentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateCatalog struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -4027,7 +16182,7 @@ type UpdateCatalog struct { // Username of current owner of catalog. Owner types.String `tfsdk:"owner" tf:"optional"` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` } func (newState *UpdateCatalog) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateCatalog) { @@ -4036,13 +16191,86 @@ func (newState *UpdateCatalog) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upda func (newState *UpdateCatalog) SyncEffectiveFieldsDuringRead(existingState UpdateCatalog) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCatalog. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCatalog) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCatalog +// only implements ToObjectValue() and Type(). +func (o UpdateCatalog) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "enable_predictive_optimization": o.EnablePredictiveOptimization, + "isolation_mode": o.IsolationMode, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + "properties": o.Properties, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCatalog) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "enable_predictive_optimization": types.StringType, + "isolation_mode": types.StringType, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetProperties returns the value of the Properties field in UpdateCatalog as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCatalog) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in UpdateCatalog. +func (o *UpdateCatalog) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type UpdateConnection struct { // Name of the connection. Name types.String `tfsdk:"-"` // New name for the connection. NewName types.String `tfsdk:"new_name" tf:"optional"` // A map of key-value properties attached to the securable. - Options map[string]types.String `tfsdk:"options" tf:""` + Options types.Map `tfsdk:"options" tf:""` // Username of current owner of the connection. Owner types.String `tfsdk:"owner" tf:"optional"` } @@ -4053,19 +16281,86 @@ func (newState *UpdateConnection) SyncEffectiveFieldsDuringCreateOrUpdate(plan U func (newState *UpdateConnection) SyncEffectiveFieldsDuringRead(existingState UpdateConnection) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateConnection. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateConnection) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateConnection +// only implements ToObjectValue() and Type(). +func (o UpdateConnection) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "new_name": o.NewName, + "options": o.Options, + "owner": o.Owner, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateConnection) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "new_name": types.StringType, + "options": basetypes.MapType{ + ElemType: types.StringType, + }, + "owner": types.StringType, + }, + } +} + +// GetOptions returns the value of the Options field in UpdateConnection as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateConnection) GetOptions(ctx context.Context) (map[string]types.String, bool) { + if o.Options.IsNull() || o.Options.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOptions sets the value of the Options field in UpdateConnection. +func (o *UpdateConnection) SetOptions(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + t = t.(attr.TypeWithElementType).ElementType() + o.Options = types.MapValueMust(t, vs) +} + type UpdateCredentialRequest struct { // The AWS IAM role configuration - AwsIamRole []AwsIamRole `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentity `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. Only applicable when purpose // is **STORAGE**. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // Comment associated with the credential. Comment types.String `tfsdk:"comment" tf:"optional"` // GCP long-lived credential. Databricks-created Google Cloud Storage // service account. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccount `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // Force an update even if there are dependent services (when purpose is // **SERVICE**) or dependent external locations and external tables (when // purpose is **STORAGE**). @@ -4093,6 +16388,176 @@ func (newState *UpdateCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *UpdateCredentialRequest) SyncEffectiveFieldsDuringRead(existingState UpdateCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRole{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentity{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccount{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCredentialRequest +// only implements ToObjectValue() and Type(). +func (o UpdateCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "comment": o.Comment, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "force": o.Force, + "isolation_mode": o.IsolationMode, + "name_arg": o.NameArg, + "new_name": o.NewName, + "owner": o.Owner, + "read_only": o.ReadOnly, + "skip_validation": o.SkipValidation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRole{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentity{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "comment": types.StringType, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccount{}.Type(ctx), + }, + "force": types.BoolType, + "isolation_mode": types.StringType, + "name_arg": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "read_only": types.BoolType, + "skip_validation": types.BoolType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in UpdateCredentialRequest as +// a AwsIamRole value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCredentialRequest) GetAwsIamRole(ctx context.Context) (AwsIamRole, bool) { + var e AwsIamRole + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRole + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in UpdateCredentialRequest. +func (o *UpdateCredentialRequest) SetAwsIamRole(ctx context.Context, v AwsIamRole) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in UpdateCredentialRequest as +// a AzureManagedIdentity value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCredentialRequest) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentity, bool) { + var e AzureManagedIdentity + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentity + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in UpdateCredentialRequest. +func (o *UpdateCredentialRequest) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentity) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in UpdateCredentialRequest as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCredentialRequest) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in UpdateCredentialRequest. +func (o *UpdateCredentialRequest) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in UpdateCredentialRequest as +// a DatabricksGcpServiceAccount value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCredentialRequest) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccount, bool) { + var e DatabricksGcpServiceAccount + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccount + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in UpdateCredentialRequest. +func (o *UpdateCredentialRequest) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccount) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + type UpdateExternalLocation struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint types.String `tfsdk:"access_point" tf:"optional"` @@ -4101,7 +16566,7 @@ type UpdateExternalLocation struct { // Name of the storage credential used with this location. CredentialName types.String `tfsdk:"credential_name" tf:"optional"` // Encryption options that apply to clients connecting to cloud storage. - EncryptionDetails []EncryptionDetails `tfsdk:"encryption_details" tf:"optional,object"` + EncryptionDetails types.List `tfsdk:"encryption_details" tf:"optional,object"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. @@ -4132,6 +16597,91 @@ func (newState *UpdateExternalLocation) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateExternalLocation) SyncEffectiveFieldsDuringRead(existingState UpdateExternalLocation) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExternalLocation. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExternalLocation) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "encryption_details": reflect.TypeOf(EncryptionDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExternalLocation +// only implements ToObjectValue() and Type(). +func (o UpdateExternalLocation) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_point": o.AccessPoint, + "comment": o.Comment, + "credential_name": o.CredentialName, + "encryption_details": o.EncryptionDetails, + "fallback": o.Fallback, + "force": o.Force, + "isolation_mode": o.IsolationMode, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + "read_only": o.ReadOnly, + "skip_validation": o.SkipValidation, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExternalLocation) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_point": types.StringType, + "comment": types.StringType, + "credential_name": types.StringType, + "encryption_details": basetypes.ListType{ + ElemType: EncryptionDetails{}.Type(ctx), + }, + "fallback": types.BoolType, + "force": types.BoolType, + "isolation_mode": types.StringType, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "read_only": types.BoolType, + "skip_validation": types.BoolType, + "url": types.StringType, + }, + } +} + +// GetEncryptionDetails returns the value of the EncryptionDetails field in UpdateExternalLocation as +// a EncryptionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateExternalLocation) GetEncryptionDetails(ctx context.Context) (EncryptionDetails, bool) { + var e EncryptionDetails + if o.EncryptionDetails.IsNull() || o.EncryptionDetails.IsUnknown() { + return e, false + } + var v []EncryptionDetails + d := o.EncryptionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEncryptionDetails sets the value of the EncryptionDetails field in UpdateExternalLocation. +func (o *UpdateExternalLocation) SetEncryptionDetails(ctx context.Context, v EncryptionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["encryption_details"] + o.EncryptionDetails = types.ListValueMust(t, vs) +} + type UpdateFunction struct { // The fully-qualified name of the function (of the form // __catalog_name__.__schema_name__.__function__name__). @@ -4146,6 +16696,39 @@ func (newState *UpdateFunction) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateFunction) SyncEffectiveFieldsDuringRead(existingState UpdateFunction) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateFunction. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateFunction) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateFunction +// only implements ToObjectValue() and Type(). +func (o UpdateFunction) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "owner": o.Owner, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateFunction) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "owner": types.StringType, + }, + } +} + type UpdateMetastore struct { // The organization name of a Delta Sharing entity, to be used in // Databricks-to-Databricks Delta Sharing as the official name. @@ -4173,6 +16756,51 @@ func (newState *UpdateMetastore) SyncEffectiveFieldsDuringCreateOrUpdate(plan Up func (newState *UpdateMetastore) SyncEffectiveFieldsDuringRead(existingState UpdateMetastore) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateMetastore. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateMetastore) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateMetastore +// only implements ToObjectValue() and Type(). +func (o UpdateMetastore) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "delta_sharing_organization_name": o.DeltaSharingOrganizationName, + "delta_sharing_recipient_token_lifetime_in_seconds": o.DeltaSharingRecipientTokenLifetimeInSeconds, + "delta_sharing_scope": o.DeltaSharingScope, + "id": o.Id, + "new_name": o.NewName, + "owner": o.Owner, + "privilege_model_version": o.PrivilegeModelVersion, + "storage_root_credential_id": o.StorageRootCredentialId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateMetastore) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "delta_sharing_organization_name": types.StringType, + "delta_sharing_recipient_token_lifetime_in_seconds": types.Int64Type, + "delta_sharing_scope": types.StringType, + "id": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "privilege_model_version": types.StringType, + "storage_root_credential_id": types.StringType, + }, + } +} + type UpdateMetastoreAssignment struct { // The name of the default catalog in the metastore. This field is // depracted. Please use "Default Namespace API" to configure the default @@ -4190,6 +16818,41 @@ func (newState *UpdateMetastoreAssignment) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UpdateMetastoreAssignment) SyncEffectiveFieldsDuringRead(existingState UpdateMetastoreAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateMetastoreAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateMetastoreAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateMetastoreAssignment +// only implements ToObjectValue() and Type(). +func (o UpdateMetastoreAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default_catalog_name": o.DefaultCatalogName, + "metastore_id": o.MetastoreId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateMetastoreAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default_catalog_name": types.StringType, + "metastore_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type UpdateModelVersionRequest struct { // The comment attached to the model version Comment types.String `tfsdk:"comment" tf:"optional"` @@ -4205,6 +16868,41 @@ func (newState *UpdateModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UpdateModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState UpdateModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o UpdateModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "full_name": o.FullName, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "full_name": types.StringType, + "version": types.Int64Type, + }, + } +} + type UpdateMonitor struct { // Name of the baseline table from which drift metrics are computed from. // Columns in the monitored table should also be present in the baseline @@ -4213,32 +16911,32 @@ type UpdateMonitor struct { // Custom metrics to compute on the monitored table. These can be aggregate // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). - CustomMetrics []MonitorMetric `tfsdk:"custom_metrics" tf:"optional"` + CustomMetrics types.List `tfsdk:"custom_metrics" tf:"optional"` // Id of dashboard that visualizes the computed metrics. This can be empty // if the monitor is in PENDING state. DashboardId types.String `tfsdk:"dashboard_id" tf:"optional"` // The data classification config for the monitor. - DataClassificationConfig []MonitorDataClassificationConfig `tfsdk:"data_classification_config" tf:"optional,object"` + DataClassificationConfig types.List `tfsdk:"data_classification_config" tf:"optional,object"` // Configuration for monitoring inference logs. - InferenceLog []MonitorInferenceLog `tfsdk:"inference_log" tf:"optional,object"` + InferenceLog types.List `tfsdk:"inference_log" tf:"optional,object"` // The notification settings for the monitor. - Notifications []MonitorNotifications `tfsdk:"notifications" tf:"optional,object"` + Notifications types.List `tfsdk:"notifications" tf:"optional,object"` // Schema where output metric tables are created. OutputSchemaName types.String `tfsdk:"output_schema_name" tf:""` // The schedule for automatically updating and refreshing metric tables. - Schedule []MonitorCronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // List of column expressions to slice data with for targeted analysis. The // data is grouped by each expression independently, resulting in a separate // slice for each predicate and its complements. For high-cardinality // columns, only the top 100 unique values by frequency will generate // slices. - SlicingExprs []types.String `tfsdk:"slicing_exprs" tf:"optional"` + SlicingExprs types.List `tfsdk:"slicing_exprs" tf:"optional"` // Configuration for monitoring snapshot tables. - Snapshot []MonitorSnapshot `tfsdk:"snapshot" tf:"optional,object"` + Snapshot types.List `tfsdk:"snapshot" tf:"optional,object"` // Full name of the table. TableName types.String `tfsdk:"-"` // Configuration for monitoring time series tables. - TimeSeries []MonitorTimeSeries `tfsdk:"time_series" tf:"optional,object"` + TimeSeries types.List `tfsdk:"time_series" tf:"optional,object"` } func (newState *UpdateMonitor) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateMonitor) { @@ -4247,9 +16945,295 @@ func (newState *UpdateMonitor) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upda func (newState *UpdateMonitor) SyncEffectiveFieldsDuringRead(existingState UpdateMonitor) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateMonitor. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateMonitor) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "custom_metrics": reflect.TypeOf(MonitorMetric{}), + "data_classification_config": reflect.TypeOf(MonitorDataClassificationConfig{}), + "inference_log": reflect.TypeOf(MonitorInferenceLog{}), + "notifications": reflect.TypeOf(MonitorNotifications{}), + "schedule": reflect.TypeOf(MonitorCronSchedule{}), + "slicing_exprs": reflect.TypeOf(types.String{}), + "snapshot": reflect.TypeOf(MonitorSnapshot{}), + "time_series": reflect.TypeOf(MonitorTimeSeries{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateMonitor +// only implements ToObjectValue() and Type(). +func (o UpdateMonitor) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "baseline_table_name": o.BaselineTableName, + "custom_metrics": o.CustomMetrics, + "dashboard_id": o.DashboardId, + "data_classification_config": o.DataClassificationConfig, + "inference_log": o.InferenceLog, + "notifications": o.Notifications, + "output_schema_name": o.OutputSchemaName, + "schedule": o.Schedule, + "slicing_exprs": o.SlicingExprs, + "snapshot": o.Snapshot, + "table_name": o.TableName, + "time_series": o.TimeSeries, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateMonitor) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "baseline_table_name": types.StringType, + "custom_metrics": basetypes.ListType{ + ElemType: MonitorMetric{}.Type(ctx), + }, + "dashboard_id": types.StringType, + "data_classification_config": basetypes.ListType{ + ElemType: MonitorDataClassificationConfig{}.Type(ctx), + }, + "inference_log": basetypes.ListType{ + ElemType: MonitorInferenceLog{}.Type(ctx), + }, + "notifications": basetypes.ListType{ + ElemType: MonitorNotifications{}.Type(ctx), + }, + "output_schema_name": types.StringType, + "schedule": basetypes.ListType{ + ElemType: MonitorCronSchedule{}.Type(ctx), + }, + "slicing_exprs": basetypes.ListType{ + ElemType: types.StringType, + }, + "snapshot": basetypes.ListType{ + ElemType: MonitorSnapshot{}.Type(ctx), + }, + "table_name": types.StringType, + "time_series": basetypes.ListType{ + ElemType: MonitorTimeSeries{}.Type(ctx), + }, + }, + } +} + +// GetCustomMetrics returns the value of the CustomMetrics field in UpdateMonitor as +// a slice of MonitorMetric values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetCustomMetrics(ctx context.Context) ([]MonitorMetric, bool) { + if o.CustomMetrics.IsNull() || o.CustomMetrics.IsUnknown() { + return nil, false + } + var v []MonitorMetric + d := o.CustomMetrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomMetrics sets the value of the CustomMetrics field in UpdateMonitor. +func (o *UpdateMonitor) SetCustomMetrics(ctx context.Context, v []MonitorMetric) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_metrics"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomMetrics = types.ListValueMust(t, vs) +} + +// GetDataClassificationConfig returns the value of the DataClassificationConfig field in UpdateMonitor as +// a MonitorDataClassificationConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetDataClassificationConfig(ctx context.Context) (MonitorDataClassificationConfig, bool) { + var e MonitorDataClassificationConfig + if o.DataClassificationConfig.IsNull() || o.DataClassificationConfig.IsUnknown() { + return e, false + } + var v []MonitorDataClassificationConfig + d := o.DataClassificationConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataClassificationConfig sets the value of the DataClassificationConfig field in UpdateMonitor. +func (o *UpdateMonitor) SetDataClassificationConfig(ctx context.Context, v MonitorDataClassificationConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_classification_config"] + o.DataClassificationConfig = types.ListValueMust(t, vs) +} + +// GetInferenceLog returns the value of the InferenceLog field in UpdateMonitor as +// a MonitorInferenceLog value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetInferenceLog(ctx context.Context) (MonitorInferenceLog, bool) { + var e MonitorInferenceLog + if o.InferenceLog.IsNull() || o.InferenceLog.IsUnknown() { + return e, false + } + var v []MonitorInferenceLog + d := o.InferenceLog.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInferenceLog sets the value of the InferenceLog field in UpdateMonitor. +func (o *UpdateMonitor) SetInferenceLog(ctx context.Context, v MonitorInferenceLog) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inference_log"] + o.InferenceLog = types.ListValueMust(t, vs) +} + +// GetNotifications returns the value of the Notifications field in UpdateMonitor as +// a MonitorNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetNotifications(ctx context.Context) (MonitorNotifications, bool) { + var e MonitorNotifications + if o.Notifications.IsNull() || o.Notifications.IsUnknown() { + return e, false + } + var v []MonitorNotifications + d := o.Notifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotifications sets the value of the Notifications field in UpdateMonitor. +func (o *UpdateMonitor) SetNotifications(ctx context.Context, v MonitorNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notifications"] + o.Notifications = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in UpdateMonitor as +// a MonitorCronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetSchedule(ctx context.Context) (MonitorCronSchedule, bool) { + var e MonitorCronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []MonitorCronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in UpdateMonitor. +func (o *UpdateMonitor) SetSchedule(ctx context.Context, v MonitorCronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetSlicingExprs returns the value of the SlicingExprs field in UpdateMonitor as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetSlicingExprs(ctx context.Context) ([]types.String, bool) { + if o.SlicingExprs.IsNull() || o.SlicingExprs.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SlicingExprs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSlicingExprs sets the value of the SlicingExprs field in UpdateMonitor. +func (o *UpdateMonitor) SetSlicingExprs(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["slicing_exprs"] + t = t.(attr.TypeWithElementType).ElementType() + o.SlicingExprs = types.ListValueMust(t, vs) +} + +// GetSnapshot returns the value of the Snapshot field in UpdateMonitor as +// a MonitorSnapshot value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetSnapshot(ctx context.Context) (MonitorSnapshot, bool) { + var e MonitorSnapshot + if o.Snapshot.IsNull() || o.Snapshot.IsUnknown() { + return e, false + } + var v []MonitorSnapshot + d := o.Snapshot.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSnapshot sets the value of the Snapshot field in UpdateMonitor. +func (o *UpdateMonitor) SetSnapshot(ctx context.Context, v MonitorSnapshot) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["snapshot"] + o.Snapshot = types.ListValueMust(t, vs) +} + +// GetTimeSeries returns the value of the TimeSeries field in UpdateMonitor as +// a MonitorTimeSeries value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateMonitor) GetTimeSeries(ctx context.Context) (MonitorTimeSeries, bool) { + var e MonitorTimeSeries + if o.TimeSeries.IsNull() || o.TimeSeries.IsUnknown() { + return e, false + } + var v []MonitorTimeSeries + d := o.TimeSeries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTimeSeries sets the value of the TimeSeries field in UpdateMonitor. +func (o *UpdateMonitor) SetTimeSeries(ctx context.Context, v MonitorTimeSeries) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["time_series"] + o.TimeSeries = types.ListValueMust(t, vs) +} + type UpdatePermissions struct { // Array of permissions change objects. - Changes []PermissionsChange `tfsdk:"changes" tf:"optional"` + Changes types.List `tfsdk:"changes" tf:"optional"` // Full name of securable. FullName types.String `tfsdk:"-"` // Type of securable. @@ -4262,6 +17246,71 @@ func (newState *UpdatePermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdatePermissions) SyncEffectiveFieldsDuringRead(existingState UpdatePermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "changes": reflect.TypeOf(PermissionsChange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePermissions +// only implements ToObjectValue() and Type(). +func (o UpdatePermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "changes": o.Changes, + "full_name": o.FullName, + "securable_type": o.SecurableType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "changes": basetypes.ListType{ + ElemType: PermissionsChange{}.Type(ctx), + }, + "full_name": types.StringType, + "securable_type": types.StringType, + }, + } +} + +// GetChanges returns the value of the Changes field in UpdatePermissions as +// a slice of PermissionsChange values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdatePermissions) GetChanges(ctx context.Context) ([]PermissionsChange, bool) { + if o.Changes.IsNull() || o.Changes.IsUnknown() { + return nil, false + } + var v []PermissionsChange + d := o.Changes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChanges sets the value of the Changes field in UpdatePermissions. +func (o *UpdatePermissions) SetChanges(ctx context.Context, v []PermissionsChange) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["changes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Changes = types.ListValueMust(t, vs) +} + type UpdateRegisteredModelRequest struct { // The comment attached to the registered model Comment types.String `tfsdk:"comment" tf:"optional"` @@ -4279,6 +17328,43 @@ func (newState *UpdateRegisteredModelRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *UpdateRegisteredModelRequest) SyncEffectiveFieldsDuringRead(existingState UpdateRegisteredModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRegisteredModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRegisteredModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRegisteredModelRequest +// only implements ToObjectValue() and Type(). +func (o UpdateRegisteredModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "full_name": o.FullName, + "new_name": o.NewName, + "owner": o.Owner, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRegisteredModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "full_name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + }, + } +} + type UpdateResponse struct { } @@ -4288,6 +17374,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateSchema struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -4301,7 +17414,7 @@ type UpdateSchema struct { // Username of current owner of schema. Owner types.String `tfsdk:"owner" tf:"optional"` // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:"optional"` + Properties types.Map `tfsdk:"properties" tf:"optional"` } func (newState *UpdateSchema) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateSchema) { @@ -4310,19 +17423,90 @@ func (newState *UpdateSchema) SyncEffectiveFieldsDuringCreateOrUpdate(plan Updat func (newState *UpdateSchema) SyncEffectiveFieldsDuringRead(existingState UpdateSchema) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateSchema. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateSchema) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateSchema +// only implements ToObjectValue() and Type(). +func (o UpdateSchema) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "enable_predictive_optimization": o.EnablePredictiveOptimization, + "full_name": o.FullName, + "new_name": o.NewName, + "owner": o.Owner, + "properties": o.Properties, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateSchema) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "enable_predictive_optimization": types.StringType, + "full_name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetProperties returns the value of the Properties field in UpdateSchema as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateSchema) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in UpdateSchema. +func (o *UpdateSchema) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type UpdateStorageCredential struct { // The AWS IAM role configuration. - AwsIamRole []AwsIamRoleRequest `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentityResponse `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // The Cloudflare API token configuration. - CloudflareApiToken []CloudflareApiToken `tfsdk:"cloudflare_api_token" tf:"optional,object"` + CloudflareApiToken types.List `tfsdk:"cloudflare_api_token" tf:"optional,object"` // Comment associated with the credential. Comment types.String `tfsdk:"comment" tf:"optional"` // The Databricks managed GCP service account configuration. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccountRequest `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // Force update even if there are dependent external locations or external // tables. Force types.Bool `tfsdk:"force" tf:"optional"` @@ -4347,6 +17531,207 @@ func (newState *UpdateStorageCredential) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *UpdateStorageCredential) SyncEffectiveFieldsDuringRead(existingState UpdateStorageCredential) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateStorageCredential. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateStorageCredential) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRoleRequest{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentityResponse{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "cloudflare_api_token": reflect.TypeOf(CloudflareApiToken{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccountRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateStorageCredential +// only implements ToObjectValue() and Type(). +func (o UpdateStorageCredential) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "cloudflare_api_token": o.CloudflareApiToken, + "comment": o.Comment, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "force": o.Force, + "isolation_mode": o.IsolationMode, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + "read_only": o.ReadOnly, + "skip_validation": o.SkipValidation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateStorageCredential) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRoleRequest{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentityResponse{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "cloudflare_api_token": basetypes.ListType{ + ElemType: CloudflareApiToken{}.Type(ctx), + }, + "comment": types.StringType, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccountRequest{}.Type(ctx), + }, + "force": types.BoolType, + "isolation_mode": types.StringType, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "read_only": types.BoolType, + "skip_validation": types.BoolType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in UpdateStorageCredential as +// a AwsIamRoleRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateStorageCredential) GetAwsIamRole(ctx context.Context) (AwsIamRoleRequest, bool) { + var e AwsIamRoleRequest + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRoleRequest + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in UpdateStorageCredential. +func (o *UpdateStorageCredential) SetAwsIamRole(ctx context.Context, v AwsIamRoleRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in UpdateStorageCredential as +// a AzureManagedIdentityResponse value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateStorageCredential) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentityResponse, bool) { + var e AzureManagedIdentityResponse + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentityResponse + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in UpdateStorageCredential. +func (o *UpdateStorageCredential) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentityResponse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in UpdateStorageCredential as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateStorageCredential) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in UpdateStorageCredential. +func (o *UpdateStorageCredential) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetCloudflareApiToken returns the value of the CloudflareApiToken field in UpdateStorageCredential as +// a CloudflareApiToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateStorageCredential) GetCloudflareApiToken(ctx context.Context) (CloudflareApiToken, bool) { + var e CloudflareApiToken + if o.CloudflareApiToken.IsNull() || o.CloudflareApiToken.IsUnknown() { + return e, false + } + var v []CloudflareApiToken + d := o.CloudflareApiToken.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloudflareApiToken sets the value of the CloudflareApiToken field in UpdateStorageCredential. +func (o *UpdateStorageCredential) SetCloudflareApiToken(ctx context.Context, v CloudflareApiToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cloudflare_api_token"] + o.CloudflareApiToken = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in UpdateStorageCredential as +// a DatabricksGcpServiceAccountRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateStorageCredential) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccountRequest, bool) { + var e DatabricksGcpServiceAccountRequest + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccountRequest + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in UpdateStorageCredential. +func (o *UpdateStorageCredential) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccountRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + // Update a table owner. type UpdateTableRequest struct { // Full name of the table. @@ -4361,6 +17746,39 @@ func (newState *UpdateTableRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateTableRequest) SyncEffectiveFieldsDuringRead(existingState UpdateTableRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateTableRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateTableRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateTableRequest +// only implements ToObjectValue() and Type(). +func (o UpdateTableRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_name": o.FullName, + "owner": o.Owner, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateTableRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_name": types.StringType, + "owner": types.StringType, + }, + } +} + type UpdateVolumeRequestContent struct { // The comment attached to the volume Comment types.String `tfsdk:"comment" tf:"optional"` @@ -4378,13 +17796,50 @@ func (newState *UpdateVolumeRequestContent) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UpdateVolumeRequestContent) SyncEffectiveFieldsDuringRead(existingState UpdateVolumeRequestContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateVolumeRequestContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateVolumeRequestContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateVolumeRequestContent +// only implements ToObjectValue() and Type(). +func (o UpdateVolumeRequestContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateVolumeRequestContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + }, + } +} + type UpdateWorkspaceBindings struct { // A list of workspace IDs. - AssignWorkspaces []types.Int64 `tfsdk:"assign_workspaces" tf:"optional"` + AssignWorkspaces types.List `tfsdk:"assign_workspaces" tf:"optional"` // The name of the catalog. Name types.String `tfsdk:"-"` // A list of workspace IDs. - UnassignWorkspaces []types.Int64 `tfsdk:"unassign_workspaces" tf:"optional"` + UnassignWorkspaces types.List `tfsdk:"unassign_workspaces" tf:"optional"` } func (newState *UpdateWorkspaceBindings) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateWorkspaceBindings) { @@ -4393,11 +17848,105 @@ func (newState *UpdateWorkspaceBindings) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *UpdateWorkspaceBindings) SyncEffectiveFieldsDuringRead(existingState UpdateWorkspaceBindings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateWorkspaceBindings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateWorkspaceBindings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "assign_workspaces": reflect.TypeOf(types.Int64{}), + "unassign_workspaces": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateWorkspaceBindings +// only implements ToObjectValue() and Type(). +func (o UpdateWorkspaceBindings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assign_workspaces": o.AssignWorkspaces, + "name": o.Name, + "unassign_workspaces": o.UnassignWorkspaces, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateWorkspaceBindings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assign_workspaces": basetypes.ListType{ + ElemType: types.Int64Type, + }, + "name": types.StringType, + "unassign_workspaces": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetAssignWorkspaces returns the value of the AssignWorkspaces field in UpdateWorkspaceBindings as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateWorkspaceBindings) GetAssignWorkspaces(ctx context.Context) ([]types.Int64, bool) { + if o.AssignWorkspaces.IsNull() || o.AssignWorkspaces.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.AssignWorkspaces.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAssignWorkspaces sets the value of the AssignWorkspaces field in UpdateWorkspaceBindings. +func (o *UpdateWorkspaceBindings) SetAssignWorkspaces(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["assign_workspaces"] + t = t.(attr.TypeWithElementType).ElementType() + o.AssignWorkspaces = types.ListValueMust(t, vs) +} + +// GetUnassignWorkspaces returns the value of the UnassignWorkspaces field in UpdateWorkspaceBindings as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateWorkspaceBindings) GetUnassignWorkspaces(ctx context.Context) ([]types.Int64, bool) { + if o.UnassignWorkspaces.IsNull() || o.UnassignWorkspaces.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.UnassignWorkspaces.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUnassignWorkspaces sets the value of the UnassignWorkspaces field in UpdateWorkspaceBindings. +func (o *UpdateWorkspaceBindings) SetUnassignWorkspaces(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["unassign_workspaces"] + t = t.(attr.TypeWithElementType).ElementType() + o.UnassignWorkspaces = types.ListValueMust(t, vs) +} + type UpdateWorkspaceBindingsParameters struct { // List of workspace bindings - Add []WorkspaceBinding `tfsdk:"add" tf:"optional"` + Add types.List `tfsdk:"add" tf:"optional"` // List of workspace bindings - Remove []WorkspaceBinding `tfsdk:"remove" tf:"optional"` + Remove types.List `tfsdk:"remove" tf:"optional"` // The name of the securable. SecurableName types.String `tfsdk:"-"` // The type of the securable to bind to a workspace. @@ -4410,11 +17959,107 @@ func (newState *UpdateWorkspaceBindingsParameters) SyncEffectiveFieldsDuringCrea func (newState *UpdateWorkspaceBindingsParameters) SyncEffectiveFieldsDuringRead(existingState UpdateWorkspaceBindingsParameters) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateWorkspaceBindingsParameters. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateWorkspaceBindingsParameters) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "add": reflect.TypeOf(WorkspaceBinding{}), + "remove": reflect.TypeOf(WorkspaceBinding{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateWorkspaceBindingsParameters +// only implements ToObjectValue() and Type(). +func (o UpdateWorkspaceBindingsParameters) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "add": o.Add, + "remove": o.Remove, + "securable_name": o.SecurableName, + "securable_type": o.SecurableType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateWorkspaceBindingsParameters) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "add": basetypes.ListType{ + ElemType: WorkspaceBinding{}.Type(ctx), + }, + "remove": basetypes.ListType{ + ElemType: WorkspaceBinding{}.Type(ctx), + }, + "securable_name": types.StringType, + "securable_type": types.StringType, + }, + } +} + +// GetAdd returns the value of the Add field in UpdateWorkspaceBindingsParameters as +// a slice of WorkspaceBinding values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateWorkspaceBindingsParameters) GetAdd(ctx context.Context) ([]WorkspaceBinding, bool) { + if o.Add.IsNull() || o.Add.IsUnknown() { + return nil, false + } + var v []WorkspaceBinding + d := o.Add.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAdd sets the value of the Add field in UpdateWorkspaceBindingsParameters. +func (o *UpdateWorkspaceBindingsParameters) SetAdd(ctx context.Context, v []WorkspaceBinding) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["add"] + t = t.(attr.TypeWithElementType).ElementType() + o.Add = types.ListValueMust(t, vs) +} + +// GetRemove returns the value of the Remove field in UpdateWorkspaceBindingsParameters as +// a slice of WorkspaceBinding values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateWorkspaceBindingsParameters) GetRemove(ctx context.Context) ([]WorkspaceBinding, bool) { + if o.Remove.IsNull() || o.Remove.IsUnknown() { + return nil, false + } + var v []WorkspaceBinding + d := o.Remove.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRemove sets the value of the Remove field in UpdateWorkspaceBindingsParameters. +func (o *UpdateWorkspaceBindingsParameters) SetRemove(ctx context.Context, v []WorkspaceBinding) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["remove"] + t = t.(attr.TypeWithElementType).ElementType() + o.Remove = types.ListValueMust(t, vs) +} + type ValidateCredentialRequest struct { // The AWS IAM role configuration - AwsIamRole []AwsIamRole `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentity `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // Required. The name of an existing credential or long-lived cloud // credential to validate. CredentialName types.String `tfsdk:"credential_name" tf:"optional"` @@ -4438,12 +18083,114 @@ func (newState *ValidateCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ValidateCredentialRequest) SyncEffectiveFieldsDuringRead(existingState ValidateCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ValidateCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ValidateCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRole{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentity{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ValidateCredentialRequest +// only implements ToObjectValue() and Type(). +func (o ValidateCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "credential_name": o.CredentialName, + "external_location_name": o.ExternalLocationName, + "purpose": o.Purpose, + "read_only": o.ReadOnly, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ValidateCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRole{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentity{}.Type(ctx), + }, + "credential_name": types.StringType, + "external_location_name": types.StringType, + "purpose": types.StringType, + "read_only": types.BoolType, + "url": types.StringType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in ValidateCredentialRequest as +// a AwsIamRole value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateCredentialRequest) GetAwsIamRole(ctx context.Context) (AwsIamRole, bool) { + var e AwsIamRole + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRole + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in ValidateCredentialRequest. +func (o *ValidateCredentialRequest) SetAwsIamRole(ctx context.Context, v AwsIamRole) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in ValidateCredentialRequest as +// a AzureManagedIdentity value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateCredentialRequest) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentity, bool) { + var e AzureManagedIdentity + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentity + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in ValidateCredentialRequest. +func (o *ValidateCredentialRequest) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentity) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + type ValidateCredentialResponse struct { // Whether the tested location is a directory in cloud storage. Only // applicable for when purpose is **STORAGE**. IsDir types.Bool `tfsdk:"isDir" tf:"optional"` // The results of the validation check. - Results []CredentialValidationResult `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ValidateCredentialResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ValidateCredentialResponse) { @@ -4452,17 +18199,80 @@ func (newState *ValidateCredentialResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ValidateCredentialResponse) SyncEffectiveFieldsDuringRead(existingState ValidateCredentialResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ValidateCredentialResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ValidateCredentialResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(CredentialValidationResult{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ValidateCredentialResponse +// only implements ToObjectValue() and Type(). +func (o ValidateCredentialResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "isDir": o.IsDir, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ValidateCredentialResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "isDir": types.BoolType, + "results": basetypes.ListType{ + ElemType: CredentialValidationResult{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ValidateCredentialResponse as +// a slice of CredentialValidationResult values. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateCredentialResponse) GetResults(ctx context.Context) ([]CredentialValidationResult, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []CredentialValidationResult + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ValidateCredentialResponse. +func (o *ValidateCredentialResponse) SetResults(ctx context.Context, v []CredentialValidationResult) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + type ValidateStorageCredential struct { // The AWS IAM role configuration. - AwsIamRole []AwsIamRoleRequest `tfsdk:"aws_iam_role" tf:"optional,object"` + AwsIamRole types.List `tfsdk:"aws_iam_role" tf:"optional,object"` // The Azure managed identity configuration. - AzureManagedIdentity []AzureManagedIdentityRequest `tfsdk:"azure_managed_identity" tf:"optional,object"` + AzureManagedIdentity types.List `tfsdk:"azure_managed_identity" tf:"optional,object"` // The Azure service principal configuration. - AzureServicePrincipal []AzureServicePrincipal `tfsdk:"azure_service_principal" tf:"optional,object"` + AzureServicePrincipal types.List `tfsdk:"azure_service_principal" tf:"optional,object"` // The Cloudflare API token configuration. - CloudflareApiToken []CloudflareApiToken `tfsdk:"cloudflare_api_token" tf:"optional,object"` + CloudflareApiToken types.List `tfsdk:"cloudflare_api_token" tf:"optional,object"` // The Databricks created GCP service account configuration. - DatabricksGcpServiceAccount []DatabricksGcpServiceAccountRequest `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` + DatabricksGcpServiceAccount types.List `tfsdk:"databricks_gcp_service_account" tf:"optional,object"` // The name of an existing external location to validate. ExternalLocationName types.String `tfsdk:"external_location_name" tf:"optional"` // Whether the storage credential is only usable for read operations. @@ -4479,11 +18289,204 @@ func (newState *ValidateStorageCredential) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ValidateStorageCredential) SyncEffectiveFieldsDuringRead(existingState ValidateStorageCredential) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ValidateStorageCredential. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ValidateStorageCredential) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_iam_role": reflect.TypeOf(AwsIamRoleRequest{}), + "azure_managed_identity": reflect.TypeOf(AzureManagedIdentityRequest{}), + "azure_service_principal": reflect.TypeOf(AzureServicePrincipal{}), + "cloudflare_api_token": reflect.TypeOf(CloudflareApiToken{}), + "databricks_gcp_service_account": reflect.TypeOf(DatabricksGcpServiceAccountRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ValidateStorageCredential +// only implements ToObjectValue() and Type(). +func (o ValidateStorageCredential) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_iam_role": o.AwsIamRole, + "azure_managed_identity": o.AzureManagedIdentity, + "azure_service_principal": o.AzureServicePrincipal, + "cloudflare_api_token": o.CloudflareApiToken, + "databricks_gcp_service_account": o.DatabricksGcpServiceAccount, + "external_location_name": o.ExternalLocationName, + "read_only": o.ReadOnly, + "storage_credential_name": o.StorageCredentialName, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ValidateStorageCredential) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_iam_role": basetypes.ListType{ + ElemType: AwsIamRoleRequest{}.Type(ctx), + }, + "azure_managed_identity": basetypes.ListType{ + ElemType: AzureManagedIdentityRequest{}.Type(ctx), + }, + "azure_service_principal": basetypes.ListType{ + ElemType: AzureServicePrincipal{}.Type(ctx), + }, + "cloudflare_api_token": basetypes.ListType{ + ElemType: CloudflareApiToken{}.Type(ctx), + }, + "databricks_gcp_service_account": basetypes.ListType{ + ElemType: DatabricksGcpServiceAccountRequest{}.Type(ctx), + }, + "external_location_name": types.StringType, + "read_only": types.BoolType, + "storage_credential_name": types.StringType, + "url": types.StringType, + }, + } +} + +// GetAwsIamRole returns the value of the AwsIamRole field in ValidateStorageCredential as +// a AwsIamRoleRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateStorageCredential) GetAwsIamRole(ctx context.Context) (AwsIamRoleRequest, bool) { + var e AwsIamRoleRequest + if o.AwsIamRole.IsNull() || o.AwsIamRole.IsUnknown() { + return e, false + } + var v []AwsIamRoleRequest + d := o.AwsIamRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsIamRole sets the value of the AwsIamRole field in ValidateStorageCredential. +func (o *ValidateStorageCredential) SetAwsIamRole(ctx context.Context, v AwsIamRoleRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_iam_role"] + o.AwsIamRole = types.ListValueMust(t, vs) +} + +// GetAzureManagedIdentity returns the value of the AzureManagedIdentity field in ValidateStorageCredential as +// a AzureManagedIdentityRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateStorageCredential) GetAzureManagedIdentity(ctx context.Context) (AzureManagedIdentityRequest, bool) { + var e AzureManagedIdentityRequest + if o.AzureManagedIdentity.IsNull() || o.AzureManagedIdentity.IsUnknown() { + return e, false + } + var v []AzureManagedIdentityRequest + d := o.AzureManagedIdentity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureManagedIdentity sets the value of the AzureManagedIdentity field in ValidateStorageCredential. +func (o *ValidateStorageCredential) SetAzureManagedIdentity(ctx context.Context, v AzureManagedIdentityRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_managed_identity"] + o.AzureManagedIdentity = types.ListValueMust(t, vs) +} + +// GetAzureServicePrincipal returns the value of the AzureServicePrincipal field in ValidateStorageCredential as +// a AzureServicePrincipal value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateStorageCredential) GetAzureServicePrincipal(ctx context.Context) (AzureServicePrincipal, bool) { + var e AzureServicePrincipal + if o.AzureServicePrincipal.IsNull() || o.AzureServicePrincipal.IsUnknown() { + return e, false + } + var v []AzureServicePrincipal + d := o.AzureServicePrincipal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServicePrincipal sets the value of the AzureServicePrincipal field in ValidateStorageCredential. +func (o *ValidateStorageCredential) SetAzureServicePrincipal(ctx context.Context, v AzureServicePrincipal) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_principal"] + o.AzureServicePrincipal = types.ListValueMust(t, vs) +} + +// GetCloudflareApiToken returns the value of the CloudflareApiToken field in ValidateStorageCredential as +// a CloudflareApiToken value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateStorageCredential) GetCloudflareApiToken(ctx context.Context) (CloudflareApiToken, bool) { + var e CloudflareApiToken + if o.CloudflareApiToken.IsNull() || o.CloudflareApiToken.IsUnknown() { + return e, false + } + var v []CloudflareApiToken + d := o.CloudflareApiToken.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloudflareApiToken sets the value of the CloudflareApiToken field in ValidateStorageCredential. +func (o *ValidateStorageCredential) SetCloudflareApiToken(ctx context.Context, v CloudflareApiToken) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cloudflare_api_token"] + o.CloudflareApiToken = types.ListValueMust(t, vs) +} + +// GetDatabricksGcpServiceAccount returns the value of the DatabricksGcpServiceAccount field in ValidateStorageCredential as +// a DatabricksGcpServiceAccountRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateStorageCredential) GetDatabricksGcpServiceAccount(ctx context.Context) (DatabricksGcpServiceAccountRequest, bool) { + var e DatabricksGcpServiceAccountRequest + if o.DatabricksGcpServiceAccount.IsNull() || o.DatabricksGcpServiceAccount.IsUnknown() { + return e, false + } + var v []DatabricksGcpServiceAccountRequest + d := o.DatabricksGcpServiceAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksGcpServiceAccount sets the value of the DatabricksGcpServiceAccount field in ValidateStorageCredential. +func (o *ValidateStorageCredential) SetDatabricksGcpServiceAccount(ctx context.Context, v DatabricksGcpServiceAccountRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_gcp_service_account"] + o.DatabricksGcpServiceAccount = types.ListValueMust(t, vs) +} + type ValidateStorageCredentialResponse struct { // Whether the tested location is a directory in cloud storage. IsDir types.Bool `tfsdk:"isDir" tf:"optional"` // The results of the validation check. - Results []ValidationResult `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ValidateStorageCredentialResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ValidateStorageCredentialResponse) { @@ -4492,6 +18495,69 @@ func (newState *ValidateStorageCredentialResponse) SyncEffectiveFieldsDuringCrea func (newState *ValidateStorageCredentialResponse) SyncEffectiveFieldsDuringRead(existingState ValidateStorageCredentialResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ValidateStorageCredentialResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ValidateStorageCredentialResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(ValidationResult{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ValidateStorageCredentialResponse +// only implements ToObjectValue() and Type(). +func (o ValidateStorageCredentialResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "isDir": o.IsDir, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ValidateStorageCredentialResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "isDir": types.BoolType, + "results": basetypes.ListType{ + ElemType: ValidationResult{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ValidateStorageCredentialResponse as +// a slice of ValidationResult values. +// If the field is unknown or null, the boolean return value is false. +func (o *ValidateStorageCredentialResponse) GetResults(ctx context.Context) ([]ValidationResult, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []ValidationResult + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ValidateStorageCredentialResponse. +func (o *ValidateStorageCredentialResponse) SetResults(ctx context.Context, v []ValidationResult) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + type ValidationResult struct { // Error message would exist when the result does not equal to **PASS**. Message types.String `tfsdk:"message" tf:"optional"` @@ -4507,6 +18573,41 @@ func (newState *ValidationResult) SyncEffectiveFieldsDuringCreateOrUpdate(plan V func (newState *ValidationResult) SyncEffectiveFieldsDuringRead(existingState ValidationResult) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ValidationResult. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ValidationResult) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ValidationResult +// only implements ToObjectValue() and Type(). +func (o ValidationResult) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + "operation": o.Operation, + "result": o.Result, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ValidationResult) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + "operation": types.StringType, + "result": types.StringType, + }, + } +} + type VolumeInfo struct { // The AWS access point to use when accesing s3 for this external location. AccessPoint types.String `tfsdk:"access_point" tf:"optional"` @@ -4523,7 +18624,7 @@ type VolumeInfo struct { // The identifier of the user who created the volume CreatedBy types.String `tfsdk:"created_by" tf:"optional"` // Encryption options that apply to clients connecting to cloud storage. - EncryptionDetails []EncryptionDetails `tfsdk:"encryption_details" tf:"optional,object"` + EncryptionDetails types.List `tfsdk:"encryption_details" tf:"optional,object"` // The three-level (fully qualified) name of the volume FullName types.String `tfsdk:"full_name" tf:"optional"` // The unique identifier of the metastore @@ -4552,6 +18653,99 @@ func (newState *VolumeInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan VolumeI func (newState *VolumeInfo) SyncEffectiveFieldsDuringRead(existingState VolumeInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in VolumeInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a VolumeInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "encryption_details": reflect.TypeOf(EncryptionDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, VolumeInfo +// only implements ToObjectValue() and Type(). +func (o VolumeInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_point": o.AccessPoint, + "browse_only": o.BrowseOnly, + "catalog_name": o.CatalogName, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "encryption_details": o.EncryptionDetails, + "full_name": o.FullName, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "schema_name": o.SchemaName, + "storage_location": o.StorageLocation, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "volume_id": o.VolumeId, + "volume_type": o.VolumeType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o VolumeInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_point": types.StringType, + "browse_only": types.BoolType, + "catalog_name": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "encryption_details": basetypes.ListType{ + ElemType: EncryptionDetails{}.Type(ctx), + }, + "full_name": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "schema_name": types.StringType, + "storage_location": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "volume_id": types.StringType, + "volume_type": types.StringType, + }, + } +} + +// GetEncryptionDetails returns the value of the EncryptionDetails field in VolumeInfo as +// a EncryptionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *VolumeInfo) GetEncryptionDetails(ctx context.Context) (EncryptionDetails, bool) { + var e EncryptionDetails + if o.EncryptionDetails.IsNull() || o.EncryptionDetails.IsUnknown() { + return e, false + } + var v []EncryptionDetails + d := o.EncryptionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEncryptionDetails sets the value of the EncryptionDetails field in VolumeInfo. +func (o *VolumeInfo) SetEncryptionDetails(ctx context.Context, v EncryptionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["encryption_details"] + o.EncryptionDetails = types.ListValueMust(t, vs) +} + type WorkspaceBinding struct { BindingType types.String `tfsdk:"binding_type" tf:"optional"` @@ -4564,10 +18758,43 @@ func (newState *WorkspaceBinding) SyncEffectiveFieldsDuringCreateOrUpdate(plan W func (newState *WorkspaceBinding) SyncEffectiveFieldsDuringRead(existingState WorkspaceBinding) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceBinding. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceBinding) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceBinding +// only implements ToObjectValue() and Type(). +func (o WorkspaceBinding) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "binding_type": o.BindingType, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceBinding) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "binding_type": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + // Currently assigned workspace bindings type WorkspaceBindingsResponse struct { // List of workspace bindings - Bindings []WorkspaceBinding `tfsdk:"bindings" tf:"optional"` + Bindings types.List `tfsdk:"bindings" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). @@ -4579,3 +18806,66 @@ func (newState *WorkspaceBindingsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *WorkspaceBindingsResponse) SyncEffectiveFieldsDuringRead(existingState WorkspaceBindingsResponse) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceBindingsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceBindingsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "bindings": reflect.TypeOf(WorkspaceBinding{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceBindingsResponse +// only implements ToObjectValue() and Type(). +func (o WorkspaceBindingsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bindings": o.Bindings, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceBindingsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bindings": basetypes.ListType{ + ElemType: WorkspaceBinding{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetBindings returns the value of the Bindings field in WorkspaceBindingsResponse as +// a slice of WorkspaceBinding values. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkspaceBindingsResponse) GetBindings(ctx context.Context) ([]WorkspaceBinding, bool) { + if o.Bindings.IsNull() || o.Bindings.IsUnknown() { + return nil, false + } + var v []WorkspaceBinding + d := o.Bindings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetBindings sets the value of the Bindings field in WorkspaceBindingsResponse. +func (o *WorkspaceBindingsResponse) SetBindings(ctx context.Context, v []WorkspaceBinding) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["bindings"] + t = t.(attr.TypeWithElementType).ElementType() + o.Bindings = types.ListValueMust(t, vs) +} diff --git a/internal/service/cleanrooms_tf/model.go b/internal/service/cleanrooms_tf/model.go index fbd3e6b40..8ff8e1884 100755 --- a/internal/service/cleanrooms_tf/model.go +++ b/internal/service/cleanrooms_tf/model.go @@ -11,11 +11,18 @@ We use go-native types for lists and maps intentionally for the ease for convert package cleanrooms_tf import ( - "github.com/databricks/databricks-sdk-go/service/catalog" - "github.com/databricks/databricks-sdk-go/service/jobs" - "github.com/databricks/databricks-sdk-go/service/settings" - "github.com/databricks/databricks-sdk-go/service/sharing" + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/databricks/terraform-provider-databricks/internal/service/catalog_tf" + "github.com/databricks/terraform-provider-databricks/internal/service/jobs_tf" + "github.com/databricks/terraform-provider-databricks/internal/service/settings_tf" + "github.com/databricks/terraform-provider-databricks/internal/service/sharing_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type CleanRoom struct { @@ -37,14 +44,14 @@ type CleanRoom struct { // Output catalog of the clean room. It is an output only field. Output // catalog is manipulated using the separate CreateCleanRoomOutputCatalog // API. - OutputCatalog []CleanRoomOutputCatalog `tfsdk:"output_catalog" tf:"optional,object"` + OutputCatalog types.List `tfsdk:"output_catalog" tf:"optional,object"` // This is Databricks username of the owner of the local clean room // securable for permission management. Owner types.String `tfsdk:"owner" tf:"optional"` // Central clean room details. During creation, users need to specify // cloud_vendor, region, and collaborators.global_metastore_id. This field // will not be filled in the ListCleanRooms call. - RemoteDetailedInfo []CleanRoomRemoteDetail `tfsdk:"remote_detailed_info" tf:"optional,object"` + RemoteDetailedInfo types.List `tfsdk:"remote_detailed_info" tf:"optional,object"` // Clean room status. Status types.String `tfsdk:"status" tf:"optional"` // When the clean room was last updated, in epoch milliseconds. @@ -57,6 +64,114 @@ func (newState *CleanRoom) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoo func (newState *CleanRoom) SyncEffectiveFieldsDuringRead(existingState CleanRoom) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoom. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoom) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "output_catalog": reflect.TypeOf(CleanRoomOutputCatalog{}), + "remote_detailed_info": reflect.TypeOf(CleanRoomRemoteDetail{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoom +// only implements ToObjectValue() and Type(). +func (o CleanRoom) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_restricted": o.AccessRestricted, + "comment": o.Comment, + "created_at": o.CreatedAt, + "local_collaborator_alias": o.LocalCollaboratorAlias, + "name": o.Name, + "output_catalog": o.OutputCatalog, + "owner": o.Owner, + "remote_detailed_info": o.RemoteDetailedInfo, + "status": o.Status, + "updated_at": o.UpdatedAt, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoom) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_restricted": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "local_collaborator_alias": types.StringType, + "name": types.StringType, + "output_catalog": basetypes.ListType{ + ElemType: CleanRoomOutputCatalog{}.Type(ctx), + }, + "owner": types.StringType, + "remote_detailed_info": basetypes.ListType{ + ElemType: CleanRoomRemoteDetail{}.Type(ctx), + }, + "status": types.StringType, + "updated_at": types.Int64Type, + }, + } +} + +// GetOutputCatalog returns the value of the OutputCatalog field in CleanRoom as +// a CleanRoomOutputCatalog value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoom) GetOutputCatalog(ctx context.Context) (CleanRoomOutputCatalog, bool) { + var e CleanRoomOutputCatalog + if o.OutputCatalog.IsNull() || o.OutputCatalog.IsUnknown() { + return e, false + } + var v []CleanRoomOutputCatalog + d := o.OutputCatalog.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOutputCatalog sets the value of the OutputCatalog field in CleanRoom. +func (o *CleanRoom) SetOutputCatalog(ctx context.Context, v CleanRoomOutputCatalog) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["output_catalog"] + o.OutputCatalog = types.ListValueMust(t, vs) +} + +// GetRemoteDetailedInfo returns the value of the RemoteDetailedInfo field in CleanRoom as +// a CleanRoomRemoteDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoom) GetRemoteDetailedInfo(ctx context.Context) (CleanRoomRemoteDetail, bool) { + var e CleanRoomRemoteDetail + if o.RemoteDetailedInfo.IsNull() || o.RemoteDetailedInfo.IsUnknown() { + return e, false + } + var v []CleanRoomRemoteDetail + d := o.RemoteDetailedInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRemoteDetailedInfo sets the value of the RemoteDetailedInfo field in CleanRoom. +func (o *CleanRoom) SetRemoteDetailedInfo(ctx context.Context, v CleanRoomRemoteDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["remote_detailed_info"] + o.RemoteDetailedInfo = types.ListValueMust(t, vs) +} + // Metadata of the clean room asset type CleanRoomAsset struct { // When the asset is added to the clean room, in epoch milliseconds. @@ -65,10 +180,10 @@ type CleanRoomAsset struct { AssetType types.String `tfsdk:"asset_type" tf:"optional"` // Foreign table details available to all collaborators of the clean room. // Present if and only if **asset_type** is **FOREIGN_TABLE** - ForeignTable []CleanRoomAssetForeignTable `tfsdk:"foreign_table" tf:"optional,object"` + ForeignTable types.List `tfsdk:"foreign_table" tf:"optional,object"` // Local details for a foreign that are only available to its owner. Present // if and only if **asset_type** is **FOREIGN_TABLE** - ForeignTableLocalDetails []CleanRoomAssetForeignTableLocalDetails `tfsdk:"foreign_table_local_details" tf:"optional,object"` + ForeignTableLocalDetails types.List `tfsdk:"foreign_table_local_details" tf:"optional,object"` // A fully qualified name that uniquely identifies the asset within the // clean room. This is also the name displayed in the clean room UI. // @@ -79,26 +194,26 @@ type CleanRoomAsset struct { Name types.String `tfsdk:"name" tf:"optional"` // Notebook details available to all collaborators of the clean room. // Present if and only if **asset_type** is **NOTEBOOK_FILE** - Notebook []CleanRoomAssetNotebook `tfsdk:"notebook" tf:"optional,object"` + Notebook types.List `tfsdk:"notebook" tf:"optional,object"` // The alias of the collaborator who owns this asset OwnerCollaboratorAlias types.String `tfsdk:"owner_collaborator_alias" tf:"optional"` // Status of the asset Status types.String `tfsdk:"status" tf:"optional"` // Table details available to all collaborators of the clean room. Present // if and only if **asset_type** is **TABLE** - Table []CleanRoomAssetTable `tfsdk:"table" tf:"optional,object"` + Table types.List `tfsdk:"table" tf:"optional,object"` // Local details for a table that are only available to its owner. Present // if and only if **asset_type** is **TABLE** - TableLocalDetails []CleanRoomAssetTableLocalDetails `tfsdk:"table_local_details" tf:"optional,object"` + TableLocalDetails types.List `tfsdk:"table_local_details" tf:"optional,object"` // View details available to all collaborators of the clean room. Present if // and only if **asset_type** is **VIEW** - View []CleanRoomAssetView `tfsdk:"view" tf:"optional,object"` + View types.List `tfsdk:"view" tf:"optional,object"` // Local details for a view that are only available to its owner. Present if // and only if **asset_type** is **VIEW** - ViewLocalDetails []CleanRoomAssetViewLocalDetails `tfsdk:"view_local_details" tf:"optional,object"` + ViewLocalDetails types.List `tfsdk:"view_local_details" tf:"optional,object"` // Local details for a volume that are only available to its owner. Present // if and only if **asset_type** is **VOLUME** - VolumeLocalDetails []CleanRoomAssetVolumeLocalDetails `tfsdk:"volume_local_details" tf:"optional,object"` + VolumeLocalDetails types.List `tfsdk:"volume_local_details" tf:"optional,object"` } func (newState *CleanRoomAsset) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoomAsset) { @@ -107,9 +222,297 @@ func (newState *CleanRoomAsset) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cle func (newState *CleanRoomAsset) SyncEffectiveFieldsDuringRead(existingState CleanRoomAsset) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAsset. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAsset) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "foreign_table": reflect.TypeOf(CleanRoomAssetForeignTable{}), + "foreign_table_local_details": reflect.TypeOf(CleanRoomAssetForeignTableLocalDetails{}), + "notebook": reflect.TypeOf(CleanRoomAssetNotebook{}), + "table": reflect.TypeOf(CleanRoomAssetTable{}), + "table_local_details": reflect.TypeOf(CleanRoomAssetTableLocalDetails{}), + "view": reflect.TypeOf(CleanRoomAssetView{}), + "view_local_details": reflect.TypeOf(CleanRoomAssetViewLocalDetails{}), + "volume_local_details": reflect.TypeOf(CleanRoomAssetVolumeLocalDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAsset +// only implements ToObjectValue() and Type(). +func (o CleanRoomAsset) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "added_at": o.AddedAt, + "asset_type": o.AssetType, + "foreign_table": o.ForeignTable, + "foreign_table_local_details": o.ForeignTableLocalDetails, + "name": o.Name, + "notebook": o.Notebook, + "owner_collaborator_alias": o.OwnerCollaboratorAlias, + "status": o.Status, + "table": o.Table, + "table_local_details": o.TableLocalDetails, + "view": o.View, + "view_local_details": o.ViewLocalDetails, + "volume_local_details": o.VolumeLocalDetails, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAsset) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "added_at": types.Int64Type, + "asset_type": types.StringType, + "foreign_table": basetypes.ListType{ + ElemType: CleanRoomAssetForeignTable{}.Type(ctx), + }, + "foreign_table_local_details": basetypes.ListType{ + ElemType: CleanRoomAssetForeignTableLocalDetails{}.Type(ctx), + }, + "name": types.StringType, + "notebook": basetypes.ListType{ + ElemType: CleanRoomAssetNotebook{}.Type(ctx), + }, + "owner_collaborator_alias": types.StringType, + "status": types.StringType, + "table": basetypes.ListType{ + ElemType: CleanRoomAssetTable{}.Type(ctx), + }, + "table_local_details": basetypes.ListType{ + ElemType: CleanRoomAssetTableLocalDetails{}.Type(ctx), + }, + "view": basetypes.ListType{ + ElemType: CleanRoomAssetView{}.Type(ctx), + }, + "view_local_details": basetypes.ListType{ + ElemType: CleanRoomAssetViewLocalDetails{}.Type(ctx), + }, + "volume_local_details": basetypes.ListType{ + ElemType: CleanRoomAssetVolumeLocalDetails{}.Type(ctx), + }, + }, + } +} + +// GetForeignTable returns the value of the ForeignTable field in CleanRoomAsset as +// a CleanRoomAssetForeignTable value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetForeignTable(ctx context.Context) (CleanRoomAssetForeignTable, bool) { + var e CleanRoomAssetForeignTable + if o.ForeignTable.IsNull() || o.ForeignTable.IsUnknown() { + return e, false + } + var v []CleanRoomAssetForeignTable + d := o.ForeignTable.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetForeignTable sets the value of the ForeignTable field in CleanRoomAsset. +func (o *CleanRoomAsset) SetForeignTable(ctx context.Context, v CleanRoomAssetForeignTable) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["foreign_table"] + o.ForeignTable = types.ListValueMust(t, vs) +} + +// GetForeignTableLocalDetails returns the value of the ForeignTableLocalDetails field in CleanRoomAsset as +// a CleanRoomAssetForeignTableLocalDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetForeignTableLocalDetails(ctx context.Context) (CleanRoomAssetForeignTableLocalDetails, bool) { + var e CleanRoomAssetForeignTableLocalDetails + if o.ForeignTableLocalDetails.IsNull() || o.ForeignTableLocalDetails.IsUnknown() { + return e, false + } + var v []CleanRoomAssetForeignTableLocalDetails + d := o.ForeignTableLocalDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetForeignTableLocalDetails sets the value of the ForeignTableLocalDetails field in CleanRoomAsset. +func (o *CleanRoomAsset) SetForeignTableLocalDetails(ctx context.Context, v CleanRoomAssetForeignTableLocalDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["foreign_table_local_details"] + o.ForeignTableLocalDetails = types.ListValueMust(t, vs) +} + +// GetNotebook returns the value of the Notebook field in CleanRoomAsset as +// a CleanRoomAssetNotebook value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetNotebook(ctx context.Context) (CleanRoomAssetNotebook, bool) { + var e CleanRoomAssetNotebook + if o.Notebook.IsNull() || o.Notebook.IsUnknown() { + return e, false + } + var v []CleanRoomAssetNotebook + d := o.Notebook.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebook sets the value of the Notebook field in CleanRoomAsset. +func (o *CleanRoomAsset) SetNotebook(ctx context.Context, v CleanRoomAssetNotebook) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook"] + o.Notebook = types.ListValueMust(t, vs) +} + +// GetTable returns the value of the Table field in CleanRoomAsset as +// a CleanRoomAssetTable value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetTable(ctx context.Context) (CleanRoomAssetTable, bool) { + var e CleanRoomAssetTable + if o.Table.IsNull() || o.Table.IsUnknown() { + return e, false + } + var v []CleanRoomAssetTable + d := o.Table.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTable sets the value of the Table field in CleanRoomAsset. +func (o *CleanRoomAsset) SetTable(ctx context.Context, v CleanRoomAssetTable) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table"] + o.Table = types.ListValueMust(t, vs) +} + +// GetTableLocalDetails returns the value of the TableLocalDetails field in CleanRoomAsset as +// a CleanRoomAssetTableLocalDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetTableLocalDetails(ctx context.Context) (CleanRoomAssetTableLocalDetails, bool) { + var e CleanRoomAssetTableLocalDetails + if o.TableLocalDetails.IsNull() || o.TableLocalDetails.IsUnknown() { + return e, false + } + var v []CleanRoomAssetTableLocalDetails + d := o.TableLocalDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTableLocalDetails sets the value of the TableLocalDetails field in CleanRoomAsset. +func (o *CleanRoomAsset) SetTableLocalDetails(ctx context.Context, v CleanRoomAssetTableLocalDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_local_details"] + o.TableLocalDetails = types.ListValueMust(t, vs) +} + +// GetView returns the value of the View field in CleanRoomAsset as +// a CleanRoomAssetView value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetView(ctx context.Context) (CleanRoomAssetView, bool) { + var e CleanRoomAssetView + if o.View.IsNull() || o.View.IsUnknown() { + return e, false + } + var v []CleanRoomAssetView + d := o.View.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetView sets the value of the View field in CleanRoomAsset. +func (o *CleanRoomAsset) SetView(ctx context.Context, v CleanRoomAssetView) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["view"] + o.View = types.ListValueMust(t, vs) +} + +// GetViewLocalDetails returns the value of the ViewLocalDetails field in CleanRoomAsset as +// a CleanRoomAssetViewLocalDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetViewLocalDetails(ctx context.Context) (CleanRoomAssetViewLocalDetails, bool) { + var e CleanRoomAssetViewLocalDetails + if o.ViewLocalDetails.IsNull() || o.ViewLocalDetails.IsUnknown() { + return e, false + } + var v []CleanRoomAssetViewLocalDetails + d := o.ViewLocalDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetViewLocalDetails sets the value of the ViewLocalDetails field in CleanRoomAsset. +func (o *CleanRoomAsset) SetViewLocalDetails(ctx context.Context, v CleanRoomAssetViewLocalDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["view_local_details"] + o.ViewLocalDetails = types.ListValueMust(t, vs) +} + +// GetVolumeLocalDetails returns the value of the VolumeLocalDetails field in CleanRoomAsset as +// a CleanRoomAssetVolumeLocalDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAsset) GetVolumeLocalDetails(ctx context.Context) (CleanRoomAssetVolumeLocalDetails, bool) { + var e CleanRoomAssetVolumeLocalDetails + if o.VolumeLocalDetails.IsNull() || o.VolumeLocalDetails.IsUnknown() { + return e, false + } + var v []CleanRoomAssetVolumeLocalDetails + d := o.VolumeLocalDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVolumeLocalDetails sets the value of the VolumeLocalDetails field in CleanRoomAsset. +func (o *CleanRoomAsset) SetVolumeLocalDetails(ctx context.Context, v CleanRoomAssetVolumeLocalDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["volume_local_details"] + o.VolumeLocalDetails = types.ListValueMust(t, vs) +} + type CleanRoomAssetForeignTable struct { // The metadata information of the columns in the foreign table - Columns catalog.ColumnInfo `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` } func (newState *CleanRoomAssetForeignTable) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoomAssetForeignTable) { @@ -118,6 +521,67 @@ func (newState *CleanRoomAssetForeignTable) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CleanRoomAssetForeignTable) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetForeignTable) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetForeignTable. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetForeignTable) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(catalog_tf.ColumnInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetForeignTable +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetForeignTable) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns": o.Columns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetForeignTable) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns": basetypes.ListType{ + ElemType: catalog_tf.ColumnInfo{}.Type(ctx), + }, + }, + } +} + +// GetColumns returns the value of the Columns field in CleanRoomAssetForeignTable as +// a slice of catalog_tf.ColumnInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAssetForeignTable) GetColumns(ctx context.Context) ([]catalog_tf.ColumnInfo, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []catalog_tf.ColumnInfo + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in CleanRoomAssetForeignTable. +func (o *CleanRoomAssetForeignTable) SetColumns(ctx context.Context, v []catalog_tf.ColumnInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + type CleanRoomAssetForeignTableLocalDetails struct { // The fully qualified name of the foreign table in its owner's local // metastore, in the format of *catalog*.*schema*.*foreign_table_name* @@ -130,6 +594,37 @@ func (newState *CleanRoomAssetForeignTableLocalDetails) SyncEffectiveFieldsDurin func (newState *CleanRoomAssetForeignTableLocalDetails) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetForeignTableLocalDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetForeignTableLocalDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetForeignTableLocalDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetForeignTableLocalDetails +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetForeignTableLocalDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "local_name": o.LocalName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetForeignTableLocalDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "local_name": types.StringType, + }, + } +} + type CleanRoomAssetNotebook struct { // Server generated checksum that represents the notebook version. Etag types.String `tfsdk:"etag" tf:"optional"` @@ -144,9 +639,42 @@ func (newState *CleanRoomAssetNotebook) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CleanRoomAssetNotebook) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetNotebook) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetNotebook. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetNotebook) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetNotebook +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetNotebook) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "notebook_content": o.NotebookContent, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetNotebook) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "notebook_content": types.StringType, + }, + } +} + type CleanRoomAssetTable struct { // The metadata information of the columns in the table - Columns catalog.ColumnInfo `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` } func (newState *CleanRoomAssetTable) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoomAssetTable) { @@ -155,12 +683,73 @@ func (newState *CleanRoomAssetTable) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *CleanRoomAssetTable) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetTable) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetTable. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetTable) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(catalog_tf.ColumnInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetTable +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetTable) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns": o.Columns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetTable) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns": basetypes.ListType{ + ElemType: catalog_tf.ColumnInfo{}.Type(ctx), + }, + }, + } +} + +// GetColumns returns the value of the Columns field in CleanRoomAssetTable as +// a slice of catalog_tf.ColumnInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAssetTable) GetColumns(ctx context.Context) ([]catalog_tf.ColumnInfo, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []catalog_tf.ColumnInfo + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in CleanRoomAssetTable. +func (o *CleanRoomAssetTable) SetColumns(ctx context.Context, v []catalog_tf.ColumnInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + type CleanRoomAssetTableLocalDetails struct { // The fully qualified name of the table in its owner's local metastore, in // the format of *catalog*.*schema*.*table_name* LocalName types.String `tfsdk:"local_name" tf:"optional"` // Partition filtering specification for a shared table. - Partitions sharing.PartitionSpecificationPartition `tfsdk:"partitions" tf:"optional"` + Partitions types.List `tfsdk:"partitions" tf:"optional"` } func (newState *CleanRoomAssetTableLocalDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoomAssetTableLocalDetails) { @@ -169,9 +758,72 @@ func (newState *CleanRoomAssetTableLocalDetails) SyncEffectiveFieldsDuringCreate func (newState *CleanRoomAssetTableLocalDetails) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetTableLocalDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetTableLocalDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetTableLocalDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "partitions": reflect.TypeOf(sharing_tf.PartitionSpecificationPartition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetTableLocalDetails +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetTableLocalDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "local_name": o.LocalName, + "partitions": o.Partitions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetTableLocalDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "local_name": types.StringType, + "partitions": basetypes.ListType{ + ElemType: sharing_tf.PartitionSpecificationPartition{}.Type(ctx), + }, + }, + } +} + +// GetPartitions returns the value of the Partitions field in CleanRoomAssetTableLocalDetails as +// a slice of sharing_tf.PartitionSpecificationPartition values. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAssetTableLocalDetails) GetPartitions(ctx context.Context) ([]sharing_tf.PartitionSpecificationPartition, bool) { + if o.Partitions.IsNull() || o.Partitions.IsUnknown() { + return nil, false + } + var v []sharing_tf.PartitionSpecificationPartition + d := o.Partitions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPartitions sets the value of the Partitions field in CleanRoomAssetTableLocalDetails. +func (o *CleanRoomAssetTableLocalDetails) SetPartitions(ctx context.Context, v []sharing_tf.PartitionSpecificationPartition) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["partitions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Partitions = types.ListValueMust(t, vs) +} + type CleanRoomAssetView struct { // The metadata information of the columns in the view - Columns catalog.ColumnInfo `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` } func (newState *CleanRoomAssetView) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoomAssetView) { @@ -180,6 +832,67 @@ func (newState *CleanRoomAssetView) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CleanRoomAssetView) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetView) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetView. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetView) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(catalog_tf.ColumnInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetView +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetView) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns": o.Columns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetView) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns": basetypes.ListType{ + ElemType: catalog_tf.ColumnInfo{}.Type(ctx), + }, + }, + } +} + +// GetColumns returns the value of the Columns field in CleanRoomAssetView as +// a slice of catalog_tf.ColumnInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomAssetView) GetColumns(ctx context.Context) ([]catalog_tf.ColumnInfo, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []catalog_tf.ColumnInfo + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in CleanRoomAssetView. +func (o *CleanRoomAssetView) SetColumns(ctx context.Context, v []catalog_tf.ColumnInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + type CleanRoomAssetViewLocalDetails struct { // The fully qualified name of the view in its owner's local metastore, in // the format of *catalog*.*schema*.*view_name* @@ -192,6 +905,37 @@ func (newState *CleanRoomAssetViewLocalDetails) SyncEffectiveFieldsDuringCreateO func (newState *CleanRoomAssetViewLocalDetails) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetViewLocalDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetViewLocalDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetViewLocalDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetViewLocalDetails +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetViewLocalDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "local_name": o.LocalName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetViewLocalDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "local_name": types.StringType, + }, + } +} + type CleanRoomAssetVolumeLocalDetails struct { // The fully qualified name of the volume in its owner's local metastore, in // the format of *catalog*.*schema*.*volume_name* @@ -204,6 +948,37 @@ func (newState *CleanRoomAssetVolumeLocalDetails) SyncEffectiveFieldsDuringCreat func (newState *CleanRoomAssetVolumeLocalDetails) SyncEffectiveFieldsDuringRead(existingState CleanRoomAssetVolumeLocalDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomAssetVolumeLocalDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomAssetVolumeLocalDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomAssetVolumeLocalDetails +// only implements ToObjectValue() and Type(). +func (o CleanRoomAssetVolumeLocalDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "local_name": o.LocalName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomAssetVolumeLocalDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "local_name": types.StringType, + }, + } +} + // Publicly visible clean room collaborator. type CleanRoomCollaborator struct { // Collaborator alias specified by the clean room creator. It is unique @@ -243,15 +1018,56 @@ func (newState *CleanRoomCollaborator) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CleanRoomCollaborator) SyncEffectiveFieldsDuringRead(existingState CleanRoomCollaborator) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomCollaborator. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomCollaborator) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomCollaborator +// only implements ToObjectValue() and Type(). +func (o CleanRoomCollaborator) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "collaborator_alias": o.CollaboratorAlias, + "display_name": o.DisplayName, + "global_metastore_id": o.GlobalMetastoreId, + "invite_recipient_email": o.InviteRecipientEmail, + "invite_recipient_workspace_id": o.InviteRecipientWorkspaceId, + "organization_name": o.OrganizationName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomCollaborator) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "collaborator_alias": types.StringType, + "display_name": types.StringType, + "global_metastore_id": types.StringType, + "invite_recipient_email": types.StringType, + "invite_recipient_workspace_id": types.Int64Type, + "organization_name": types.StringType, + }, + } +} + // Stores information about a single task run. type CleanRoomNotebookTaskRun struct { // Job run info of the task in the runner's local workspace. This field is // only included in the LIST API. if the task was run within the same // workspace the API is being called. If the task run was in a different // workspace under the same metastore, only the workspace_id is included. - CollaboratorJobRunInfo []CollaboratorJobRunInfo `tfsdk:"collaborator_job_run_info" tf:"optional,object"` + CollaboratorJobRunInfo types.List `tfsdk:"collaborator_job_run_info" tf:"optional,object"` // State of the task run. - NotebookJobRunState jobs.CleanRoomTaskRunState `tfsdk:"notebook_job_run_state" tf:"optional,object"` + NotebookJobRunState types.List `tfsdk:"notebook_job_run_state" tf:"optional,object"` // Asset name of the notebook executed in this task run. NotebookName types.String `tfsdk:"notebook_name" tf:"optional"` // Expiration time of the output schema of the task run (if any), in epoch @@ -272,6 +1088,108 @@ func (newState *CleanRoomNotebookTaskRun) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CleanRoomNotebookTaskRun) SyncEffectiveFieldsDuringRead(existingState CleanRoomNotebookTaskRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomNotebookTaskRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomNotebookTaskRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "collaborator_job_run_info": reflect.TypeOf(CollaboratorJobRunInfo{}), + "notebook_job_run_state": reflect.TypeOf(jobs_tf.CleanRoomTaskRunState{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomNotebookTaskRun +// only implements ToObjectValue() and Type(). +func (o CleanRoomNotebookTaskRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "collaborator_job_run_info": o.CollaboratorJobRunInfo, + "notebook_job_run_state": o.NotebookJobRunState, + "notebook_name": o.NotebookName, + "output_schema_expiration_time": o.OutputSchemaExpirationTime, + "output_schema_name": o.OutputSchemaName, + "run_duration": o.RunDuration, + "start_time": o.StartTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomNotebookTaskRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "collaborator_job_run_info": basetypes.ListType{ + ElemType: CollaboratorJobRunInfo{}.Type(ctx), + }, + "notebook_job_run_state": basetypes.ListType{ + ElemType: jobs_tf.CleanRoomTaskRunState{}.Type(ctx), + }, + "notebook_name": types.StringType, + "output_schema_expiration_time": types.Int64Type, + "output_schema_name": types.StringType, + "run_duration": types.Int64Type, + "start_time": types.Int64Type, + }, + } +} + +// GetCollaboratorJobRunInfo returns the value of the CollaboratorJobRunInfo field in CleanRoomNotebookTaskRun as +// a CollaboratorJobRunInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomNotebookTaskRun) GetCollaboratorJobRunInfo(ctx context.Context) (CollaboratorJobRunInfo, bool) { + var e CollaboratorJobRunInfo + if o.CollaboratorJobRunInfo.IsNull() || o.CollaboratorJobRunInfo.IsUnknown() { + return e, false + } + var v []CollaboratorJobRunInfo + d := o.CollaboratorJobRunInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCollaboratorJobRunInfo sets the value of the CollaboratorJobRunInfo field in CleanRoomNotebookTaskRun. +func (o *CleanRoomNotebookTaskRun) SetCollaboratorJobRunInfo(ctx context.Context, v CollaboratorJobRunInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["collaborator_job_run_info"] + o.CollaboratorJobRunInfo = types.ListValueMust(t, vs) +} + +// GetNotebookJobRunState returns the value of the NotebookJobRunState field in CleanRoomNotebookTaskRun as +// a jobs_tf.CleanRoomTaskRunState value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomNotebookTaskRun) GetNotebookJobRunState(ctx context.Context) (jobs_tf.CleanRoomTaskRunState, bool) { + var e jobs_tf.CleanRoomTaskRunState + if o.NotebookJobRunState.IsNull() || o.NotebookJobRunState.IsUnknown() { + return e, false + } + var v []jobs_tf.CleanRoomTaskRunState + d := o.NotebookJobRunState.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebookJobRunState sets the value of the NotebookJobRunState field in CleanRoomNotebookTaskRun. +func (o *CleanRoomNotebookTaskRun) SetNotebookJobRunState(ctx context.Context, v jobs_tf.CleanRoomTaskRunState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_job_run_state"] + o.NotebookJobRunState = types.ListValueMust(t, vs) +} + type CleanRoomOutputCatalog struct { // The name of the output catalog in UC. It should follow [UC securable // naming requirements]. The field will always exist if status is CREATED. @@ -288,6 +1206,39 @@ func (newState *CleanRoomOutputCatalog) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CleanRoomOutputCatalog) SyncEffectiveFieldsDuringRead(existingState CleanRoomOutputCatalog) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomOutputCatalog. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomOutputCatalog) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomOutputCatalog +// only implements ToObjectValue() and Type(). +func (o CleanRoomOutputCatalog) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomOutputCatalog) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "status": types.StringType, + }, + } +} + // Publicly visible central clean room details. type CleanRoomRemoteDetail struct { // Central clean room ID. @@ -301,14 +1252,14 @@ type CleanRoomRemoteDetail struct { // CreateCleanRoom). // // 2. Its invite_recipient_email is empty. - Collaborators []CleanRoomCollaborator `tfsdk:"collaborators" tf:"optional"` + Collaborators types.List `tfsdk:"collaborators" tf:"optional"` // The compliance security profile used to process regulated data following // compliance standards. - ComplianceSecurityProfile []ComplianceSecurityProfile `tfsdk:"compliance_security_profile" tf:"optional,object"` + ComplianceSecurityProfile types.List `tfsdk:"compliance_security_profile" tf:"optional,object"` // Collaborator who creates the clean room. - Creator []CleanRoomCollaborator `tfsdk:"creator" tf:"optional,object"` + Creator types.List `tfsdk:"creator" tf:"optional,object"` // Egress network policy to apply to the central clean room workspace. - EgressNetworkPolicy settings.EgressNetworkPolicy `tfsdk:"egress_network_policy" tf:"optional,object"` + EgressNetworkPolicy types.List `tfsdk:"egress_network_policy" tf:"optional,object"` // Region of the central clean room. Region types.String `tfsdk:"region" tf:"optional"` } @@ -319,6 +1270,166 @@ func (newState *CleanRoomRemoteDetail) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CleanRoomRemoteDetail) SyncEffectiveFieldsDuringRead(existingState CleanRoomRemoteDetail) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomRemoteDetail. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomRemoteDetail) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "collaborators": reflect.TypeOf(CleanRoomCollaborator{}), + "compliance_security_profile": reflect.TypeOf(ComplianceSecurityProfile{}), + "creator": reflect.TypeOf(CleanRoomCollaborator{}), + "egress_network_policy": reflect.TypeOf(settings_tf.EgressNetworkPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomRemoteDetail +// only implements ToObjectValue() and Type(). +func (o CleanRoomRemoteDetail) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "central_clean_room_id": o.CentralCleanRoomId, + "cloud_vendor": o.CloudVendor, + "collaborators": o.Collaborators, + "compliance_security_profile": o.ComplianceSecurityProfile, + "creator": o.Creator, + "egress_network_policy": o.EgressNetworkPolicy, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomRemoteDetail) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "central_clean_room_id": types.StringType, + "cloud_vendor": types.StringType, + "collaborators": basetypes.ListType{ + ElemType: CleanRoomCollaborator{}.Type(ctx), + }, + "compliance_security_profile": basetypes.ListType{ + ElemType: ComplianceSecurityProfile{}.Type(ctx), + }, + "creator": basetypes.ListType{ + ElemType: CleanRoomCollaborator{}.Type(ctx), + }, + "egress_network_policy": basetypes.ListType{ + ElemType: settings_tf.EgressNetworkPolicy{}.Type(ctx), + }, + "region": types.StringType, + }, + } +} + +// GetCollaborators returns the value of the Collaborators field in CleanRoomRemoteDetail as +// a slice of CleanRoomCollaborator values. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomRemoteDetail) GetCollaborators(ctx context.Context) ([]CleanRoomCollaborator, bool) { + if o.Collaborators.IsNull() || o.Collaborators.IsUnknown() { + return nil, false + } + var v []CleanRoomCollaborator + d := o.Collaborators.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCollaborators sets the value of the Collaborators field in CleanRoomRemoteDetail. +func (o *CleanRoomRemoteDetail) SetCollaborators(ctx context.Context, v []CleanRoomCollaborator) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["collaborators"] + t = t.(attr.TypeWithElementType).ElementType() + o.Collaborators = types.ListValueMust(t, vs) +} + +// GetComplianceSecurityProfile returns the value of the ComplianceSecurityProfile field in CleanRoomRemoteDetail as +// a ComplianceSecurityProfile value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomRemoteDetail) GetComplianceSecurityProfile(ctx context.Context) (ComplianceSecurityProfile, bool) { + var e ComplianceSecurityProfile + if o.ComplianceSecurityProfile.IsNull() || o.ComplianceSecurityProfile.IsUnknown() { + return e, false + } + var v []ComplianceSecurityProfile + d := o.ComplianceSecurityProfile.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetComplianceSecurityProfile sets the value of the ComplianceSecurityProfile field in CleanRoomRemoteDetail. +func (o *CleanRoomRemoteDetail) SetComplianceSecurityProfile(ctx context.Context, v ComplianceSecurityProfile) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["compliance_security_profile"] + o.ComplianceSecurityProfile = types.ListValueMust(t, vs) +} + +// GetCreator returns the value of the Creator field in CleanRoomRemoteDetail as +// a CleanRoomCollaborator value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomRemoteDetail) GetCreator(ctx context.Context) (CleanRoomCollaborator, bool) { + var e CleanRoomCollaborator + if o.Creator.IsNull() || o.Creator.IsUnknown() { + return e, false + } + var v []CleanRoomCollaborator + d := o.Creator.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCreator sets the value of the Creator field in CleanRoomRemoteDetail. +func (o *CleanRoomRemoteDetail) SetCreator(ctx context.Context, v CleanRoomCollaborator) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["creator"] + o.Creator = types.ListValueMust(t, vs) +} + +// GetEgressNetworkPolicy returns the value of the EgressNetworkPolicy field in CleanRoomRemoteDetail as +// a settings_tf.EgressNetworkPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomRemoteDetail) GetEgressNetworkPolicy(ctx context.Context) (settings_tf.EgressNetworkPolicy, bool) { + var e settings_tf.EgressNetworkPolicy + if o.EgressNetworkPolicy.IsNull() || o.EgressNetworkPolicy.IsUnknown() { + return e, false + } + var v []settings_tf.EgressNetworkPolicy + d := o.EgressNetworkPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEgressNetworkPolicy sets the value of the EgressNetworkPolicy field in CleanRoomRemoteDetail. +func (o *CleanRoomRemoteDetail) SetEgressNetworkPolicy(ctx context.Context, v settings_tf.EgressNetworkPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["egress_network_policy"] + o.EgressNetworkPolicy = types.ListValueMust(t, vs) +} + type CollaboratorJobRunInfo struct { // Alias of the collaborator that triggered the task run. CollaboratorAlias types.String `tfsdk:"collaborator_alias" tf:"optional"` @@ -338,12 +1449,51 @@ func (newState *CollaboratorJobRunInfo) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CollaboratorJobRunInfo) SyncEffectiveFieldsDuringRead(existingState CollaboratorJobRunInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CollaboratorJobRunInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CollaboratorJobRunInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CollaboratorJobRunInfo +// only implements ToObjectValue() and Type(). +func (o CollaboratorJobRunInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "collaborator_alias": o.CollaboratorAlias, + "collaborator_job_id": o.CollaboratorJobId, + "collaborator_job_run_id": o.CollaboratorJobRunId, + "collaborator_task_run_id": o.CollaboratorTaskRunId, + "collaborator_workspace_id": o.CollaboratorWorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CollaboratorJobRunInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "collaborator_alias": types.StringType, + "collaborator_job_id": types.Int64Type, + "collaborator_job_run_id": types.Int64Type, + "collaborator_task_run_id": types.Int64Type, + "collaborator_workspace_id": types.Int64Type, + }, + } +} + // The compliance security profile used to process regulated data following // compliance standards. type ComplianceSecurityProfile struct { // The list of compliance standards that the compliance security profile is // configured to enforce. - ComplianceStandards settings.ComplianceStandard `tfsdk:"compliance_standards" tf:"optional"` + ComplianceStandards types.List `tfsdk:"compliance_standards" tf:"optional"` // Whether the compliance security profile is enabled. IsEnabled types.Bool `tfsdk:"is_enabled" tf:"optional"` } @@ -354,10 +1504,73 @@ func (newState *ComplianceSecurityProfile) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ComplianceSecurityProfile) SyncEffectiveFieldsDuringRead(existingState ComplianceSecurityProfile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ComplianceSecurityProfile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ComplianceSecurityProfile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "compliance_standards": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ComplianceSecurityProfile +// only implements ToObjectValue() and Type(). +func (o ComplianceSecurityProfile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "compliance_standards": o.ComplianceStandards, + "is_enabled": o.IsEnabled, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ComplianceSecurityProfile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "compliance_standards": basetypes.ListType{ + ElemType: types.String{}.Type(ctx), + }, + "is_enabled": types.BoolType, + }, + } +} + +// GetComplianceStandards returns the value of the ComplianceStandards field in ComplianceSecurityProfile as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ComplianceSecurityProfile) GetComplianceStandards(ctx context.Context) ([]types.String, bool) { + if o.ComplianceStandards.IsNull() || o.ComplianceStandards.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ComplianceStandards.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetComplianceStandards sets the value of the ComplianceStandards field in ComplianceSecurityProfile. +func (o *ComplianceSecurityProfile) SetComplianceStandards(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["compliance_standards"] + t = t.(attr.TypeWithElementType).ElementType() + o.ComplianceStandards = types.ListValueMust(t, vs) +} + // Create an asset type CreateCleanRoomAssetRequest struct { // Metadata of the clean room asset - Asset []CleanRoomAsset `tfsdk:"asset" tf:"optional,object"` + Asset types.List `tfsdk:"asset" tf:"optional,object"` // Name of the clean room. CleanRoomName types.String `tfsdk:"-"` } @@ -368,12 +1581,75 @@ func (newState *CreateCleanRoomAssetRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *CreateCleanRoomAssetRequest) SyncEffectiveFieldsDuringRead(existingState CreateCleanRoomAssetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCleanRoomAssetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCleanRoomAssetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "asset": reflect.TypeOf(CleanRoomAsset{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCleanRoomAssetRequest +// only implements ToObjectValue() and Type(). +func (o CreateCleanRoomAssetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "asset": o.Asset, + "clean_room_name": o.CleanRoomName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCleanRoomAssetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "asset": basetypes.ListType{ + ElemType: CleanRoomAsset{}.Type(ctx), + }, + "clean_room_name": types.StringType, + }, + } +} + +// GetAsset returns the value of the Asset field in CreateCleanRoomAssetRequest as +// a CleanRoomAsset value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCleanRoomAssetRequest) GetAsset(ctx context.Context) (CleanRoomAsset, bool) { + var e CleanRoomAsset + if o.Asset.IsNull() || o.Asset.IsUnknown() { + return e, false + } + var v []CleanRoomAsset + d := o.Asset.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAsset sets the value of the Asset field in CreateCleanRoomAssetRequest. +func (o *CreateCleanRoomAssetRequest) SetAsset(ctx context.Context, v CleanRoomAsset) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["asset"] + o.Asset = types.ListValueMust(t, vs) +} + // Create an output catalog type CreateCleanRoomOutputCatalogRequest struct { // Name of the clean room. CleanRoomName types.String `tfsdk:"-"` - OutputCatalog []CleanRoomOutputCatalog `tfsdk:"output_catalog" tf:"optional,object"` + OutputCatalog types.List `tfsdk:"output_catalog" tf:"optional,object"` } func (newState *CreateCleanRoomOutputCatalogRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCleanRoomOutputCatalogRequest) { @@ -382,8 +1658,71 @@ func (newState *CreateCleanRoomOutputCatalogRequest) SyncEffectiveFieldsDuringCr func (newState *CreateCleanRoomOutputCatalogRequest) SyncEffectiveFieldsDuringRead(existingState CreateCleanRoomOutputCatalogRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCleanRoomOutputCatalogRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCleanRoomOutputCatalogRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "output_catalog": reflect.TypeOf(CleanRoomOutputCatalog{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCleanRoomOutputCatalogRequest +// only implements ToObjectValue() and Type(). +func (o CreateCleanRoomOutputCatalogRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_room_name": o.CleanRoomName, + "output_catalog": o.OutputCatalog, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCleanRoomOutputCatalogRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_room_name": types.StringType, + "output_catalog": basetypes.ListType{ + ElemType: CleanRoomOutputCatalog{}.Type(ctx), + }, + }, + } +} + +// GetOutputCatalog returns the value of the OutputCatalog field in CreateCleanRoomOutputCatalogRequest as +// a CleanRoomOutputCatalog value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCleanRoomOutputCatalogRequest) GetOutputCatalog(ctx context.Context) (CleanRoomOutputCatalog, bool) { + var e CleanRoomOutputCatalog + if o.OutputCatalog.IsNull() || o.OutputCatalog.IsUnknown() { + return e, false + } + var v []CleanRoomOutputCatalog + d := o.OutputCatalog.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOutputCatalog sets the value of the OutputCatalog field in CreateCleanRoomOutputCatalogRequest. +func (o *CreateCleanRoomOutputCatalogRequest) SetOutputCatalog(ctx context.Context, v CleanRoomOutputCatalog) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["output_catalog"] + o.OutputCatalog = types.ListValueMust(t, vs) +} + type CreateCleanRoomOutputCatalogResponse struct { - OutputCatalog []CleanRoomOutputCatalog `tfsdk:"output_catalog" tf:"optional,object"` + OutputCatalog types.List `tfsdk:"output_catalog" tf:"optional,object"` } func (newState *CreateCleanRoomOutputCatalogResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCleanRoomOutputCatalogResponse) { @@ -392,9 +1731,70 @@ func (newState *CreateCleanRoomOutputCatalogResponse) SyncEffectiveFieldsDuringC func (newState *CreateCleanRoomOutputCatalogResponse) SyncEffectiveFieldsDuringRead(existingState CreateCleanRoomOutputCatalogResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCleanRoomOutputCatalogResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCleanRoomOutputCatalogResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "output_catalog": reflect.TypeOf(CleanRoomOutputCatalog{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCleanRoomOutputCatalogResponse +// only implements ToObjectValue() and Type(). +func (o CreateCleanRoomOutputCatalogResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "output_catalog": o.OutputCatalog, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCleanRoomOutputCatalogResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "output_catalog": basetypes.ListType{ + ElemType: CleanRoomOutputCatalog{}.Type(ctx), + }, + }, + } +} + +// GetOutputCatalog returns the value of the OutputCatalog field in CreateCleanRoomOutputCatalogResponse as +// a CleanRoomOutputCatalog value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCleanRoomOutputCatalogResponse) GetOutputCatalog(ctx context.Context) (CleanRoomOutputCatalog, bool) { + var e CleanRoomOutputCatalog + if o.OutputCatalog.IsNull() || o.OutputCatalog.IsUnknown() { + return e, false + } + var v []CleanRoomOutputCatalog + d := o.OutputCatalog.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOutputCatalog sets the value of the OutputCatalog field in CreateCleanRoomOutputCatalogResponse. +func (o *CreateCleanRoomOutputCatalogResponse) SetOutputCatalog(ctx context.Context, v CleanRoomOutputCatalog) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["output_catalog"] + o.OutputCatalog = types.ListValueMust(t, vs) +} + // Create a clean room type CreateCleanRoomRequest struct { - CleanRoom []CleanRoom `tfsdk:"clean_room" tf:"optional,object"` + CleanRoom types.List `tfsdk:"clean_room" tf:"optional,object"` } func (newState *CreateCleanRoomRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCleanRoomRequest) { @@ -403,6 +1803,67 @@ func (newState *CreateCleanRoomRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateCleanRoomRequest) SyncEffectiveFieldsDuringRead(existingState CreateCleanRoomRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCleanRoomRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCleanRoomRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clean_room": reflect.TypeOf(CleanRoom{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCleanRoomRequest +// only implements ToObjectValue() and Type(). +func (o CreateCleanRoomRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_room": o.CleanRoom, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCleanRoomRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_room": basetypes.ListType{ + ElemType: CleanRoom{}.Type(ctx), + }, + }, + } +} + +// GetCleanRoom returns the value of the CleanRoom field in CreateCleanRoomRequest as +// a CleanRoom value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCleanRoomRequest) GetCleanRoom(ctx context.Context) (CleanRoom, bool) { + var e CleanRoom + if o.CleanRoom.IsNull() || o.CleanRoom.IsUnknown() { + return e, false + } + var v []CleanRoom + d := o.CleanRoom.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCleanRoom sets the value of the CleanRoom field in CreateCleanRoomRequest. +func (o *CreateCleanRoomRequest) SetCleanRoom(ctx context.Context, v CleanRoom) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clean_room"] + o.CleanRoom = types.ListValueMust(t, vs) +} + // Delete an asset type DeleteCleanRoomAssetRequest struct { // The fully qualified name of the asset, it is same as the name field in @@ -420,6 +1881,41 @@ func (newState *DeleteCleanRoomAssetRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *DeleteCleanRoomAssetRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCleanRoomAssetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCleanRoomAssetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCleanRoomAssetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCleanRoomAssetRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCleanRoomAssetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "asset_full_name": o.AssetFullName, + "asset_type": o.AssetType, + "clean_room_name": o.CleanRoomName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCleanRoomAssetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "asset_full_name": types.StringType, + "asset_type": types.StringType, + "clean_room_name": types.StringType, + }, + } +} + // Response for delete clean room request. Using an empty message since the // generic Empty proto does not externd UnshadedMessageMarker. type DeleteCleanRoomAssetResponse struct { @@ -431,6 +1927,33 @@ func (newState *DeleteCleanRoomAssetResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteCleanRoomAssetResponse) SyncEffectiveFieldsDuringRead(existingState DeleteCleanRoomAssetResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCleanRoomAssetResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCleanRoomAssetResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCleanRoomAssetResponse +// only implements ToObjectValue() and Type(). +func (o DeleteCleanRoomAssetResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCleanRoomAssetResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a clean room type DeleteCleanRoomRequest struct { // Name of the clean room. @@ -443,6 +1966,37 @@ func (newState *DeleteCleanRoomRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteCleanRoomRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCleanRoomRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCleanRoomRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCleanRoomRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCleanRoomRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCleanRoomRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCleanRoomRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -452,6 +2006,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Get an asset type GetCleanRoomAssetRequest struct { // The fully qualified name of the asset, it is same as the name field in @@ -469,6 +2050,41 @@ func (newState *GetCleanRoomAssetRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetCleanRoomAssetRequest) SyncEffectiveFieldsDuringRead(existingState GetCleanRoomAssetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCleanRoomAssetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCleanRoomAssetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCleanRoomAssetRequest +// only implements ToObjectValue() and Type(). +func (o GetCleanRoomAssetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "asset_full_name": o.AssetFullName, + "asset_type": o.AssetType, + "clean_room_name": o.CleanRoomName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCleanRoomAssetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "asset_full_name": types.StringType, + "asset_type": types.StringType, + "clean_room_name": types.StringType, + }, + } +} + // Get a clean room type GetCleanRoomRequest struct { Name types.String `tfsdk:"-"` @@ -480,6 +2096,37 @@ func (newState *GetCleanRoomRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetCleanRoomRequest) SyncEffectiveFieldsDuringRead(existingState GetCleanRoomRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCleanRoomRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCleanRoomRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCleanRoomRequest +// only implements ToObjectValue() and Type(). +func (o GetCleanRoomRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCleanRoomRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // List assets type ListCleanRoomAssetsRequest struct { // Name of the clean room. @@ -494,9 +2141,42 @@ func (newState *ListCleanRoomAssetsRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListCleanRoomAssetsRequest) SyncEffectiveFieldsDuringRead(existingState ListCleanRoomAssetsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCleanRoomAssetsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCleanRoomAssetsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCleanRoomAssetsRequest +// only implements ToObjectValue() and Type(). +func (o ListCleanRoomAssetsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_room_name": o.CleanRoomName, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCleanRoomAssetsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_room_name": types.StringType, + "page_token": types.StringType, + }, + } +} + type ListCleanRoomAssetsResponse struct { // Assets in the clean room. - Assets []CleanRoomAsset `tfsdk:"assets" tf:"optional"` + Assets types.List `tfsdk:"assets" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. page_token should be set to this value for the next request // (for the next page of results). @@ -509,6 +2189,69 @@ func (newState *ListCleanRoomAssetsResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *ListCleanRoomAssetsResponse) SyncEffectiveFieldsDuringRead(existingState ListCleanRoomAssetsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCleanRoomAssetsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCleanRoomAssetsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "assets": reflect.TypeOf(CleanRoomAsset{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCleanRoomAssetsResponse +// only implements ToObjectValue() and Type(). +func (o ListCleanRoomAssetsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assets": o.Assets, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCleanRoomAssetsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assets": basetypes.ListType{ + ElemType: CleanRoomAsset{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetAssets returns the value of the Assets field in ListCleanRoomAssetsResponse as +// a slice of CleanRoomAsset values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListCleanRoomAssetsResponse) GetAssets(ctx context.Context) ([]CleanRoomAsset, bool) { + if o.Assets.IsNull() || o.Assets.IsUnknown() { + return nil, false + } + var v []CleanRoomAsset + d := o.Assets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAssets sets the value of the Assets field in ListCleanRoomAssetsResponse. +func (o *ListCleanRoomAssetsResponse) SetAssets(ctx context.Context, v []CleanRoomAsset) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["assets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Assets = types.ListValueMust(t, vs) +} + // List notebook task runs type ListCleanRoomNotebookTaskRunsRequest struct { // Name of the clean room. @@ -527,13 +2270,50 @@ func (newState *ListCleanRoomNotebookTaskRunsRequest) SyncEffectiveFieldsDuringC func (newState *ListCleanRoomNotebookTaskRunsRequest) SyncEffectiveFieldsDuringRead(existingState ListCleanRoomNotebookTaskRunsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCleanRoomNotebookTaskRunsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCleanRoomNotebookTaskRunsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCleanRoomNotebookTaskRunsRequest +// only implements ToObjectValue() and Type(). +func (o ListCleanRoomNotebookTaskRunsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_room_name": o.CleanRoomName, + "notebook_name": o.NotebookName, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCleanRoomNotebookTaskRunsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_room_name": types.StringType, + "notebook_name": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListCleanRoomNotebookTaskRunsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. page_token should be set to this value for the next request // (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // Name of the clean room. - Runs []CleanRoomNotebookTaskRun `tfsdk:"runs" tf:"optional"` + Runs types.List `tfsdk:"runs" tf:"optional"` } func (newState *ListCleanRoomNotebookTaskRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListCleanRoomNotebookTaskRunsResponse) { @@ -542,6 +2322,69 @@ func (newState *ListCleanRoomNotebookTaskRunsResponse) SyncEffectiveFieldsDuring func (newState *ListCleanRoomNotebookTaskRunsResponse) SyncEffectiveFieldsDuringRead(existingState ListCleanRoomNotebookTaskRunsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCleanRoomNotebookTaskRunsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCleanRoomNotebookTaskRunsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "runs": reflect.TypeOf(CleanRoomNotebookTaskRun{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCleanRoomNotebookTaskRunsResponse +// only implements ToObjectValue() and Type(). +func (o ListCleanRoomNotebookTaskRunsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "runs": o.Runs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCleanRoomNotebookTaskRunsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "runs": basetypes.ListType{ + ElemType: CleanRoomNotebookTaskRun{}.Type(ctx), + }, + }, + } +} + +// GetRuns returns the value of the Runs field in ListCleanRoomNotebookTaskRunsResponse as +// a slice of CleanRoomNotebookTaskRun values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListCleanRoomNotebookTaskRunsResponse) GetRuns(ctx context.Context) ([]CleanRoomNotebookTaskRun, bool) { + if o.Runs.IsNull() || o.Runs.IsUnknown() { + return nil, false + } + var v []CleanRoomNotebookTaskRun + d := o.Runs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRuns sets the value of the Runs field in ListCleanRoomNotebookTaskRunsResponse. +func (o *ListCleanRoomNotebookTaskRunsResponse) SetRuns(ctx context.Context, v []CleanRoomNotebookTaskRun) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["runs"] + t = t.(attr.TypeWithElementType).ElementType() + o.Runs = types.ListValueMust(t, vs) +} + // List clean rooms type ListCleanRoomsRequest struct { // Maximum number of clean rooms to return (i.e., the page length). Defaults @@ -557,8 +2400,41 @@ func (newState *ListCleanRoomsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListCleanRoomsRequest) SyncEffectiveFieldsDuringRead(existingState ListCleanRoomsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCleanRoomsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCleanRoomsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCleanRoomsRequest +// only implements ToObjectValue() and Type(). +func (o ListCleanRoomsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCleanRoomsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListCleanRoomsResponse struct { - CleanRooms []CleanRoom `tfsdk:"clean_rooms" tf:"optional"` + CleanRooms types.List `tfsdk:"clean_rooms" tf:"optional"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. page_token should be set to this value for the next request // (for the next page of results). @@ -571,10 +2447,73 @@ func (newState *ListCleanRoomsResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListCleanRoomsResponse) SyncEffectiveFieldsDuringRead(existingState ListCleanRoomsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCleanRoomsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCleanRoomsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clean_rooms": reflect.TypeOf(CleanRoom{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCleanRoomsResponse +// only implements ToObjectValue() and Type(). +func (o ListCleanRoomsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_rooms": o.CleanRooms, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCleanRoomsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_rooms": basetypes.ListType{ + ElemType: CleanRoom{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetCleanRooms returns the value of the CleanRooms field in ListCleanRoomsResponse as +// a slice of CleanRoom values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListCleanRoomsResponse) GetCleanRooms(ctx context.Context) ([]CleanRoom, bool) { + if o.CleanRooms.IsNull() || o.CleanRooms.IsUnknown() { + return nil, false + } + var v []CleanRoom + d := o.CleanRooms.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCleanRooms sets the value of the CleanRooms field in ListCleanRoomsResponse. +func (o *ListCleanRoomsResponse) SetCleanRooms(ctx context.Context, v []CleanRoom) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clean_rooms"] + t = t.(attr.TypeWithElementType).ElementType() + o.CleanRooms = types.ListValueMust(t, vs) +} + // Update an asset type UpdateCleanRoomAssetRequest struct { // Metadata of the clean room asset - Asset []CleanRoomAsset `tfsdk:"asset" tf:"optional,object"` + Asset types.List `tfsdk:"asset" tf:"optional,object"` // The type of the asset. AssetType types.String `tfsdk:"-"` // Name of the clean room. @@ -595,8 +2534,75 @@ func (newState *UpdateCleanRoomAssetRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *UpdateCleanRoomAssetRequest) SyncEffectiveFieldsDuringRead(existingState UpdateCleanRoomAssetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCleanRoomAssetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCleanRoomAssetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "asset": reflect.TypeOf(CleanRoomAsset{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCleanRoomAssetRequest +// only implements ToObjectValue() and Type(). +func (o UpdateCleanRoomAssetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "asset": o.Asset, + "asset_type": o.AssetType, + "clean_room_name": o.CleanRoomName, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCleanRoomAssetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "asset": basetypes.ListType{ + ElemType: CleanRoomAsset{}.Type(ctx), + }, + "asset_type": types.StringType, + "clean_room_name": types.StringType, + "name": types.StringType, + }, + } +} + +// GetAsset returns the value of the Asset field in UpdateCleanRoomAssetRequest as +// a CleanRoomAsset value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCleanRoomAssetRequest) GetAsset(ctx context.Context) (CleanRoomAsset, bool) { + var e CleanRoomAsset + if o.Asset.IsNull() || o.Asset.IsUnknown() { + return e, false + } + var v []CleanRoomAsset + d := o.Asset.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAsset sets the value of the Asset field in UpdateCleanRoomAssetRequest. +func (o *UpdateCleanRoomAssetRequest) SetAsset(ctx context.Context, v CleanRoomAsset) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["asset"] + o.Asset = types.ListValueMust(t, vs) +} + type UpdateCleanRoomRequest struct { - CleanRoom []CleanRoom `tfsdk:"clean_room" tf:"optional,object"` + CleanRoom types.List `tfsdk:"clean_room" tf:"optional,object"` // Name of the clean room. Name types.String `tfsdk:"-"` } @@ -606,3 +2612,66 @@ func (newState *UpdateCleanRoomRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateCleanRoomRequest) SyncEffectiveFieldsDuringRead(existingState UpdateCleanRoomRequest) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCleanRoomRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCleanRoomRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clean_room": reflect.TypeOf(CleanRoom{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCleanRoomRequest +// only implements ToObjectValue() and Type(). +func (o UpdateCleanRoomRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_room": o.CleanRoom, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCleanRoomRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_room": basetypes.ListType{ + ElemType: CleanRoom{}.Type(ctx), + }, + "name": types.StringType, + }, + } +} + +// GetCleanRoom returns the value of the CleanRoom field in UpdateCleanRoomRequest as +// a CleanRoom value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCleanRoomRequest) GetCleanRoom(ctx context.Context) (CleanRoom, bool) { + var e CleanRoom + if o.CleanRoom.IsNull() || o.CleanRoom.IsUnknown() { + return e, false + } + var v []CleanRoom + d := o.CleanRoom.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCleanRoom sets the value of the CleanRoom field in UpdateCleanRoomRequest. +func (o *UpdateCleanRoomRequest) SetCleanRoom(ctx context.Context, v CleanRoom) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clean_room"] + o.CleanRoom = types.ListValueMust(t, vs) +} diff --git a/internal/service/compute_tf/model.go b/internal/service/compute_tf/model.go index d1e67f00b..ad9792e56 100755 --- a/internal/service/compute_tf/model.go +++ b/internal/service/compute_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package compute_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AddInstanceProfile struct { @@ -49,6 +56,43 @@ func (newState *AddInstanceProfile) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AddInstanceProfile) SyncEffectiveFieldsDuringRead(existingState AddInstanceProfile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AddInstanceProfile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AddInstanceProfile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AddInstanceProfile +// only implements ToObjectValue() and Type(). +func (o AddInstanceProfile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "iam_role_arn": o.IamRoleArn, + "instance_profile_arn": o.InstanceProfileArn, + "is_meta_instance_profile": o.IsMetaInstanceProfile, + "skip_validation": o.SkipValidation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AddInstanceProfile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "iam_role_arn": types.StringType, + "instance_profile_arn": types.StringType, + "is_meta_instance_profile": types.BoolType, + "skip_validation": types.BoolType, + }, + } +} + type AddResponse struct { } @@ -58,6 +102,33 @@ func (newState *AddResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan AddRes func (newState *AddResponse) SyncEffectiveFieldsDuringRead(existingState AddResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AddResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AddResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AddResponse +// only implements ToObjectValue() and Type(). +func (o AddResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o AddResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Adlsgen2Info struct { // abfss destination, e.g. // `abfss://@.dfs.core.windows.net/`. @@ -70,6 +141,37 @@ func (newState *Adlsgen2Info) SyncEffectiveFieldsDuringCreateOrUpdate(plan Adlsg func (newState *Adlsgen2Info) SyncEffectiveFieldsDuringRead(existingState Adlsgen2Info) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Adlsgen2Info. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Adlsgen2Info) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Adlsgen2Info +// only implements ToObjectValue() and Type(). +func (o Adlsgen2Info) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Adlsgen2Info) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + }, + } +} + type AutoScale struct { // The maximum number of workers to which the cluster can scale up when // overloaded. Note that `max_workers` must be strictly greater than @@ -87,6 +189,39 @@ func (newState *AutoScale) SyncEffectiveFieldsDuringCreateOrUpdate(plan AutoScal func (newState *AutoScale) SyncEffectiveFieldsDuringRead(existingState AutoScale) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AutoScale. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AutoScale) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AutoScale +// only implements ToObjectValue() and Type(). +func (o AutoScale) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_workers": o.MaxWorkers, + "min_workers": o.MinWorkers, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AutoScale) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_workers": types.Int64Type, + "min_workers": types.Int64Type, + }, + } +} + type AwsAttributes struct { // Availability type used for all subsequent nodes past the // `first_on_demand` ones. @@ -179,6 +314,55 @@ func (newState *AwsAttributes) SyncEffectiveFieldsDuringCreateOrUpdate(plan AwsA func (newState *AwsAttributes) SyncEffectiveFieldsDuringRead(existingState AwsAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsAttributes +// only implements ToObjectValue() and Type(). +func (o AwsAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "availability": o.Availability, + "ebs_volume_count": o.EbsVolumeCount, + "ebs_volume_iops": o.EbsVolumeIops, + "ebs_volume_size": o.EbsVolumeSize, + "ebs_volume_throughput": o.EbsVolumeThroughput, + "ebs_volume_type": o.EbsVolumeType, + "first_on_demand": o.FirstOnDemand, + "instance_profile_arn": o.InstanceProfileArn, + "spot_bid_price_percent": o.SpotBidPricePercent, + "zone_id": o.ZoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "availability": types.StringType, + "ebs_volume_count": types.Int64Type, + "ebs_volume_iops": types.Int64Type, + "ebs_volume_size": types.Int64Type, + "ebs_volume_throughput": types.Int64Type, + "ebs_volume_type": types.StringType, + "first_on_demand": types.Int64Type, + "instance_profile_arn": types.StringType, + "spot_bid_price_percent": types.Int64Type, + "zone_id": types.StringType, + }, + } +} + type AzureAttributes struct { // Availability type used for all subsequent nodes past the // `first_on_demand` ones. Note: If `first_on_demand` is zero (which only @@ -196,7 +380,7 @@ type AzureAttributes struct { // mutated over the lifetime of a cluster. FirstOnDemand types.Int64 `tfsdk:"first_on_demand" tf:"optional"` // Defines values necessary to configure and run Azure Log Analytics agent - LogAnalyticsInfo []LogAnalyticsInfo `tfsdk:"log_analytics_info" tf:"optional,object"` + LogAnalyticsInfo types.List `tfsdk:"log_analytics_info" tf:"optional,object"` // The max bid price to be used for Azure spot instances. The Max price for // the bid cannot be higher than the on-demand price of the instance. If not // specified, the default value is -1, which specifies that the instance @@ -211,6 +395,73 @@ func (newState *AzureAttributes) SyncEffectiveFieldsDuringCreateOrUpdate(plan Az func (newState *AzureAttributes) SyncEffectiveFieldsDuringRead(existingState AzureAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "log_analytics_info": reflect.TypeOf(LogAnalyticsInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureAttributes +// only implements ToObjectValue() and Type(). +func (o AzureAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "availability": o.Availability, + "first_on_demand": o.FirstOnDemand, + "log_analytics_info": o.LogAnalyticsInfo, + "spot_bid_max_price": o.SpotBidMaxPrice, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "availability": types.StringType, + "first_on_demand": types.Int64Type, + "log_analytics_info": basetypes.ListType{ + ElemType: LogAnalyticsInfo{}.Type(ctx), + }, + "spot_bid_max_price": types.Float64Type, + }, + } +} + +// GetLogAnalyticsInfo returns the value of the LogAnalyticsInfo field in AzureAttributes as +// a LogAnalyticsInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *AzureAttributes) GetLogAnalyticsInfo(ctx context.Context) (LogAnalyticsInfo, bool) { + var e LogAnalyticsInfo + if o.LogAnalyticsInfo.IsNull() || o.LogAnalyticsInfo.IsUnknown() { + return e, false + } + var v []LogAnalyticsInfo + d := o.LogAnalyticsInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLogAnalyticsInfo sets the value of the LogAnalyticsInfo field in AzureAttributes. +func (o *AzureAttributes) SetLogAnalyticsInfo(ctx context.Context, v LogAnalyticsInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["log_analytics_info"] + o.LogAnalyticsInfo = types.ListValueMust(t, vs) +} + type CancelCommand struct { ClusterId types.String `tfsdk:"clusterId" tf:"optional"` @@ -225,6 +476,41 @@ func (newState *CancelCommand) SyncEffectiveFieldsDuringCreateOrUpdate(plan Canc func (newState *CancelCommand) SyncEffectiveFieldsDuringRead(existingState CancelCommand) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelCommand. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelCommand) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelCommand +// only implements ToObjectValue() and Type(). +func (o CancelCommand) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusterId": o.ClusterId, + "commandId": o.CommandId, + "contextId": o.ContextId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelCommand) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusterId": types.StringType, + "commandId": types.StringType, + "contextId": types.StringType, + }, + } +} + type CancelResponse struct { } @@ -234,6 +520,33 @@ func (newState *CancelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Can func (newState *CancelResponse) SyncEffectiveFieldsDuringRead(existingState CancelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelResponse +// only implements ToObjectValue() and Type(). +func (o CancelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ChangeClusterOwner struct { // ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -247,6 +560,39 @@ func (newState *ChangeClusterOwner) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ChangeClusterOwner) SyncEffectiveFieldsDuringRead(existingState ChangeClusterOwner) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ChangeClusterOwner. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ChangeClusterOwner) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ChangeClusterOwner +// only implements ToObjectValue() and Type(). +func (o ChangeClusterOwner) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "owner_username": o.OwnerUsername, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ChangeClusterOwner) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "owner_username": types.StringType, + }, + } +} + type ChangeClusterOwnerResponse struct { } @@ -256,6 +602,33 @@ func (newState *ChangeClusterOwnerResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ChangeClusterOwnerResponse) SyncEffectiveFieldsDuringRead(existingState ChangeClusterOwnerResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ChangeClusterOwnerResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ChangeClusterOwnerResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ChangeClusterOwnerResponse +// only implements ToObjectValue() and Type(). +func (o ChangeClusterOwnerResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ChangeClusterOwnerResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ClientsTypes struct { // With jobs set, the cluster can be used for jobs Jobs types.Bool `tfsdk:"jobs" tf:"optional"` @@ -269,6 +642,39 @@ func (newState *ClientsTypes) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clien func (newState *ClientsTypes) SyncEffectiveFieldsDuringRead(existingState ClientsTypes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClientsTypes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClientsTypes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClientsTypes +// only implements ToObjectValue() and Type(). +func (o ClientsTypes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "jobs": o.Jobs, + "notebooks": o.Notebooks, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClientsTypes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "jobs": types.BoolType, + "notebooks": types.BoolType, + }, + } +} + type CloneCluster struct { // The cluster that is being cloned. SourceClusterId types.String `tfsdk:"source_cluster_id" tf:""` @@ -280,8 +686,39 @@ func (newState *CloneCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clone func (newState *CloneCluster) SyncEffectiveFieldsDuringRead(existingState CloneCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CloneCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CloneCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CloneCluster +// only implements ToObjectValue() and Type(). +func (o CloneCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "source_cluster_id": o.SourceClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CloneCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "source_cluster_id": types.StringType, + }, + } +} + type CloudProviderNodeInfo struct { - Status []types.String `tfsdk:"status" tf:"optional"` + Status types.List `tfsdk:"status" tf:"optional"` } func (newState *CloudProviderNodeInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan CloudProviderNodeInfo) { @@ -290,6 +727,67 @@ func (newState *CloudProviderNodeInfo) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CloudProviderNodeInfo) SyncEffectiveFieldsDuringRead(existingState CloudProviderNodeInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CloudProviderNodeInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CloudProviderNodeInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "status": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CloudProviderNodeInfo +// only implements ToObjectValue() and Type(). +func (o CloudProviderNodeInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CloudProviderNodeInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "status": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetStatus returns the value of the Status field in CloudProviderNodeInfo as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CloudProviderNodeInfo) GetStatus(ctx context.Context) ([]types.String, bool) { + if o.Status.IsNull() || o.Status.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStatus sets the value of the Status field in CloudProviderNodeInfo. +func (o *CloudProviderNodeInfo) SetStatus(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + t = t.(attr.TypeWithElementType).ElementType() + o.Status = types.ListValueMust(t, vs) +} + type ClusterAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -307,9 +805,46 @@ func (newState *ClusterAccessControlRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *ClusterAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState ClusterAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o ClusterAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type ClusterAccessControlResponse struct { // All permissions. - AllPermissions []ClusterPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -326,6 +861,75 @@ func (newState *ClusterAccessControlResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *ClusterAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState ClusterAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(ClusterPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o ClusterAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: ClusterPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in ClusterAccessControlResponse as +// a slice of ClusterPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAccessControlResponse) GetAllPermissions(ctx context.Context) ([]ClusterPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []ClusterPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in ClusterAccessControlResponse. +func (o *ClusterAccessControlResponse) SetAllPermissions(ctx context.Context, v []ClusterPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type ClusterAttributes struct { // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically @@ -335,17 +939,17 @@ type ClusterAttributes struct { AutoterminationMinutes types.Int64 `tfsdk:"autotermination_minutes" tf:"optional"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes []AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes []AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // The configuration for delivering spark logs to a long-term storage // destination. Two kinds of destinations (dbfs and s3) are supported. Only // one destination can be specified for one cluster. If the conf is given, // the logs will be delivered to the destination every `5 mins`. The // destination of driver logs is `$destination/$clusterId/driver`, while the // destination of executor logs is `$destination/$clusterId/executor`. - ClusterLogConf []ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. ClusterName types.String `tfsdk:"cluster_name" tf:"optional"` @@ -357,7 +961,7 @@ type ClusterAttributes struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Data security mode decides what data governance model to use when // accessing data from a cluster. // @@ -382,7 +986,7 @@ type ClusterAttributes struct { // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode types.String `tfsdk:"data_security_mode" tf:"optional"` - DockerImage []DockerImage `tfsdk:"docker_image" tf:"optional,object"` + DockerImage types.List `tfsdk:"docker_image" tf:"optional,object"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -400,12 +1004,12 @@ type ClusterAttributes struct { EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes []GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts []InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // This field encodes, through a single value, the resources available to @@ -432,7 +1036,7 @@ type ClusterAttributes struct { // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form // (X,Y) will be exported as is (i.e., `export X='Y'`) while launching the @@ -446,7 +1050,7 @@ type ClusterAttributes struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. @@ -454,9 +1058,9 @@ type ClusterAttributes struct { // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` - WorkloadType []WorkloadType `tfsdk:"workload_type" tf:"optional,object"` + WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } func (newState *ClusterAttributes) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterAttributes) { @@ -465,6 +1069,403 @@ func (newState *ClusterAttributes) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ClusterAttributes) SyncEffectiveFieldsDuringRead(existingState ClusterAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_attributes": reflect.TypeOf(AwsAttributes{}), + "azure_attributes": reflect.TypeOf(AzureAttributes{}), + "cluster_log_conf": reflect.TypeOf(ClusterLogConf{}), + "custom_tags": reflect.TypeOf(types.String{}), + "docker_image": reflect.TypeOf(DockerImage{}), + "gcp_attributes": reflect.TypeOf(GcpAttributes{}), + "init_scripts": reflect.TypeOf(InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + "workload_type": reflect.TypeOf(WorkloadType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAttributes +// only implements ToObjectValue() and Type(). +func (o ClusterAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "autotermination_minutes": o.AutoterminationMinutes, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "cluster_log_conf": o.ClusterLogConf, + "cluster_name": o.ClusterName, + "custom_tags": o.CustomTags, + "data_security_mode": o.DataSecurityMode, + "docker_image": o.DockerImage, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_elastic_disk": o.EnableElasticDisk, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "node_type_id": o.NodeTypeId, + "policy_id": o.PolicyId, + "runtime_engine": o.RuntimeEngine, + "single_user_name": o.SingleUserName, + "spark_conf": o.SparkConf, + "spark_env_vars": o.SparkEnvVars, + "spark_version": o.SparkVersion, + "ssh_public_keys": o.SshPublicKeys, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "autotermination_minutes": types.Int64Type, + "aws_attributes": basetypes.ListType{ + ElemType: AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: AzureAttributes{}.Type(ctx), + }, + "cluster_log_conf": basetypes.ListType{ + ElemType: ClusterLogConf{}.Type(ctx), + }, + "cluster_name": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "data_security_mode": types.StringType, + "docker_image": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_elastic_disk": types.BoolType, + "enable_local_disk_encryption": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "node_type_id": types.StringType, + "policy_id": types.StringType, + "runtime_engine": types.StringType, + "single_user_name": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_version": types.StringType, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "workload_type": basetypes.ListType{ + ElemType: WorkloadType{}.Type(ctx), + }, + }, + } +} + +// GetAwsAttributes returns the value of the AwsAttributes field in ClusterAttributes as +// a AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetAwsAttributes(ctx context.Context) (AwsAttributes, bool) { + var e AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in ClusterAttributes. +func (o *ClusterAttributes) SetAwsAttributes(ctx context.Context, v AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in ClusterAttributes as +// a AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetAzureAttributes(ctx context.Context) (AzureAttributes, bool) { + var e AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in ClusterAttributes. +func (o *ClusterAttributes) SetAzureAttributes(ctx context.Context, v AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in ClusterAttributes as +// a ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetClusterLogConf(ctx context.Context) (ClusterLogConf, bool) { + var e ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in ClusterAttributes. +func (o *ClusterAttributes) SetClusterLogConf(ctx context.Context, v ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in ClusterAttributes as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in ClusterAttributes. +func (o *ClusterAttributes) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDockerImage returns the value of the DockerImage field in ClusterAttributes as +// a DockerImage value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetDockerImage(ctx context.Context) (DockerImage, bool) { + var e DockerImage + if o.DockerImage.IsNull() || o.DockerImage.IsUnknown() { + return e, false + } + var v []DockerImage + d := o.DockerImage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDockerImage sets the value of the DockerImage field in ClusterAttributes. +func (o *ClusterAttributes) SetDockerImage(ctx context.Context, v DockerImage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["docker_image"] + o.DockerImage = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in ClusterAttributes as +// a GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetGcpAttributes(ctx context.Context) (GcpAttributes, bool) { + var e GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in ClusterAttributes. +func (o *ClusterAttributes) SetGcpAttributes(ctx context.Context, v GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in ClusterAttributes as +// a slice of InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetInitScripts(ctx context.Context) ([]InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in ClusterAttributes. +func (o *ClusterAttributes) SetInitScripts(ctx context.Context, v []InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in ClusterAttributes as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in ClusterAttributes. +func (o *ClusterAttributes) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in ClusterAttributes as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in ClusterAttributes. +func (o *ClusterAttributes) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in ClusterAttributes as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in ClusterAttributes. +func (o *ClusterAttributes) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + +// GetWorkloadType returns the value of the WorkloadType field in ClusterAttributes as +// a WorkloadType value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAttributes) GetWorkloadType(ctx context.Context) (WorkloadType, bool) { + var e WorkloadType + if o.WorkloadType.IsNull() || o.WorkloadType.IsUnknown() { + return e, false + } + var v []WorkloadType + d := o.WorkloadType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkloadType sets the value of the WorkloadType field in ClusterAttributes. +func (o *ClusterAttributes) SetWorkloadType(ctx context.Context, v WorkloadType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workload_type"] + o.WorkloadType = types.ListValueMust(t, vs) +} + type ClusterCompliance struct { // Canonical unique identifier for a cluster. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -475,7 +1476,7 @@ type ClusterCompliance struct { // validation errors. The keys indicate the path where the policy validation // error is occurring. The values indicate an error message describing the // policy validation error. - Violations map[string]types.String `tfsdk:"violations" tf:"optional"` + Violations types.Map `tfsdk:"violations" tf:"optional"` } func (newState *ClusterCompliance) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterCompliance) { @@ -484,11 +1485,76 @@ func (newState *ClusterCompliance) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ClusterCompliance) SyncEffectiveFieldsDuringRead(existingState ClusterCompliance) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterCompliance. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterCompliance) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "violations": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterCompliance +// only implements ToObjectValue() and Type(). +func (o ClusterCompliance) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "is_compliant": o.IsCompliant, + "violations": o.Violations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterCompliance) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "is_compliant": types.BoolType, + "violations": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetViolations returns the value of the Violations field in ClusterCompliance as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterCompliance) GetViolations(ctx context.Context) (map[string]types.String, bool) { + if o.Violations.IsNull() || o.Violations.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Violations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetViolations sets the value of the Violations field in ClusterCompliance. +func (o *ClusterCompliance) SetViolations(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["violations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Violations = types.MapValueMust(t, vs) +} + type ClusterDetails struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 @@ -497,10 +1563,10 @@ type ClusterDetails struct { AutoterminationMinutes types.Int64 `tfsdk:"autotermination_minutes" tf:"optional"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes []AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes []AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // Number of CPU cores available for this cluster. Note that this can be // fractional, e.g. 7.5 cores, since certain node types are configured to // share cores between Spark nodes on the same instance. @@ -514,9 +1580,9 @@ type ClusterDetails struct { // the logs will be delivered to the destination every `5 mins`. The // destination of driver logs is `$destination/$clusterId/driver`, while the // destination of executor logs is `$destination/$clusterId/executor`. - ClusterLogConf []ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Cluster log delivery status. - ClusterLogStatus []LogSyncStatus `tfsdk:"cluster_log_status" tf:"optional,object"` + ClusterLogStatus types.List `tfsdk:"cluster_log_status" tf:"optional,object"` // Total amount of cluster memory, in megabytes ClusterMemoryMb types.Int64 `tfsdk:"cluster_memory_mb" tf:"optional"` // Cluster name requested by the user. This doesn't have to be unique. If @@ -537,7 +1603,7 @@ type ClusterDetails struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Data security mode decides what data governance model to use when // accessing data from a cluster. // @@ -573,13 +1639,13 @@ type ClusterDetails struct { // - ClusterId: // // - Name: - DefaultTags map[string]types.String `tfsdk:"default_tags" tf:"optional"` + DefaultTags types.Map `tfsdk:"default_tags" tf:"optional"` - DockerImage []DockerImage `tfsdk:"docker_image" tf:"optional,object"` + DockerImage types.List `tfsdk:"docker_image" tf:"optional,object"` // Node on which the Spark driver resides. The driver node contains the // Spark master and the Databricks application that manages the per-notebook // Spark REPLs. - Driver []SparkNode `tfsdk:"driver" tf:"optional,object"` + Driver types.List `tfsdk:"driver" tf:"optional,object"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -596,15 +1662,15 @@ type ClusterDetails struct { // Whether to enable LUKS on cluster VMs' local disks EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Nodes on which the Spark executors reside. - Executors []SparkNode `tfsdk:"executors" tf:"optional"` + Executors types.List `tfsdk:"executors" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes []GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts []InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // Port on which Spark JDBC server is listening, in the driver nod. No @@ -650,7 +1716,7 @@ type ClusterDetails struct { // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // A canonical SparkContext identifier. This value *does* change when the // Spark driver restarts. The pair `(cluster_id, spark_context_id)` is a // globally unique identifier over all Spark contexts. @@ -668,7 +1734,7 @@ type ClusterDetails struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. @@ -677,11 +1743,11 @@ type ClusterDetails struct { // or edit this cluster. The contents of `spec` can be used in the body of a // create cluster request. This field might not be populated for older // clusters. Note: not included in the response of the ListClusters API. - Spec []ClusterSpec `tfsdk:"spec" tf:"optional,object"` + Spec types.List `tfsdk:"spec" tf:"optional,object"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` // Time (in epoch milliseconds) when the cluster creation request was // received (when the cluster entered a `PENDING` state). StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` @@ -695,9 +1761,9 @@ type ClusterDetails struct { TerminatedTime types.Int64 `tfsdk:"terminated_time" tf:"optional"` // Information about why the cluster was terminated. This field only appears // when the cluster is in a `TERMINATING` or `TERMINATED` state. - TerminationReason []TerminationReason `tfsdk:"termination_reason" tf:"optional,object"` + TerminationReason types.List `tfsdk:"termination_reason" tf:"optional,object"` - WorkloadType []WorkloadType `tfsdk:"workload_type" tf:"optional,object"` + WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } func (newState *ClusterDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterDetails) { @@ -706,19 +1772,661 @@ func (newState *ClusterDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clu func (newState *ClusterDetails) SyncEffectiveFieldsDuringRead(existingState ClusterDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + "aws_attributes": reflect.TypeOf(AwsAttributes{}), + "azure_attributes": reflect.TypeOf(AzureAttributes{}), + "cluster_log_conf": reflect.TypeOf(ClusterLogConf{}), + "cluster_log_status": reflect.TypeOf(LogSyncStatus{}), + "custom_tags": reflect.TypeOf(types.String{}), + "default_tags": reflect.TypeOf(types.String{}), + "docker_image": reflect.TypeOf(DockerImage{}), + "driver": reflect.TypeOf(SparkNode{}), + "executors": reflect.TypeOf(SparkNode{}), + "gcp_attributes": reflect.TypeOf(GcpAttributes{}), + "init_scripts": reflect.TypeOf(InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "spec": reflect.TypeOf(ClusterSpec{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + "termination_reason": reflect.TypeOf(TerminationReason{}), + "workload_type": reflect.TypeOf(WorkloadType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterDetails +// only implements ToObjectValue() and Type(). +func (o ClusterDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "autoscale": o.Autoscale, + "autotermination_minutes": o.AutoterminationMinutes, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "cluster_cores": o.ClusterCores, + "cluster_id": o.ClusterId, + "cluster_log_conf": o.ClusterLogConf, + "cluster_log_status": o.ClusterLogStatus, + "cluster_memory_mb": o.ClusterMemoryMb, + "cluster_name": o.ClusterName, + "cluster_source": o.ClusterSource, + "creator_user_name": o.CreatorUserName, + "custom_tags": o.CustomTags, + "data_security_mode": o.DataSecurityMode, + "default_tags": o.DefaultTags, + "docker_image": o.DockerImage, + "driver": o.Driver, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_elastic_disk": o.EnableElasticDisk, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "executors": o.Executors, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "jdbc_port": o.JdbcPort, + "last_restarted_time": o.LastRestartedTime, + "last_state_loss_time": o.LastStateLossTime, + "node_type_id": o.NodeTypeId, + "num_workers": o.NumWorkers, + "policy_id": o.PolicyId, + "runtime_engine": o.RuntimeEngine, + "single_user_name": o.SingleUserName, + "spark_conf": o.SparkConf, + "spark_context_id": o.SparkContextId, + "spark_env_vars": o.SparkEnvVars, + "spark_version": o.SparkVersion, + "spec": o.Spec, + "ssh_public_keys": o.SshPublicKeys, + "start_time": o.StartTime, + "state": o.State, + "state_message": o.StateMessage, + "terminated_time": o.TerminatedTime, + "termination_reason": o.TerminationReason, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "autotermination_minutes": types.Int64Type, + "aws_attributes": basetypes.ListType{ + ElemType: AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: AzureAttributes{}.Type(ctx), + }, + "cluster_cores": types.Float64Type, + "cluster_id": types.StringType, + "cluster_log_conf": basetypes.ListType{ + ElemType: ClusterLogConf{}.Type(ctx), + }, + "cluster_log_status": basetypes.ListType{ + ElemType: LogSyncStatus{}.Type(ctx), + }, + "cluster_memory_mb": types.Int64Type, + "cluster_name": types.StringType, + "cluster_source": types.StringType, + "creator_user_name": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "data_security_mode": types.StringType, + "default_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "docker_image": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "driver": basetypes.ListType{ + ElemType: SparkNode{}.Type(ctx), + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_elastic_disk": types.BoolType, + "enable_local_disk_encryption": types.BoolType, + "executors": basetypes.ListType{ + ElemType: SparkNode{}.Type(ctx), + }, + "gcp_attributes": basetypes.ListType{ + ElemType: GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "jdbc_port": types.Int64Type, + "last_restarted_time": types.Int64Type, + "last_state_loss_time": types.Int64Type, + "node_type_id": types.StringType, + "num_workers": types.Int64Type, + "policy_id": types.StringType, + "runtime_engine": types.StringType, + "single_user_name": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_context_id": types.Int64Type, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_version": types.StringType, + "spec": basetypes.ListType{ + ElemType: ClusterSpec{}.Type(ctx), + }, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "start_time": types.Int64Type, + "state": types.StringType, + "state_message": types.StringType, + "terminated_time": types.Int64Type, + "termination_reason": basetypes.ListType{ + ElemType: TerminationReason{}.Type(ctx), + }, + "workload_type": basetypes.ListType{ + ElemType: WorkloadType{}.Type(ctx), + }, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in ClusterDetails as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in ClusterDetails. +func (o *ClusterDetails) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + +// GetAwsAttributes returns the value of the AwsAttributes field in ClusterDetails as +// a AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetAwsAttributes(ctx context.Context) (AwsAttributes, bool) { + var e AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in ClusterDetails. +func (o *ClusterDetails) SetAwsAttributes(ctx context.Context, v AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in ClusterDetails as +// a AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetAzureAttributes(ctx context.Context) (AzureAttributes, bool) { + var e AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in ClusterDetails. +func (o *ClusterDetails) SetAzureAttributes(ctx context.Context, v AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in ClusterDetails as +// a ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetClusterLogConf(ctx context.Context) (ClusterLogConf, bool) { + var e ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in ClusterDetails. +func (o *ClusterDetails) SetClusterLogConf(ctx context.Context, v ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetClusterLogStatus returns the value of the ClusterLogStatus field in ClusterDetails as +// a LogSyncStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetClusterLogStatus(ctx context.Context) (LogSyncStatus, bool) { + var e LogSyncStatus + if o.ClusterLogStatus.IsNull() || o.ClusterLogStatus.IsUnknown() { + return e, false + } + var v []LogSyncStatus + d := o.ClusterLogStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogStatus sets the value of the ClusterLogStatus field in ClusterDetails. +func (o *ClusterDetails) SetClusterLogStatus(ctx context.Context, v LogSyncStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_status"] + o.ClusterLogStatus = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in ClusterDetails as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in ClusterDetails. +func (o *ClusterDetails) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDefaultTags returns the value of the DefaultTags field in ClusterDetails as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetDefaultTags(ctx context.Context) (map[string]types.String, bool) { + if o.DefaultTags.IsNull() || o.DefaultTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.DefaultTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDefaultTags sets the value of the DefaultTags field in ClusterDetails. +func (o *ClusterDetails) SetDefaultTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["default_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.DefaultTags = types.MapValueMust(t, vs) +} + +// GetDockerImage returns the value of the DockerImage field in ClusterDetails as +// a DockerImage value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetDockerImage(ctx context.Context) (DockerImage, bool) { + var e DockerImage + if o.DockerImage.IsNull() || o.DockerImage.IsUnknown() { + return e, false + } + var v []DockerImage + d := o.DockerImage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDockerImage sets the value of the DockerImage field in ClusterDetails. +func (o *ClusterDetails) SetDockerImage(ctx context.Context, v DockerImage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["docker_image"] + o.DockerImage = types.ListValueMust(t, vs) +} + +// GetDriver returns the value of the Driver field in ClusterDetails as +// a SparkNode value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetDriver(ctx context.Context) (SparkNode, bool) { + var e SparkNode + if o.Driver.IsNull() || o.Driver.IsUnknown() { + return e, false + } + var v []SparkNode + d := o.Driver.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDriver sets the value of the Driver field in ClusterDetails. +func (o *ClusterDetails) SetDriver(ctx context.Context, v SparkNode) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["driver"] + o.Driver = types.ListValueMust(t, vs) +} + +// GetExecutors returns the value of the Executors field in ClusterDetails as +// a slice of SparkNode values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetExecutors(ctx context.Context) ([]SparkNode, bool) { + if o.Executors.IsNull() || o.Executors.IsUnknown() { + return nil, false + } + var v []SparkNode + d := o.Executors.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExecutors sets the value of the Executors field in ClusterDetails. +func (o *ClusterDetails) SetExecutors(ctx context.Context, v []SparkNode) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["executors"] + t = t.(attr.TypeWithElementType).ElementType() + o.Executors = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in ClusterDetails as +// a GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetGcpAttributes(ctx context.Context) (GcpAttributes, bool) { + var e GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in ClusterDetails. +func (o *ClusterDetails) SetGcpAttributes(ctx context.Context, v GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in ClusterDetails as +// a slice of InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetInitScripts(ctx context.Context) ([]InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in ClusterDetails. +func (o *ClusterDetails) SetInitScripts(ctx context.Context, v []InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in ClusterDetails as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in ClusterDetails. +func (o *ClusterDetails) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in ClusterDetails as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in ClusterDetails. +func (o *ClusterDetails) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSpec returns the value of the Spec field in ClusterDetails as +// a ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetSpec(ctx context.Context) (ClusterSpec, bool) { + var e ClusterSpec + if o.Spec.IsNull() || o.Spec.IsUnknown() { + return e, false + } + var v []ClusterSpec + d := o.Spec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSpec sets the value of the Spec field in ClusterDetails. +func (o *ClusterDetails) SetSpec(ctx context.Context, v ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spec"] + o.Spec = types.ListValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in ClusterDetails as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in ClusterDetails. +func (o *ClusterDetails) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + +// GetTerminationReason returns the value of the TerminationReason field in ClusterDetails as +// a TerminationReason value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetTerminationReason(ctx context.Context) (TerminationReason, bool) { + var e TerminationReason + if o.TerminationReason.IsNull() || o.TerminationReason.IsUnknown() { + return e, false + } + var v []TerminationReason + d := o.TerminationReason.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTerminationReason sets the value of the TerminationReason field in ClusterDetails. +func (o *ClusterDetails) SetTerminationReason(ctx context.Context, v TerminationReason) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["termination_reason"] + o.TerminationReason = types.ListValueMust(t, vs) +} + +// GetWorkloadType returns the value of the WorkloadType field in ClusterDetails as +// a WorkloadType value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterDetails) GetWorkloadType(ctx context.Context) (WorkloadType, bool) { + var e WorkloadType + if o.WorkloadType.IsNull() || o.WorkloadType.IsUnknown() { + return e, false + } + var v []WorkloadType + d := o.WorkloadType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkloadType sets the value of the WorkloadType field in ClusterDetails. +func (o *ClusterDetails) SetWorkloadType(ctx context.Context, v WorkloadType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workload_type"] + o.WorkloadType = types.ListValueMust(t, vs) +} + type ClusterEvent struct { // ClusterId types.String `tfsdk:"cluster_id" tf:""` // - DataPlaneEventDetails []DataPlaneEventDetails `tfsdk:"data_plane_event_details" tf:"optional,object"` + DataPlaneEventDetails types.List `tfsdk:"data_plane_event_details" tf:"optional,object"` // - Details []EventDetails `tfsdk:"details" tf:"optional,object"` + Details types.List `tfsdk:"details" tf:"optional,object"` // The timestamp when the event occurred, stored as the number of // milliseconds since the Unix epoch. If not provided, this will be assigned // by the Timeline service. Timestamp types.Int64 `tfsdk:"timestamp" tf:"optional"` - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *ClusterEvent) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterEvent) { @@ -727,11 +2435,109 @@ func (newState *ClusterEvent) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clust func (newState *ClusterEvent) SyncEffectiveFieldsDuringRead(existingState ClusterEvent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterEvent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterEvent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data_plane_event_details": reflect.TypeOf(DataPlaneEventDetails{}), + "details": reflect.TypeOf(EventDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterEvent +// only implements ToObjectValue() and Type(). +func (o ClusterEvent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "data_plane_event_details": o.DataPlaneEventDetails, + "details": o.Details, + "timestamp": o.Timestamp, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterEvent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "data_plane_event_details": basetypes.ListType{ + ElemType: DataPlaneEventDetails{}.Type(ctx), + }, + "details": basetypes.ListType{ + ElemType: EventDetails{}.Type(ctx), + }, + "timestamp": types.Int64Type, + "type": types.StringType, + }, + } +} + +// GetDataPlaneEventDetails returns the value of the DataPlaneEventDetails field in ClusterEvent as +// a DataPlaneEventDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterEvent) GetDataPlaneEventDetails(ctx context.Context) (DataPlaneEventDetails, bool) { + var e DataPlaneEventDetails + if o.DataPlaneEventDetails.IsNull() || o.DataPlaneEventDetails.IsUnknown() { + return e, false + } + var v []DataPlaneEventDetails + d := o.DataPlaneEventDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataPlaneEventDetails sets the value of the DataPlaneEventDetails field in ClusterEvent. +func (o *ClusterEvent) SetDataPlaneEventDetails(ctx context.Context, v DataPlaneEventDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_plane_event_details"] + o.DataPlaneEventDetails = types.ListValueMust(t, vs) +} + +// GetDetails returns the value of the Details field in ClusterEvent as +// a EventDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterEvent) GetDetails(ctx context.Context) (EventDetails, bool) { + var e EventDetails + if o.Details.IsNull() || o.Details.IsUnknown() { + return e, false + } + var v []EventDetails + d := o.Details.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDetails sets the value of the Details field in ClusterEvent. +func (o *ClusterEvent) SetDetails(ctx context.Context, v EventDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["details"] + o.Details = types.ListValueMust(t, vs) +} + type ClusterLibraryStatuses struct { // Unique identifier for the cluster. ClusterId types.String `tfsdk:"cluster_id" tf:"optional"` // Status of all libraries on the cluster. - LibraryStatuses []LibraryFullStatus `tfsdk:"library_statuses" tf:"optional"` + LibraryStatuses types.List `tfsdk:"library_statuses" tf:"optional"` } func (newState *ClusterLibraryStatuses) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterLibraryStatuses) { @@ -740,16 +2546,79 @@ func (newState *ClusterLibraryStatuses) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ClusterLibraryStatuses) SyncEffectiveFieldsDuringRead(existingState ClusterLibraryStatuses) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterLibraryStatuses. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterLibraryStatuses) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "library_statuses": reflect.TypeOf(LibraryFullStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterLibraryStatuses +// only implements ToObjectValue() and Type(). +func (o ClusterLibraryStatuses) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "library_statuses": o.LibraryStatuses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterLibraryStatuses) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "library_statuses": basetypes.ListType{ + ElemType: LibraryFullStatus{}.Type(ctx), + }, + }, + } +} + +// GetLibraryStatuses returns the value of the LibraryStatuses field in ClusterLibraryStatuses as +// a slice of LibraryFullStatus values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterLibraryStatuses) GetLibraryStatuses(ctx context.Context) ([]LibraryFullStatus, bool) { + if o.LibraryStatuses.IsNull() || o.LibraryStatuses.IsUnknown() { + return nil, false + } + var v []LibraryFullStatus + d := o.LibraryStatuses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraryStatuses sets the value of the LibraryStatuses field in ClusterLibraryStatuses. +func (o *ClusterLibraryStatuses) SetLibraryStatuses(ctx context.Context, v []LibraryFullStatus) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["library_statuses"] + t = t.(attr.TypeWithElementType).ElementType() + o.LibraryStatuses = types.ListValueMust(t, vs) +} + type ClusterLogConf struct { // destination needs to be provided. e.g. `{ "dbfs" : { "destination" : // "dbfs:/home/cluster_log" } }` - Dbfs []DbfsStorageInfo `tfsdk:"dbfs" tf:"optional,object"` + Dbfs types.List `tfsdk:"dbfs" tf:"optional,object"` // destination and either the region or endpoint need to be provided. e.g. // `{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : // "us-west-2" } }` Cluster iam role is used to access s3, please make sure // the cluster iam role in `instance_profile_arn` has permission to write // data to the s3 destination. - S3 []S3StorageInfo `tfsdk:"s3" tf:"optional,object"` + S3 types.List `tfsdk:"s3" tf:"optional,object"` } func (newState *ClusterLogConf) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterLogConf) { @@ -758,10 +2627,102 @@ func (newState *ClusterLogConf) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clu func (newState *ClusterLogConf) SyncEffectiveFieldsDuringRead(existingState ClusterLogConf) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterLogConf. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterLogConf) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dbfs": reflect.TypeOf(DbfsStorageInfo{}), + "s3": reflect.TypeOf(S3StorageInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterLogConf +// only implements ToObjectValue() and Type(). +func (o ClusterLogConf) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbfs": o.Dbfs, + "s3": o.S3, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterLogConf) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbfs": basetypes.ListType{ + ElemType: DbfsStorageInfo{}.Type(ctx), + }, + "s3": basetypes.ListType{ + ElemType: S3StorageInfo{}.Type(ctx), + }, + }, + } +} + +// GetDbfs returns the value of the Dbfs field in ClusterLogConf as +// a DbfsStorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterLogConf) GetDbfs(ctx context.Context) (DbfsStorageInfo, bool) { + var e DbfsStorageInfo + if o.Dbfs.IsNull() || o.Dbfs.IsUnknown() { + return e, false + } + var v []DbfsStorageInfo + d := o.Dbfs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbfs sets the value of the Dbfs field in ClusterLogConf. +func (o *ClusterLogConf) SetDbfs(ctx context.Context, v DbfsStorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbfs"] + o.Dbfs = types.ListValueMust(t, vs) +} + +// GetS3 returns the value of the S3 field in ClusterLogConf as +// a S3StorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterLogConf) GetS3(ctx context.Context) (S3StorageInfo, bool) { + var e S3StorageInfo + if o.S3.IsNull() || o.S3.IsUnknown() { + return e, false + } + var v []S3StorageInfo + d := o.S3.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetS3 sets the value of the S3 field in ClusterLogConf. +func (o *ClusterLogConf) SetS3(ctx context.Context, v S3StorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["s3"] + o.S3 = types.ListValueMust(t, vs) +} + type ClusterPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -772,8 +2733,73 @@ func (newState *ClusterPermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ClusterPermission) SyncEffectiveFieldsDuringRead(existingState ClusterPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPermission +// only implements ToObjectValue() and Type(). +func (o ClusterPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in ClusterPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in ClusterPermission. +func (o *ClusterPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type ClusterPermissions struct { - AccessControlList []ClusterAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -786,6 +2812,71 @@ func (newState *ClusterPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ClusterPermissions) SyncEffectiveFieldsDuringRead(existingState ClusterPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ClusterAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPermissions +// only implements ToObjectValue() and Type(). +func (o ClusterPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ClusterAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ClusterPermissions as +// a slice of ClusterAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPermissions) GetAccessControlList(ctx context.Context) ([]ClusterAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ClusterAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ClusterPermissions. +func (o *ClusterPermissions) SetAccessControlList(ctx context.Context, v []ClusterAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type ClusterPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -798,8 +2889,41 @@ func (newState *ClusterPermissionsDescription) SyncEffectiveFieldsDuringCreateOr func (newState *ClusterPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState ClusterPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o ClusterPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type ClusterPermissionsRequest struct { - AccessControlList []ClusterAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The cluster for which to get or manage permissions. ClusterId types.String `tfsdk:"-"` } @@ -810,6 +2934,69 @@ func (newState *ClusterPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ClusterPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState ClusterPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ClusterAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o ClusterPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ClusterAccessControlRequest{}.Type(ctx), + }, + "cluster_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ClusterPermissionsRequest as +// a slice of ClusterAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPermissionsRequest) GetAccessControlList(ctx context.Context) ([]ClusterAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ClusterAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ClusterPermissionsRequest. +func (o *ClusterPermissionsRequest) SetAccessControlList(ctx context.Context, v []ClusterAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type ClusterPolicyAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -827,9 +3014,46 @@ func (newState *ClusterPolicyAccessControlRequest) SyncEffectiveFieldsDuringCrea func (newState *ClusterPolicyAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState ClusterPolicyAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPolicyAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPolicyAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPolicyAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o ClusterPolicyAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPolicyAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type ClusterPolicyAccessControlResponse struct { // All permissions. - AllPermissions []ClusterPolicyPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -846,10 +3070,79 @@ func (newState *ClusterPolicyAccessControlResponse) SyncEffectiveFieldsDuringCre func (newState *ClusterPolicyAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState ClusterPolicyAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPolicyAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPolicyAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(ClusterPolicyPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPolicyAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o ClusterPolicyAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPolicyAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: ClusterPolicyPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in ClusterPolicyAccessControlResponse as +// a slice of ClusterPolicyPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPolicyAccessControlResponse) GetAllPermissions(ctx context.Context) ([]ClusterPolicyPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []ClusterPolicyPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in ClusterPolicyAccessControlResponse. +func (o *ClusterPolicyAccessControlResponse) SetAllPermissions(ctx context.Context, v []ClusterPolicyPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type ClusterPolicyPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -860,8 +3153,73 @@ func (newState *ClusterPolicyPermission) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ClusterPolicyPermission) SyncEffectiveFieldsDuringRead(existingState ClusterPolicyPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPolicyPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPolicyPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPolicyPermission +// only implements ToObjectValue() and Type(). +func (o ClusterPolicyPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPolicyPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in ClusterPolicyPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPolicyPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in ClusterPolicyPermission. +func (o *ClusterPolicyPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type ClusterPolicyPermissions struct { - AccessControlList []ClusterPolicyAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -874,6 +3232,71 @@ func (newState *ClusterPolicyPermissions) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ClusterPolicyPermissions) SyncEffectiveFieldsDuringRead(existingState ClusterPolicyPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPolicyPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPolicyPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ClusterPolicyAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPolicyPermissions +// only implements ToObjectValue() and Type(). +func (o ClusterPolicyPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPolicyPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ClusterPolicyAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ClusterPolicyPermissions as +// a slice of ClusterPolicyAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPolicyPermissions) GetAccessControlList(ctx context.Context) ([]ClusterPolicyAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ClusterPolicyAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ClusterPolicyPermissions. +func (o *ClusterPolicyPermissions) SetAccessControlList(ctx context.Context, v []ClusterPolicyAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type ClusterPolicyPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -886,8 +3309,41 @@ func (newState *ClusterPolicyPermissionsDescription) SyncEffectiveFieldsDuringCr func (newState *ClusterPolicyPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState ClusterPolicyPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPolicyPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPolicyPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPolicyPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o ClusterPolicyPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPolicyPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type ClusterPolicyPermissionsRequest struct { - AccessControlList []ClusterPolicyAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The cluster policy for which to get or manage permissions. ClusterPolicyId types.String `tfsdk:"-"` } @@ -898,6 +3354,69 @@ func (newState *ClusterPolicyPermissionsRequest) SyncEffectiveFieldsDuringCreate func (newState *ClusterPolicyPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState ClusterPolicyPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterPolicyPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterPolicyPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ClusterPolicyAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterPolicyPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o ClusterPolicyPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "cluster_policy_id": o.ClusterPolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterPolicyPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ClusterPolicyAccessControlRequest{}.Type(ctx), + }, + "cluster_policy_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ClusterPolicyPermissionsRequest as +// a slice of ClusterPolicyAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterPolicyPermissionsRequest) GetAccessControlList(ctx context.Context) ([]ClusterPolicyAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ClusterPolicyAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ClusterPolicyPermissionsRequest. +func (o *ClusterPolicyPermissionsRequest) SetAccessControlList(ctx context.Context, v []ClusterPolicyAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + // Represents a change to the cluster settings required for the cluster to // become compliant with its policy. type ClusterSettingsChange struct { @@ -921,11 +3440,46 @@ func (newState *ClusterSettingsChange) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ClusterSettingsChange) SyncEffectiveFieldsDuringRead(existingState ClusterSettingsChange) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterSettingsChange. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterSettingsChange) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterSettingsChange +// only implements ToObjectValue() and Type(). +func (o ClusterSettingsChange) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "field": o.Field, + "new_value": o.NewValue, + "previous_value": o.PreviousValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterSettingsChange) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "field": types.StringType, + "new_value": types.StringType, + "previous_value": types.StringType, + }, + } +} + type ClusterSize struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 // Spark nodes. @@ -945,6 +3499,69 @@ func (newState *ClusterSize) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cluste func (newState *ClusterSize) SyncEffectiveFieldsDuringRead(existingState ClusterSize) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterSize. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterSize) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterSize +// only implements ToObjectValue() and Type(). +func (o ClusterSize) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "autoscale": o.Autoscale, + "num_workers": o.NumWorkers, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterSize) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "num_workers": types.Int64Type, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in ClusterSize as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSize) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in ClusterSize. +func (o *ClusterSize) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + type ClusterSpec struct { // When set to true, fixed and default values from the policy will be used // for fields that are omitted. When set to false, only fixed values from @@ -953,7 +3570,7 @@ type ClusterSpec struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 @@ -962,17 +3579,17 @@ type ClusterSpec struct { AutoterminationMinutes types.Int64 `tfsdk:"autotermination_minutes" tf:"optional"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes []AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes []AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // The configuration for delivering spark logs to a long-term storage // destination. Two kinds of destinations (dbfs and s3) are supported. Only // one destination can be specified for one cluster. If the conf is given, // the logs will be delivered to the destination every `5 mins`. The // destination of driver logs is `$destination/$clusterId/driver`, while the // destination of executor logs is `$destination/$clusterId/executor`. - ClusterLogConf []ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. ClusterName types.String `tfsdk:"cluster_name" tf:"optional"` @@ -984,7 +3601,7 @@ type ClusterSpec struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Data security mode decides what data governance model to use when // accessing data from a cluster. // @@ -1009,7 +3626,7 @@ type ClusterSpec struct { // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode types.String `tfsdk:"data_security_mode" tf:"optional"` - DockerImage []DockerImage `tfsdk:"docker_image" tf:"optional,object"` + DockerImage types.List `tfsdk:"docker_image" tf:"optional,object"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -1027,12 +3644,12 @@ type ClusterSpec struct { EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes []GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts []InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // This field encodes, through a single value, the resources available to @@ -1070,7 +3687,7 @@ type ClusterSpec struct { // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form // (X,Y) will be exported as is (i.e., `export X='Y'`) while launching the @@ -1084,7 +3701,7 @@ type ClusterSpec struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. @@ -1092,9 +3709,9 @@ type ClusterSpec struct { // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` - WorkloadType []WorkloadType `tfsdk:"workload_type" tf:"optional,object"` + WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } func (newState *ClusterSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterSpec) { @@ -1103,6 +3720,438 @@ func (newState *ClusterSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cluste func (newState *ClusterSpec) SyncEffectiveFieldsDuringRead(existingState ClusterSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + "aws_attributes": reflect.TypeOf(AwsAttributes{}), + "azure_attributes": reflect.TypeOf(AzureAttributes{}), + "cluster_log_conf": reflect.TypeOf(ClusterLogConf{}), + "custom_tags": reflect.TypeOf(types.String{}), + "docker_image": reflect.TypeOf(DockerImage{}), + "gcp_attributes": reflect.TypeOf(GcpAttributes{}), + "init_scripts": reflect.TypeOf(InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + "workload_type": reflect.TypeOf(WorkloadType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterSpec +// only implements ToObjectValue() and Type(). +func (o ClusterSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_policy_default_values": o.ApplyPolicyDefaultValues, + "autoscale": o.Autoscale, + "autotermination_minutes": o.AutoterminationMinutes, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "cluster_log_conf": o.ClusterLogConf, + "cluster_name": o.ClusterName, + "custom_tags": o.CustomTags, + "data_security_mode": o.DataSecurityMode, + "docker_image": o.DockerImage, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_elastic_disk": o.EnableElasticDisk, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "node_type_id": o.NodeTypeId, + "num_workers": o.NumWorkers, + "policy_id": o.PolicyId, + "runtime_engine": o.RuntimeEngine, + "single_user_name": o.SingleUserName, + "spark_conf": o.SparkConf, + "spark_env_vars": o.SparkEnvVars, + "spark_version": o.SparkVersion, + "ssh_public_keys": o.SshPublicKeys, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_policy_default_values": types.BoolType, + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "autotermination_minutes": types.Int64Type, + "aws_attributes": basetypes.ListType{ + ElemType: AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: AzureAttributes{}.Type(ctx), + }, + "cluster_log_conf": basetypes.ListType{ + ElemType: ClusterLogConf{}.Type(ctx), + }, + "cluster_name": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "data_security_mode": types.StringType, + "docker_image": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_elastic_disk": types.BoolType, + "enable_local_disk_encryption": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "node_type_id": types.StringType, + "num_workers": types.Int64Type, + "policy_id": types.StringType, + "runtime_engine": types.StringType, + "single_user_name": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_version": types.StringType, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "workload_type": basetypes.ListType{ + ElemType: WorkloadType{}.Type(ctx), + }, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in ClusterSpec as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in ClusterSpec. +func (o *ClusterSpec) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + +// GetAwsAttributes returns the value of the AwsAttributes field in ClusterSpec as +// a AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetAwsAttributes(ctx context.Context) (AwsAttributes, bool) { + var e AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in ClusterSpec. +func (o *ClusterSpec) SetAwsAttributes(ctx context.Context, v AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in ClusterSpec as +// a AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetAzureAttributes(ctx context.Context) (AzureAttributes, bool) { + var e AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in ClusterSpec. +func (o *ClusterSpec) SetAzureAttributes(ctx context.Context, v AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in ClusterSpec as +// a ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetClusterLogConf(ctx context.Context) (ClusterLogConf, bool) { + var e ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in ClusterSpec. +func (o *ClusterSpec) SetClusterLogConf(ctx context.Context, v ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in ClusterSpec as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in ClusterSpec. +func (o *ClusterSpec) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDockerImage returns the value of the DockerImage field in ClusterSpec as +// a DockerImage value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetDockerImage(ctx context.Context) (DockerImage, bool) { + var e DockerImage + if o.DockerImage.IsNull() || o.DockerImage.IsUnknown() { + return e, false + } + var v []DockerImage + d := o.DockerImage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDockerImage sets the value of the DockerImage field in ClusterSpec. +func (o *ClusterSpec) SetDockerImage(ctx context.Context, v DockerImage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["docker_image"] + o.DockerImage = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in ClusterSpec as +// a GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetGcpAttributes(ctx context.Context) (GcpAttributes, bool) { + var e GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in ClusterSpec. +func (o *ClusterSpec) SetGcpAttributes(ctx context.Context, v GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in ClusterSpec as +// a slice of InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetInitScripts(ctx context.Context) ([]InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in ClusterSpec. +func (o *ClusterSpec) SetInitScripts(ctx context.Context, v []InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in ClusterSpec as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in ClusterSpec. +func (o *ClusterSpec) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in ClusterSpec as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in ClusterSpec. +func (o *ClusterSpec) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in ClusterSpec as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in ClusterSpec. +func (o *ClusterSpec) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + +// GetWorkloadType returns the value of the WorkloadType field in ClusterSpec as +// a WorkloadType value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetWorkloadType(ctx context.Context) (WorkloadType, bool) { + var e WorkloadType + if o.WorkloadType.IsNull() || o.WorkloadType.IsUnknown() { + return e, false + } + var v []WorkloadType + d := o.WorkloadType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkloadType sets the value of the WorkloadType field in ClusterSpec. +func (o *ClusterSpec) SetWorkloadType(ctx context.Context, v WorkloadType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workload_type"] + o.WorkloadType = types.ListValueMust(t, vs) +} + // Get status type ClusterStatus struct { // Unique identifier of the cluster whose status should be retrieved. @@ -1115,6 +4164,37 @@ func (newState *ClusterStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clus func (newState *ClusterStatus) SyncEffectiveFieldsDuringRead(existingState ClusterStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterStatus +// only implements ToObjectValue() and Type(). +func (o ClusterStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type Command struct { // Running cluster id ClusterId types.String `tfsdk:"clusterId" tf:"optional"` @@ -1132,6 +4212,43 @@ func (newState *Command) SyncEffectiveFieldsDuringCreateOrUpdate(plan Command) { func (newState *Command) SyncEffectiveFieldsDuringRead(existingState Command) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Command. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Command) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Command +// only implements ToObjectValue() and Type(). +func (o Command) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusterId": o.ClusterId, + "command": o.Command, + "contextId": o.ContextId, + "language": o.Language, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Command) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusterId": types.StringType, + "command": types.StringType, + "contextId": types.StringType, + "language": types.StringType, + }, + } +} + // Get command info type CommandStatusRequest struct { ClusterId types.String `tfsdk:"-"` @@ -1147,10 +4264,45 @@ func (newState *CommandStatusRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *CommandStatusRequest) SyncEffectiveFieldsDuringRead(existingState CommandStatusRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CommandStatusRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CommandStatusRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CommandStatusRequest +// only implements ToObjectValue() and Type(). +func (o CommandStatusRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusterId": o.ClusterId, + "commandId": o.CommandId, + "contextId": o.ContextId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CommandStatusRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusterId": types.StringType, + "commandId": types.StringType, + "contextId": types.StringType, + }, + } +} + type CommandStatusResponse struct { Id types.String `tfsdk:"id" tf:"optional"` - Results []Results `tfsdk:"results" tf:"optional,object"` + Results types.List `tfsdk:"results" tf:"optional,object"` Status types.String `tfsdk:"status" tf:"optional"` } @@ -1161,6 +4313,71 @@ func (newState *CommandStatusResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CommandStatusResponse) SyncEffectiveFieldsDuringRead(existingState CommandStatusResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CommandStatusResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CommandStatusResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(Results{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CommandStatusResponse +// only implements ToObjectValue() and Type(). +func (o CommandStatusResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "results": o.Results, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CommandStatusResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "results": basetypes.ListType{ + ElemType: Results{}.Type(ctx), + }, + "status": types.StringType, + }, + } +} + +// GetResults returns the value of the Results field in CommandStatusResponse as +// a Results value. +// If the field is unknown or null, the boolean return value is false. +func (o *CommandStatusResponse) GetResults(ctx context.Context) (Results, bool) { + var e Results + if o.Results.IsNull() || o.Results.IsUnknown() { + return e, false + } + var v []Results + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetResults sets the value of the Results field in CommandStatusResponse. +func (o *CommandStatusResponse) SetResults(ctx context.Context, v Results) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + o.Results = types.ListValueMust(t, vs) +} + // Get status type ContextStatusRequest struct { ClusterId types.String `tfsdk:"-"` @@ -1174,6 +4391,39 @@ func (newState *ContextStatusRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ContextStatusRequest) SyncEffectiveFieldsDuringRead(existingState ContextStatusRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ContextStatusRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ContextStatusRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ContextStatusRequest +// only implements ToObjectValue() and Type(). +func (o ContextStatusRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusterId": o.ClusterId, + "contextId": o.ContextId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ContextStatusRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusterId": types.StringType, + "contextId": types.StringType, + }, + } +} + type ContextStatusResponse struct { Id types.String `tfsdk:"id" tf:"optional"` @@ -1186,6 +4436,39 @@ func (newState *ContextStatusResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ContextStatusResponse) SyncEffectiveFieldsDuringRead(existingState ContextStatusResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ContextStatusResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ContextStatusResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ContextStatusResponse +// only implements ToObjectValue() and Type(). +func (o ContextStatusResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ContextStatusResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "status": types.StringType, + }, + } +} + type CreateCluster struct { // When set to true, fixed and default values from the policy will be used // for fields that are omitted. When set to false, only fixed values from @@ -1194,7 +4477,7 @@ type CreateCluster struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 @@ -1203,20 +4486,20 @@ type CreateCluster struct { AutoterminationMinutes types.Int64 `tfsdk:"autotermination_minutes" tf:"optional"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes []AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes []AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // When specified, this clones libraries from a source cluster during the // creation of a new cluster. - CloneFrom []CloneCluster `tfsdk:"clone_from" tf:"optional,object"` + CloneFrom types.List `tfsdk:"clone_from" tf:"optional,object"` // The configuration for delivering spark logs to a long-term storage // destination. Two kinds of destinations (dbfs and s3) are supported. Only // one destination can be specified for one cluster. If the conf is given, // the logs will be delivered to the destination every `5 mins`. The // destination of driver logs is `$destination/$clusterId/driver`, while the // destination of executor logs is `$destination/$clusterId/executor`. - ClusterLogConf []ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. ClusterName types.String `tfsdk:"cluster_name" tf:"optional"` @@ -1228,7 +4511,7 @@ type CreateCluster struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Data security mode decides what data governance model to use when // accessing data from a cluster. // @@ -1253,7 +4536,7 @@ type CreateCluster struct { // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode types.String `tfsdk:"data_security_mode" tf:"optional"` - DockerImage []DockerImage `tfsdk:"docker_image" tf:"optional,object"` + DockerImage types.List `tfsdk:"docker_image" tf:"optional,object"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -1271,12 +4554,12 @@ type CreateCluster struct { EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes []GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts []InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // This field encodes, through a single value, the resources available to @@ -1314,7 +4597,7 @@ type CreateCluster struct { // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form // (X,Y) will be exported as is (i.e., `export X='Y'`) while launching the @@ -1328,7 +4611,7 @@ type CreateCluster struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. @@ -1336,9 +4619,9 @@ type CreateCluster struct { // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` - WorkloadType []WorkloadType `tfsdk:"workload_type" tf:"optional,object"` + WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } func (newState *CreateCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCluster) { @@ -1347,6 +4630,469 @@ func (newState *CreateCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Crea func (newState *CreateCluster) SyncEffectiveFieldsDuringRead(existingState CreateCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + "aws_attributes": reflect.TypeOf(AwsAttributes{}), + "azure_attributes": reflect.TypeOf(AzureAttributes{}), + "clone_from": reflect.TypeOf(CloneCluster{}), + "cluster_log_conf": reflect.TypeOf(ClusterLogConf{}), + "custom_tags": reflect.TypeOf(types.String{}), + "docker_image": reflect.TypeOf(DockerImage{}), + "gcp_attributes": reflect.TypeOf(GcpAttributes{}), + "init_scripts": reflect.TypeOf(InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + "workload_type": reflect.TypeOf(WorkloadType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCluster +// only implements ToObjectValue() and Type(). +func (o CreateCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_policy_default_values": o.ApplyPolicyDefaultValues, + "autoscale": o.Autoscale, + "autotermination_minutes": o.AutoterminationMinutes, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "clone_from": o.CloneFrom, + "cluster_log_conf": o.ClusterLogConf, + "cluster_name": o.ClusterName, + "custom_tags": o.CustomTags, + "data_security_mode": o.DataSecurityMode, + "docker_image": o.DockerImage, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_elastic_disk": o.EnableElasticDisk, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "node_type_id": o.NodeTypeId, + "num_workers": o.NumWorkers, + "policy_id": o.PolicyId, + "runtime_engine": o.RuntimeEngine, + "single_user_name": o.SingleUserName, + "spark_conf": o.SparkConf, + "spark_env_vars": o.SparkEnvVars, + "spark_version": o.SparkVersion, + "ssh_public_keys": o.SshPublicKeys, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_policy_default_values": types.BoolType, + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "autotermination_minutes": types.Int64Type, + "aws_attributes": basetypes.ListType{ + ElemType: AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: AzureAttributes{}.Type(ctx), + }, + "clone_from": basetypes.ListType{ + ElemType: CloneCluster{}.Type(ctx), + }, + "cluster_log_conf": basetypes.ListType{ + ElemType: ClusterLogConf{}.Type(ctx), + }, + "cluster_name": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "data_security_mode": types.StringType, + "docker_image": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_elastic_disk": types.BoolType, + "enable_local_disk_encryption": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "node_type_id": types.StringType, + "num_workers": types.Int64Type, + "policy_id": types.StringType, + "runtime_engine": types.StringType, + "single_user_name": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_version": types.StringType, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "workload_type": basetypes.ListType{ + ElemType: WorkloadType{}.Type(ctx), + }, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in CreateCluster as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in CreateCluster. +func (o *CreateCluster) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + +// GetAwsAttributes returns the value of the AwsAttributes field in CreateCluster as +// a AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetAwsAttributes(ctx context.Context) (AwsAttributes, bool) { + var e AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in CreateCluster. +func (o *CreateCluster) SetAwsAttributes(ctx context.Context, v AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in CreateCluster as +// a AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetAzureAttributes(ctx context.Context) (AzureAttributes, bool) { + var e AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in CreateCluster. +func (o *CreateCluster) SetAzureAttributes(ctx context.Context, v AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetCloneFrom returns the value of the CloneFrom field in CreateCluster as +// a CloneCluster value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetCloneFrom(ctx context.Context) (CloneCluster, bool) { + var e CloneCluster + if o.CloneFrom.IsNull() || o.CloneFrom.IsUnknown() { + return e, false + } + var v []CloneCluster + d := o.CloneFrom.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloneFrom sets the value of the CloneFrom field in CreateCluster. +func (o *CreateCluster) SetCloneFrom(ctx context.Context, v CloneCluster) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clone_from"] + o.CloneFrom = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in CreateCluster as +// a ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetClusterLogConf(ctx context.Context) (ClusterLogConf, bool) { + var e ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in CreateCluster. +func (o *CreateCluster) SetClusterLogConf(ctx context.Context, v ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in CreateCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in CreateCluster. +func (o *CreateCluster) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDockerImage returns the value of the DockerImage field in CreateCluster as +// a DockerImage value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetDockerImage(ctx context.Context) (DockerImage, bool) { + var e DockerImage + if o.DockerImage.IsNull() || o.DockerImage.IsUnknown() { + return e, false + } + var v []DockerImage + d := o.DockerImage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDockerImage sets the value of the DockerImage field in CreateCluster. +func (o *CreateCluster) SetDockerImage(ctx context.Context, v DockerImage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["docker_image"] + o.DockerImage = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in CreateCluster as +// a GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetGcpAttributes(ctx context.Context) (GcpAttributes, bool) { + var e GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in CreateCluster. +func (o *CreateCluster) SetGcpAttributes(ctx context.Context, v GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in CreateCluster as +// a slice of InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetInitScripts(ctx context.Context) ([]InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in CreateCluster. +func (o *CreateCluster) SetInitScripts(ctx context.Context, v []InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in CreateCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in CreateCluster. +func (o *CreateCluster) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in CreateCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in CreateCluster. +func (o *CreateCluster) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in CreateCluster as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in CreateCluster. +func (o *CreateCluster) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + +// GetWorkloadType returns the value of the WorkloadType field in CreateCluster as +// a WorkloadType value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCluster) GetWorkloadType(ctx context.Context) (WorkloadType, bool) { + var e WorkloadType + if o.WorkloadType.IsNull() || o.WorkloadType.IsUnknown() { + return e, false + } + var v []WorkloadType + d := o.WorkloadType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkloadType sets the value of the WorkloadType field in CreateCluster. +func (o *CreateCluster) SetWorkloadType(ctx context.Context, v WorkloadType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workload_type"] + o.WorkloadType = types.ListValueMust(t, vs) +} + type CreateClusterResponse struct { ClusterId types.String `tfsdk:"cluster_id" tf:"optional"` } @@ -1357,6 +5103,37 @@ func (newState *CreateClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateClusterResponse) SyncEffectiveFieldsDuringRead(existingState CreateClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateClusterResponse +// only implements ToObjectValue() and Type(). +func (o CreateClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type CreateContext struct { // Running cluster id ClusterId types.String `tfsdk:"clusterId" tf:"optional"` @@ -1370,22 +5147,55 @@ func (newState *CreateContext) SyncEffectiveFieldsDuringCreateOrUpdate(plan Crea func (newState *CreateContext) SyncEffectiveFieldsDuringRead(existingState CreateContext) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateContext. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateContext) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateContext +// only implements ToObjectValue() and Type(). +func (o CreateContext) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusterId": o.ClusterId, + "language": o.Language, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateContext) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusterId": types.StringType, + "language": types.StringType, + }, + } +} + type CreateInstancePool struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. - AwsAttributes []InstancePoolAwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to instance pools running on Azure. If not specified // at pool creation, a set of default values will be used. - AzureAttributes []InstancePoolAzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Defines the specification of the disks that will be attached to all spark // containers. - DiskSpec []DiskSpec `tfsdk:"disk_spec" tf:"optional,object"` + DiskSpec types.List `tfsdk:"disk_spec" tf:"optional,object"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -1394,7 +5204,7 @@ type CreateInstancePool struct { EnableElasticDisk types.Bool `tfsdk:"enable_elastic_disk" tf:"optional"` // Attributes related to instance pools running on Google Cloud Platform. If // not specified at pool creation, a set of default values will be used. - GcpAttributes []InstancePoolGcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement // is already met. If not set, the extra pool instances will be @@ -1419,12 +5229,12 @@ type CreateInstancePool struct { // :method:clusters/listNodeTypes API call. NodeTypeId types.String `tfsdk:"node_type_id" tf:""` // Custom Docker Image BYOC - PreloadedDockerImages []DockerImage `tfsdk:"preloaded_docker_images" tf:"optional"` + PreloadedDockerImages types.List `tfsdk:"preloaded_docker_images" tf:"optional"` // A list containing at most one preloaded Spark image version for the pool. // Pool-backed clusters started with the preloaded Spark version will start // faster. A list of available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - PreloadedSparkVersions []types.String `tfsdk:"preloaded_spark_versions" tf:"optional"` + PreloadedSparkVersions types.List `tfsdk:"preloaded_spark_versions" tf:"optional"` } func (newState *CreateInstancePool) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateInstancePool) { @@ -1433,6 +5243,265 @@ func (newState *CreateInstancePool) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateInstancePool) SyncEffectiveFieldsDuringRead(existingState CreateInstancePool) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateInstancePool. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateInstancePool) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_attributes": reflect.TypeOf(InstancePoolAwsAttributes{}), + "azure_attributes": reflect.TypeOf(InstancePoolAzureAttributes{}), + "custom_tags": reflect.TypeOf(types.String{}), + "disk_spec": reflect.TypeOf(DiskSpec{}), + "gcp_attributes": reflect.TypeOf(InstancePoolGcpAttributes{}), + "preloaded_docker_images": reflect.TypeOf(DockerImage{}), + "preloaded_spark_versions": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateInstancePool +// only implements ToObjectValue() and Type(). +func (o CreateInstancePool) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "custom_tags": o.CustomTags, + "disk_spec": o.DiskSpec, + "enable_elastic_disk": o.EnableElasticDisk, + "gcp_attributes": o.GcpAttributes, + "idle_instance_autotermination_minutes": o.IdleInstanceAutoterminationMinutes, + "instance_pool_name": o.InstancePoolName, + "max_capacity": o.MaxCapacity, + "min_idle_instances": o.MinIdleInstances, + "node_type_id": o.NodeTypeId, + "preloaded_docker_images": o.PreloadedDockerImages, + "preloaded_spark_versions": o.PreloadedSparkVersions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateInstancePool) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_attributes": basetypes.ListType{ + ElemType: InstancePoolAwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: InstancePoolAzureAttributes{}.Type(ctx), + }, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "disk_spec": basetypes.ListType{ + ElemType: DiskSpec{}.Type(ctx), + }, + "enable_elastic_disk": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: InstancePoolGcpAttributes{}.Type(ctx), + }, + "idle_instance_autotermination_minutes": types.Int64Type, + "instance_pool_name": types.StringType, + "max_capacity": types.Int64Type, + "min_idle_instances": types.Int64Type, + "node_type_id": types.StringType, + "preloaded_docker_images": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "preloaded_spark_versions": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAwsAttributes returns the value of the AwsAttributes field in CreateInstancePool as +// a InstancePoolAwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetAwsAttributes(ctx context.Context) (InstancePoolAwsAttributes, bool) { + var e InstancePoolAwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolAwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in CreateInstancePool. +func (o *CreateInstancePool) SetAwsAttributes(ctx context.Context, v InstancePoolAwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in CreateInstancePool as +// a InstancePoolAzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetAzureAttributes(ctx context.Context) (InstancePoolAzureAttributes, bool) { + var e InstancePoolAzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolAzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in CreateInstancePool. +func (o *CreateInstancePool) SetAzureAttributes(ctx context.Context, v InstancePoolAzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in CreateInstancePool as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in CreateInstancePool. +func (o *CreateInstancePool) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDiskSpec returns the value of the DiskSpec field in CreateInstancePool as +// a DiskSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetDiskSpec(ctx context.Context) (DiskSpec, bool) { + var e DiskSpec + if o.DiskSpec.IsNull() || o.DiskSpec.IsUnknown() { + return e, false + } + var v []DiskSpec + d := o.DiskSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDiskSpec sets the value of the DiskSpec field in CreateInstancePool. +func (o *CreateInstancePool) SetDiskSpec(ctx context.Context, v DiskSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disk_spec"] + o.DiskSpec = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in CreateInstancePool as +// a InstancePoolGcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetGcpAttributes(ctx context.Context) (InstancePoolGcpAttributes, bool) { + var e InstancePoolGcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolGcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in CreateInstancePool. +func (o *CreateInstancePool) SetGcpAttributes(ctx context.Context, v InstancePoolGcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetPreloadedDockerImages returns the value of the PreloadedDockerImages field in CreateInstancePool as +// a slice of DockerImage values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetPreloadedDockerImages(ctx context.Context) ([]DockerImage, bool) { + if o.PreloadedDockerImages.IsNull() || o.PreloadedDockerImages.IsUnknown() { + return nil, false + } + var v []DockerImage + d := o.PreloadedDockerImages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPreloadedDockerImages sets the value of the PreloadedDockerImages field in CreateInstancePool. +func (o *CreateInstancePool) SetPreloadedDockerImages(ctx context.Context, v []DockerImage) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["preloaded_docker_images"] + t = t.(attr.TypeWithElementType).ElementType() + o.PreloadedDockerImages = types.ListValueMust(t, vs) +} + +// GetPreloadedSparkVersions returns the value of the PreloadedSparkVersions field in CreateInstancePool as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstancePool) GetPreloadedSparkVersions(ctx context.Context) ([]types.String, bool) { + if o.PreloadedSparkVersions.IsNull() || o.PreloadedSparkVersions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PreloadedSparkVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPreloadedSparkVersions sets the value of the PreloadedSparkVersions field in CreateInstancePool. +func (o *CreateInstancePool) SetPreloadedSparkVersions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["preloaded_spark_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.PreloadedSparkVersions = types.ListValueMust(t, vs) +} + type CreateInstancePoolResponse struct { // The ID of the created instance pool. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` @@ -1444,6 +5513,37 @@ func (newState *CreateInstancePoolResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateInstancePoolResponse) SyncEffectiveFieldsDuringRead(existingState CreateInstancePoolResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateInstancePoolResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateInstancePoolResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateInstancePoolResponse +// only implements ToObjectValue() and Type(). +func (o CreateInstancePoolResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_pool_id": o.InstancePoolId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateInstancePoolResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_pool_id": types.StringType, + }, + } +} + type CreatePolicy struct { // Policy definition document expressed in [Databricks Cluster Policy // Definition Language]. @@ -1454,7 +5554,7 @@ type CreatePolicy struct { Description types.String `tfsdk:"description" tf:"optional"` // A list of libraries to be installed on the next cluster restart that uses // this policy. The maximum number of libraries is 500. - Libraries []Library `tfsdk:"libraries" tf:"optional"` + Libraries types.List `tfsdk:"libraries" tf:"optional"` // Max number of clusters per user that can be active using this policy. If // not present, there is no max limit. MaxClustersPerUser types.Int64 `tfsdk:"max_clusters_per_user" tf:"optional"` @@ -1486,6 +5586,79 @@ func (newState *CreatePolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan Creat func (newState *CreatePolicy) SyncEffectiveFieldsDuringRead(existingState CreatePolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "libraries": reflect.TypeOf(Library{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePolicy +// only implements ToObjectValue() and Type(). +func (o CreatePolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "definition": o.Definition, + "description": o.Description, + "libraries": o.Libraries, + "max_clusters_per_user": o.MaxClustersPerUser, + "name": o.Name, + "policy_family_definition_overrides": o.PolicyFamilyDefinitionOverrides, + "policy_family_id": o.PolicyFamilyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "definition": types.StringType, + "description": types.StringType, + "libraries": basetypes.ListType{ + ElemType: Library{}.Type(ctx), + }, + "max_clusters_per_user": types.Int64Type, + "name": types.StringType, + "policy_family_definition_overrides": types.StringType, + "policy_family_id": types.StringType, + }, + } +} + +// GetLibraries returns the value of the Libraries field in CreatePolicy as +// a slice of Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePolicy) GetLibraries(ctx context.Context) ([]Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in CreatePolicy. +func (o *CreatePolicy) SetLibraries(ctx context.Context, v []Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + type CreatePolicyResponse struct { // Canonical unique identifier for the cluster policy. PolicyId types.String `tfsdk:"policy_id" tf:"optional"` @@ -1497,6 +5670,37 @@ func (newState *CreatePolicyResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *CreatePolicyResponse) SyncEffectiveFieldsDuringRead(existingState CreatePolicyResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePolicyResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePolicyResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePolicyResponse +// only implements ToObjectValue() and Type(). +func (o CreatePolicyResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePolicyResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + }, + } +} + type CreateResponse struct { // The global init script ID. ScriptId types.String `tfsdk:"script_id" tf:"optional"` @@ -1508,6 +5712,37 @@ func (newState *CreateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateResponse) SyncEffectiveFieldsDuringRead(existingState CreateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateResponse +// only implements ToObjectValue() and Type(). +func (o CreateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "script_id": o.ScriptId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "script_id": types.StringType, + }, + } +} + type Created struct { Id types.String `tfsdk:"id" tf:"optional"` } @@ -1518,6 +5753,37 @@ func (newState *Created) SyncEffectiveFieldsDuringCreateOrUpdate(plan Created) { func (newState *Created) SyncEffectiveFieldsDuringRead(existingState Created) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Created. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Created) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Created +// only implements ToObjectValue() and Type(). +func (o Created) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Created) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DataPlaneEventDetails struct { // EventType types.String `tfsdk:"event_type" tf:"optional"` @@ -1535,6 +5801,43 @@ func (newState *DataPlaneEventDetails) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DataPlaneEventDetails) SyncEffectiveFieldsDuringRead(existingState DataPlaneEventDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DataPlaneEventDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DataPlaneEventDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DataPlaneEventDetails +// only implements ToObjectValue() and Type(). +func (o DataPlaneEventDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "event_type": o.EventType, + "executor_failures": o.ExecutorFailures, + "host_id": o.HostId, + "timestamp": o.Timestamp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DataPlaneEventDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "event_type": types.StringType, + "executor_failures": types.Int64Type, + "host_id": types.StringType, + "timestamp": types.Int64Type, + }, + } +} + type DbfsStorageInfo struct { // dbfs destination, e.g. `dbfs:/my/path` Destination types.String `tfsdk:"destination" tf:""` @@ -1546,6 +5849,37 @@ func (newState *DbfsStorageInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Db func (newState *DbfsStorageInfo) SyncEffectiveFieldsDuringRead(existingState DbfsStorageInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DbfsStorageInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DbfsStorageInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DbfsStorageInfo +// only implements ToObjectValue() and Type(). +func (o DbfsStorageInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DbfsStorageInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + }, + } +} + type DeleteCluster struct { // The cluster to be terminated. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -1557,6 +5891,37 @@ func (newState *DeleteCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dele func (newState *DeleteCluster) SyncEffectiveFieldsDuringRead(existingState DeleteCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCluster +// only implements ToObjectValue() and Type(). +func (o DeleteCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type DeleteClusterResponse struct { } @@ -1566,6 +5931,33 @@ func (newState *DeleteClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteClusterResponse) SyncEffectiveFieldsDuringRead(existingState DeleteClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteClusterResponse +// only implements ToObjectValue() and Type(). +func (o DeleteClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete init script type DeleteGlobalInitScriptRequest struct { // The ID of the global init script. @@ -1578,6 +5970,37 @@ func (newState *DeleteGlobalInitScriptRequest) SyncEffectiveFieldsDuringCreateOr func (newState *DeleteGlobalInitScriptRequest) SyncEffectiveFieldsDuringRead(existingState DeleteGlobalInitScriptRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteGlobalInitScriptRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteGlobalInitScriptRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteGlobalInitScriptRequest +// only implements ToObjectValue() and Type(). +func (o DeleteGlobalInitScriptRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "script_id": o.ScriptId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteGlobalInitScriptRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "script_id": types.StringType, + }, + } +} + type DeleteInstancePool struct { // The instance pool to be terminated. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:""` @@ -1589,6 +6012,37 @@ func (newState *DeleteInstancePool) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteInstancePool) SyncEffectiveFieldsDuringRead(existingState DeleteInstancePool) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteInstancePool. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteInstancePool) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteInstancePool +// only implements ToObjectValue() and Type(). +func (o DeleteInstancePool) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_pool_id": o.InstancePoolId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteInstancePool) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_pool_id": types.StringType, + }, + } +} + type DeleteInstancePoolResponse struct { } @@ -1598,6 +6052,33 @@ func (newState *DeleteInstancePoolResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteInstancePoolResponse) SyncEffectiveFieldsDuringRead(existingState DeleteInstancePoolResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteInstancePoolResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteInstancePoolResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteInstancePoolResponse +// only implements ToObjectValue() and Type(). +func (o DeleteInstancePoolResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteInstancePoolResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeletePolicy struct { // The ID of the policy to delete. PolicyId types.String `tfsdk:"policy_id" tf:""` @@ -1609,6 +6090,37 @@ func (newState *DeletePolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan Delet func (newState *DeletePolicy) SyncEffectiveFieldsDuringRead(existingState DeletePolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePolicy +// only implements ToObjectValue() and Type(). +func (o DeletePolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + }, + } +} + type DeletePolicyResponse struct { } @@ -1618,6 +6130,33 @@ func (newState *DeletePolicyResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeletePolicyResponse) SyncEffectiveFieldsDuringRead(existingState DeletePolicyResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePolicyResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePolicyResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePolicyResponse +// only implements ToObjectValue() and Type(). +func (o DeletePolicyResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePolicyResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteResponse struct { } @@ -1627,6 +6166,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DestroyContext struct { ClusterId types.String `tfsdk:"clusterId" tf:""` @@ -1639,6 +6205,39 @@ func (newState *DestroyContext) SyncEffectiveFieldsDuringCreateOrUpdate(plan Des func (newState *DestroyContext) SyncEffectiveFieldsDuringRead(existingState DestroyContext) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DestroyContext. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DestroyContext) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DestroyContext +// only implements ToObjectValue() and Type(). +func (o DestroyContext) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusterId": o.ClusterId, + "contextId": o.ContextId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DestroyContext) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusterId": types.StringType, + "contextId": types.StringType, + }, + } +} + type DestroyResponse struct { } @@ -1648,6 +6247,33 @@ func (newState *DestroyResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan De func (newState *DestroyResponse) SyncEffectiveFieldsDuringRead(existingState DestroyResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DestroyResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DestroyResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DestroyResponse +// only implements ToObjectValue() and Type(). +func (o DestroyResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DestroyResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DiskSpec struct { // The number of disks launched for each instance: - This feature is only // enabled for supported node types. - Users can choose up to the limit of @@ -1680,7 +6306,7 @@ type DiskSpec struct { DiskThroughput types.Int64 `tfsdk:"disk_throughput" tf:"optional"` // The type of disks that will be launched with this cluster. - DiskType []DiskType `tfsdk:"disk_type" tf:"optional,object"` + DiskType types.List `tfsdk:"disk_type" tf:"optional,object"` } func (newState *DiskSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan DiskSpec) { @@ -1689,6 +6315,75 @@ func (newState *DiskSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan DiskSpec) func (newState *DiskSpec) SyncEffectiveFieldsDuringRead(existingState DiskSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DiskSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DiskSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "disk_type": reflect.TypeOf(DiskType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DiskSpec +// only implements ToObjectValue() and Type(). +func (o DiskSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "disk_count": o.DiskCount, + "disk_iops": o.DiskIops, + "disk_size": o.DiskSize, + "disk_throughput": o.DiskThroughput, + "disk_type": o.DiskType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DiskSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "disk_count": types.Int64Type, + "disk_iops": types.Int64Type, + "disk_size": types.Int64Type, + "disk_throughput": types.Int64Type, + "disk_type": basetypes.ListType{ + ElemType: DiskType{}.Type(ctx), + }, + }, + } +} + +// GetDiskType returns the value of the DiskType field in DiskSpec as +// a DiskType value. +// If the field is unknown or null, the boolean return value is false. +func (o *DiskSpec) GetDiskType(ctx context.Context) (DiskType, bool) { + var e DiskType + if o.DiskType.IsNull() || o.DiskType.IsUnknown() { + return e, false + } + var v []DiskType + d := o.DiskType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDiskType sets the value of the DiskType field in DiskSpec. +func (o *DiskSpec) SetDiskType(ctx context.Context, v DiskType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disk_type"] + o.DiskType = types.ListValueMust(t, vs) +} + type DiskType struct { AzureDiskVolumeType types.String `tfsdk:"azure_disk_volume_type" tf:"optional"` @@ -1701,6 +6396,39 @@ func (newState *DiskType) SyncEffectiveFieldsDuringCreateOrUpdate(plan DiskType) func (newState *DiskType) SyncEffectiveFieldsDuringRead(existingState DiskType) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DiskType. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DiskType) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DiskType +// only implements ToObjectValue() and Type(). +func (o DiskType) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "azure_disk_volume_type": o.AzureDiskVolumeType, + "ebs_volume_type": o.EbsVolumeType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DiskType) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "azure_disk_volume_type": types.StringType, + "ebs_volume_type": types.StringType, + }, + } +} + type DockerBasicAuth struct { // Password of the user Password types.String `tfsdk:"password" tf:"optional"` @@ -1714,18 +6442,114 @@ func (newState *DockerBasicAuth) SyncEffectiveFieldsDuringCreateOrUpdate(plan Do func (newState *DockerBasicAuth) SyncEffectiveFieldsDuringRead(existingState DockerBasicAuth) { } -type DockerImage struct { - BasicAuth []DockerBasicAuth `tfsdk:"basic_auth" tf:"optional,object"` - // URL of the docker image. - Url types.String `tfsdk:"url" tf:"optional"` +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DockerBasicAuth. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DockerBasicAuth) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} } -func (newState *DockerImage) SyncEffectiveFieldsDuringCreateOrUpdate(plan DockerImage) { +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DockerBasicAuth +// only implements ToObjectValue() and Type(). +func (o DockerBasicAuth) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "password": o.Password, + "username": o.Username, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DockerBasicAuth) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "password": types.StringType, + "username": types.StringType, + }, + } +} + +type DockerImage struct { + BasicAuth types.List `tfsdk:"basic_auth" tf:"optional,object"` + // URL of the docker image. + Url types.String `tfsdk:"url" tf:"optional"` +} + +func (newState *DockerImage) SyncEffectiveFieldsDuringCreateOrUpdate(plan DockerImage) { } func (newState *DockerImage) SyncEffectiveFieldsDuringRead(existingState DockerImage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DockerImage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DockerImage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "basic_auth": reflect.TypeOf(DockerBasicAuth{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DockerImage +// only implements ToObjectValue() and Type(). +func (o DockerImage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "basic_auth": o.BasicAuth, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DockerImage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "basic_auth": basetypes.ListType{ + ElemType: DockerBasicAuth{}.Type(ctx), + }, + "url": types.StringType, + }, + } +} + +// GetBasicAuth returns the value of the BasicAuth field in DockerImage as +// a DockerBasicAuth value. +// If the field is unknown or null, the boolean return value is false. +func (o *DockerImage) GetBasicAuth(ctx context.Context) (DockerBasicAuth, bool) { + var e DockerBasicAuth + if o.BasicAuth.IsNull() || o.BasicAuth.IsUnknown() { + return e, false + } + var v []DockerBasicAuth + d := o.BasicAuth.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBasicAuth sets the value of the BasicAuth field in DockerImage. +func (o *DockerImage) SetBasicAuth(ctx context.Context, v DockerBasicAuth) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["basic_auth"] + o.BasicAuth = types.ListValueMust(t, vs) +} + type EditCluster struct { // When set to true, fixed and default values from the policy will be used // for fields that are omitted. When set to false, only fixed values from @@ -1734,7 +6558,7 @@ type EditCluster struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 @@ -1743,10 +6567,10 @@ type EditCluster struct { AutoterminationMinutes types.Int64 `tfsdk:"autotermination_minutes" tf:"optional"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes []AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes []AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // ID of the cluster ClusterId types.String `tfsdk:"cluster_id" tf:""` // The configuration for delivering spark logs to a long-term storage @@ -1755,7 +6579,7 @@ type EditCluster struct { // the logs will be delivered to the destination every `5 mins`. The // destination of driver logs is `$destination/$clusterId/driver`, while the // destination of executor logs is `$destination/$clusterId/executor`. - ClusterLogConf []ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. ClusterName types.String `tfsdk:"cluster_name" tf:"optional"` @@ -1767,7 +6591,7 @@ type EditCluster struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Data security mode decides what data governance model to use when // accessing data from a cluster. // @@ -1792,7 +6616,7 @@ type EditCluster struct { // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode types.String `tfsdk:"data_security_mode" tf:"optional"` - DockerImage []DockerImage `tfsdk:"docker_image" tf:"optional,object"` + DockerImage types.List `tfsdk:"docker_image" tf:"optional,object"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -1810,12 +6634,12 @@ type EditCluster struct { EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes []GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts []InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // This field encodes, through a single value, the resources available to @@ -1853,7 +6677,7 @@ type EditCluster struct { // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form // (X,Y) will be exported as is (i.e., `export X='Y'`) while launching the @@ -1867,7 +6691,7 @@ type EditCluster struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. @@ -1875,9 +6699,9 @@ type EditCluster struct { // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` - WorkloadType []WorkloadType `tfsdk:"workload_type" tf:"optional,object"` + WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } func (newState *EditCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditCluster) { @@ -1886,6 +6710,440 @@ func (newState *EditCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditCl func (newState *EditCluster) SyncEffectiveFieldsDuringRead(existingState EditCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + "aws_attributes": reflect.TypeOf(AwsAttributes{}), + "azure_attributes": reflect.TypeOf(AzureAttributes{}), + "cluster_log_conf": reflect.TypeOf(ClusterLogConf{}), + "custom_tags": reflect.TypeOf(types.String{}), + "docker_image": reflect.TypeOf(DockerImage{}), + "gcp_attributes": reflect.TypeOf(GcpAttributes{}), + "init_scripts": reflect.TypeOf(InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + "workload_type": reflect.TypeOf(WorkloadType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditCluster +// only implements ToObjectValue() and Type(). +func (o EditCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_policy_default_values": o.ApplyPolicyDefaultValues, + "autoscale": o.Autoscale, + "autotermination_minutes": o.AutoterminationMinutes, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "cluster_id": o.ClusterId, + "cluster_log_conf": o.ClusterLogConf, + "cluster_name": o.ClusterName, + "custom_tags": o.CustomTags, + "data_security_mode": o.DataSecurityMode, + "docker_image": o.DockerImage, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_elastic_disk": o.EnableElasticDisk, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "node_type_id": o.NodeTypeId, + "num_workers": o.NumWorkers, + "policy_id": o.PolicyId, + "runtime_engine": o.RuntimeEngine, + "single_user_name": o.SingleUserName, + "spark_conf": o.SparkConf, + "spark_env_vars": o.SparkEnvVars, + "spark_version": o.SparkVersion, + "ssh_public_keys": o.SshPublicKeys, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EditCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_policy_default_values": types.BoolType, + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "autotermination_minutes": types.Int64Type, + "aws_attributes": basetypes.ListType{ + ElemType: AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: AzureAttributes{}.Type(ctx), + }, + "cluster_id": types.StringType, + "cluster_log_conf": basetypes.ListType{ + ElemType: ClusterLogConf{}.Type(ctx), + }, + "cluster_name": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "data_security_mode": types.StringType, + "docker_image": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_elastic_disk": types.BoolType, + "enable_local_disk_encryption": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "node_type_id": types.StringType, + "num_workers": types.Int64Type, + "policy_id": types.StringType, + "runtime_engine": types.StringType, + "single_user_name": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_version": types.StringType, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "workload_type": basetypes.ListType{ + ElemType: WorkloadType{}.Type(ctx), + }, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in EditCluster as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in EditCluster. +func (o *EditCluster) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + +// GetAwsAttributes returns the value of the AwsAttributes field in EditCluster as +// a AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetAwsAttributes(ctx context.Context) (AwsAttributes, bool) { + var e AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in EditCluster. +func (o *EditCluster) SetAwsAttributes(ctx context.Context, v AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in EditCluster as +// a AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetAzureAttributes(ctx context.Context) (AzureAttributes, bool) { + var e AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in EditCluster. +func (o *EditCluster) SetAzureAttributes(ctx context.Context, v AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in EditCluster as +// a ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetClusterLogConf(ctx context.Context) (ClusterLogConf, bool) { + var e ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in EditCluster. +func (o *EditCluster) SetClusterLogConf(ctx context.Context, v ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in EditCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in EditCluster. +func (o *EditCluster) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDockerImage returns the value of the DockerImage field in EditCluster as +// a DockerImage value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetDockerImage(ctx context.Context) (DockerImage, bool) { + var e DockerImage + if o.DockerImage.IsNull() || o.DockerImage.IsUnknown() { + return e, false + } + var v []DockerImage + d := o.DockerImage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDockerImage sets the value of the DockerImage field in EditCluster. +func (o *EditCluster) SetDockerImage(ctx context.Context, v DockerImage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["docker_image"] + o.DockerImage = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in EditCluster as +// a GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetGcpAttributes(ctx context.Context) (GcpAttributes, bool) { + var e GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in EditCluster. +func (o *EditCluster) SetGcpAttributes(ctx context.Context, v GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in EditCluster as +// a slice of InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetInitScripts(ctx context.Context) ([]InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in EditCluster. +func (o *EditCluster) SetInitScripts(ctx context.Context, v []InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in EditCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in EditCluster. +func (o *EditCluster) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in EditCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in EditCluster. +func (o *EditCluster) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in EditCluster as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in EditCluster. +func (o *EditCluster) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + +// GetWorkloadType returns the value of the WorkloadType field in EditCluster as +// a WorkloadType value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditCluster) GetWorkloadType(ctx context.Context) (WorkloadType, bool) { + var e WorkloadType + if o.WorkloadType.IsNull() || o.WorkloadType.IsUnknown() { + return e, false + } + var v []WorkloadType + d := o.WorkloadType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkloadType sets the value of the WorkloadType field in EditCluster. +func (o *EditCluster) SetWorkloadType(ctx context.Context, v WorkloadType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workload_type"] + o.WorkloadType = types.ListValueMust(t, vs) +} + type EditClusterResponse struct { } @@ -1895,13 +7153,40 @@ func (newState *EditClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *EditClusterResponse) SyncEffectiveFieldsDuringRead(existingState EditClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditClusterResponse +// only implements ToObjectValue() and Type(). +func (o EditClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EditClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EditInstancePool struct { // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement // is already met. If not set, the extra pool instances will be @@ -1935,6 +7220,79 @@ func (newState *EditInstancePool) SyncEffectiveFieldsDuringCreateOrUpdate(plan E func (newState *EditInstancePool) SyncEffectiveFieldsDuringRead(existingState EditInstancePool) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditInstancePool. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditInstancePool) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "custom_tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditInstancePool +// only implements ToObjectValue() and Type(). +func (o EditInstancePool) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "custom_tags": o.CustomTags, + "idle_instance_autotermination_minutes": o.IdleInstanceAutoterminationMinutes, + "instance_pool_id": o.InstancePoolId, + "instance_pool_name": o.InstancePoolName, + "max_capacity": o.MaxCapacity, + "min_idle_instances": o.MinIdleInstances, + "node_type_id": o.NodeTypeId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EditInstancePool) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "idle_instance_autotermination_minutes": types.Int64Type, + "instance_pool_id": types.StringType, + "instance_pool_name": types.StringType, + "max_capacity": types.Int64Type, + "min_idle_instances": types.Int64Type, + "node_type_id": types.StringType, + }, + } +} + +// GetCustomTags returns the value of the CustomTags field in EditInstancePool as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditInstancePool) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in EditInstancePool. +func (o *EditInstancePool) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + type EditInstancePoolResponse struct { } @@ -1944,6 +7302,33 @@ func (newState *EditInstancePoolResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *EditInstancePoolResponse) SyncEffectiveFieldsDuringRead(existingState EditInstancePoolResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditInstancePoolResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditInstancePoolResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditInstancePoolResponse +// only implements ToObjectValue() and Type(). +func (o EditInstancePoolResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EditInstancePoolResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EditPolicy struct { // Policy definition document expressed in [Databricks Cluster Policy // Definition Language]. @@ -1954,7 +7339,7 @@ type EditPolicy struct { Description types.String `tfsdk:"description" tf:"optional"` // A list of libraries to be installed on the next cluster restart that uses // this policy. The maximum number of libraries is 500. - Libraries []Library `tfsdk:"libraries" tf:"optional"` + Libraries types.List `tfsdk:"libraries" tf:"optional"` // Max number of clusters per user that can be active using this policy. If // not present, there is no max limit. MaxClustersPerUser types.Int64 `tfsdk:"max_clusters_per_user" tf:"optional"` @@ -1988,6 +7373,81 @@ func (newState *EditPolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditPol func (newState *EditPolicy) SyncEffectiveFieldsDuringRead(existingState EditPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "libraries": reflect.TypeOf(Library{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditPolicy +// only implements ToObjectValue() and Type(). +func (o EditPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "definition": o.Definition, + "description": o.Description, + "libraries": o.Libraries, + "max_clusters_per_user": o.MaxClustersPerUser, + "name": o.Name, + "policy_family_definition_overrides": o.PolicyFamilyDefinitionOverrides, + "policy_family_id": o.PolicyFamilyId, + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EditPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "definition": types.StringType, + "description": types.StringType, + "libraries": basetypes.ListType{ + ElemType: Library{}.Type(ctx), + }, + "max_clusters_per_user": types.Int64Type, + "name": types.StringType, + "policy_family_definition_overrides": types.StringType, + "policy_family_id": types.StringType, + "policy_id": types.StringType, + }, + } +} + +// GetLibraries returns the value of the Libraries field in EditPolicy as +// a slice of Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPolicy) GetLibraries(ctx context.Context) ([]Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in EditPolicy. +func (o *EditPolicy) SetLibraries(ctx context.Context, v []Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + type EditPolicyResponse struct { } @@ -1997,6 +7457,33 @@ func (newState *EditPolicyResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *EditPolicyResponse) SyncEffectiveFieldsDuringRead(existingState EditPolicyResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditPolicyResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditPolicyResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditPolicyResponse +// only implements ToObjectValue() and Type(). +func (o EditPolicyResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EditPolicyResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EditResponse struct { } @@ -2006,6 +7493,33 @@ func (newState *EditResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditR func (newState *EditResponse) SyncEffectiveFieldsDuringRead(existingState EditResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditResponse +// only implements ToObjectValue() and Type(). +func (o EditResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EditResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EnforceClusterComplianceRequest struct { // The ID of the cluster you want to enforce policy compliance on. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -2020,10 +7534,43 @@ func (newState *EnforceClusterComplianceRequest) SyncEffectiveFieldsDuringCreate func (newState *EnforceClusterComplianceRequest) SyncEffectiveFieldsDuringRead(existingState EnforceClusterComplianceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnforceClusterComplianceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnforceClusterComplianceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnforceClusterComplianceRequest +// only implements ToObjectValue() and Type(). +func (o EnforceClusterComplianceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "validate_only": o.ValidateOnly, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnforceClusterComplianceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "validate_only": types.BoolType, + }, + } +} + type EnforceClusterComplianceResponse struct { // A list of changes that have been made to the cluster settings for the // cluster to become compliant with its policy. - Changes []ClusterSettingsChange `tfsdk:"changes" tf:"optional"` + Changes types.List `tfsdk:"changes" tf:"optional"` // Whether any changes have been made to the cluster settings for the // cluster to become compliant with its policy. HasChanges types.Bool `tfsdk:"has_changes" tf:"optional"` @@ -2035,6 +7582,69 @@ func (newState *EnforceClusterComplianceResponse) SyncEffectiveFieldsDuringCreat func (newState *EnforceClusterComplianceResponse) SyncEffectiveFieldsDuringRead(existingState EnforceClusterComplianceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnforceClusterComplianceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnforceClusterComplianceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "changes": reflect.TypeOf(ClusterSettingsChange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnforceClusterComplianceResponse +// only implements ToObjectValue() and Type(). +func (o EnforceClusterComplianceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "changes": o.Changes, + "has_changes": o.HasChanges, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnforceClusterComplianceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "changes": basetypes.ListType{ + ElemType: ClusterSettingsChange{}.Type(ctx), + }, + "has_changes": types.BoolType, + }, + } +} + +// GetChanges returns the value of the Changes field in EnforceClusterComplianceResponse as +// a slice of ClusterSettingsChange values. +// If the field is unknown or null, the boolean return value is false. +func (o *EnforceClusterComplianceResponse) GetChanges(ctx context.Context) ([]ClusterSettingsChange, bool) { + if o.Changes.IsNull() || o.Changes.IsUnknown() { + return nil, false + } + var v []ClusterSettingsChange + d := o.Changes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChanges sets the value of the Changes field in EnforceClusterComplianceResponse. +func (o *EnforceClusterComplianceResponse) SetChanges(ctx context.Context, v []ClusterSettingsChange) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["changes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Changes = types.ListValueMust(t, vs) +} + // The environment entity used to preserve serverless environment side panel and // jobs' environment for non-notebook task. In this minimal environment spec, // only pip dependencies are supported. @@ -2050,7 +7660,7 @@ type Environment struct { // dependency could be , , (WSFS or Volumes in Databricks), E.g. // dependencies: ["foo==0.0.1", "-r /Workspace/test/requirements.txt"] - Dependencies []types.String `tfsdk:"dependencies" tf:"optional"` + Dependencies types.List `tfsdk:"dependencies" tf:"optional"` } func (newState *Environment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Environment) { @@ -2059,14 +7669,77 @@ func (newState *Environment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Enviro func (newState *Environment) SyncEffectiveFieldsDuringRead(existingState Environment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Environment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Environment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dependencies": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Environment +// only implements ToObjectValue() and Type(). +func (o Environment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "client": o.Client, + "dependencies": o.Dependencies, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Environment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "client": types.StringType, + "dependencies": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDependencies returns the value of the Dependencies field in Environment as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Environment) GetDependencies(ctx context.Context) ([]types.String, bool) { + if o.Dependencies.IsNull() || o.Dependencies.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Dependencies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDependencies sets the value of the Dependencies field in Environment. +func (o *Environment) SetDependencies(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dependencies"] + t = t.(attr.TypeWithElementType).ElementType() + o.Dependencies = types.ListValueMust(t, vs) +} + type EventDetails struct { // * For created clusters, the attributes of the cluster. * For edited // clusters, the new attributes of the cluster. - Attributes []ClusterAttributes `tfsdk:"attributes" tf:"optional,object"` + Attributes types.List `tfsdk:"attributes" tf:"optional,object"` // The cause of a change in target size. Cause types.String `tfsdk:"cause" tf:"optional"` // The actual cluster size that was set in the cluster creation or edit. - ClusterSize []ClusterSize `tfsdk:"cluster_size" tf:"optional,object"` + ClusterSize types.List `tfsdk:"cluster_size" tf:"optional,object"` // The current number of vCPUs in the cluster. CurrentNumVcpus types.Int64 `tfsdk:"current_num_vcpus" tf:"optional"` // The current number of nodes in the cluster. @@ -2084,7 +7757,7 @@ type EventDetails struct { FreeSpace types.Int64 `tfsdk:"free_space" tf:"optional"` // List of global and cluster init scripts associated with this cluster // event. - InitScripts []InitScriptEventDetails `tfsdk:"init_scripts" tf:"optional,object"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional,object"` // Instance Id where the event originated from InstanceId types.String `tfsdk:"instance_id" tf:"optional"` // Unique identifier of the specific job run associated with this cluster @@ -2092,15 +7765,15 @@ type EventDetails struct { // cluster name JobRunName types.String `tfsdk:"job_run_name" tf:"optional"` // The cluster attributes before a cluster was edited. - PreviousAttributes []ClusterAttributes `tfsdk:"previous_attributes" tf:"optional,object"` + PreviousAttributes types.List `tfsdk:"previous_attributes" tf:"optional,object"` // The size of the cluster before an edit or resize. - PreviousClusterSize []ClusterSize `tfsdk:"previous_cluster_size" tf:"optional,object"` + PreviousClusterSize types.List `tfsdk:"previous_cluster_size" tf:"optional,object"` // Previous disk size in bytes PreviousDiskSize types.Int64 `tfsdk:"previous_disk_size" tf:"optional"` // A termination reason: * On a TERMINATED event, this is the reason of the // termination. * On a RESIZE_COMPLETE event, this indicates the reason that // we failed to acquire some nodes. - Reason []TerminationReason `tfsdk:"reason" tf:"optional,object"` + Reason types.List `tfsdk:"reason" tf:"optional,object"` // The targeted number of vCPUs in the cluster. TargetNumVcpus types.Int64 `tfsdk:"target_num_vcpus" tf:"optional"` // The targeted number of nodes in the cluster. @@ -2116,6 +7789,250 @@ func (newState *EventDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan Event func (newState *EventDetails) SyncEffectiveFieldsDuringRead(existingState EventDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EventDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EventDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "attributes": reflect.TypeOf(ClusterAttributes{}), + "cluster_size": reflect.TypeOf(ClusterSize{}), + "init_scripts": reflect.TypeOf(InitScriptEventDetails{}), + "previous_attributes": reflect.TypeOf(ClusterAttributes{}), + "previous_cluster_size": reflect.TypeOf(ClusterSize{}), + "reason": reflect.TypeOf(TerminationReason{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EventDetails +// only implements ToObjectValue() and Type(). +func (o EventDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "cause": o.Cause, + "cluster_size": o.ClusterSize, + "current_num_vcpus": o.CurrentNumVcpus, + "current_num_workers": o.CurrentNumWorkers, + "did_not_expand_reason": o.DidNotExpandReason, + "disk_size": o.DiskSize, + "driver_state_message": o.DriverStateMessage, + "enable_termination_for_node_blocklisted": o.EnableTerminationForNodeBlocklisted, + "free_space": o.FreeSpace, + "init_scripts": o.InitScripts, + "instance_id": o.InstanceId, + "job_run_name": o.JobRunName, + "previous_attributes": o.PreviousAttributes, + "previous_cluster_size": o.PreviousClusterSize, + "previous_disk_size": o.PreviousDiskSize, + "reason": o.Reason, + "target_num_vcpus": o.TargetNumVcpus, + "target_num_workers": o.TargetNumWorkers, + "user": o.User, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EventDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": basetypes.ListType{ + ElemType: ClusterAttributes{}.Type(ctx), + }, + "cause": types.StringType, + "cluster_size": basetypes.ListType{ + ElemType: ClusterSize{}.Type(ctx), + }, + "current_num_vcpus": types.Int64Type, + "current_num_workers": types.Int64Type, + "did_not_expand_reason": types.StringType, + "disk_size": types.Int64Type, + "driver_state_message": types.StringType, + "enable_termination_for_node_blocklisted": types.BoolType, + "free_space": types.Int64Type, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptEventDetails{}.Type(ctx), + }, + "instance_id": types.StringType, + "job_run_name": types.StringType, + "previous_attributes": basetypes.ListType{ + ElemType: ClusterAttributes{}.Type(ctx), + }, + "previous_cluster_size": basetypes.ListType{ + ElemType: ClusterSize{}.Type(ctx), + }, + "previous_disk_size": types.Int64Type, + "reason": basetypes.ListType{ + ElemType: TerminationReason{}.Type(ctx), + }, + "target_num_vcpus": types.Int64Type, + "target_num_workers": types.Int64Type, + "user": types.StringType, + }, + } +} + +// GetAttributes returns the value of the Attributes field in EventDetails as +// a ClusterAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *EventDetails) GetAttributes(ctx context.Context) (ClusterAttributes, bool) { + var e ClusterAttributes + if o.Attributes.IsNull() || o.Attributes.IsUnknown() { + return e, false + } + var v []ClusterAttributes + d := o.Attributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAttributes sets the value of the Attributes field in EventDetails. +func (o *EventDetails) SetAttributes(ctx context.Context, v ClusterAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["attributes"] + o.Attributes = types.ListValueMust(t, vs) +} + +// GetClusterSize returns the value of the ClusterSize field in EventDetails as +// a ClusterSize value. +// If the field is unknown or null, the boolean return value is false. +func (o *EventDetails) GetClusterSize(ctx context.Context) (ClusterSize, bool) { + var e ClusterSize + if o.ClusterSize.IsNull() || o.ClusterSize.IsUnknown() { + return e, false + } + var v []ClusterSize + d := o.ClusterSize.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterSize sets the value of the ClusterSize field in EventDetails. +func (o *EventDetails) SetClusterSize(ctx context.Context, v ClusterSize) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_size"] + o.ClusterSize = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in EventDetails as +// a InitScriptEventDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *EventDetails) GetInitScripts(ctx context.Context) (InitScriptEventDetails, bool) { + var e InitScriptEventDetails + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return e, false + } + var v []InitScriptEventDetails + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInitScripts sets the value of the InitScripts field in EventDetails. +func (o *EventDetails) SetInitScripts(ctx context.Context, v InitScriptEventDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetPreviousAttributes returns the value of the PreviousAttributes field in EventDetails as +// a ClusterAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *EventDetails) GetPreviousAttributes(ctx context.Context) (ClusterAttributes, bool) { + var e ClusterAttributes + if o.PreviousAttributes.IsNull() || o.PreviousAttributes.IsUnknown() { + return e, false + } + var v []ClusterAttributes + d := o.PreviousAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPreviousAttributes sets the value of the PreviousAttributes field in EventDetails. +func (o *EventDetails) SetPreviousAttributes(ctx context.Context, v ClusterAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["previous_attributes"] + o.PreviousAttributes = types.ListValueMust(t, vs) +} + +// GetPreviousClusterSize returns the value of the PreviousClusterSize field in EventDetails as +// a ClusterSize value. +// If the field is unknown or null, the boolean return value is false. +func (o *EventDetails) GetPreviousClusterSize(ctx context.Context) (ClusterSize, bool) { + var e ClusterSize + if o.PreviousClusterSize.IsNull() || o.PreviousClusterSize.IsUnknown() { + return e, false + } + var v []ClusterSize + d := o.PreviousClusterSize.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPreviousClusterSize sets the value of the PreviousClusterSize field in EventDetails. +func (o *EventDetails) SetPreviousClusterSize(ctx context.Context, v ClusterSize) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["previous_cluster_size"] + o.PreviousClusterSize = types.ListValueMust(t, vs) +} + +// GetReason returns the value of the Reason field in EventDetails as +// a TerminationReason value. +// If the field is unknown or null, the boolean return value is false. +func (o *EventDetails) GetReason(ctx context.Context) (TerminationReason, bool) { + var e TerminationReason + if o.Reason.IsNull() || o.Reason.IsUnknown() { + return e, false + } + var v []TerminationReason + d := o.Reason.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetReason sets the value of the Reason field in EventDetails. +func (o *EventDetails) SetReason(ctx context.Context, v TerminationReason) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["reason"] + o.Reason = types.ListValueMust(t, vs) +} + type GcpAttributes struct { // This field determines whether the instance pool will contain preemptible // VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs @@ -2156,6 +8073,47 @@ func (newState *GcpAttributes) SyncEffectiveFieldsDuringCreateOrUpdate(plan GcpA func (newState *GcpAttributes) SyncEffectiveFieldsDuringRead(existingState GcpAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcpAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcpAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcpAttributes +// only implements ToObjectValue() and Type(). +func (o GcpAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "availability": o.Availability, + "boot_disk_size": o.BootDiskSize, + "google_service_account": o.GoogleServiceAccount, + "local_ssd_count": o.LocalSsdCount, + "use_preemptible_executors": o.UsePreemptibleExecutors, + "zone_id": o.ZoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcpAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "availability": types.StringType, + "boot_disk_size": types.Int64Type, + "google_service_account": types.StringType, + "local_ssd_count": types.Int64Type, + "use_preemptible_executors": types.BoolType, + "zone_id": types.StringType, + }, + } +} + type GcsStorageInfo struct { // GCS destination/URI, e.g. `gs://my-bucket/some-prefix` Destination types.String `tfsdk:"destination" tf:""` @@ -2167,6 +8125,37 @@ func (newState *GcsStorageInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Gcs func (newState *GcsStorageInfo) SyncEffectiveFieldsDuringRead(existingState GcsStorageInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcsStorageInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcsStorageInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcsStorageInfo +// only implements ToObjectValue() and Type(). +func (o GcsStorageInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcsStorageInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + }, + } +} + // Get cluster policy compliance type GetClusterComplianceRequest struct { // The ID of the cluster to get the compliance status @@ -2179,6 +8168,37 @@ func (newState *GetClusterComplianceRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetClusterComplianceRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterComplianceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterComplianceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterComplianceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterComplianceRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterComplianceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterComplianceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type GetClusterComplianceResponse struct { // Whether the cluster is compliant with its policy or not. Clusters could // be out of compliance if the policy was updated after the cluster was last @@ -2188,7 +8208,7 @@ type GetClusterComplianceResponse struct { // validation errors. The keys indicate the path where the policy validation // error is occurring. The values indicate an error message describing the // policy validation error. - Violations map[string]types.String `tfsdk:"violations" tf:"optional"` + Violations types.Map `tfsdk:"violations" tf:"optional"` } func (newState *GetClusterComplianceResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetClusterComplianceResponse) { @@ -2197,6 +8217,69 @@ func (newState *GetClusterComplianceResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *GetClusterComplianceResponse) SyncEffectiveFieldsDuringRead(existingState GetClusterComplianceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterComplianceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterComplianceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "violations": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterComplianceResponse +// only implements ToObjectValue() and Type(). +func (o GetClusterComplianceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_compliant": o.IsCompliant, + "violations": o.Violations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterComplianceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_compliant": types.BoolType, + "violations": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetViolations returns the value of the Violations field in GetClusterComplianceResponse as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetClusterComplianceResponse) GetViolations(ctx context.Context) (map[string]types.String, bool) { + if o.Violations.IsNull() || o.Violations.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Violations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetViolations sets the value of the Violations field in GetClusterComplianceResponse. +func (o *GetClusterComplianceResponse) SetViolations(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["violations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Violations = types.MapValueMust(t, vs) +} + // Get cluster permission levels type GetClusterPermissionLevelsRequest struct { // The cluster for which to get or manage permissions. @@ -2209,9 +8292,40 @@ func (newState *GetClusterPermissionLevelsRequest) SyncEffectiveFieldsDuringCrea func (newState *GetClusterPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type GetClusterPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []ClusterPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetClusterPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetClusterPermissionLevelsResponse) { @@ -2220,6 +8334,67 @@ func (newState *GetClusterPermissionLevelsResponse) SyncEffectiveFieldsDuringCre func (newState *GetClusterPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetClusterPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(ClusterPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetClusterPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: ClusterPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetClusterPermissionLevelsResponse as +// a slice of ClusterPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetClusterPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]ClusterPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []ClusterPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetClusterPermissionLevelsResponse. +func (o *GetClusterPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []ClusterPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get cluster permissions type GetClusterPermissionsRequest struct { // The cluster for which to get or manage permissions. @@ -2232,6 +8407,37 @@ func (newState *GetClusterPermissionsRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *GetClusterPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + // Get cluster policy permission levels type GetClusterPolicyPermissionLevelsRequest struct { // The cluster policy for which to get or manage permissions. @@ -2244,9 +8450,40 @@ func (newState *GetClusterPolicyPermissionLevelsRequest) SyncEffectiveFieldsDuri func (newState *GetClusterPolicyPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterPolicyPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPolicyPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPolicyPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPolicyPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterPolicyPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_policy_id": o.ClusterPolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPolicyPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_policy_id": types.StringType, + }, + } +} + type GetClusterPolicyPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []ClusterPolicyPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetClusterPolicyPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetClusterPolicyPermissionLevelsResponse) { @@ -2255,6 +8492,67 @@ func (newState *GetClusterPolicyPermissionLevelsResponse) SyncEffectiveFieldsDur func (newState *GetClusterPolicyPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetClusterPolicyPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPolicyPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPolicyPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(ClusterPolicyPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPolicyPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetClusterPolicyPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPolicyPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: ClusterPolicyPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetClusterPolicyPermissionLevelsResponse as +// a slice of ClusterPolicyPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetClusterPolicyPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]ClusterPolicyPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []ClusterPolicyPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetClusterPolicyPermissionLevelsResponse. +func (o *GetClusterPolicyPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []ClusterPolicyPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get cluster policy permissions type GetClusterPolicyPermissionsRequest struct { // The cluster policy for which to get or manage permissions. @@ -2267,6 +8565,37 @@ func (newState *GetClusterPolicyPermissionsRequest) SyncEffectiveFieldsDuringCre func (newState *GetClusterPolicyPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterPolicyPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPolicyPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPolicyPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPolicyPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterPolicyPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_policy_id": o.ClusterPolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPolicyPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_policy_id": types.StringType, + }, + } +} + // Get a cluster policy type GetClusterPolicyRequest struct { // Canonical unique identifier for the Cluster Policy. @@ -2279,6 +8608,37 @@ func (newState *GetClusterPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GetClusterPolicyRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterPolicyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterPolicyRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + }, + } +} + // Get cluster info type GetClusterRequest struct { // The cluster about which to retrieve information. @@ -2291,6 +8651,37 @@ func (newState *GetClusterRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetClusterRequest) SyncEffectiveFieldsDuringRead(existingState GetClusterRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetClusterRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetClusterRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetClusterRequest +// only implements ToObjectValue() and Type(). +func (o GetClusterRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetClusterRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type GetEvents struct { // The ID of the cluster to retrieve events about. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -2299,7 +8690,7 @@ type GetEvents struct { EndTime types.Int64 `tfsdk:"end_time" tf:"optional"` // An optional set of event types to filter on. If empty, all event types // are returned. - EventTypes []types.String `tfsdk:"event_types" tf:"optional"` + EventTypes types.List `tfsdk:"event_types" tf:"optional"` // The maximum number of events to include in a page of events. Defaults to // 50, and maximum allowed value is 500. Limit types.Int64 `tfsdk:"limit" tf:"optional"` @@ -2320,12 +8711,85 @@ func (newState *GetEvents) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetEvent func (newState *GetEvents) SyncEffectiveFieldsDuringRead(existingState GetEvents) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEvents. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEvents) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "event_types": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEvents +// only implements ToObjectValue() and Type(). +func (o GetEvents) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "end_time": o.EndTime, + "event_types": o.EventTypes, + "limit": o.Limit, + "offset": o.Offset, + "order": o.Order, + "start_time": o.StartTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEvents) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "end_time": types.Int64Type, + "event_types": basetypes.ListType{ + ElemType: types.StringType, + }, + "limit": types.Int64Type, + "offset": types.Int64Type, + "order": types.StringType, + "start_time": types.Int64Type, + }, + } +} + +// GetEventTypes returns the value of the EventTypes field in GetEvents as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetEvents) GetEventTypes(ctx context.Context) ([]types.String, bool) { + if o.EventTypes.IsNull() || o.EventTypes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.EventTypes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEventTypes sets the value of the EventTypes field in GetEvents. +func (o *GetEvents) SetEventTypes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["event_types"] + t = t.(attr.TypeWithElementType).ElementType() + o.EventTypes = types.ListValueMust(t, vs) +} + type GetEventsResponse struct { // - Events []ClusterEvent `tfsdk:"events" tf:"optional"` + Events types.List `tfsdk:"events" tf:"optional"` // The parameters required to retrieve the next page of events. Omitted if // there are no more events to read. - NextPage []GetEvents `tfsdk:"next_page" tf:"optional,object"` + NextPage types.List `tfsdk:"next_page" tf:"optional,object"` // The total number of events filtered by the start_time, end_time, and // event_types. TotalCount types.Int64 `tfsdk:"total_count" tf:"optional"` @@ -2337,6 +8801,100 @@ func (newState *GetEventsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetEventsResponse) SyncEffectiveFieldsDuringRead(existingState GetEventsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEventsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEventsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "events": reflect.TypeOf(ClusterEvent{}), + "next_page": reflect.TypeOf(GetEvents{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEventsResponse +// only implements ToObjectValue() and Type(). +func (o GetEventsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "events": o.Events, + "next_page": o.NextPage, + "total_count": o.TotalCount, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEventsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "events": basetypes.ListType{ + ElemType: ClusterEvent{}.Type(ctx), + }, + "next_page": basetypes.ListType{ + ElemType: GetEvents{}.Type(ctx), + }, + "total_count": types.Int64Type, + }, + } +} + +// GetEvents returns the value of the Events field in GetEventsResponse as +// a slice of ClusterEvent values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetEventsResponse) GetEvents(ctx context.Context) ([]ClusterEvent, bool) { + if o.Events.IsNull() || o.Events.IsUnknown() { + return nil, false + } + var v []ClusterEvent + d := o.Events.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEvents sets the value of the Events field in GetEventsResponse. +func (o *GetEventsResponse) SetEvents(ctx context.Context, v []ClusterEvent) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["events"] + t = t.(attr.TypeWithElementType).ElementType() + o.Events = types.ListValueMust(t, vs) +} + +// GetNextPage returns the value of the NextPage field in GetEventsResponse as +// a GetEvents value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetEventsResponse) GetNextPage(ctx context.Context) (GetEvents, bool) { + var e GetEvents + if o.NextPage.IsNull() || o.NextPage.IsUnknown() { + return e, false + } + var v []GetEvents + d := o.NextPage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNextPage sets the value of the NextPage field in GetEventsResponse. +func (o *GetEventsResponse) SetNextPage(ctx context.Context, v GetEvents) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["next_page"] + o.NextPage = types.ListValueMust(t, vs) +} + // Get an init script type GetGlobalInitScriptRequest struct { // The ID of the global init script. @@ -2349,19 +8907,50 @@ func (newState *GetGlobalInitScriptRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetGlobalInitScriptRequest) SyncEffectiveFieldsDuringRead(existingState GetGlobalInitScriptRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetGlobalInitScriptRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetGlobalInitScriptRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetGlobalInitScriptRequest +// only implements ToObjectValue() and Type(). +func (o GetGlobalInitScriptRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "script_id": o.ScriptId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetGlobalInitScriptRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "script_id": types.StringType, + }, + } +} + type GetInstancePool struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. - AwsAttributes []InstancePoolAwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to instance pools running on Azure. If not specified // at pool creation, a set of default values will be used. - AzureAttributes []InstancePoolAzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Tags that are added by Databricks regardless of any `custom_tags`, // including: // @@ -2372,10 +8961,10 @@ type GetInstancePool struct { // - InstancePoolName: // // - InstancePoolId: - DefaultTags map[string]types.String `tfsdk:"default_tags" tf:"optional"` + DefaultTags types.Map `tfsdk:"default_tags" tf:"optional"` // Defines the specification of the disks that will be attached to all spark // containers. - DiskSpec []DiskSpec `tfsdk:"disk_spec" tf:"optional,object"` + DiskSpec types.List `tfsdk:"disk_spec" tf:"optional,object"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -2384,7 +8973,7 @@ type GetInstancePool struct { EnableElasticDisk types.Bool `tfsdk:"enable_elastic_disk" tf:"optional"` // Attributes related to instance pools running on Google Cloud Platform. If // not specified at pool creation, a set of default values will be used. - GcpAttributes []InstancePoolGcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement // is already met. If not set, the extra pool instances will be @@ -2411,18 +9000,18 @@ type GetInstancePool struct { // :method:clusters/listNodeTypes API call. NodeTypeId types.String `tfsdk:"node_type_id" tf:"optional"` // Custom Docker Image BYOC - PreloadedDockerImages []DockerImage `tfsdk:"preloaded_docker_images" tf:"optional"` + PreloadedDockerImages types.List `tfsdk:"preloaded_docker_images" tf:"optional"` // A list containing at most one preloaded Spark image version for the pool. // Pool-backed clusters started with the preloaded Spark version will start // faster. A list of available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - PreloadedSparkVersions []types.String `tfsdk:"preloaded_spark_versions" tf:"optional"` + PreloadedSparkVersions types.List `tfsdk:"preloaded_spark_versions" tf:"optional"` // Current state of the instance pool. State types.String `tfsdk:"state" tf:"optional"` // Usage statistics about the instance pool. - Stats []InstancePoolStats `tfsdk:"stats" tf:"optional,object"` + Stats types.List `tfsdk:"stats" tf:"optional,object"` // Status of failed pending instances in the pool. - Status []InstancePoolStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` } func (newState *GetInstancePool) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetInstancePool) { @@ -2431,6 +9020,362 @@ func (newState *GetInstancePool) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetInstancePool) SyncEffectiveFieldsDuringRead(existingState GetInstancePool) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetInstancePool. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetInstancePool) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_attributes": reflect.TypeOf(InstancePoolAwsAttributes{}), + "azure_attributes": reflect.TypeOf(InstancePoolAzureAttributes{}), + "custom_tags": reflect.TypeOf(types.String{}), + "default_tags": reflect.TypeOf(types.String{}), + "disk_spec": reflect.TypeOf(DiskSpec{}), + "gcp_attributes": reflect.TypeOf(InstancePoolGcpAttributes{}), + "preloaded_docker_images": reflect.TypeOf(DockerImage{}), + "preloaded_spark_versions": reflect.TypeOf(types.String{}), + "stats": reflect.TypeOf(InstancePoolStats{}), + "status": reflect.TypeOf(InstancePoolStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetInstancePool +// only implements ToObjectValue() and Type(). +func (o GetInstancePool) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "custom_tags": o.CustomTags, + "default_tags": o.DefaultTags, + "disk_spec": o.DiskSpec, + "enable_elastic_disk": o.EnableElasticDisk, + "gcp_attributes": o.GcpAttributes, + "idle_instance_autotermination_minutes": o.IdleInstanceAutoterminationMinutes, + "instance_pool_id": o.InstancePoolId, + "instance_pool_name": o.InstancePoolName, + "max_capacity": o.MaxCapacity, + "min_idle_instances": o.MinIdleInstances, + "node_type_id": o.NodeTypeId, + "preloaded_docker_images": o.PreloadedDockerImages, + "preloaded_spark_versions": o.PreloadedSparkVersions, + "state": o.State, + "stats": o.Stats, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetInstancePool) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_attributes": basetypes.ListType{ + ElemType: InstancePoolAwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: InstancePoolAzureAttributes{}.Type(ctx), + }, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "default_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "disk_spec": basetypes.ListType{ + ElemType: DiskSpec{}.Type(ctx), + }, + "enable_elastic_disk": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: InstancePoolGcpAttributes{}.Type(ctx), + }, + "idle_instance_autotermination_minutes": types.Int64Type, + "instance_pool_id": types.StringType, + "instance_pool_name": types.StringType, + "max_capacity": types.Int64Type, + "min_idle_instances": types.Int64Type, + "node_type_id": types.StringType, + "preloaded_docker_images": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "preloaded_spark_versions": basetypes.ListType{ + ElemType: types.StringType, + }, + "state": types.StringType, + "stats": basetypes.ListType{ + ElemType: InstancePoolStats{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: InstancePoolStatus{}.Type(ctx), + }, + }, + } +} + +// GetAwsAttributes returns the value of the AwsAttributes field in GetInstancePool as +// a InstancePoolAwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetAwsAttributes(ctx context.Context) (InstancePoolAwsAttributes, bool) { + var e InstancePoolAwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolAwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in GetInstancePool. +func (o *GetInstancePool) SetAwsAttributes(ctx context.Context, v InstancePoolAwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in GetInstancePool as +// a InstancePoolAzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetAzureAttributes(ctx context.Context) (InstancePoolAzureAttributes, bool) { + var e InstancePoolAzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolAzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in GetInstancePool. +func (o *GetInstancePool) SetAzureAttributes(ctx context.Context, v InstancePoolAzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in GetInstancePool as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in GetInstancePool. +func (o *GetInstancePool) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDefaultTags returns the value of the DefaultTags field in GetInstancePool as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetDefaultTags(ctx context.Context) (map[string]types.String, bool) { + if o.DefaultTags.IsNull() || o.DefaultTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.DefaultTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDefaultTags sets the value of the DefaultTags field in GetInstancePool. +func (o *GetInstancePool) SetDefaultTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["default_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.DefaultTags = types.MapValueMust(t, vs) +} + +// GetDiskSpec returns the value of the DiskSpec field in GetInstancePool as +// a DiskSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetDiskSpec(ctx context.Context) (DiskSpec, bool) { + var e DiskSpec + if o.DiskSpec.IsNull() || o.DiskSpec.IsUnknown() { + return e, false + } + var v []DiskSpec + d := o.DiskSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDiskSpec sets the value of the DiskSpec field in GetInstancePool. +func (o *GetInstancePool) SetDiskSpec(ctx context.Context, v DiskSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disk_spec"] + o.DiskSpec = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in GetInstancePool as +// a InstancePoolGcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetGcpAttributes(ctx context.Context) (InstancePoolGcpAttributes, bool) { + var e InstancePoolGcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolGcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in GetInstancePool. +func (o *GetInstancePool) SetGcpAttributes(ctx context.Context, v InstancePoolGcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetPreloadedDockerImages returns the value of the PreloadedDockerImages field in GetInstancePool as +// a slice of DockerImage values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetPreloadedDockerImages(ctx context.Context) ([]DockerImage, bool) { + if o.PreloadedDockerImages.IsNull() || o.PreloadedDockerImages.IsUnknown() { + return nil, false + } + var v []DockerImage + d := o.PreloadedDockerImages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPreloadedDockerImages sets the value of the PreloadedDockerImages field in GetInstancePool. +func (o *GetInstancePool) SetPreloadedDockerImages(ctx context.Context, v []DockerImage) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["preloaded_docker_images"] + t = t.(attr.TypeWithElementType).ElementType() + o.PreloadedDockerImages = types.ListValueMust(t, vs) +} + +// GetPreloadedSparkVersions returns the value of the PreloadedSparkVersions field in GetInstancePool as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetPreloadedSparkVersions(ctx context.Context) ([]types.String, bool) { + if o.PreloadedSparkVersions.IsNull() || o.PreloadedSparkVersions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PreloadedSparkVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPreloadedSparkVersions sets the value of the PreloadedSparkVersions field in GetInstancePool. +func (o *GetInstancePool) SetPreloadedSparkVersions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["preloaded_spark_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.PreloadedSparkVersions = types.ListValueMust(t, vs) +} + +// GetStats returns the value of the Stats field in GetInstancePool as +// a InstancePoolStats value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetStats(ctx context.Context) (InstancePoolStats, bool) { + var e InstancePoolStats + if o.Stats.IsNull() || o.Stats.IsUnknown() { + return e, false + } + var v []InstancePoolStats + d := o.Stats.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStats sets the value of the Stats field in GetInstancePool. +func (o *GetInstancePool) SetStats(ctx context.Context, v InstancePoolStats) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["stats"] + o.Stats = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in GetInstancePool as +// a InstancePoolStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePool) GetStatus(ctx context.Context) (InstancePoolStatus, bool) { + var e InstancePoolStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []InstancePoolStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in GetInstancePool. +func (o *GetInstancePool) SetStatus(ctx context.Context, v InstancePoolStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + // Get instance pool permission levels type GetInstancePoolPermissionLevelsRequest struct { // The instance pool for which to get or manage permissions. @@ -2443,9 +9388,40 @@ func (newState *GetInstancePoolPermissionLevelsRequest) SyncEffectiveFieldsDurin func (newState *GetInstancePoolPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetInstancePoolPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetInstancePoolPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetInstancePoolPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetInstancePoolPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetInstancePoolPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_pool_id": o.InstancePoolId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetInstancePoolPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_pool_id": types.StringType, + }, + } +} + type GetInstancePoolPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []InstancePoolPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetInstancePoolPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetInstancePoolPermissionLevelsResponse) { @@ -2454,6 +9430,67 @@ func (newState *GetInstancePoolPermissionLevelsResponse) SyncEffectiveFieldsDuri func (newState *GetInstancePoolPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetInstancePoolPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetInstancePoolPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetInstancePoolPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(InstancePoolPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetInstancePoolPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetInstancePoolPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetInstancePoolPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: InstancePoolPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetInstancePoolPermissionLevelsResponse as +// a slice of InstancePoolPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetInstancePoolPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]InstancePoolPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []InstancePoolPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetInstancePoolPermissionLevelsResponse. +func (o *GetInstancePoolPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []InstancePoolPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get instance pool permissions type GetInstancePoolPermissionsRequest struct { // The instance pool for which to get or manage permissions. @@ -2466,6 +9503,37 @@ func (newState *GetInstancePoolPermissionsRequest) SyncEffectiveFieldsDuringCrea func (newState *GetInstancePoolPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetInstancePoolPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetInstancePoolPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetInstancePoolPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetInstancePoolPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetInstancePoolPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_pool_id": o.InstancePoolId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetInstancePoolPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_pool_id": types.StringType, + }, + } +} + // Get instance pool information type GetInstancePoolRequest struct { // The canonical unique identifier for the instance pool. @@ -2478,6 +9546,37 @@ func (newState *GetInstancePoolRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetInstancePoolRequest) SyncEffectiveFieldsDuringRead(existingState GetInstancePoolRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetInstancePoolRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetInstancePoolRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetInstancePoolRequest +// only implements ToObjectValue() and Type(). +func (o GetInstancePoolRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_pool_id": o.InstancePoolId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetInstancePoolRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_pool_id": types.StringType, + }, + } +} + // Get policy family information type GetPolicyFamilyRequest struct { // The family ID about which to retrieve information. @@ -2493,9 +9592,42 @@ func (newState *GetPolicyFamilyRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetPolicyFamilyRequest) SyncEffectiveFieldsDuringRead(existingState GetPolicyFamilyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPolicyFamilyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPolicyFamilyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPolicyFamilyRequest +// only implements ToObjectValue() and Type(). +func (o GetPolicyFamilyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_family_id": o.PolicyFamilyId, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPolicyFamilyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_family_id": types.StringType, + "version": types.Int64Type, + }, + } +} + type GetSparkVersionsResponse struct { // All the available Spark versions. - Versions []SparkVersion `tfsdk:"versions" tf:"optional"` + Versions types.List `tfsdk:"versions" tf:"optional"` } func (newState *GetSparkVersionsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetSparkVersionsResponse) { @@ -2504,6 +9636,67 @@ func (newState *GetSparkVersionsResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetSparkVersionsResponse) SyncEffectiveFieldsDuringRead(existingState GetSparkVersionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetSparkVersionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetSparkVersionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "versions": reflect.TypeOf(SparkVersion{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetSparkVersionsResponse +// only implements ToObjectValue() and Type(). +func (o GetSparkVersionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "versions": o.Versions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetSparkVersionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "versions": basetypes.ListType{ + ElemType: SparkVersion{}.Type(ctx), + }, + }, + } +} + +// GetVersions returns the value of the Versions field in GetSparkVersionsResponse as +// a slice of SparkVersion values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetSparkVersionsResponse) GetVersions(ctx context.Context) ([]SparkVersion, bool) { + if o.Versions.IsNull() || o.Versions.IsUnknown() { + return nil, false + } + var v []SparkVersion + d := o.Versions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetVersions sets the value of the Versions field in GetSparkVersionsResponse. +func (o *GetSparkVersionsResponse) SetVersions(ctx context.Context, v []SparkVersion) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Versions = types.ListValueMust(t, vs) +} + type GlobalInitScriptCreateRequest struct { // Specifies whether the script is enabled. The script runs only if enabled. Enabled types.Bool `tfsdk:"enabled" tf:"optional"` @@ -2531,6 +9724,43 @@ func (newState *GlobalInitScriptCreateRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GlobalInitScriptCreateRequest) SyncEffectiveFieldsDuringRead(existingState GlobalInitScriptCreateRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GlobalInitScriptCreateRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GlobalInitScriptCreateRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GlobalInitScriptCreateRequest +// only implements ToObjectValue() and Type(). +func (o GlobalInitScriptCreateRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + "name": o.Name, + "position": o.Position, + "script": o.Script, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GlobalInitScriptCreateRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + "name": types.StringType, + "position": types.Int64Type, + "script": types.StringType, + }, + } +} + type GlobalInitScriptDetails struct { // Time when the script was created, represented as a Unix timestamp in // milliseconds. @@ -2559,6 +9789,51 @@ func (newState *GlobalInitScriptDetails) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GlobalInitScriptDetails) SyncEffectiveFieldsDuringRead(existingState GlobalInitScriptDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GlobalInitScriptDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GlobalInitScriptDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GlobalInitScriptDetails +// only implements ToObjectValue() and Type(). +func (o GlobalInitScriptDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "enabled": o.Enabled, + "name": o.Name, + "position": o.Position, + "script_id": o.ScriptId, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GlobalInitScriptDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.Int64Type, + "created_by": types.StringType, + "enabled": types.BoolType, + "name": types.StringType, + "position": types.Int64Type, + "script_id": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + type GlobalInitScriptDetailsWithContent struct { // Time when the script was created, represented as a Unix timestamp in // milliseconds. @@ -2589,6 +9864,53 @@ func (newState *GlobalInitScriptDetailsWithContent) SyncEffectiveFieldsDuringCre func (newState *GlobalInitScriptDetailsWithContent) SyncEffectiveFieldsDuringRead(existingState GlobalInitScriptDetailsWithContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GlobalInitScriptDetailsWithContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GlobalInitScriptDetailsWithContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GlobalInitScriptDetailsWithContent +// only implements ToObjectValue() and Type(). +func (o GlobalInitScriptDetailsWithContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "enabled": o.Enabled, + "name": o.Name, + "position": o.Position, + "script": o.Script, + "script_id": o.ScriptId, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GlobalInitScriptDetailsWithContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.Int64Type, + "created_by": types.StringType, + "enabled": types.BoolType, + "name": types.StringType, + "position": types.Int64Type, + "script": types.StringType, + "script_id": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + type GlobalInitScriptUpdateRequest struct { // Specifies whether the script is enabled. The script runs only if enabled. Enabled types.Bool `tfsdk:"enabled" tf:"optional"` @@ -2619,11 +9941,50 @@ func (newState *GlobalInitScriptUpdateRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GlobalInitScriptUpdateRequest) SyncEffectiveFieldsDuringRead(existingState GlobalInitScriptUpdateRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GlobalInitScriptUpdateRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GlobalInitScriptUpdateRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GlobalInitScriptUpdateRequest +// only implements ToObjectValue() and Type(). +func (o GlobalInitScriptUpdateRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + "name": o.Name, + "position": o.Position, + "script": o.Script, + "script_id": o.ScriptId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GlobalInitScriptUpdateRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + "name": types.StringType, + "position": types.Int64Type, + "script": types.StringType, + "script_id": types.StringType, + }, + } +} + type InitScriptEventDetails struct { // The cluster scoped init scripts associated with this cluster event - Cluster []InitScriptInfoAndExecutionDetails `tfsdk:"cluster" tf:"optional"` + Cluster types.List `tfsdk:"cluster" tf:"optional"` // The global init scripts associated with this cluster event - Global []InitScriptInfoAndExecutionDetails `tfsdk:"global" tf:"optional"` + Global types.List `tfsdk:"global" tf:"optional"` // The private ip address of the node where the init scripts were run. ReportedForNode types.String `tfsdk:"reported_for_node" tf:"optional"` } @@ -2634,6 +9995,100 @@ func (newState *InitScriptEventDetails) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *InitScriptEventDetails) SyncEffectiveFieldsDuringRead(existingState InitScriptEventDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InitScriptEventDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InitScriptEventDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster": reflect.TypeOf(InitScriptInfoAndExecutionDetails{}), + "global": reflect.TypeOf(InitScriptInfoAndExecutionDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InitScriptEventDetails +// only implements ToObjectValue() and Type(). +func (o InitScriptEventDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster": o.Cluster, + "global": o.Global, + "reported_for_node": o.ReportedForNode, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InitScriptEventDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster": basetypes.ListType{ + ElemType: InitScriptInfoAndExecutionDetails{}.Type(ctx), + }, + "global": basetypes.ListType{ + ElemType: InitScriptInfoAndExecutionDetails{}.Type(ctx), + }, + "reported_for_node": types.StringType, + }, + } +} + +// GetCluster returns the value of the Cluster field in InitScriptEventDetails as +// a slice of InitScriptInfoAndExecutionDetails values. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptEventDetails) GetCluster(ctx context.Context) ([]InitScriptInfoAndExecutionDetails, bool) { + if o.Cluster.IsNull() || o.Cluster.IsUnknown() { + return nil, false + } + var v []InitScriptInfoAndExecutionDetails + d := o.Cluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCluster sets the value of the Cluster field in InitScriptEventDetails. +func (o *InitScriptEventDetails) SetCluster(ctx context.Context, v []InitScriptInfoAndExecutionDetails) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster"] + t = t.(attr.TypeWithElementType).ElementType() + o.Cluster = types.ListValueMust(t, vs) +} + +// GetGlobal returns the value of the Global field in InitScriptEventDetails as +// a slice of InitScriptInfoAndExecutionDetails values. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptEventDetails) GetGlobal(ctx context.Context) ([]InitScriptInfoAndExecutionDetails, bool) { + if o.Global.IsNull() || o.Global.IsUnknown() { + return nil, false + } + var v []InitScriptInfoAndExecutionDetails + d := o.Global.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGlobal sets the value of the Global field in InitScriptEventDetails. +func (o *InitScriptEventDetails) SetGlobal(ctx context.Context, v []InitScriptInfoAndExecutionDetails) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["global"] + t = t.(attr.TypeWithElementType).ElementType() + o.Global = types.ListValueMust(t, vs) +} + type InitScriptExecutionDetails struct { // Addition details regarding errors. ErrorMessage types.String `tfsdk:"error_message" tf:"optional"` @@ -2649,32 +10104,67 @@ func (newState *InitScriptExecutionDetails) SyncEffectiveFieldsDuringCreateOrUpd func (newState *InitScriptExecutionDetails) SyncEffectiveFieldsDuringRead(existingState InitScriptExecutionDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InitScriptExecutionDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InitScriptExecutionDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InitScriptExecutionDetails +// only implements ToObjectValue() and Type(). +func (o InitScriptExecutionDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error_message": o.ErrorMessage, + "execution_duration_seconds": o.ExecutionDurationSeconds, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InitScriptExecutionDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error_message": types.StringType, + "execution_duration_seconds": types.Int64Type, + "status": types.StringType, + }, + } +} + type InitScriptInfo struct { // destination needs to be provided. e.g. `{ "abfss" : { "destination" : // "abfss://@.dfs.core.windows.net/" // } } - Abfss []Adlsgen2Info `tfsdk:"abfss" tf:"optional,object"` + Abfss types.List `tfsdk:"abfss" tf:"optional,object"` // destination needs to be provided. e.g. `{ "dbfs" : { "destination" : // "dbfs:/home/cluster_log" } }` - Dbfs []DbfsStorageInfo `tfsdk:"dbfs" tf:"optional,object"` + Dbfs types.List `tfsdk:"dbfs" tf:"optional,object"` // destination needs to be provided. e.g. `{ "file" : { "destination" : // "file:/my/local/file.sh" } }` - File []LocalFileInfo `tfsdk:"file" tf:"optional,object"` + File types.List `tfsdk:"file" tf:"optional,object"` // destination needs to be provided. e.g. `{ "gcs": { "destination": // "gs://my-bucket/file.sh" } }` - Gcs []GcsStorageInfo `tfsdk:"gcs" tf:"optional,object"` + Gcs types.List `tfsdk:"gcs" tf:"optional,object"` // destination and either the region or endpoint need to be provided. e.g. // `{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : // "us-west-2" } }` Cluster iam role is used to access s3, please make sure // the cluster iam role in `instance_profile_arn` has permission to write // data to the s3 destination. - S3 []S3StorageInfo `tfsdk:"s3" tf:"optional,object"` + S3 types.List `tfsdk:"s3" tf:"optional,object"` // destination needs to be provided. e.g. `{ "volumes" : { "destination" : // "/Volumes/my-init.sh" } }` - Volumes []VolumesStorageInfo `tfsdk:"volumes" tf:"optional,object"` + Volumes types.List `tfsdk:"volumes" tf:"optional,object"` // destination needs to be provided. e.g. `{ "workspace" : { "destination" : // "/Users/user1@databricks.com/my-init.sh" } }` - Workspace []WorkspaceStorageInfo `tfsdk:"workspace" tf:"optional,object"` + Workspace types.List `tfsdk:"workspace" tf:"optional,object"` } func (newState *InitScriptInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan InitScriptInfo) { @@ -2683,11 +10173,258 @@ func (newState *InitScriptInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ini func (newState *InitScriptInfo) SyncEffectiveFieldsDuringRead(existingState InitScriptInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InitScriptInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InitScriptInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "abfss": reflect.TypeOf(Adlsgen2Info{}), + "dbfs": reflect.TypeOf(DbfsStorageInfo{}), + "file": reflect.TypeOf(LocalFileInfo{}), + "gcs": reflect.TypeOf(GcsStorageInfo{}), + "s3": reflect.TypeOf(S3StorageInfo{}), + "volumes": reflect.TypeOf(VolumesStorageInfo{}), + "workspace": reflect.TypeOf(WorkspaceStorageInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InitScriptInfo +// only implements ToObjectValue() and Type(). +func (o InitScriptInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "abfss": o.Abfss, + "dbfs": o.Dbfs, + "file": o.File, + "gcs": o.Gcs, + "s3": o.S3, + "volumes": o.Volumes, + "workspace": o.Workspace, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InitScriptInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "abfss": basetypes.ListType{ + ElemType: Adlsgen2Info{}.Type(ctx), + }, + "dbfs": basetypes.ListType{ + ElemType: DbfsStorageInfo{}.Type(ctx), + }, + "file": basetypes.ListType{ + ElemType: LocalFileInfo{}.Type(ctx), + }, + "gcs": basetypes.ListType{ + ElemType: GcsStorageInfo{}.Type(ctx), + }, + "s3": basetypes.ListType{ + ElemType: S3StorageInfo{}.Type(ctx), + }, + "volumes": basetypes.ListType{ + ElemType: VolumesStorageInfo{}.Type(ctx), + }, + "workspace": basetypes.ListType{ + ElemType: WorkspaceStorageInfo{}.Type(ctx), + }, + }, + } +} + +// GetAbfss returns the value of the Abfss field in InitScriptInfo as +// a Adlsgen2Info value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetAbfss(ctx context.Context) (Adlsgen2Info, bool) { + var e Adlsgen2Info + if o.Abfss.IsNull() || o.Abfss.IsUnknown() { + return e, false + } + var v []Adlsgen2Info + d := o.Abfss.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAbfss sets the value of the Abfss field in InitScriptInfo. +func (o *InitScriptInfo) SetAbfss(ctx context.Context, v Adlsgen2Info) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["abfss"] + o.Abfss = types.ListValueMust(t, vs) +} + +// GetDbfs returns the value of the Dbfs field in InitScriptInfo as +// a DbfsStorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetDbfs(ctx context.Context) (DbfsStorageInfo, bool) { + var e DbfsStorageInfo + if o.Dbfs.IsNull() || o.Dbfs.IsUnknown() { + return e, false + } + var v []DbfsStorageInfo + d := o.Dbfs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbfs sets the value of the Dbfs field in InitScriptInfo. +func (o *InitScriptInfo) SetDbfs(ctx context.Context, v DbfsStorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbfs"] + o.Dbfs = types.ListValueMust(t, vs) +} + +// GetFile returns the value of the File field in InitScriptInfo as +// a LocalFileInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetFile(ctx context.Context) (LocalFileInfo, bool) { + var e LocalFileInfo + if o.File.IsNull() || o.File.IsUnknown() { + return e, false + } + var v []LocalFileInfo + d := o.File.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFile sets the value of the File field in InitScriptInfo. +func (o *InitScriptInfo) SetFile(ctx context.Context, v LocalFileInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file"] + o.File = types.ListValueMust(t, vs) +} + +// GetGcs returns the value of the Gcs field in InitScriptInfo as +// a GcsStorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetGcs(ctx context.Context) (GcsStorageInfo, bool) { + var e GcsStorageInfo + if o.Gcs.IsNull() || o.Gcs.IsUnknown() { + return e, false + } + var v []GcsStorageInfo + d := o.Gcs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcs sets the value of the Gcs field in InitScriptInfo. +func (o *InitScriptInfo) SetGcs(ctx context.Context, v GcsStorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcs"] + o.Gcs = types.ListValueMust(t, vs) +} + +// GetS3 returns the value of the S3 field in InitScriptInfo as +// a S3StorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetS3(ctx context.Context) (S3StorageInfo, bool) { + var e S3StorageInfo + if o.S3.IsNull() || o.S3.IsUnknown() { + return e, false + } + var v []S3StorageInfo + d := o.S3.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetS3 sets the value of the S3 field in InitScriptInfo. +func (o *InitScriptInfo) SetS3(ctx context.Context, v S3StorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["s3"] + o.S3 = types.ListValueMust(t, vs) +} + +// GetVolumes returns the value of the Volumes field in InitScriptInfo as +// a VolumesStorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetVolumes(ctx context.Context) (VolumesStorageInfo, bool) { + var e VolumesStorageInfo + if o.Volumes.IsNull() || o.Volumes.IsUnknown() { + return e, false + } + var v []VolumesStorageInfo + d := o.Volumes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVolumes sets the value of the Volumes field in InitScriptInfo. +func (o *InitScriptInfo) SetVolumes(ctx context.Context, v VolumesStorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["volumes"] + o.Volumes = types.ListValueMust(t, vs) +} + +// GetWorkspace returns the value of the Workspace field in InitScriptInfo as +// a WorkspaceStorageInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfo) GetWorkspace(ctx context.Context) (WorkspaceStorageInfo, bool) { + var e WorkspaceStorageInfo + if o.Workspace.IsNull() || o.Workspace.IsUnknown() { + return e, false + } + var v []WorkspaceStorageInfo + d := o.Workspace.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkspace sets the value of the Workspace field in InitScriptInfo. +func (o *InitScriptInfo) SetWorkspace(ctx context.Context, v WorkspaceStorageInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workspace"] + o.Workspace = types.ListValueMust(t, vs) +} + type InitScriptInfoAndExecutionDetails struct { // Details about the script - ExecutionDetails []InitScriptExecutionDetails `tfsdk:"execution_details" tf:"optional,object"` + ExecutionDetails types.List `tfsdk:"execution_details" tf:"optional,object"` // The script - Script []InitScriptInfo `tfsdk:"script" tf:"optional,object"` + Script types.List `tfsdk:"script" tf:"optional,object"` } func (newState *InitScriptInfoAndExecutionDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan InitScriptInfoAndExecutionDetails) { @@ -2696,11 +10433,103 @@ func (newState *InitScriptInfoAndExecutionDetails) SyncEffectiveFieldsDuringCrea func (newState *InitScriptInfoAndExecutionDetails) SyncEffectiveFieldsDuringRead(existingState InitScriptInfoAndExecutionDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InitScriptInfoAndExecutionDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InitScriptInfoAndExecutionDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "execution_details": reflect.TypeOf(InitScriptExecutionDetails{}), + "script": reflect.TypeOf(InitScriptInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InitScriptInfoAndExecutionDetails +// only implements ToObjectValue() and Type(). +func (o InitScriptInfoAndExecutionDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "execution_details": o.ExecutionDetails, + "script": o.Script, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InitScriptInfoAndExecutionDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "execution_details": basetypes.ListType{ + ElemType: InitScriptExecutionDetails{}.Type(ctx), + }, + "script": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + }, + } +} + +// GetExecutionDetails returns the value of the ExecutionDetails field in InitScriptInfoAndExecutionDetails as +// a InitScriptExecutionDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfoAndExecutionDetails) GetExecutionDetails(ctx context.Context) (InitScriptExecutionDetails, bool) { + var e InitScriptExecutionDetails + if o.ExecutionDetails.IsNull() || o.ExecutionDetails.IsUnknown() { + return e, false + } + var v []InitScriptExecutionDetails + d := o.ExecutionDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExecutionDetails sets the value of the ExecutionDetails field in InitScriptInfoAndExecutionDetails. +func (o *InitScriptInfoAndExecutionDetails) SetExecutionDetails(ctx context.Context, v InitScriptExecutionDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["execution_details"] + o.ExecutionDetails = types.ListValueMust(t, vs) +} + +// GetScript returns the value of the Script field in InitScriptInfoAndExecutionDetails as +// a InitScriptInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *InitScriptInfoAndExecutionDetails) GetScript(ctx context.Context) (InitScriptInfo, bool) { + var e InitScriptInfo + if o.Script.IsNull() || o.Script.IsUnknown() { + return e, false + } + var v []InitScriptInfo + d := o.Script.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetScript sets the value of the Script field in InitScriptInfoAndExecutionDetails. +func (o *InitScriptInfoAndExecutionDetails) SetScript(ctx context.Context, v InitScriptInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["script"] + o.Script = types.ListValueMust(t, vs) +} + type InstallLibraries struct { // Unique identifier for the cluster on which to install these libraries. ClusterId types.String `tfsdk:"cluster_id" tf:""` // The libraries to install. - Libraries []Library `tfsdk:"libraries" tf:""` + Libraries types.List `tfsdk:"libraries" tf:""` } func (newState *InstallLibraries) SyncEffectiveFieldsDuringCreateOrUpdate(plan InstallLibraries) { @@ -2709,6 +10538,69 @@ func (newState *InstallLibraries) SyncEffectiveFieldsDuringCreateOrUpdate(plan I func (newState *InstallLibraries) SyncEffectiveFieldsDuringRead(existingState InstallLibraries) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstallLibraries. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstallLibraries) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "libraries": reflect.TypeOf(Library{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstallLibraries +// only implements ToObjectValue() and Type(). +func (o InstallLibraries) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "libraries": o.Libraries, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstallLibraries) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "libraries": basetypes.ListType{ + ElemType: Library{}.Type(ctx), + }, + }, + } +} + +// GetLibraries returns the value of the Libraries field in InstallLibraries as +// a slice of Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstallLibraries) GetLibraries(ctx context.Context) ([]Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in InstallLibraries. +func (o *InstallLibraries) SetLibraries(ctx context.Context, v []Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + type InstallLibrariesResponse struct { } @@ -2718,6 +10610,33 @@ func (newState *InstallLibrariesResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *InstallLibrariesResponse) SyncEffectiveFieldsDuringRead(existingState InstallLibrariesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstallLibrariesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstallLibrariesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstallLibrariesResponse +// only implements ToObjectValue() and Type(). +func (o InstallLibrariesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o InstallLibrariesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type InstancePoolAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -2735,9 +10654,46 @@ func (newState *InstancePoolAccessControlRequest) SyncEffectiveFieldsDuringCreat func (newState *InstancePoolAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState InstancePoolAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o InstancePoolAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type InstancePoolAccessControlResponse struct { // All permissions. - AllPermissions []InstancePoolPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -2754,19 +10710,88 @@ func (newState *InstancePoolAccessControlResponse) SyncEffectiveFieldsDuringCrea func (newState *InstancePoolAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState InstancePoolAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(InstancePoolPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o InstancePoolAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: InstancePoolPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in InstancePoolAccessControlResponse as +// a slice of InstancePoolPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAccessControlResponse) GetAllPermissions(ctx context.Context) ([]InstancePoolPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []InstancePoolPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in InstancePoolAccessControlResponse. +func (o *InstancePoolAccessControlResponse) SetAllPermissions(ctx context.Context, v []InstancePoolPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type InstancePoolAndStats struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. - AwsAttributes []InstancePoolAwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to instance pools running on Azure. If not specified // at pool creation, a set of default values will be used. - AzureAttributes []InstancePoolAzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Tags that are added by Databricks regardless of any `custom_tags`, // including: // @@ -2777,10 +10802,10 @@ type InstancePoolAndStats struct { // - InstancePoolName: // // - InstancePoolId: - DefaultTags map[string]types.String `tfsdk:"default_tags" tf:"optional"` + DefaultTags types.Map `tfsdk:"default_tags" tf:"optional"` // Defines the specification of the disks that will be attached to all spark // containers. - DiskSpec []DiskSpec `tfsdk:"disk_spec" tf:"optional,object"` + DiskSpec types.List `tfsdk:"disk_spec" tf:"optional,object"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS @@ -2789,7 +10814,7 @@ type InstancePoolAndStats struct { EnableElasticDisk types.Bool `tfsdk:"enable_elastic_disk" tf:"optional"` // Attributes related to instance pools running on Google Cloud Platform. If // not specified at pool creation, a set of default values will be used. - GcpAttributes []InstancePoolGcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement // is already met. If not set, the extra pool instances will be @@ -2816,18 +10841,18 @@ type InstancePoolAndStats struct { // :method:clusters/listNodeTypes API call. NodeTypeId types.String `tfsdk:"node_type_id" tf:"optional"` // Custom Docker Image BYOC - PreloadedDockerImages []DockerImage `tfsdk:"preloaded_docker_images" tf:"optional"` + PreloadedDockerImages types.List `tfsdk:"preloaded_docker_images" tf:"optional"` // A list containing at most one preloaded Spark image version for the pool. // Pool-backed clusters started with the preloaded Spark version will start // faster. A list of available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - PreloadedSparkVersions []types.String `tfsdk:"preloaded_spark_versions" tf:"optional"` + PreloadedSparkVersions types.List `tfsdk:"preloaded_spark_versions" tf:"optional"` // Current state of the instance pool. State types.String `tfsdk:"state" tf:"optional"` // Usage statistics about the instance pool. - Stats []InstancePoolStats `tfsdk:"stats" tf:"optional,object"` + Stats types.List `tfsdk:"stats" tf:"optional,object"` // Status of failed pending instances in the pool. - Status []InstancePoolStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` } func (newState *InstancePoolAndStats) SyncEffectiveFieldsDuringCreateOrUpdate(plan InstancePoolAndStats) { @@ -2836,6 +10861,362 @@ func (newState *InstancePoolAndStats) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *InstancePoolAndStats) SyncEffectiveFieldsDuringRead(existingState InstancePoolAndStats) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolAndStats. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolAndStats) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_attributes": reflect.TypeOf(InstancePoolAwsAttributes{}), + "azure_attributes": reflect.TypeOf(InstancePoolAzureAttributes{}), + "custom_tags": reflect.TypeOf(types.String{}), + "default_tags": reflect.TypeOf(types.String{}), + "disk_spec": reflect.TypeOf(DiskSpec{}), + "gcp_attributes": reflect.TypeOf(InstancePoolGcpAttributes{}), + "preloaded_docker_images": reflect.TypeOf(DockerImage{}), + "preloaded_spark_versions": reflect.TypeOf(types.String{}), + "stats": reflect.TypeOf(InstancePoolStats{}), + "status": reflect.TypeOf(InstancePoolStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolAndStats +// only implements ToObjectValue() and Type(). +func (o InstancePoolAndStats) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "custom_tags": o.CustomTags, + "default_tags": o.DefaultTags, + "disk_spec": o.DiskSpec, + "enable_elastic_disk": o.EnableElasticDisk, + "gcp_attributes": o.GcpAttributes, + "idle_instance_autotermination_minutes": o.IdleInstanceAutoterminationMinutes, + "instance_pool_id": o.InstancePoolId, + "instance_pool_name": o.InstancePoolName, + "max_capacity": o.MaxCapacity, + "min_idle_instances": o.MinIdleInstances, + "node_type_id": o.NodeTypeId, + "preloaded_docker_images": o.PreloadedDockerImages, + "preloaded_spark_versions": o.PreloadedSparkVersions, + "state": o.State, + "stats": o.Stats, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolAndStats) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_attributes": basetypes.ListType{ + ElemType: InstancePoolAwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: InstancePoolAzureAttributes{}.Type(ctx), + }, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "default_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "disk_spec": basetypes.ListType{ + ElemType: DiskSpec{}.Type(ctx), + }, + "enable_elastic_disk": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: InstancePoolGcpAttributes{}.Type(ctx), + }, + "idle_instance_autotermination_minutes": types.Int64Type, + "instance_pool_id": types.StringType, + "instance_pool_name": types.StringType, + "max_capacity": types.Int64Type, + "min_idle_instances": types.Int64Type, + "node_type_id": types.StringType, + "preloaded_docker_images": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "preloaded_spark_versions": basetypes.ListType{ + ElemType: types.StringType, + }, + "state": types.StringType, + "stats": basetypes.ListType{ + ElemType: InstancePoolStats{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: InstancePoolStatus{}.Type(ctx), + }, + }, + } +} + +// GetAwsAttributes returns the value of the AwsAttributes field in InstancePoolAndStats as +// a InstancePoolAwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetAwsAttributes(ctx context.Context) (InstancePoolAwsAttributes, bool) { + var e InstancePoolAwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolAwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetAwsAttributes(ctx context.Context, v InstancePoolAwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in InstancePoolAndStats as +// a InstancePoolAzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetAzureAttributes(ctx context.Context) (InstancePoolAzureAttributes, bool) { + var e InstancePoolAzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolAzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetAzureAttributes(ctx context.Context, v InstancePoolAzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in InstancePoolAndStats as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDefaultTags returns the value of the DefaultTags field in InstancePoolAndStats as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetDefaultTags(ctx context.Context) (map[string]types.String, bool) { + if o.DefaultTags.IsNull() || o.DefaultTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.DefaultTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDefaultTags sets the value of the DefaultTags field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetDefaultTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["default_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.DefaultTags = types.MapValueMust(t, vs) +} + +// GetDiskSpec returns the value of the DiskSpec field in InstancePoolAndStats as +// a DiskSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetDiskSpec(ctx context.Context) (DiskSpec, bool) { + var e DiskSpec + if o.DiskSpec.IsNull() || o.DiskSpec.IsUnknown() { + return e, false + } + var v []DiskSpec + d := o.DiskSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDiskSpec sets the value of the DiskSpec field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetDiskSpec(ctx context.Context, v DiskSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disk_spec"] + o.DiskSpec = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in InstancePoolAndStats as +// a InstancePoolGcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetGcpAttributes(ctx context.Context) (InstancePoolGcpAttributes, bool) { + var e InstancePoolGcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []InstancePoolGcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetGcpAttributes(ctx context.Context, v InstancePoolGcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetPreloadedDockerImages returns the value of the PreloadedDockerImages field in InstancePoolAndStats as +// a slice of DockerImage values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetPreloadedDockerImages(ctx context.Context) ([]DockerImage, bool) { + if o.PreloadedDockerImages.IsNull() || o.PreloadedDockerImages.IsUnknown() { + return nil, false + } + var v []DockerImage + d := o.PreloadedDockerImages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPreloadedDockerImages sets the value of the PreloadedDockerImages field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetPreloadedDockerImages(ctx context.Context, v []DockerImage) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["preloaded_docker_images"] + t = t.(attr.TypeWithElementType).ElementType() + o.PreloadedDockerImages = types.ListValueMust(t, vs) +} + +// GetPreloadedSparkVersions returns the value of the PreloadedSparkVersions field in InstancePoolAndStats as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetPreloadedSparkVersions(ctx context.Context) ([]types.String, bool) { + if o.PreloadedSparkVersions.IsNull() || o.PreloadedSparkVersions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PreloadedSparkVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPreloadedSparkVersions sets the value of the PreloadedSparkVersions field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetPreloadedSparkVersions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["preloaded_spark_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.PreloadedSparkVersions = types.ListValueMust(t, vs) +} + +// GetStats returns the value of the Stats field in InstancePoolAndStats as +// a InstancePoolStats value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetStats(ctx context.Context) (InstancePoolStats, bool) { + var e InstancePoolStats + if o.Stats.IsNull() || o.Stats.IsUnknown() { + return e, false + } + var v []InstancePoolStats + d := o.Stats.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStats sets the value of the Stats field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetStats(ctx context.Context, v InstancePoolStats) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["stats"] + o.Stats = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in InstancePoolAndStats as +// a InstancePoolStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolAndStats) GetStatus(ctx context.Context) (InstancePoolStatus, bool) { + var e InstancePoolStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []InstancePoolStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in InstancePoolAndStats. +func (o *InstancePoolAndStats) SetStatus(ctx context.Context, v InstancePoolStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + type InstancePoolAwsAttributes struct { // Availability type used for the spot nodes. // @@ -2874,6 +11255,41 @@ func (newState *InstancePoolAwsAttributes) SyncEffectiveFieldsDuringCreateOrUpda func (newState *InstancePoolAwsAttributes) SyncEffectiveFieldsDuringRead(existingState InstancePoolAwsAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolAwsAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolAwsAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolAwsAttributes +// only implements ToObjectValue() and Type(). +func (o InstancePoolAwsAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "availability": o.Availability, + "spot_bid_price_percent": o.SpotBidPricePercent, + "zone_id": o.ZoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolAwsAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "availability": types.StringType, + "spot_bid_price_percent": types.Int64Type, + "zone_id": types.StringType, + }, + } +} + type InstancePoolAzureAttributes struct { // Shows the Availability type used for the spot nodes. // @@ -2891,6 +11307,39 @@ func (newState *InstancePoolAzureAttributes) SyncEffectiveFieldsDuringCreateOrUp func (newState *InstancePoolAzureAttributes) SyncEffectiveFieldsDuringRead(existingState InstancePoolAzureAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolAzureAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolAzureAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolAzureAttributes +// only implements ToObjectValue() and Type(). +func (o InstancePoolAzureAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "availability": o.Availability, + "spot_bid_max_price": o.SpotBidMaxPrice, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolAzureAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "availability": types.StringType, + "spot_bid_max_price": types.Float64Type, + }, + } +} + type InstancePoolGcpAttributes struct { // This field determines whether the instance pool will contain preemptible // VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs @@ -2928,10 +11377,45 @@ func (newState *InstancePoolGcpAttributes) SyncEffectiveFieldsDuringCreateOrUpda func (newState *InstancePoolGcpAttributes) SyncEffectiveFieldsDuringRead(existingState InstancePoolGcpAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolGcpAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolGcpAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolGcpAttributes +// only implements ToObjectValue() and Type(). +func (o InstancePoolGcpAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "gcp_availability": o.GcpAvailability, + "local_ssd_count": o.LocalSsdCount, + "zone_id": o.ZoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolGcpAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "gcp_availability": types.StringType, + "local_ssd_count": types.Int64Type, + "zone_id": types.StringType, + }, + } +} + type InstancePoolPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -2942,8 +11426,73 @@ func (newState *InstancePoolPermission) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *InstancePoolPermission) SyncEffectiveFieldsDuringRead(existingState InstancePoolPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolPermission +// only implements ToObjectValue() and Type(). +func (o InstancePoolPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in InstancePoolPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in InstancePoolPermission. +func (o *InstancePoolPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type InstancePoolPermissions struct { - AccessControlList []InstancePoolAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -2956,6 +11505,71 @@ func (newState *InstancePoolPermissions) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *InstancePoolPermissions) SyncEffectiveFieldsDuringRead(existingState InstancePoolPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(InstancePoolAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolPermissions +// only implements ToObjectValue() and Type(). +func (o InstancePoolPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: InstancePoolAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in InstancePoolPermissions as +// a slice of InstancePoolAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolPermissions) GetAccessControlList(ctx context.Context) ([]InstancePoolAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []InstancePoolAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in InstancePoolPermissions. +func (o *InstancePoolPermissions) SetAccessControlList(ctx context.Context, v []InstancePoolAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type InstancePoolPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -2968,8 +11582,41 @@ func (newState *InstancePoolPermissionsDescription) SyncEffectiveFieldsDuringCre func (newState *InstancePoolPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState InstancePoolPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o InstancePoolPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type InstancePoolPermissionsRequest struct { - AccessControlList []InstancePoolAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The instance pool for which to get or manage permissions. InstancePoolId types.String `tfsdk:"-"` } @@ -2980,6 +11627,69 @@ func (newState *InstancePoolPermissionsRequest) SyncEffectiveFieldsDuringCreateO func (newState *InstancePoolPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState InstancePoolPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(InstancePoolAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o InstancePoolPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "instance_pool_id": o.InstancePoolId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: InstancePoolAccessControlRequest{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in InstancePoolPermissionsRequest as +// a slice of InstancePoolAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolPermissionsRequest) GetAccessControlList(ctx context.Context) ([]InstancePoolAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []InstancePoolAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in InstancePoolPermissionsRequest. +func (o *InstancePoolPermissionsRequest) SetAccessControlList(ctx context.Context, v []InstancePoolAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type InstancePoolStats struct { // Number of active instances in the pool that are NOT part of a cluster. IdleCount types.Int64 `tfsdk:"idle_count" tf:"optional"` @@ -2997,12 +11707,49 @@ func (newState *InstancePoolStats) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *InstancePoolStats) SyncEffectiveFieldsDuringRead(existingState InstancePoolStats) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolStats. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolStats) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolStats +// only implements ToObjectValue() and Type(). +func (o InstancePoolStats) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "idle_count": o.IdleCount, + "pending_idle_count": o.PendingIdleCount, + "pending_used_count": o.PendingUsedCount, + "used_count": o.UsedCount, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolStats) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "idle_count": types.Int64Type, + "pending_idle_count": types.Int64Type, + "pending_used_count": types.Int64Type, + "used_count": types.Int64Type, + }, + } +} + type InstancePoolStatus struct { // List of error messages for the failed pending instances. The // pending_instance_errors follows FIFO with maximum length of the min_idle // of the pool. The pending_instance_errors is emptied once the number of // exiting available instances reaches the min_idle of the pool. - PendingInstanceErrors []PendingInstanceError `tfsdk:"pending_instance_errors" tf:"optional"` + PendingInstanceErrors types.List `tfsdk:"pending_instance_errors" tf:"optional"` } func (newState *InstancePoolStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan InstancePoolStatus) { @@ -3011,6 +11758,67 @@ func (newState *InstancePoolStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *InstancePoolStatus) SyncEffectiveFieldsDuringRead(existingState InstancePoolStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstancePoolStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstancePoolStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "pending_instance_errors": reflect.TypeOf(PendingInstanceError{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstancePoolStatus +// only implements ToObjectValue() and Type(). +func (o InstancePoolStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pending_instance_errors": o.PendingInstanceErrors, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstancePoolStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pending_instance_errors": basetypes.ListType{ + ElemType: PendingInstanceError{}.Type(ctx), + }, + }, + } +} + +// GetPendingInstanceErrors returns the value of the PendingInstanceErrors field in InstancePoolStatus as +// a slice of PendingInstanceError values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstancePoolStatus) GetPendingInstanceErrors(ctx context.Context) ([]PendingInstanceError, bool) { + if o.PendingInstanceErrors.IsNull() || o.PendingInstanceErrors.IsUnknown() { + return nil, false + } + var v []PendingInstanceError + d := o.PendingInstanceErrors.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPendingInstanceErrors sets the value of the PendingInstanceErrors field in InstancePoolStatus. +func (o *InstancePoolStatus) SetPendingInstanceErrors(ctx context.Context, v []PendingInstanceError) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pending_instance_errors"] + t = t.(attr.TypeWithElementType).ElementType() + o.PendingInstanceErrors = types.ListValueMust(t, vs) +} + type InstanceProfile struct { // The AWS IAM role ARN of the role associated with the instance profile. // This field is required if your role name and instance profile name do not @@ -3038,9 +11846,44 @@ func (newState *InstanceProfile) SyncEffectiveFieldsDuringCreateOrUpdate(plan In func (newState *InstanceProfile) SyncEffectiveFieldsDuringRead(existingState InstanceProfile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstanceProfile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstanceProfile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstanceProfile +// only implements ToObjectValue() and Type(). +func (o InstanceProfile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "iam_role_arn": o.IamRoleArn, + "instance_profile_arn": o.InstanceProfileArn, + "is_meta_instance_profile": o.IsMetaInstanceProfile, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstanceProfile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "iam_role_arn": types.StringType, + "instance_profile_arn": types.StringType, + "is_meta_instance_profile": types.BoolType, + }, + } +} + type Library struct { // Specification of a CRAN library to be installed as part of the library - Cran []RCranLibrary `tfsdk:"cran" tf:"optional,object"` + Cran types.List `tfsdk:"cran" tf:"optional,object"` // Deprecated. URI of the egg library to install. Installing Python egg // files is deprecated and is not supported in Databricks Runtime 14.0 and // above. @@ -3055,10 +11898,10 @@ type Library struct { Jar types.String `tfsdk:"jar" tf:"optional"` // Specification of a maven library to be installed. For example: `{ // "coordinates": "org.jsoup:jsoup:1.7.2" }` - Maven []MavenLibrary `tfsdk:"maven" tf:"optional,object"` + Maven types.List `tfsdk:"maven" tf:"optional,object"` // Specification of a PyPi library to be installed. For example: `{ // "package": "simplejson" }` - Pypi []PythonPyPiLibrary `tfsdk:"pypi" tf:"optional,object"` + Pypi types.List `tfsdk:"pypi" tf:"optional,object"` // URI of the requirements.txt file to install. Only Workspace paths and // Unity Catalog Volumes paths are supported. For example: `{ // "requirements": "/Workspace/path/to/requirements.txt" }` or `{ @@ -3080,16 +11923,147 @@ func (newState *Library) SyncEffectiveFieldsDuringCreateOrUpdate(plan Library) { func (newState *Library) SyncEffectiveFieldsDuringRead(existingState Library) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Library. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Library) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cran": reflect.TypeOf(RCranLibrary{}), + "maven": reflect.TypeOf(MavenLibrary{}), + "pypi": reflect.TypeOf(PythonPyPiLibrary{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Library +// only implements ToObjectValue() and Type(). +func (o Library) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cran": o.Cran, + "egg": o.Egg, + "jar": o.Jar, + "maven": o.Maven, + "pypi": o.Pypi, + "requirements": o.Requirements, + "whl": o.Whl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Library) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cran": basetypes.ListType{ + ElemType: RCranLibrary{}.Type(ctx), + }, + "egg": types.StringType, + "jar": types.StringType, + "maven": basetypes.ListType{ + ElemType: MavenLibrary{}.Type(ctx), + }, + "pypi": basetypes.ListType{ + ElemType: PythonPyPiLibrary{}.Type(ctx), + }, + "requirements": types.StringType, + "whl": types.StringType, + }, + } +} + +// GetCran returns the value of the Cran field in Library as +// a RCranLibrary value. +// If the field is unknown or null, the boolean return value is false. +func (o *Library) GetCran(ctx context.Context) (RCranLibrary, bool) { + var e RCranLibrary + if o.Cran.IsNull() || o.Cran.IsUnknown() { + return e, false + } + var v []RCranLibrary + d := o.Cran.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCran sets the value of the Cran field in Library. +func (o *Library) SetCran(ctx context.Context, v RCranLibrary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cran"] + o.Cran = types.ListValueMust(t, vs) +} + +// GetMaven returns the value of the Maven field in Library as +// a MavenLibrary value. +// If the field is unknown or null, the boolean return value is false. +func (o *Library) GetMaven(ctx context.Context) (MavenLibrary, bool) { + var e MavenLibrary + if o.Maven.IsNull() || o.Maven.IsUnknown() { + return e, false + } + var v []MavenLibrary + d := o.Maven.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMaven sets the value of the Maven field in Library. +func (o *Library) SetMaven(ctx context.Context, v MavenLibrary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["maven"] + o.Maven = types.ListValueMust(t, vs) +} + +// GetPypi returns the value of the Pypi field in Library as +// a PythonPyPiLibrary value. +// If the field is unknown or null, the boolean return value is false. +func (o *Library) GetPypi(ctx context.Context) (PythonPyPiLibrary, bool) { + var e PythonPyPiLibrary + if o.Pypi.IsNull() || o.Pypi.IsUnknown() { + return e, false + } + var v []PythonPyPiLibrary + d := o.Pypi.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPypi sets the value of the Pypi field in Library. +func (o *Library) SetPypi(ctx context.Context, v PythonPyPiLibrary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pypi"] + o.Pypi = types.ListValueMust(t, vs) +} + // The status of the library on a specific cluster. type LibraryFullStatus struct { // Whether the library was set to be installed on all clusters via the // libraries UI. IsLibraryForAllClusters types.Bool `tfsdk:"is_library_for_all_clusters" tf:"optional"` // Unique identifier for the library. - Library []Library `tfsdk:"library" tf:"optional,object"` + Library types.List `tfsdk:"library" tf:"optional,object"` // All the info and warning messages that have occurred so far for this // library. - Messages []types.String `tfsdk:"messages" tf:"optional"` + Messages types.List `tfsdk:"messages" tf:"optional"` // Status of installing the library on the cluster. Status types.String `tfsdk:"status" tf:"optional"` } @@ -3100,9 +12074,105 @@ func (newState *LibraryFullStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *LibraryFullStatus) SyncEffectiveFieldsDuringRead(existingState LibraryFullStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LibraryFullStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LibraryFullStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "library": reflect.TypeOf(Library{}), + "messages": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LibraryFullStatus +// only implements ToObjectValue() and Type(). +func (o LibraryFullStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_library_for_all_clusters": o.IsLibraryForAllClusters, + "library": o.Library, + "messages": o.Messages, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LibraryFullStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_library_for_all_clusters": types.BoolType, + "library": basetypes.ListType{ + ElemType: Library{}.Type(ctx), + }, + "messages": basetypes.ListType{ + ElemType: types.StringType, + }, + "status": types.StringType, + }, + } +} + +// GetLibrary returns the value of the Library field in LibraryFullStatus as +// a Library value. +// If the field is unknown or null, the boolean return value is false. +func (o *LibraryFullStatus) GetLibrary(ctx context.Context) (Library, bool) { + var e Library + if o.Library.IsNull() || o.Library.IsUnknown() { + return e, false + } + var v []Library + d := o.Library.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLibrary sets the value of the Library field in LibraryFullStatus. +func (o *LibraryFullStatus) SetLibrary(ctx context.Context, v Library) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["library"] + o.Library = types.ListValueMust(t, vs) +} + +// GetMessages returns the value of the Messages field in LibraryFullStatus as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *LibraryFullStatus) GetMessages(ctx context.Context) ([]types.String, bool) { + if o.Messages.IsNull() || o.Messages.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Messages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMessages sets the value of the Messages field in LibraryFullStatus. +func (o *LibraryFullStatus) SetMessages(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["messages"] + t = t.(attr.TypeWithElementType).ElementType() + o.Messages = types.ListValueMust(t, vs) +} + type ListAllClusterLibraryStatusesResponse struct { // A list of cluster statuses. - Statuses []ClusterLibraryStatuses `tfsdk:"statuses" tf:"optional"` + Statuses types.List `tfsdk:"statuses" tf:"optional"` } func (newState *ListAllClusterLibraryStatusesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAllClusterLibraryStatusesResponse) { @@ -3111,12 +12181,73 @@ func (newState *ListAllClusterLibraryStatusesResponse) SyncEffectiveFieldsDuring func (newState *ListAllClusterLibraryStatusesResponse) SyncEffectiveFieldsDuringRead(existingState ListAllClusterLibraryStatusesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAllClusterLibraryStatusesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAllClusterLibraryStatusesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "statuses": reflect.TypeOf(ClusterLibraryStatuses{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAllClusterLibraryStatusesResponse +// only implements ToObjectValue() and Type(). +func (o ListAllClusterLibraryStatusesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "statuses": o.Statuses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAllClusterLibraryStatusesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "statuses": basetypes.ListType{ + ElemType: ClusterLibraryStatuses{}.Type(ctx), + }, + }, + } +} + +// GetStatuses returns the value of the Statuses field in ListAllClusterLibraryStatusesResponse as +// a slice of ClusterLibraryStatuses values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAllClusterLibraryStatusesResponse) GetStatuses(ctx context.Context) ([]ClusterLibraryStatuses, bool) { + if o.Statuses.IsNull() || o.Statuses.IsUnknown() { + return nil, false + } + var v []ClusterLibraryStatuses + d := o.Statuses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStatuses sets the value of the Statuses field in ListAllClusterLibraryStatusesResponse. +func (o *ListAllClusterLibraryStatusesResponse) SetStatuses(ctx context.Context, v []ClusterLibraryStatuses) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["statuses"] + t = t.(attr.TypeWithElementType).ElementType() + o.Statuses = types.ListValueMust(t, vs) +} + type ListAvailableZonesResponse struct { // The availability zone if no `zone_id` is provided in the cluster creation // request. DefaultZone types.String `tfsdk:"default_zone" tf:"optional"` // The list of available zones (e.g., ['us-west-2c', 'us-east-2']). - Zones []types.String `tfsdk:"zones" tf:"optional"` + Zones types.List `tfsdk:"zones" tf:"optional"` } func (newState *ListAvailableZonesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAvailableZonesResponse) { @@ -3125,6 +12256,69 @@ func (newState *ListAvailableZonesResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListAvailableZonesResponse) SyncEffectiveFieldsDuringRead(existingState ListAvailableZonesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAvailableZonesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAvailableZonesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "zones": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAvailableZonesResponse +// only implements ToObjectValue() and Type(). +func (o ListAvailableZonesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default_zone": o.DefaultZone, + "zones": o.Zones, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAvailableZonesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default_zone": types.StringType, + "zones": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetZones returns the value of the Zones field in ListAvailableZonesResponse as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAvailableZonesResponse) GetZones(ctx context.Context) ([]types.String, bool) { + if o.Zones.IsNull() || o.Zones.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Zones.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetZones sets the value of the Zones field in ListAvailableZonesResponse. +func (o *ListAvailableZonesResponse) SetZones(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["zones"] + t = t.(attr.TypeWithElementType).ElementType() + o.Zones = types.ListValueMust(t, vs) +} + // List cluster policy compliance type ListClusterCompliancesRequest struct { // Use this field to specify the maximum number of results to be returned by @@ -3144,9 +12338,44 @@ func (newState *ListClusterCompliancesRequest) SyncEffectiveFieldsDuringCreateOr func (newState *ListClusterCompliancesRequest) SyncEffectiveFieldsDuringRead(existingState ListClusterCompliancesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClusterCompliancesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClusterCompliancesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClusterCompliancesRequest +// only implements ToObjectValue() and Type(). +func (o ListClusterCompliancesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClusterCompliancesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + "policy_id": types.StringType, + }, + } +} + type ListClusterCompliancesResponse struct { // A list of clusters and their policy compliance statuses. - Clusters []ClusterCompliance `tfsdk:"clusters" tf:"optional"` + Clusters types.List `tfsdk:"clusters" tf:"optional"` // This field represents the pagination token to retrieve the next page of // results. If the value is "", it means no further results for the request. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -3162,6 +12391,71 @@ func (newState *ListClusterCompliancesResponse) SyncEffectiveFieldsDuringCreateO func (newState *ListClusterCompliancesResponse) SyncEffectiveFieldsDuringRead(existingState ListClusterCompliancesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClusterCompliancesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClusterCompliancesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clusters": reflect.TypeOf(ClusterCompliance{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClusterCompliancesResponse +// only implements ToObjectValue() and Type(). +func (o ListClusterCompliancesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusters": o.Clusters, + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClusterCompliancesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusters": basetypes.ListType{ + ElemType: ClusterCompliance{}.Type(ctx), + }, + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + }, + } +} + +// GetClusters returns the value of the Clusters field in ListClusterCompliancesResponse as +// a slice of ClusterCompliance values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListClusterCompliancesResponse) GetClusters(ctx context.Context) ([]ClusterCompliance, bool) { + if o.Clusters.IsNull() || o.Clusters.IsUnknown() { + return nil, false + } + var v []ClusterCompliance + d := o.Clusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusters sets the value of the Clusters field in ListClusterCompliancesResponse. +func (o *ListClusterCompliancesResponse) SetClusters(ctx context.Context, v []ClusterCompliance) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Clusters = types.ListValueMust(t, vs) +} + // List cluster policies type ListClusterPoliciesRequest struct { // The cluster policy attribute to sort by. * `POLICY_CREATION_TIME` - Sort @@ -3179,11 +12473,44 @@ func (newState *ListClusterPoliciesRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListClusterPoliciesRequest) SyncEffectiveFieldsDuringRead(existingState ListClusterPoliciesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClusterPoliciesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClusterPoliciesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClusterPoliciesRequest +// only implements ToObjectValue() and Type(). +func (o ListClusterPoliciesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "sort_column": o.SortColumn, + "sort_order": o.SortOrder, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClusterPoliciesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "sort_column": types.StringType, + "sort_order": types.StringType, + }, + } +} + type ListClustersFilterBy struct { // The source of cluster creation. - ClusterSources []types.String `tfsdk:"cluster_sources" tf:"optional"` + ClusterSources types.List `tfsdk:"cluster_sources" tf:"optional"` // The current state of the clusters. - ClusterStates []types.String `tfsdk:"cluster_states" tf:"optional"` + ClusterStates types.List `tfsdk:"cluster_states" tf:"optional"` // Whether the clusters are pinned or not. IsPinned types.Bool `tfsdk:"is_pinned" tf:"optional"` // The ID of the cluster policy used to create the cluster if applicable. @@ -3196,10 +12523,106 @@ func (newState *ListClustersFilterBy) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListClustersFilterBy) SyncEffectiveFieldsDuringRead(existingState ListClustersFilterBy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClustersFilterBy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClustersFilterBy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster_sources": reflect.TypeOf(types.String{}), + "cluster_states": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClustersFilterBy +// only implements ToObjectValue() and Type(). +func (o ListClustersFilterBy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_sources": o.ClusterSources, + "cluster_states": o.ClusterStates, + "is_pinned": o.IsPinned, + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClustersFilterBy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_sources": basetypes.ListType{ + ElemType: types.StringType, + }, + "cluster_states": basetypes.ListType{ + ElemType: types.StringType, + }, + "is_pinned": types.BoolType, + "policy_id": types.StringType, + }, + } +} + +// GetClusterSources returns the value of the ClusterSources field in ListClustersFilterBy as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListClustersFilterBy) GetClusterSources(ctx context.Context) ([]types.String, bool) { + if o.ClusterSources.IsNull() || o.ClusterSources.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ClusterSources.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusterSources sets the value of the ClusterSources field in ListClustersFilterBy. +func (o *ListClustersFilterBy) SetClusterSources(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_sources"] + t = t.(attr.TypeWithElementType).ElementType() + o.ClusterSources = types.ListValueMust(t, vs) +} + +// GetClusterStates returns the value of the ClusterStates field in ListClustersFilterBy as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListClustersFilterBy) GetClusterStates(ctx context.Context) ([]types.String, bool) { + if o.ClusterStates.IsNull() || o.ClusterStates.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ClusterStates.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusterStates sets the value of the ClusterStates field in ListClustersFilterBy. +func (o *ListClustersFilterBy) SetClusterStates(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_states"] + t = t.(attr.TypeWithElementType).ElementType() + o.ClusterStates = types.ListValueMust(t, vs) +} + // List clusters type ListClustersRequest struct { // Filters to apply to the list of clusters. - FilterBy []ListClustersFilterBy `tfsdk:"-"` + FilterBy types.List `tfsdk:"-"` // Use this field to specify the maximum number of results to be returned by // the server. The server may further constrain the maximum number of // results returned in a single page. @@ -3208,7 +12631,7 @@ type ListClustersRequest struct { // to list the next or previous page of clusters respectively. PageToken types.String `tfsdk:"-"` // Sort the list of clusters by a specific criteria. - SortBy []ListClustersSortBy `tfsdk:"-"` + SortBy types.List `tfsdk:"-"` } func (newState *ListClustersRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListClustersRequest) { @@ -3217,9 +12640,105 @@ func (newState *ListClustersRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListClustersRequest) SyncEffectiveFieldsDuringRead(existingState ListClustersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClustersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClustersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filter_by": reflect.TypeOf(ListClustersFilterBy{}), + "sort_by": reflect.TypeOf(ListClustersSortBy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClustersRequest +// only implements ToObjectValue() and Type(). +func (o ListClustersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter_by": o.FilterBy, + "page_size": o.PageSize, + "page_token": o.PageToken, + "sort_by": o.SortBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClustersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter_by": basetypes.ListType{ + ElemType: ListClustersFilterBy{}.Type(ctx), + }, + "page_size": types.Int64Type, + "page_token": types.StringType, + "sort_by": basetypes.ListType{ + ElemType: ListClustersSortBy{}.Type(ctx), + }, + }, + } +} + +// GetFilterBy returns the value of the FilterBy field in ListClustersRequest as +// a ListClustersFilterBy value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListClustersRequest) GetFilterBy(ctx context.Context) (ListClustersFilterBy, bool) { + var e ListClustersFilterBy + if o.FilterBy.IsNull() || o.FilterBy.IsUnknown() { + return e, false + } + var v []ListClustersFilterBy + d := o.FilterBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilterBy sets the value of the FilterBy field in ListClustersRequest. +func (o *ListClustersRequest) SetFilterBy(ctx context.Context, v ListClustersFilterBy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter_by"] + o.FilterBy = types.ListValueMust(t, vs) +} + +// GetSortBy returns the value of the SortBy field in ListClustersRequest as +// a ListClustersSortBy value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListClustersRequest) GetSortBy(ctx context.Context) (ListClustersSortBy, bool) { + var e ListClustersSortBy + if o.SortBy.IsNull() || o.SortBy.IsUnknown() { + return e, false + } + var v []ListClustersSortBy + d := o.SortBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSortBy sets the value of the SortBy field in ListClustersRequest. +func (o *ListClustersRequest) SetSortBy(ctx context.Context, v ListClustersSortBy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sort_by"] + o.SortBy = types.ListValueMust(t, vs) +} + type ListClustersResponse struct { // - Clusters []ClusterDetails `tfsdk:"clusters" tf:"optional"` + Clusters types.List `tfsdk:"clusters" tf:"optional"` // This field represents the pagination token to retrieve the next page of // results. If the value is "", it means no further results for the request. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -3235,6 +12754,71 @@ func (newState *ListClustersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListClustersResponse) SyncEffectiveFieldsDuringRead(existingState ListClustersResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClustersResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClustersResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clusters": reflect.TypeOf(ClusterDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClustersResponse +// only implements ToObjectValue() and Type(). +func (o ListClustersResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clusters": o.Clusters, + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClustersResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clusters": basetypes.ListType{ + ElemType: ClusterDetails{}.Type(ctx), + }, + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + }, + } +} + +// GetClusters returns the value of the Clusters field in ListClustersResponse as +// a slice of ClusterDetails values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListClustersResponse) GetClusters(ctx context.Context) ([]ClusterDetails, bool) { + if o.Clusters.IsNull() || o.Clusters.IsUnknown() { + return nil, false + } + var v []ClusterDetails + d := o.Clusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusters sets the value of the Clusters field in ListClustersResponse. +func (o *ListClustersResponse) SetClusters(ctx context.Context, v []ClusterDetails) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Clusters = types.ListValueMust(t, vs) +} + type ListClustersSortBy struct { // The direction to sort by. Direction types.String `tfsdk:"direction" tf:"optional"` @@ -3250,8 +12834,41 @@ func (newState *ListClustersSortBy) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListClustersSortBy) SyncEffectiveFieldsDuringRead(existingState ListClustersSortBy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListClustersSortBy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListClustersSortBy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListClustersSortBy +// only implements ToObjectValue() and Type(). +func (o ListClustersSortBy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "direction": o.Direction, + "field": o.Field, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListClustersSortBy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "direction": types.StringType, + "field": types.StringType, + }, + } +} + type ListGlobalInitScriptsResponse struct { - Scripts []GlobalInitScriptDetails `tfsdk:"scripts" tf:"optional"` + Scripts types.List `tfsdk:"scripts" tf:"optional"` } func (newState *ListGlobalInitScriptsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListGlobalInitScriptsResponse) { @@ -3260,8 +12877,69 @@ func (newState *ListGlobalInitScriptsResponse) SyncEffectiveFieldsDuringCreateOr func (newState *ListGlobalInitScriptsResponse) SyncEffectiveFieldsDuringRead(existingState ListGlobalInitScriptsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListGlobalInitScriptsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListGlobalInitScriptsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "scripts": reflect.TypeOf(GlobalInitScriptDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListGlobalInitScriptsResponse +// only implements ToObjectValue() and Type(). +func (o ListGlobalInitScriptsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "scripts": o.Scripts, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListGlobalInitScriptsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "scripts": basetypes.ListType{ + ElemType: GlobalInitScriptDetails{}.Type(ctx), + }, + }, + } +} + +// GetScripts returns the value of the Scripts field in ListGlobalInitScriptsResponse as +// a slice of GlobalInitScriptDetails values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListGlobalInitScriptsResponse) GetScripts(ctx context.Context) ([]GlobalInitScriptDetails, bool) { + if o.Scripts.IsNull() || o.Scripts.IsUnknown() { + return nil, false + } + var v []GlobalInitScriptDetails + d := o.Scripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScripts sets the value of the Scripts field in ListGlobalInitScriptsResponse. +func (o *ListGlobalInitScriptsResponse) SetScripts(ctx context.Context, v []GlobalInitScriptDetails) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scripts = types.ListValueMust(t, vs) +} + type ListInstancePools struct { - InstancePools []InstancePoolAndStats `tfsdk:"instance_pools" tf:"optional"` + InstancePools types.List `tfsdk:"instance_pools" tf:"optional"` } func (newState *ListInstancePools) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListInstancePools) { @@ -3270,9 +12948,70 @@ func (newState *ListInstancePools) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListInstancePools) SyncEffectiveFieldsDuringRead(existingState ListInstancePools) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListInstancePools. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListInstancePools) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "instance_pools": reflect.TypeOf(InstancePoolAndStats{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListInstancePools +// only implements ToObjectValue() and Type(). +func (o ListInstancePools) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_pools": o.InstancePools, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListInstancePools) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_pools": basetypes.ListType{ + ElemType: InstancePoolAndStats{}.Type(ctx), + }, + }, + } +} + +// GetInstancePools returns the value of the InstancePools field in ListInstancePools as +// a slice of InstancePoolAndStats values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListInstancePools) GetInstancePools(ctx context.Context) ([]InstancePoolAndStats, bool) { + if o.InstancePools.IsNull() || o.InstancePools.IsUnknown() { + return nil, false + } + var v []InstancePoolAndStats + d := o.InstancePools.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInstancePools sets the value of the InstancePools field in ListInstancePools. +func (o *ListInstancePools) SetInstancePools(ctx context.Context, v []InstancePoolAndStats) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["instance_pools"] + t = t.(attr.TypeWithElementType).ElementType() + o.InstancePools = types.ListValueMust(t, vs) +} + type ListInstanceProfilesResponse struct { // A list of instance profiles that the user can access. - InstanceProfiles []InstanceProfile `tfsdk:"instance_profiles" tf:"optional"` + InstanceProfiles types.List `tfsdk:"instance_profiles" tf:"optional"` } func (newState *ListInstanceProfilesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListInstanceProfilesResponse) { @@ -3281,9 +13020,70 @@ func (newState *ListInstanceProfilesResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *ListInstanceProfilesResponse) SyncEffectiveFieldsDuringRead(existingState ListInstanceProfilesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListInstanceProfilesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListInstanceProfilesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "instance_profiles": reflect.TypeOf(InstanceProfile{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListInstanceProfilesResponse +// only implements ToObjectValue() and Type(). +func (o ListInstanceProfilesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_profiles": o.InstanceProfiles, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListInstanceProfilesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_profiles": basetypes.ListType{ + ElemType: InstanceProfile{}.Type(ctx), + }, + }, + } +} + +// GetInstanceProfiles returns the value of the InstanceProfiles field in ListInstanceProfilesResponse as +// a slice of InstanceProfile values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListInstanceProfilesResponse) GetInstanceProfiles(ctx context.Context) ([]InstanceProfile, bool) { + if o.InstanceProfiles.IsNull() || o.InstanceProfiles.IsUnknown() { + return nil, false + } + var v []InstanceProfile + d := o.InstanceProfiles.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInstanceProfiles sets the value of the InstanceProfiles field in ListInstanceProfilesResponse. +func (o *ListInstanceProfilesResponse) SetInstanceProfiles(ctx context.Context, v []InstanceProfile) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["instance_profiles"] + t = t.(attr.TypeWithElementType).ElementType() + o.InstanceProfiles = types.ListValueMust(t, vs) +} + type ListNodeTypesResponse struct { // The list of available Spark node types. - NodeTypes []NodeType `tfsdk:"node_types" tf:"optional"` + NodeTypes types.List `tfsdk:"node_types" tf:"optional"` } func (newState *ListNodeTypesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListNodeTypesResponse) { @@ -3292,9 +13092,70 @@ func (newState *ListNodeTypesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListNodeTypesResponse) SyncEffectiveFieldsDuringRead(existingState ListNodeTypesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNodeTypesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNodeTypesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "node_types": reflect.TypeOf(NodeType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNodeTypesResponse +// only implements ToObjectValue() and Type(). +func (o ListNodeTypesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "node_types": o.NodeTypes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNodeTypesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "node_types": basetypes.ListType{ + ElemType: NodeType{}.Type(ctx), + }, + }, + } +} + +// GetNodeTypes returns the value of the NodeTypes field in ListNodeTypesResponse as +// a slice of NodeType values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListNodeTypesResponse) GetNodeTypes(ctx context.Context) ([]NodeType, bool) { + if o.NodeTypes.IsNull() || o.NodeTypes.IsUnknown() { + return nil, false + } + var v []NodeType + d := o.NodeTypes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNodeTypes sets the value of the NodeTypes field in ListNodeTypesResponse. +func (o *ListNodeTypesResponse) SetNodeTypes(ctx context.Context, v []NodeType) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["node_types"] + t = t.(attr.TypeWithElementType).ElementType() + o.NodeTypes = types.ListValueMust(t, vs) +} + type ListPoliciesResponse struct { // List of policies. - Policies []Policy `tfsdk:"policies" tf:"optional"` + Policies types.List `tfsdk:"policies" tf:"optional"` } func (newState *ListPoliciesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListPoliciesResponse) { @@ -3303,6 +13164,67 @@ func (newState *ListPoliciesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListPoliciesResponse) SyncEffectiveFieldsDuringRead(existingState ListPoliciesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPoliciesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPoliciesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policies": reflect.TypeOf(Policy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPoliciesResponse +// only implements ToObjectValue() and Type(). +func (o ListPoliciesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policies": o.Policies, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPoliciesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policies": basetypes.ListType{ + ElemType: Policy{}.Type(ctx), + }, + }, + } +} + +// GetPolicies returns the value of the Policies field in ListPoliciesResponse as +// a slice of Policy values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPoliciesResponse) GetPolicies(ctx context.Context) ([]Policy, bool) { + if o.Policies.IsNull() || o.Policies.IsUnknown() { + return nil, false + } + var v []Policy + d := o.Policies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPolicies sets the value of the Policies field in ListPoliciesResponse. +func (o *ListPoliciesResponse) SetPolicies(ctx context.Context, v []Policy) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["policies"] + t = t.(attr.TypeWithElementType).ElementType() + o.Policies = types.ListValueMust(t, vs) +} + // List policy families type ListPolicyFamiliesRequest struct { // Maximum number of policy families to return. @@ -3317,12 +13239,45 @@ func (newState *ListPolicyFamiliesRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListPolicyFamiliesRequest) SyncEffectiveFieldsDuringRead(existingState ListPolicyFamiliesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPolicyFamiliesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPolicyFamiliesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPolicyFamiliesRequest +// only implements ToObjectValue() and Type(). +func (o ListPolicyFamiliesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPolicyFamiliesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListPolicyFamiliesResponse struct { // A token that can be used to get the next page of results. If not present, // there are no more results to show. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // List of policy families. - PolicyFamilies []PolicyFamily `tfsdk:"policy_families" tf:"optional"` + PolicyFamilies types.List `tfsdk:"policy_families" tf:"optional"` } func (newState *ListPolicyFamiliesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListPolicyFamiliesResponse) { @@ -3331,6 +13286,69 @@ func (newState *ListPolicyFamiliesResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListPolicyFamiliesResponse) SyncEffectiveFieldsDuringRead(existingState ListPolicyFamiliesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPolicyFamiliesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPolicyFamiliesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policy_families": reflect.TypeOf(PolicyFamily{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPolicyFamiliesResponse +// only implements ToObjectValue() and Type(). +func (o ListPolicyFamiliesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "policy_families": o.PolicyFamilies, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPolicyFamiliesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "policy_families": basetypes.ListType{ + ElemType: PolicyFamily{}.Type(ctx), + }, + }, + } +} + +// GetPolicyFamilies returns the value of the PolicyFamilies field in ListPolicyFamiliesResponse as +// a slice of PolicyFamily values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPolicyFamiliesResponse) GetPolicyFamilies(ctx context.Context) ([]PolicyFamily, bool) { + if o.PolicyFamilies.IsNull() || o.PolicyFamilies.IsUnknown() { + return nil, false + } + var v []PolicyFamily + d := o.PolicyFamilies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPolicyFamilies sets the value of the PolicyFamilies field in ListPolicyFamiliesResponse. +func (o *ListPolicyFamiliesResponse) SetPolicyFamilies(ctx context.Context, v []PolicyFamily) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["policy_families"] + t = t.(attr.TypeWithElementType).ElementType() + o.PolicyFamilies = types.ListValueMust(t, vs) +} + type LocalFileInfo struct { // local file destination, e.g. `file:/my/local/file.sh` Destination types.String `tfsdk:"destination" tf:""` @@ -3342,6 +13360,37 @@ func (newState *LocalFileInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Loca func (newState *LocalFileInfo) SyncEffectiveFieldsDuringRead(existingState LocalFileInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LocalFileInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LocalFileInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LocalFileInfo +// only implements ToObjectValue() and Type(). +func (o LocalFileInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LocalFileInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + }, + } +} + type LogAnalyticsInfo struct { // LogAnalyticsPrimaryKey types.String `tfsdk:"log_analytics_primary_key" tf:"optional"` @@ -3355,6 +13404,39 @@ func (newState *LogAnalyticsInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *LogAnalyticsInfo) SyncEffectiveFieldsDuringRead(existingState LogAnalyticsInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogAnalyticsInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogAnalyticsInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogAnalyticsInfo +// only implements ToObjectValue() and Type(). +func (o LogAnalyticsInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_analytics_primary_key": o.LogAnalyticsPrimaryKey, + "log_analytics_workspace_id": o.LogAnalyticsWorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogAnalyticsInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_analytics_primary_key": types.StringType, + "log_analytics_workspace_id": types.StringType, + }, + } +} + type LogSyncStatus struct { // The timestamp of last attempt. If the last attempt fails, // `last_exception` will contain the exception in the last attempt. @@ -3370,6 +13452,39 @@ func (newState *LogSyncStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogS func (newState *LogSyncStatus) SyncEffectiveFieldsDuringRead(existingState LogSyncStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogSyncStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogSyncStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogSyncStatus +// only implements ToObjectValue() and Type(). +func (o LogSyncStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "last_attempted": o.LastAttempted, + "last_exception": o.LastException, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogSyncStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "last_attempted": types.Int64Type, + "last_exception": types.StringType, + }, + } +} + type MavenLibrary struct { // Gradle-style maven coordinates. For example: "org.jsoup:jsoup:1.7.2". Coordinates types.String `tfsdk:"coordinates" tf:""` @@ -3378,7 +13493,7 @@ type MavenLibrary struct { // // Maven dependency exclusions: // https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html. - Exclusions []types.String `tfsdk:"exclusions" tf:"optional"` + Exclusions types.List `tfsdk:"exclusions" tf:"optional"` // Maven repo to install the Maven package from. If omitted, both Maven // Central Repository and Spark Packages are searched. Repo types.String `tfsdk:"repo" tf:"optional"` @@ -3390,6 +13505,71 @@ func (newState *MavenLibrary) SyncEffectiveFieldsDuringCreateOrUpdate(plan Maven func (newState *MavenLibrary) SyncEffectiveFieldsDuringRead(existingState MavenLibrary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MavenLibrary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MavenLibrary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exclusions": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MavenLibrary +// only implements ToObjectValue() and Type(). +func (o MavenLibrary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "coordinates": o.Coordinates, + "exclusions": o.Exclusions, + "repo": o.Repo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MavenLibrary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "coordinates": types.StringType, + "exclusions": basetypes.ListType{ + ElemType: types.StringType, + }, + "repo": types.StringType, + }, + } +} + +// GetExclusions returns the value of the Exclusions field in MavenLibrary as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *MavenLibrary) GetExclusions(ctx context.Context) ([]types.String, bool) { + if o.Exclusions.IsNull() || o.Exclusions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Exclusions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExclusions sets the value of the Exclusions field in MavenLibrary. +func (o *MavenLibrary) SetExclusions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exclusions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Exclusions = types.ListValueMust(t, vs) +} + type NodeInstanceType struct { InstanceTypeId types.String `tfsdk:"instance_type_id" tf:"optional"` @@ -3408,6 +13588,45 @@ func (newState *NodeInstanceType) SyncEffectiveFieldsDuringCreateOrUpdate(plan N func (newState *NodeInstanceType) SyncEffectiveFieldsDuringRead(existingState NodeInstanceType) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NodeInstanceType. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NodeInstanceType) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NodeInstanceType +// only implements ToObjectValue() and Type(). +func (o NodeInstanceType) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_type_id": o.InstanceTypeId, + "local_disk_size_gb": o.LocalDiskSizeGb, + "local_disks": o.LocalDisks, + "local_nvme_disk_size_gb": o.LocalNvmeDiskSizeGb, + "local_nvme_disks": o.LocalNvmeDisks, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NodeInstanceType) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_type_id": types.StringType, + "local_disk_size_gb": types.Int64Type, + "local_disks": types.Int64Type, + "local_nvme_disk_size_gb": types.Int64Type, + "local_nvme_disks": types.Int64Type, + }, + } +} + type NodeType struct { Category types.String `tfsdk:"category" tf:"optional"` // A string description associated with this node type, e.g., "r3.xlarge". @@ -3432,9 +13651,9 @@ type NodeType struct { // Memory (in MB) available for this node type. MemoryMb types.Int64 `tfsdk:"memory_mb" tf:""` - NodeInfo []CloudProviderNodeInfo `tfsdk:"node_info" tf:"optional,object"` + NodeInfo types.List `tfsdk:"node_info" tf:"optional,object"` - NodeInstanceType []NodeInstanceType `tfsdk:"node_instance_type" tf:"optional,object"` + NodeInstanceType types.List `tfsdk:"node_instance_type" tf:"optional,object"` // Unique identifier for this node type. NodeTypeId types.String `tfsdk:"node_type_id" tf:""` // Number of CPU cores available for this node type. Note that this can be @@ -3464,6 +13683,136 @@ func (newState *NodeType) SyncEffectiveFieldsDuringCreateOrUpdate(plan NodeType) func (newState *NodeType) SyncEffectiveFieldsDuringRead(existingState NodeType) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NodeType. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NodeType) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "node_info": reflect.TypeOf(CloudProviderNodeInfo{}), + "node_instance_type": reflect.TypeOf(NodeInstanceType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NodeType +// only implements ToObjectValue() and Type(). +func (o NodeType) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "category": o.Category, + "description": o.Description, + "display_order": o.DisplayOrder, + "instance_type_id": o.InstanceTypeId, + "is_deprecated": o.IsDeprecated, + "is_encrypted_in_transit": o.IsEncryptedInTransit, + "is_graviton": o.IsGraviton, + "is_hidden": o.IsHidden, + "is_io_cache_enabled": o.IsIoCacheEnabled, + "memory_mb": o.MemoryMb, + "node_info": o.NodeInfo, + "node_instance_type": o.NodeInstanceType, + "node_type_id": o.NodeTypeId, + "num_cores": o.NumCores, + "num_gpus": o.NumGpus, + "photon_driver_capable": o.PhotonDriverCapable, + "photon_worker_capable": o.PhotonWorkerCapable, + "support_cluster_tags": o.SupportClusterTags, + "support_ebs_volumes": o.SupportEbsVolumes, + "support_port_forwarding": o.SupportPortForwarding, + "supports_elastic_disk": o.SupportsElasticDisk, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NodeType) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "category": types.StringType, + "description": types.StringType, + "display_order": types.Int64Type, + "instance_type_id": types.StringType, + "is_deprecated": types.BoolType, + "is_encrypted_in_transit": types.BoolType, + "is_graviton": types.BoolType, + "is_hidden": types.BoolType, + "is_io_cache_enabled": types.BoolType, + "memory_mb": types.Int64Type, + "node_info": basetypes.ListType{ + ElemType: CloudProviderNodeInfo{}.Type(ctx), + }, + "node_instance_type": basetypes.ListType{ + ElemType: NodeInstanceType{}.Type(ctx), + }, + "node_type_id": types.StringType, + "num_cores": types.Float64Type, + "num_gpus": types.Int64Type, + "photon_driver_capable": types.BoolType, + "photon_worker_capable": types.BoolType, + "support_cluster_tags": types.BoolType, + "support_ebs_volumes": types.BoolType, + "support_port_forwarding": types.BoolType, + "supports_elastic_disk": types.BoolType, + }, + } +} + +// GetNodeInfo returns the value of the NodeInfo field in NodeType as +// a CloudProviderNodeInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *NodeType) GetNodeInfo(ctx context.Context) (CloudProviderNodeInfo, bool) { + var e CloudProviderNodeInfo + if o.NodeInfo.IsNull() || o.NodeInfo.IsUnknown() { + return e, false + } + var v []CloudProviderNodeInfo + d := o.NodeInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNodeInfo sets the value of the NodeInfo field in NodeType. +func (o *NodeType) SetNodeInfo(ctx context.Context, v CloudProviderNodeInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["node_info"] + o.NodeInfo = types.ListValueMust(t, vs) +} + +// GetNodeInstanceType returns the value of the NodeInstanceType field in NodeType as +// a NodeInstanceType value. +// If the field is unknown or null, the boolean return value is false. +func (o *NodeType) GetNodeInstanceType(ctx context.Context) (NodeInstanceType, bool) { + var e NodeInstanceType + if o.NodeInstanceType.IsNull() || o.NodeInstanceType.IsUnknown() { + return e, false + } + var v []NodeInstanceType + d := o.NodeInstanceType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNodeInstanceType sets the value of the NodeInstanceType field in NodeType. +func (o *NodeType) SetNodeInstanceType(ctx context.Context, v NodeInstanceType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["node_instance_type"] + o.NodeInstanceType = types.ListValueMust(t, vs) +} + type PendingInstanceError struct { InstanceId types.String `tfsdk:"instance_id" tf:"optional"` @@ -3476,6 +13825,39 @@ func (newState *PendingInstanceError) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *PendingInstanceError) SyncEffectiveFieldsDuringRead(existingState PendingInstanceError) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PendingInstanceError. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PendingInstanceError) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PendingInstanceError +// only implements ToObjectValue() and Type(). +func (o PendingInstanceError) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_id": o.InstanceId, + "message": o.Message, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PendingInstanceError) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_id": types.StringType, + "message": types.StringType, + }, + } +} + type PermanentDeleteCluster struct { // The cluster to be deleted. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -3487,6 +13869,37 @@ func (newState *PermanentDeleteCluster) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *PermanentDeleteCluster) SyncEffectiveFieldsDuringRead(existingState PermanentDeleteCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermanentDeleteCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermanentDeleteCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermanentDeleteCluster +// only implements ToObjectValue() and Type(). +func (o PermanentDeleteCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermanentDeleteCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type PermanentDeleteClusterResponse struct { } @@ -3496,6 +13909,33 @@ func (newState *PermanentDeleteClusterResponse) SyncEffectiveFieldsDuringCreateO func (newState *PermanentDeleteClusterResponse) SyncEffectiveFieldsDuringRead(existingState PermanentDeleteClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermanentDeleteClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermanentDeleteClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermanentDeleteClusterResponse +// only implements ToObjectValue() and Type(). +func (o PermanentDeleteClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PermanentDeleteClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type PinCluster struct { // ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -3507,6 +13947,37 @@ func (newState *PinCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan PinClus func (newState *PinCluster) SyncEffectiveFieldsDuringRead(existingState PinCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PinCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PinCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PinCluster +// only implements ToObjectValue() and Type(). +func (o PinCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PinCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type PinClusterResponse struct { } @@ -3516,6 +13987,33 @@ func (newState *PinClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PinClusterResponse) SyncEffectiveFieldsDuringRead(existingState PinClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PinClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PinClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PinClusterResponse +// only implements ToObjectValue() and Type(). +func (o PinClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PinClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Describes a Cluster Policy entity. type Policy struct { // Creation time. The timestamp (in millisecond) when this Cluster Policy @@ -3537,7 +14035,7 @@ type Policy struct { IsDefault types.Bool `tfsdk:"is_default" tf:"optional"` // A list of libraries to be installed on the next cluster restart that uses // this policy. The maximum number of libraries is 500. - Libraries []Library `tfsdk:"libraries" tf:"optional"` + Libraries types.List `tfsdk:"libraries" tf:"optional"` // Max number of clusters per user that can be active using this policy. If // not present, there is no max limit. MaxClustersPerUser types.Int64 `tfsdk:"max_clusters_per_user" tf:"optional"` @@ -3571,6 +14069,87 @@ func (newState *Policy) SyncEffectiveFieldsDuringCreateOrUpdate(plan Policy) { func (newState *Policy) SyncEffectiveFieldsDuringRead(existingState Policy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Policy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Policy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "libraries": reflect.TypeOf(Library{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Policy +// only implements ToObjectValue() and Type(). +func (o Policy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at_timestamp": o.CreatedAtTimestamp, + "creator_user_name": o.CreatorUserName, + "definition": o.Definition, + "description": o.Description, + "is_default": o.IsDefault, + "libraries": o.Libraries, + "max_clusters_per_user": o.MaxClustersPerUser, + "name": o.Name, + "policy_family_definition_overrides": o.PolicyFamilyDefinitionOverrides, + "policy_family_id": o.PolicyFamilyId, + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Policy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at_timestamp": types.Int64Type, + "creator_user_name": types.StringType, + "definition": types.StringType, + "description": types.StringType, + "is_default": types.BoolType, + "libraries": basetypes.ListType{ + ElemType: Library{}.Type(ctx), + }, + "max_clusters_per_user": types.Int64Type, + "name": types.StringType, + "policy_family_definition_overrides": types.StringType, + "policy_family_id": types.StringType, + "policy_id": types.StringType, + }, + } +} + +// GetLibraries returns the value of the Libraries field in Policy as +// a slice of Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *Policy) GetLibraries(ctx context.Context) ([]Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in Policy. +func (o *Policy) SetLibraries(ctx context.Context, v []Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + type PolicyFamily struct { // Policy definition document expressed in [Databricks Cluster Policy // Definition Language]. @@ -3591,6 +14170,43 @@ func (newState *PolicyFamily) SyncEffectiveFieldsDuringCreateOrUpdate(plan Polic func (newState *PolicyFamily) SyncEffectiveFieldsDuringRead(existingState PolicyFamily) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PolicyFamily. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PolicyFamily) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PolicyFamily +// only implements ToObjectValue() and Type(). +func (o PolicyFamily) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "definition": o.Definition, + "description": o.Description, + "name": o.Name, + "policy_family_id": o.PolicyFamilyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PolicyFamily) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "definition": types.StringType, + "description": types.StringType, + "name": types.StringType, + "policy_family_id": types.StringType, + }, + } +} + type PythonPyPiLibrary struct { // The name of the pypi package to install. An optional exact version // specification is also supported. Examples: "simplejson" and @@ -3607,6 +14223,39 @@ func (newState *PythonPyPiLibrary) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PythonPyPiLibrary) SyncEffectiveFieldsDuringRead(existingState PythonPyPiLibrary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PythonPyPiLibrary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PythonPyPiLibrary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PythonPyPiLibrary +// only implements ToObjectValue() and Type(). +func (o PythonPyPiLibrary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "package": o.Package, + "repo": o.Repo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PythonPyPiLibrary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "package": types.StringType, + "repo": types.StringType, + }, + } +} + type RCranLibrary struct { // The name of the CRAN package to install. Package types.String `tfsdk:"package" tf:""` @@ -3621,6 +14270,39 @@ func (newState *RCranLibrary) SyncEffectiveFieldsDuringCreateOrUpdate(plan RCran func (newState *RCranLibrary) SyncEffectiveFieldsDuringRead(existingState RCranLibrary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RCranLibrary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RCranLibrary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RCranLibrary +// only implements ToObjectValue() and Type(). +func (o RCranLibrary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "package": o.Package, + "repo": o.Repo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RCranLibrary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "package": types.StringType, + "repo": types.StringType, + }, + } +} + type RemoveInstanceProfile struct { // The ARN of the instance profile to remove. This field is required. InstanceProfileArn types.String `tfsdk:"instance_profile_arn" tf:""` @@ -3632,6 +14314,37 @@ func (newState *RemoveInstanceProfile) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *RemoveInstanceProfile) SyncEffectiveFieldsDuringRead(existingState RemoveInstanceProfile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RemoveInstanceProfile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RemoveInstanceProfile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RemoveInstanceProfile +// only implements ToObjectValue() and Type(). +func (o RemoveInstanceProfile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance_profile_arn": o.InstanceProfileArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RemoveInstanceProfile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance_profile_arn": types.StringType, + }, + } +} + type RemoveResponse struct { } @@ -3641,11 +14354,38 @@ func (newState *RemoveResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Rem func (newState *RemoveResponse) SyncEffectiveFieldsDuringRead(existingState RemoveResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RemoveResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RemoveResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RemoveResponse +// only implements ToObjectValue() and Type(). +func (o RemoveResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RemoveResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ResizeCluster struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // The cluster to be resized. ClusterId types.String `tfsdk:"cluster_id" tf:""` // Number of worker nodes that this cluster should have. A cluster has one @@ -3667,6 +14407,71 @@ func (newState *ResizeCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Resi func (newState *ResizeCluster) SyncEffectiveFieldsDuringRead(existingState ResizeCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResizeCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResizeCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResizeCluster +// only implements ToObjectValue() and Type(). +func (o ResizeCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "autoscale": o.Autoscale, + "cluster_id": o.ClusterId, + "num_workers": o.NumWorkers, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResizeCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "cluster_id": types.StringType, + "num_workers": types.Int64Type, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in ResizeCluster as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResizeCluster) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in ResizeCluster. +func (o *ResizeCluster) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + type ResizeClusterResponse struct { } @@ -3676,6 +14481,33 @@ func (newState *ResizeClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ResizeClusterResponse) SyncEffectiveFieldsDuringRead(existingState ResizeClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResizeClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResizeClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResizeClusterResponse +// only implements ToObjectValue() and Type(). +func (o ResizeClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ResizeClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type RestartCluster struct { // The cluster to be started. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -3689,6 +14521,39 @@ func (newState *RestartCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Res func (newState *RestartCluster) SyncEffectiveFieldsDuringRead(existingState RestartCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestartCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestartCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestartCluster +// only implements ToObjectValue() and Type(). +func (o RestartCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "restart_user": o.RestartUser, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestartCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "restart_user": types.StringType, + }, + } +} + type RestartClusterResponse struct { } @@ -3698,15 +14563,42 @@ func (newState *RestartClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *RestartClusterResponse) SyncEffectiveFieldsDuringRead(existingState RestartClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestartClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestartClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestartClusterResponse +// only implements ToObjectValue() and Type(). +func (o RestartClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RestartClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Results struct { // The cause of the error Cause types.String `tfsdk:"cause" tf:"optional"` - Data any `tfsdk:"data" tf:"optional"` + Data types.Object `tfsdk:"data" tf:"optional"` // The image filename FileName types.String `tfsdk:"fileName" tf:"optional"` - FileNames []types.String `tfsdk:"fileNames" tf:"optional"` + FileNames types.List `tfsdk:"fileNames" tf:"optional"` // true if a JSON schema is returned instead of a string representation of // the Hive type. IsJsonSchema types.Bool `tfsdk:"isJsonSchema" tf:"optional"` @@ -3715,7 +14607,7 @@ type Results struct { ResultType types.String `tfsdk:"resultType" tf:"optional"` // The table schema - Schema []map[string]any `tfsdk:"schema" tf:"optional"` + Schema types.List `tfsdk:"schema" tf:"optional"` // The summary of the error Summary types.String `tfsdk:"summary" tf:"optional"` // true if partial results are returned. @@ -3728,6 +14620,116 @@ func (newState *Results) SyncEffectiveFieldsDuringCreateOrUpdate(plan Results) { func (newState *Results) SyncEffectiveFieldsDuringRead(existingState Results) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Results. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Results) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "fileNames": reflect.TypeOf(types.String{}), + "schema": reflect.TypeOf(types.Object{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Results +// only implements ToObjectValue() and Type(). +func (o Results) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cause": o.Cause, + "data": o.Data, + "fileName": o.FileName, + "fileNames": o.FileNames, + "isJsonSchema": o.IsJsonSchema, + "pos": o.Pos, + "resultType": o.ResultType, + "schema": o.Schema, + "summary": o.Summary, + "truncated": o.Truncated, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Results) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cause": types.StringType, + "data": types.ObjectType{}, + "fileName": types.StringType, + "fileNames": basetypes.ListType{ + ElemType: types.StringType, + }, + "isJsonSchema": types.BoolType, + "pos": types.Int64Type, + "resultType": types.StringType, + "schema": basetypes.ListType{ + ElemType: basetypes.MapType{ + ElemType: types.ObjectType{}, + }, + }, + "summary": types.StringType, + "truncated": types.BoolType, + }, + } +} + +// GetFileNames returns the value of the FileNames field in Results as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Results) GetFileNames(ctx context.Context) ([]types.String, bool) { + if o.FileNames.IsNull() || o.FileNames.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FileNames.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFileNames sets the value of the FileNames field in Results. +func (o *Results) SetFileNames(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["fileNames"] + t = t.(attr.TypeWithElementType).ElementType() + o.FileNames = types.ListValueMust(t, vs) +} + +// GetSchema returns the value of the Schema field in Results as +// a slice of types.Object values. +// If the field is unknown or null, the boolean return value is false. +func (o *Results) GetSchema(ctx context.Context) ([]types.Object, bool) { + if o.Schema.IsNull() || o.Schema.IsUnknown() { + return nil, false + } + var v []types.Object + d := o.Schema.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchema sets the value of the Schema field in Results. +func (o *Results) SetSchema(ctx context.Context, v []types.Object) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schema"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schema = types.ListValueMust(t, vs) +} + type S3StorageInfo struct { // (Optional) Set canned access control list for the logs, e.g. // `bucket-owner-full-control`. If `canned_cal` is set, please make sure the @@ -3767,13 +14769,56 @@ func (newState *S3StorageInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan S3St func (newState *S3StorageInfo) SyncEffectiveFieldsDuringRead(existingState S3StorageInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in S3StorageInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a S3StorageInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, S3StorageInfo +// only implements ToObjectValue() and Type(). +func (o S3StorageInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "canned_acl": o.CannedAcl, + "destination": o.Destination, + "enable_encryption": o.EnableEncryption, + "encryption_type": o.EncryptionType, + "endpoint": o.Endpoint, + "kms_key": o.KmsKey, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o S3StorageInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "canned_acl": types.StringType, + "destination": types.StringType, + "enable_encryption": types.BoolType, + "encryption_type": types.StringType, + "endpoint": types.StringType, + "kms_key": types.StringType, + "region": types.StringType, + }, + } +} + type SparkNode struct { // The private IP address of the host instance. HostPrivateIp types.String `tfsdk:"host_private_ip" tf:"optional"` // Globally unique identifier for the host instance from the cloud provider. InstanceId types.String `tfsdk:"instance_id" tf:"optional"` // Attributes specific to AWS for a Spark node. - NodeAwsAttributes []SparkNodeAwsAttributes `tfsdk:"node_aws_attributes" tf:"optional,object"` + NodeAwsAttributes types.List `tfsdk:"node_aws_attributes" tf:"optional,object"` // Globally unique identifier for this node. NodeId types.String `tfsdk:"node_id" tf:"optional"` // Private IP address (typically a 10.x.x.x address) of the Spark node. Note @@ -3801,6 +14846,79 @@ func (newState *SparkNode) SyncEffectiveFieldsDuringCreateOrUpdate(plan SparkNod func (newState *SparkNode) SyncEffectiveFieldsDuringRead(existingState SparkNode) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparkNode. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparkNode) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "node_aws_attributes": reflect.TypeOf(SparkNodeAwsAttributes{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparkNode +// only implements ToObjectValue() and Type(). +func (o SparkNode) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "host_private_ip": o.HostPrivateIp, + "instance_id": o.InstanceId, + "node_aws_attributes": o.NodeAwsAttributes, + "node_id": o.NodeId, + "private_ip": o.PrivateIp, + "public_dns": o.PublicDns, + "start_timestamp": o.StartTimestamp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparkNode) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "host_private_ip": types.StringType, + "instance_id": types.StringType, + "node_aws_attributes": basetypes.ListType{ + ElemType: SparkNodeAwsAttributes{}.Type(ctx), + }, + "node_id": types.StringType, + "private_ip": types.StringType, + "public_dns": types.StringType, + "start_timestamp": types.Int64Type, + }, + } +} + +// GetNodeAwsAttributes returns the value of the NodeAwsAttributes field in SparkNode as +// a SparkNodeAwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *SparkNode) GetNodeAwsAttributes(ctx context.Context) (SparkNodeAwsAttributes, bool) { + var e SparkNodeAwsAttributes + if o.NodeAwsAttributes.IsNull() || o.NodeAwsAttributes.IsUnknown() { + return e, false + } + var v []SparkNodeAwsAttributes + d := o.NodeAwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNodeAwsAttributes sets the value of the NodeAwsAttributes field in SparkNode. +func (o *SparkNode) SetNodeAwsAttributes(ctx context.Context, v SparkNodeAwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["node_aws_attributes"] + o.NodeAwsAttributes = types.ListValueMust(t, vs) +} + type SparkNodeAwsAttributes struct { // Whether this node is on an Amazon spot instance. IsSpot types.Bool `tfsdk:"is_spot" tf:"optional"` @@ -3812,6 +14930,37 @@ func (newState *SparkNodeAwsAttributes) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *SparkNodeAwsAttributes) SyncEffectiveFieldsDuringRead(existingState SparkNodeAwsAttributes) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparkNodeAwsAttributes. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparkNodeAwsAttributes) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparkNodeAwsAttributes +// only implements ToObjectValue() and Type(). +func (o SparkNodeAwsAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_spot": o.IsSpot, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparkNodeAwsAttributes) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_spot": types.BoolType, + }, + } +} + type SparkVersion struct { // Spark version key, for example "2.1.x-scala2.11". This is the value which // should be provided as the "spark_version" when creating a new cluster. @@ -3829,6 +14978,39 @@ func (newState *SparkVersion) SyncEffectiveFieldsDuringCreateOrUpdate(plan Spark func (newState *SparkVersion) SyncEffectiveFieldsDuringRead(existingState SparkVersion) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparkVersion. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparkVersion) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparkVersion +// only implements ToObjectValue() and Type(). +func (o SparkVersion) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparkVersion) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "name": types.StringType, + }, + } +} + type StartCluster struct { // The cluster to be started. ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -3840,6 +15022,37 @@ func (newState *StartCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Start func (newState *StartCluster) SyncEffectiveFieldsDuringRead(existingState StartCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartCluster +// only implements ToObjectValue() and Type(). +func (o StartCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StartCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type StartClusterResponse struct { } @@ -3849,14 +15062,41 @@ func (newState *StartClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *StartClusterResponse) SyncEffectiveFieldsDuringRead(existingState StartClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartClusterResponse +// only implements ToObjectValue() and Type(). +func (o StartClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o StartClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type TerminationReason struct { // status code indicating why the cluster was terminated Code types.String `tfsdk:"code" tf:"optional"` // list of parameters that provide additional information about why the // cluster was terminated - Parameters map[string]types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.Map `tfsdk:"parameters" tf:"optional"` // type of the termination - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *TerminationReason) SyncEffectiveFieldsDuringCreateOrUpdate(plan TerminationReason) { @@ -3865,11 +15105,76 @@ func (newState *TerminationReason) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TerminationReason) SyncEffectiveFieldsDuringRead(existingState TerminationReason) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TerminationReason. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TerminationReason) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TerminationReason +// only implements ToObjectValue() and Type(). +func (o TerminationReason) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "code": o.Code, + "parameters": o.Parameters, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TerminationReason) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "code": types.StringType, + "parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "type": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in TerminationReason as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TerminationReason) GetParameters(ctx context.Context) (map[string]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in TerminationReason. +func (o *TerminationReason) SetParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.MapValueMust(t, vs) +} + type UninstallLibraries struct { // Unique identifier for the cluster on which to uninstall these libraries. ClusterId types.String `tfsdk:"cluster_id" tf:""` // The libraries to uninstall. - Libraries []Library `tfsdk:"libraries" tf:""` + Libraries types.List `tfsdk:"libraries" tf:""` } func (newState *UninstallLibraries) SyncEffectiveFieldsDuringCreateOrUpdate(plan UninstallLibraries) { @@ -3878,6 +15183,69 @@ func (newState *UninstallLibraries) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UninstallLibraries) SyncEffectiveFieldsDuringRead(existingState UninstallLibraries) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UninstallLibraries. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UninstallLibraries) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "libraries": reflect.TypeOf(Library{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UninstallLibraries +// only implements ToObjectValue() and Type(). +func (o UninstallLibraries) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "libraries": o.Libraries, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UninstallLibraries) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "libraries": basetypes.ListType{ + ElemType: Library{}.Type(ctx), + }, + }, + } +} + +// GetLibraries returns the value of the Libraries field in UninstallLibraries as +// a slice of Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *UninstallLibraries) GetLibraries(ctx context.Context) ([]Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in UninstallLibraries. +func (o *UninstallLibraries) SetLibraries(ctx context.Context, v []Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + type UninstallLibrariesResponse struct { } @@ -3887,6 +15255,33 @@ func (newState *UninstallLibrariesResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UninstallLibrariesResponse) SyncEffectiveFieldsDuringRead(existingState UninstallLibrariesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UninstallLibrariesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UninstallLibrariesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UninstallLibrariesResponse +// only implements ToObjectValue() and Type(). +func (o UninstallLibrariesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UninstallLibrariesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UnpinCluster struct { // ClusterId types.String `tfsdk:"cluster_id" tf:""` @@ -3898,6 +15293,37 @@ func (newState *UnpinCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Unpin func (newState *UnpinCluster) SyncEffectiveFieldsDuringRead(existingState UnpinCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UnpinCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UnpinCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UnpinCluster +// only implements ToObjectValue() and Type(). +func (o UnpinCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UnpinCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + }, + } +} + type UnpinClusterResponse struct { } @@ -3907,9 +15333,36 @@ func (newState *UnpinClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *UnpinClusterResponse) SyncEffectiveFieldsDuringRead(existingState UnpinClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UnpinClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UnpinClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UnpinClusterResponse +// only implements ToObjectValue() and Type(). +func (o UnpinClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UnpinClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateCluster struct { // The cluster to be updated. - Cluster []UpdateClusterResource `tfsdk:"cluster" tf:"optional,object"` + Cluster types.List `tfsdk:"cluster" tf:"optional,object"` // ID of the cluster. ClusterId types.String `tfsdk:"cluster_id" tf:""` // Specifies which fields of the cluster will be updated. This is required @@ -3926,11 +15379,76 @@ func (newState *UpdateCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upda func (newState *UpdateCluster) SyncEffectiveFieldsDuringRead(existingState UpdateCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster": reflect.TypeOf(UpdateClusterResource{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCluster +// only implements ToObjectValue() and Type(). +func (o UpdateCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster": o.Cluster, + "cluster_id": o.ClusterId, + "update_mask": o.UpdateMask, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster": basetypes.ListType{ + ElemType: UpdateClusterResource{}.Type(ctx), + }, + "cluster_id": types.StringType, + "update_mask": types.StringType, + }, + } +} + +// GetCluster returns the value of the Cluster field in UpdateCluster as +// a UpdateClusterResource value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCluster) GetCluster(ctx context.Context) (UpdateClusterResource, bool) { + var e UpdateClusterResource + if o.Cluster.IsNull() || o.Cluster.IsUnknown() { + return e, false + } + var v []UpdateClusterResource + d := o.Cluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCluster sets the value of the Cluster field in UpdateCluster. +func (o *UpdateCluster) SetCluster(ctx context.Context, v UpdateClusterResource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster"] + o.Cluster = types.ListValueMust(t, vs) +} + type UpdateClusterResource struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []AutoScale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 @@ -3939,17 +15457,17 @@ type UpdateClusterResource struct { AutoterminationMinutes types.Int64 `tfsdk:"autotermination_minutes" tf:"optional"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes []AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes []AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // The configuration for delivering spark logs to a long-term storage // destination. Two kinds of destinations (dbfs and s3) are supported. Only // one destination can be specified for one cluster. If the conf is given, // the logs will be delivered to the destination every `5 mins`. The // destination of driver logs is `$destination/$clusterId/driver`, while the // destination of executor logs is `$destination/$clusterId/executor`. - ClusterLogConf []ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. ClusterName types.String `tfsdk:"cluster_name" tf:"optional"` @@ -3961,7 +15479,7 @@ type UpdateClusterResource struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // Data security mode decides what data governance model to use when // accessing data from a cluster. // @@ -3986,7 +15504,7 @@ type UpdateClusterResource struct { // mode provides a way that doesn’t have UC nor passthrough enabled. DataSecurityMode types.String `tfsdk:"data_security_mode" tf:"optional"` - DockerImage []DockerImage `tfsdk:"docker_image" tf:"optional,object"` + DockerImage types.List `tfsdk:"docker_image" tf:"optional,object"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -4004,12 +15522,12 @@ type UpdateClusterResource struct { EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes []GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts []InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // This field encodes, through a single value, the resources available to @@ -4047,7 +15565,7 @@ type UpdateClusterResource struct { // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form // (X,Y) will be exported as is (i.e., `export X='Y'`) while launching the @@ -4061,7 +15579,7 @@ type UpdateClusterResource struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. @@ -4069,9 +15587,9 @@ type UpdateClusterResource struct { // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` - WorkloadType []WorkloadType `tfsdk:"workload_type" tf:"optional,object"` + WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } func (newState *UpdateClusterResource) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateClusterResource) { @@ -4080,6 +15598,436 @@ func (newState *UpdateClusterResource) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateClusterResource) SyncEffectiveFieldsDuringRead(existingState UpdateClusterResource) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateClusterResource. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateClusterResource) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(AutoScale{}), + "aws_attributes": reflect.TypeOf(AwsAttributes{}), + "azure_attributes": reflect.TypeOf(AzureAttributes{}), + "cluster_log_conf": reflect.TypeOf(ClusterLogConf{}), + "custom_tags": reflect.TypeOf(types.String{}), + "docker_image": reflect.TypeOf(DockerImage{}), + "gcp_attributes": reflect.TypeOf(GcpAttributes{}), + "init_scripts": reflect.TypeOf(InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + "workload_type": reflect.TypeOf(WorkloadType{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateClusterResource +// only implements ToObjectValue() and Type(). +func (o UpdateClusterResource) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "autoscale": o.Autoscale, + "autotermination_minutes": o.AutoterminationMinutes, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "cluster_log_conf": o.ClusterLogConf, + "cluster_name": o.ClusterName, + "custom_tags": o.CustomTags, + "data_security_mode": o.DataSecurityMode, + "docker_image": o.DockerImage, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_elastic_disk": o.EnableElasticDisk, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "node_type_id": o.NodeTypeId, + "num_workers": o.NumWorkers, + "policy_id": o.PolicyId, + "runtime_engine": o.RuntimeEngine, + "single_user_name": o.SingleUserName, + "spark_conf": o.SparkConf, + "spark_env_vars": o.SparkEnvVars, + "spark_version": o.SparkVersion, + "ssh_public_keys": o.SshPublicKeys, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateClusterResource) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "autoscale": basetypes.ListType{ + ElemType: AutoScale{}.Type(ctx), + }, + "autotermination_minutes": types.Int64Type, + "aws_attributes": basetypes.ListType{ + ElemType: AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: AzureAttributes{}.Type(ctx), + }, + "cluster_log_conf": basetypes.ListType{ + ElemType: ClusterLogConf{}.Type(ctx), + }, + "cluster_name": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "data_security_mode": types.StringType, + "docker_image": basetypes.ListType{ + ElemType: DockerImage{}.Type(ctx), + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_elastic_disk": types.BoolType, + "enable_local_disk_encryption": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "node_type_id": types.StringType, + "num_workers": types.Int64Type, + "policy_id": types.StringType, + "runtime_engine": types.StringType, + "single_user_name": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_version": types.StringType, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "workload_type": basetypes.ListType{ + ElemType: WorkloadType{}.Type(ctx), + }, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in UpdateClusterResource as +// a AutoScale value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetAutoscale(ctx context.Context) (AutoScale, bool) { + var e AutoScale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []AutoScale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in UpdateClusterResource. +func (o *UpdateClusterResource) SetAutoscale(ctx context.Context, v AutoScale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + +// GetAwsAttributes returns the value of the AwsAttributes field in UpdateClusterResource as +// a AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetAwsAttributes(ctx context.Context) (AwsAttributes, bool) { + var e AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in UpdateClusterResource. +func (o *UpdateClusterResource) SetAwsAttributes(ctx context.Context, v AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in UpdateClusterResource as +// a AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetAzureAttributes(ctx context.Context) (AzureAttributes, bool) { + var e AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in UpdateClusterResource. +func (o *UpdateClusterResource) SetAzureAttributes(ctx context.Context, v AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in UpdateClusterResource as +// a ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetClusterLogConf(ctx context.Context) (ClusterLogConf, bool) { + var e ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in UpdateClusterResource. +func (o *UpdateClusterResource) SetClusterLogConf(ctx context.Context, v ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in UpdateClusterResource as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in UpdateClusterResource. +func (o *UpdateClusterResource) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetDockerImage returns the value of the DockerImage field in UpdateClusterResource as +// a DockerImage value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetDockerImage(ctx context.Context) (DockerImage, bool) { + var e DockerImage + if o.DockerImage.IsNull() || o.DockerImage.IsUnknown() { + return e, false + } + var v []DockerImage + d := o.DockerImage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDockerImage sets the value of the DockerImage field in UpdateClusterResource. +func (o *UpdateClusterResource) SetDockerImage(ctx context.Context, v DockerImage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["docker_image"] + o.DockerImage = types.ListValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in UpdateClusterResource as +// a GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetGcpAttributes(ctx context.Context) (GcpAttributes, bool) { + var e GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in UpdateClusterResource. +func (o *UpdateClusterResource) SetGcpAttributes(ctx context.Context, v GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in UpdateClusterResource as +// a slice of InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetInitScripts(ctx context.Context) ([]InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in UpdateClusterResource. +func (o *UpdateClusterResource) SetInitScripts(ctx context.Context, v []InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in UpdateClusterResource as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in UpdateClusterResource. +func (o *UpdateClusterResource) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in UpdateClusterResource as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in UpdateClusterResource. +func (o *UpdateClusterResource) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in UpdateClusterResource as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in UpdateClusterResource. +func (o *UpdateClusterResource) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + +// GetWorkloadType returns the value of the WorkloadType field in UpdateClusterResource as +// a WorkloadType value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateClusterResource) GetWorkloadType(ctx context.Context) (WorkloadType, bool) { + var e WorkloadType + if o.WorkloadType.IsNull() || o.WorkloadType.IsUnknown() { + return e, false + } + var v []WorkloadType + d := o.WorkloadType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWorkloadType sets the value of the WorkloadType field in UpdateClusterResource. +func (o *UpdateClusterResource) SetWorkloadType(ctx context.Context, v WorkloadType) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workload_type"] + o.WorkloadType = types.ListValueMust(t, vs) +} + type UpdateClusterResponse struct { } @@ -4089,6 +16037,33 @@ func (newState *UpdateClusterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateClusterResponse) SyncEffectiveFieldsDuringRead(existingState UpdateClusterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateClusterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateClusterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateClusterResponse +// only implements ToObjectValue() and Type(). +func (o UpdateClusterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateClusterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateResponse struct { } @@ -4098,6 +16073,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type VolumesStorageInfo struct { // Unity Catalog Volumes file destination, e.g. `/Volumes/my-init.sh` Destination types.String `tfsdk:"destination" tf:""` @@ -4109,9 +16111,40 @@ func (newState *VolumesStorageInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *VolumesStorageInfo) SyncEffectiveFieldsDuringRead(existingState VolumesStorageInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in VolumesStorageInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a VolumesStorageInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, VolumesStorageInfo +// only implements ToObjectValue() and Type(). +func (o VolumesStorageInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o VolumesStorageInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + }, + } +} + type WorkloadType struct { // defined what type of clients can use the cluster. E.g. Notebooks, Jobs - Clients []ClientsTypes `tfsdk:"clients" tf:"object"` + Clients types.List `tfsdk:"clients" tf:"object"` } func (newState *WorkloadType) SyncEffectiveFieldsDuringCreateOrUpdate(plan WorkloadType) { @@ -4120,6 +16153,67 @@ func (newState *WorkloadType) SyncEffectiveFieldsDuringCreateOrUpdate(plan Workl func (newState *WorkloadType) SyncEffectiveFieldsDuringRead(existingState WorkloadType) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkloadType. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkloadType) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clients": reflect.TypeOf(ClientsTypes{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkloadType +// only implements ToObjectValue() and Type(). +func (o WorkloadType) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clients": o.Clients, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkloadType) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clients": basetypes.ListType{ + ElemType: ClientsTypes{}.Type(ctx), + }, + }, + } +} + +// GetClients returns the value of the Clients field in WorkloadType as +// a ClientsTypes value. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkloadType) GetClients(ctx context.Context) (ClientsTypes, bool) { + var e ClientsTypes + if o.Clients.IsNull() || o.Clients.IsUnknown() { + return e, false + } + var v []ClientsTypes + d := o.Clients.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClients sets the value of the Clients field in WorkloadType. +func (o *WorkloadType) SetClients(ctx context.Context, v ClientsTypes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clients"] + o.Clients = types.ListValueMust(t, vs) +} + type WorkspaceStorageInfo struct { // workspace files destination, e.g. // `/Users/user1@databricks.com/my-init.sh` @@ -4131,3 +16225,34 @@ func (newState *WorkspaceStorageInfo) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *WorkspaceStorageInfo) SyncEffectiveFieldsDuringRead(existingState WorkspaceStorageInfo) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceStorageInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceStorageInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceStorageInfo +// only implements ToObjectValue() and Type(). +func (o WorkspaceStorageInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceStorageInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + }, + } +} diff --git a/internal/service/dashboards_tf/model.go b/internal/service/dashboards_tf/model.go index 9e0c94224..c77ba8ef1 100755 --- a/internal/service/dashboards_tf/model.go +++ b/internal/service/dashboards_tf/model.go @@ -11,13 +11,20 @@ We use go-native types for lists and maps intentionally for the ease for convert package dashboards_tf import ( - "github.com/databricks/databricks-sdk-go/service/sql" + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/databricks/terraform-provider-databricks/internal/service/sql_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) // Create dashboard type CreateDashboardRequest struct { - Dashboard []Dashboard `tfsdk:"dashboard" tf:"optional,object"` + Dashboard types.List `tfsdk:"dashboard" tf:"optional,object"` } func (newState *CreateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateDashboardRequest) { @@ -26,12 +33,73 @@ func (newState *CreateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateDashboardRequest) SyncEffectiveFieldsDuringRead(existingState CreateDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dashboard": reflect.TypeOf(Dashboard{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateDashboardRequest +// only implements ToObjectValue() and Type(). +func (o CreateDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard": o.Dashboard, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard": basetypes.ListType{ + ElemType: Dashboard{}.Type(ctx), + }, + }, + } +} + +// GetDashboard returns the value of the Dashboard field in CreateDashboardRequest as +// a Dashboard value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateDashboardRequest) GetDashboard(ctx context.Context) (Dashboard, bool) { + var e Dashboard + if o.Dashboard.IsNull() || o.Dashboard.IsUnknown() { + return e, false + } + var v []Dashboard + d := o.Dashboard.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDashboard sets the value of the Dashboard field in CreateDashboardRequest. +func (o *CreateDashboardRequest) SetDashboard(ctx context.Context, v Dashboard) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dashboard"] + o.Dashboard = types.ListValueMust(t, vs) +} + // Create dashboard schedule type CreateScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. DashboardId types.String `tfsdk:"-"` - Schedule []Schedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` } func (newState *CreateScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateScheduleRequest) { @@ -40,6 +108,69 @@ func (newState *CreateScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateScheduleRequest) SyncEffectiveFieldsDuringRead(existingState CreateScheduleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateScheduleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateScheduleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "schedule": reflect.TypeOf(Schedule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateScheduleRequest +// only implements ToObjectValue() and Type(). +func (o CreateScheduleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "schedule": o.Schedule, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateScheduleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "schedule": basetypes.ListType{ + ElemType: Schedule{}.Type(ctx), + }, + }, + } +} + +// GetSchedule returns the value of the Schedule field in CreateScheduleRequest as +// a Schedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateScheduleRequest) GetSchedule(ctx context.Context) (Schedule, bool) { + var e Schedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []Schedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in CreateScheduleRequest. +func (o *CreateScheduleRequest) SetSchedule(ctx context.Context, v Schedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + // Create schedule subscription type CreateSubscriptionRequest struct { // UUID identifying the dashboard to which the subscription belongs. @@ -47,7 +178,7 @@ type CreateSubscriptionRequest struct { // UUID identifying the schedule to which the subscription belongs. ScheduleId types.String `tfsdk:"-"` - Subscription []Subscription `tfsdk:"subscription" tf:"optional,object"` + Subscription types.List `tfsdk:"subscription" tf:"optional,object"` } func (newState *CreateSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateSubscriptionRequest) { @@ -56,6 +187,71 @@ func (newState *CreateSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *CreateSubscriptionRequest) SyncEffectiveFieldsDuringRead(existingState CreateSubscriptionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateSubscriptionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateSubscriptionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "subscription": reflect.TypeOf(Subscription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateSubscriptionRequest +// only implements ToObjectValue() and Type(). +func (o CreateSubscriptionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "schedule_id": o.ScheduleId, + "subscription": o.Subscription, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateSubscriptionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "schedule_id": types.StringType, + "subscription": basetypes.ListType{ + ElemType: Subscription{}.Type(ctx), + }, + }, + } +} + +// GetSubscription returns the value of the Subscription field in CreateSubscriptionRequest as +// a Subscription value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateSubscriptionRequest) GetSubscription(ctx context.Context) (Subscription, bool) { + var e Subscription + if o.Subscription.IsNull() || o.Subscription.IsUnknown() { + return e, false + } + var v []Subscription + d := o.Subscription.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSubscription sets the value of the Subscription field in CreateSubscriptionRequest. +func (o *CreateSubscriptionRequest) SetSubscription(ctx context.Context, v Subscription) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subscription"] + o.Subscription = types.ListValueMust(t, vs) +} + type CronSchedule struct { // A cron expression using quartz syntax. EX: `0 0 8 * * ?` represents // everyday at 8am. See [Cron Trigger] for details. @@ -75,6 +271,39 @@ func (newState *CronSchedule) SyncEffectiveFieldsDuringCreateOrUpdate(plan CronS func (newState *CronSchedule) SyncEffectiveFieldsDuringRead(existingState CronSchedule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CronSchedule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CronSchedule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CronSchedule +// only implements ToObjectValue() and Type(). +func (o CronSchedule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "quartz_cron_expression": o.QuartzCronExpression, + "timezone_id": o.TimezoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CronSchedule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "quartz_cron_expression": types.StringType, + "timezone_id": types.StringType, + }, + } +} + type Dashboard struct { // The timestamp of when the dashboard was created. CreateTime types.String `tfsdk:"create_time" tf:"computed,optional"` @@ -117,6 +346,55 @@ func (newState *Dashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dashboar func (newState *Dashboard) SyncEffectiveFieldsDuringRead(existingState Dashboard) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Dashboard. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Dashboard) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Dashboard +// only implements ToObjectValue() and Type(). +func (o Dashboard) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "dashboard_id": o.DashboardId, + "display_name": o.DisplayName, + "etag": o.Etag, + "lifecycle_state": o.LifecycleState, + "parent_path": o.ParentPath, + "path": o.Path, + "serialized_dashboard": o.SerializedDashboard, + "update_time": o.UpdateTime, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Dashboard) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "dashboard_id": types.StringType, + "display_name": types.StringType, + "etag": types.StringType, + "lifecycle_state": types.StringType, + "parent_path": types.StringType, + "path": types.StringType, + "serialized_dashboard": types.StringType, + "update_time": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + // Delete dashboard schedule type DeleteScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. @@ -134,6 +412,41 @@ func (newState *DeleteScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteScheduleRequest) SyncEffectiveFieldsDuringRead(existingState DeleteScheduleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteScheduleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteScheduleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteScheduleRequest +// only implements ToObjectValue() and Type(). +func (o DeleteScheduleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "etag": o.Etag, + "schedule_id": o.ScheduleId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteScheduleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "etag": types.StringType, + "schedule_id": types.StringType, + }, + } +} + type DeleteScheduleResponse struct { } @@ -143,6 +456,33 @@ func (newState *DeleteScheduleResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteScheduleResponse) SyncEffectiveFieldsDuringRead(existingState DeleteScheduleResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteScheduleResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteScheduleResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteScheduleResponse +// only implements ToObjectValue() and Type(). +func (o DeleteScheduleResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteScheduleResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete schedule subscription type DeleteSubscriptionRequest struct { // UUID identifying the dashboard which the subscription belongs. @@ -162,6 +502,43 @@ func (newState *DeleteSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteSubscriptionRequest) SyncEffectiveFieldsDuringRead(existingState DeleteSubscriptionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteSubscriptionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteSubscriptionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteSubscriptionRequest +// only implements ToObjectValue() and Type(). +func (o DeleteSubscriptionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "etag": o.Etag, + "schedule_id": o.ScheduleId, + "subscription_id": o.SubscriptionId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteSubscriptionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "etag": types.StringType, + "schedule_id": types.StringType, + "subscription_id": types.StringType, + }, + } +} + type DeleteSubscriptionResponse struct { } @@ -171,11 +548,38 @@ func (newState *DeleteSubscriptionResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteSubscriptionResponse) SyncEffectiveFieldsDuringRead(existingState DeleteSubscriptionResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteSubscriptionResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteSubscriptionResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteSubscriptionResponse +// only implements ToObjectValue() and Type(). +func (o DeleteSubscriptionResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteSubscriptionResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Genie AI Response type GenieAttachment struct { - Query []QueryAttachment `tfsdk:"query" tf:"optional,object"` + Query types.List `tfsdk:"query" tf:"optional,object"` - Text []TextAttachment `tfsdk:"text" tf:"optional,object"` + Text types.List `tfsdk:"text" tf:"optional,object"` } func (newState *GenieAttachment) SyncEffectiveFieldsDuringCreateOrUpdate(plan GenieAttachment) { @@ -184,6 +588,98 @@ func (newState *GenieAttachment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GenieAttachment) SyncEffectiveFieldsDuringRead(existingState GenieAttachment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieAttachment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieAttachment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "query": reflect.TypeOf(QueryAttachment{}), + "text": reflect.TypeOf(TextAttachment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieAttachment +// only implements ToObjectValue() and Type(). +func (o GenieAttachment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query": o.Query, + "text": o.Text, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieAttachment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query": basetypes.ListType{ + ElemType: QueryAttachment{}.Type(ctx), + }, + "text": basetypes.ListType{ + ElemType: TextAttachment{}.Type(ctx), + }, + }, + } +} + +// GetQuery returns the value of the Query field in GenieAttachment as +// a QueryAttachment value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieAttachment) GetQuery(ctx context.Context) (QueryAttachment, bool) { + var e QueryAttachment + if o.Query.IsNull() || o.Query.IsUnknown() { + return e, false + } + var v []QueryAttachment + d := o.Query.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuery sets the value of the Query field in GenieAttachment. +func (o *GenieAttachment) SetQuery(ctx context.Context, v QueryAttachment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query"] + o.Query = types.ListValueMust(t, vs) +} + +// GetText returns the value of the Text field in GenieAttachment as +// a TextAttachment value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieAttachment) GetText(ctx context.Context) (TextAttachment, bool) { + var e TextAttachment + if o.Text.IsNull() || o.Text.IsUnknown() { + return e, false + } + var v []TextAttachment + d := o.Text.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetText sets the value of the Text field in GenieAttachment. +func (o *GenieAttachment) SetText(ctx context.Context, v TextAttachment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["text"] + o.Text = types.ListValueMust(t, vs) +} + type GenieConversation struct { // Timestamp when the message was created CreatedTimestamp types.Int64 `tfsdk:"created_timestamp" tf:"optional"` @@ -205,6 +701,47 @@ func (newState *GenieConversation) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GenieConversation) SyncEffectiveFieldsDuringRead(existingState GenieConversation) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieConversation. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieConversation) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieConversation +// only implements ToObjectValue() and Type(). +func (o GenieConversation) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_timestamp": o.CreatedTimestamp, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "space_id": o.SpaceId, + "title": o.Title, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieConversation) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_timestamp": types.Int64Type, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "space_id": types.StringType, + "title": types.StringType, + "user_id": types.Int64Type, + }, + } +} + type GenieCreateConversationMessageRequest struct { // User message content. Content types.String `tfsdk:"content" tf:""` @@ -220,6 +757,41 @@ func (newState *GenieCreateConversationMessageRequest) SyncEffectiveFieldsDuring func (newState *GenieCreateConversationMessageRequest) SyncEffectiveFieldsDuringRead(existingState GenieCreateConversationMessageRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieCreateConversationMessageRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieCreateConversationMessageRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieCreateConversationMessageRequest +// only implements ToObjectValue() and Type(). +func (o GenieCreateConversationMessageRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "conversation_id": o.ConversationId, + "space_id": o.SpaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieCreateConversationMessageRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "conversation_id": types.StringType, + "space_id": types.StringType, + }, + } +} + // Execute SQL query in a conversation message type GenieExecuteMessageQueryRequest struct { // Conversation ID @@ -236,6 +808,41 @@ func (newState *GenieExecuteMessageQueryRequest) SyncEffectiveFieldsDuringCreate func (newState *GenieExecuteMessageQueryRequest) SyncEffectiveFieldsDuringRead(existingState GenieExecuteMessageQueryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieExecuteMessageQueryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieExecuteMessageQueryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieExecuteMessageQueryRequest +// only implements ToObjectValue() and Type(). +func (o GenieExecuteMessageQueryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "conversation_id": o.ConversationId, + "message_id": o.MessageId, + "space_id": o.SpaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieExecuteMessageQueryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "conversation_id": types.StringType, + "message_id": types.StringType, + "space_id": types.StringType, + }, + } +} + // Get conversation message type GenieGetConversationMessageRequest struct { // The ID associated with the target conversation. @@ -254,6 +861,41 @@ func (newState *GenieGetConversationMessageRequest) SyncEffectiveFieldsDuringCre func (newState *GenieGetConversationMessageRequest) SyncEffectiveFieldsDuringRead(existingState GenieGetConversationMessageRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieGetConversationMessageRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieGetConversationMessageRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieGetConversationMessageRequest +// only implements ToObjectValue() and Type(). +func (o GenieGetConversationMessageRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "conversation_id": o.ConversationId, + "message_id": o.MessageId, + "space_id": o.SpaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieGetConversationMessageRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "conversation_id": types.StringType, + "message_id": types.StringType, + "space_id": types.StringType, + }, + } +} + // Get conversation message SQL query result type GenieGetMessageQueryResultRequest struct { // Conversation ID @@ -270,10 +912,45 @@ func (newState *GenieGetMessageQueryResultRequest) SyncEffectiveFieldsDuringCrea func (newState *GenieGetMessageQueryResultRequest) SyncEffectiveFieldsDuringRead(existingState GenieGetMessageQueryResultRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieGetMessageQueryResultRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieGetMessageQueryResultRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieGetMessageQueryResultRequest +// only implements ToObjectValue() and Type(). +func (o GenieGetMessageQueryResultRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "conversation_id": o.ConversationId, + "message_id": o.MessageId, + "space_id": o.SpaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieGetMessageQueryResultRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "conversation_id": types.StringType, + "message_id": types.StringType, + "space_id": types.StringType, + }, + } +} + type GenieGetMessageQueryResultResponse struct { // SQL Statement Execution response. See [Get status, manifest, and result // first chunk](:method:statementexecution/getstatement) for more details. - StatementResponse sql.StatementResponse `tfsdk:"statement_response" tf:"optional,object"` + StatementResponse types.List `tfsdk:"statement_response" tf:"optional,object"` } func (newState *GenieGetMessageQueryResultResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GenieGetMessageQueryResultResponse) { @@ -282,9 +959,70 @@ func (newState *GenieGetMessageQueryResultResponse) SyncEffectiveFieldsDuringCre func (newState *GenieGetMessageQueryResultResponse) SyncEffectiveFieldsDuringRead(existingState GenieGetMessageQueryResultResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieGetMessageQueryResultResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieGetMessageQueryResultResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "statement_response": reflect.TypeOf(sql_tf.StatementResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieGetMessageQueryResultResponse +// only implements ToObjectValue() and Type(). +func (o GenieGetMessageQueryResultResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "statement_response": o.StatementResponse, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieGetMessageQueryResultResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "statement_response": basetypes.ListType{ + ElemType: sql_tf.StatementResponse{}.Type(ctx), + }, + }, + } +} + +// GetStatementResponse returns the value of the StatementResponse field in GenieGetMessageQueryResultResponse as +// a sql_tf.StatementResponse value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieGetMessageQueryResultResponse) GetStatementResponse(ctx context.Context) (sql_tf.StatementResponse, bool) { + var e sql_tf.StatementResponse + if o.StatementResponse.IsNull() || o.StatementResponse.IsUnknown() { + return e, false + } + var v []sql_tf.StatementResponse + d := o.StatementResponse.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatementResponse sets the value of the StatementResponse field in GenieGetMessageQueryResultResponse. +func (o *GenieGetMessageQueryResultResponse) SetStatementResponse(ctx context.Context, v sql_tf.StatementResponse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["statement_response"] + o.StatementResponse = types.ListValueMust(t, vs) +} + type GenieMessage struct { // AI produced response to the message - Attachments []GenieAttachment `tfsdk:"attachments" tf:"optional"` + Attachments types.List `tfsdk:"attachments" tf:"optional"` // User message content Content types.String `tfsdk:"content" tf:""` // Conversation ID @@ -292,13 +1030,13 @@ type GenieMessage struct { // Timestamp when the message was created CreatedTimestamp types.Int64 `tfsdk:"created_timestamp" tf:"optional"` // Error message if AI failed to respond to the message - Error []MessageError `tfsdk:"error" tf:"optional,object"` + Error types.List `tfsdk:"error" tf:"optional,object"` // Message ID Id types.String `tfsdk:"id" tf:""` // Timestamp when the message was last updated LastUpdatedTimestamp types.Int64 `tfsdk:"last_updated_timestamp" tf:"optional"` // The result of SQL query if the message has a query attachment - QueryResult []Result `tfsdk:"query_result" tf:"optional,object"` + QueryResult types.List `tfsdk:"query_result" tf:"optional,object"` // Genie space ID SpaceId types.String `tfsdk:"space_id" tf:""` // MesssageStatus. The possible values are: * `FETCHING_METADATA`: Fetching @@ -328,6 +1066,145 @@ func (newState *GenieMessage) SyncEffectiveFieldsDuringCreateOrUpdate(plan Genie func (newState *GenieMessage) SyncEffectiveFieldsDuringRead(existingState GenieMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "attachments": reflect.TypeOf(GenieAttachment{}), + "error": reflect.TypeOf(MessageError{}), + "query_result": reflect.TypeOf(Result{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieMessage +// only implements ToObjectValue() and Type(). +func (o GenieMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attachments": o.Attachments, + "content": o.Content, + "conversation_id": o.ConversationId, + "created_timestamp": o.CreatedTimestamp, + "error": o.Error, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "query_result": o.QueryResult, + "space_id": o.SpaceId, + "status": o.Status, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attachments": basetypes.ListType{ + ElemType: GenieAttachment{}.Type(ctx), + }, + "content": types.StringType, + "conversation_id": types.StringType, + "created_timestamp": types.Int64Type, + "error": basetypes.ListType{ + ElemType: MessageError{}.Type(ctx), + }, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "query_result": basetypes.ListType{ + ElemType: Result{}.Type(ctx), + }, + "space_id": types.StringType, + "status": types.StringType, + "user_id": types.Int64Type, + }, + } +} + +// GetAttachments returns the value of the Attachments field in GenieMessage as +// a slice of GenieAttachment values. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieMessage) GetAttachments(ctx context.Context) ([]GenieAttachment, bool) { + if o.Attachments.IsNull() || o.Attachments.IsUnknown() { + return nil, false + } + var v []GenieAttachment + d := o.Attachments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAttachments sets the value of the Attachments field in GenieMessage. +func (o *GenieMessage) SetAttachments(ctx context.Context, v []GenieAttachment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["attachments"] + t = t.(attr.TypeWithElementType).ElementType() + o.Attachments = types.ListValueMust(t, vs) +} + +// GetError returns the value of the Error field in GenieMessage as +// a MessageError value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieMessage) GetError(ctx context.Context) (MessageError, bool) { + var e MessageError + if o.Error.IsNull() || o.Error.IsUnknown() { + return e, false + } + var v []MessageError + d := o.Error.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetError sets the value of the Error field in GenieMessage. +func (o *GenieMessage) SetError(ctx context.Context, v MessageError) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["error"] + o.Error = types.ListValueMust(t, vs) +} + +// GetQueryResult returns the value of the QueryResult field in GenieMessage as +// a Result value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieMessage) GetQueryResult(ctx context.Context) (Result, bool) { + var e Result + if o.QueryResult.IsNull() || o.QueryResult.IsUnknown() { + return e, false + } + var v []Result + d := o.QueryResult.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueryResult sets the value of the QueryResult field in GenieMessage. +func (o *GenieMessage) SetQueryResult(ctx context.Context, v Result) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query_result"] + o.QueryResult = types.ListValueMust(t, vs) +} + type GenieStartConversationMessageRequest struct { // The text of the message that starts the conversation. Content types.String `tfsdk:"content" tf:""` @@ -342,12 +1219,45 @@ func (newState *GenieStartConversationMessageRequest) SyncEffectiveFieldsDuringC func (newState *GenieStartConversationMessageRequest) SyncEffectiveFieldsDuringRead(existingState GenieStartConversationMessageRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieStartConversationMessageRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieStartConversationMessageRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieStartConversationMessageRequest +// only implements ToObjectValue() and Type(). +func (o GenieStartConversationMessageRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "space_id": o.SpaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieStartConversationMessageRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "space_id": types.StringType, + }, + } +} + type GenieStartConversationResponse struct { - Conversation []GenieConversation `tfsdk:"conversation" tf:"optional,object"` + Conversation types.List `tfsdk:"conversation" tf:"optional,object"` // Conversation ID ConversationId types.String `tfsdk:"conversation_id" tf:""` - Message []GenieMessage `tfsdk:"message" tf:"optional,object"` + Message types.List `tfsdk:"message" tf:"optional,object"` // Message ID MessageId types.String `tfsdk:"message_id" tf:""` } @@ -358,6 +1268,102 @@ func (newState *GenieStartConversationResponse) SyncEffectiveFieldsDuringCreateO func (newState *GenieStartConversationResponse) SyncEffectiveFieldsDuringRead(existingState GenieStartConversationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenieStartConversationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenieStartConversationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "conversation": reflect.TypeOf(GenieConversation{}), + "message": reflect.TypeOf(GenieMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenieStartConversationResponse +// only implements ToObjectValue() and Type(). +func (o GenieStartConversationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "conversation": o.Conversation, + "conversation_id": o.ConversationId, + "message": o.Message, + "message_id": o.MessageId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenieStartConversationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "conversation": basetypes.ListType{ + ElemType: GenieConversation{}.Type(ctx), + }, + "conversation_id": types.StringType, + "message": basetypes.ListType{ + ElemType: GenieMessage{}.Type(ctx), + }, + "message_id": types.StringType, + }, + } +} + +// GetConversation returns the value of the Conversation field in GenieStartConversationResponse as +// a GenieConversation value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieStartConversationResponse) GetConversation(ctx context.Context) (GenieConversation, bool) { + var e GenieConversation + if o.Conversation.IsNull() || o.Conversation.IsUnknown() { + return e, false + } + var v []GenieConversation + d := o.Conversation.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConversation sets the value of the Conversation field in GenieStartConversationResponse. +func (o *GenieStartConversationResponse) SetConversation(ctx context.Context, v GenieConversation) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["conversation"] + o.Conversation = types.ListValueMust(t, vs) +} + +// GetMessage returns the value of the Message field in GenieStartConversationResponse as +// a GenieMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *GenieStartConversationResponse) GetMessage(ctx context.Context) (GenieMessage, bool) { + var e GenieMessage + if o.Message.IsNull() || o.Message.IsUnknown() { + return e, false + } + var v []GenieMessage + d := o.Message.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMessage sets the value of the Message field in GenieStartConversationResponse. +func (o *GenieStartConversationResponse) SetMessage(ctx context.Context, v GenieMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["message"] + o.Message = types.ListValueMust(t, vs) +} + // Get dashboard type GetDashboardRequest struct { // UUID identifying the dashboard. @@ -370,6 +1376,37 @@ func (newState *GetDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetDashboardRequest) SyncEffectiveFieldsDuringRead(existingState GetDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDashboardRequest +// only implements ToObjectValue() and Type(). +func (o GetDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + // Get published dashboard type GetPublishedDashboardRequest struct { // UUID identifying the published dashboard. @@ -382,6 +1419,37 @@ func (newState *GetPublishedDashboardRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *GetPublishedDashboardRequest) SyncEffectiveFieldsDuringRead(existingState GetPublishedDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPublishedDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPublishedDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPublishedDashboardRequest +// only implements ToObjectValue() and Type(). +func (o GetPublishedDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPublishedDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + // Get dashboard schedule type GetScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. @@ -396,6 +1464,39 @@ func (newState *GetScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetScheduleRequest) SyncEffectiveFieldsDuringRead(existingState GetScheduleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetScheduleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetScheduleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetScheduleRequest +// only implements ToObjectValue() and Type(). +func (o GetScheduleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "schedule_id": o.ScheduleId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetScheduleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "schedule_id": types.StringType, + }, + } +} + // Get schedule subscription type GetSubscriptionRequest struct { // UUID identifying the dashboard which the subscription belongs. @@ -412,6 +1513,41 @@ func (newState *GetSubscriptionRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetSubscriptionRequest) SyncEffectiveFieldsDuringRead(existingState GetSubscriptionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetSubscriptionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetSubscriptionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetSubscriptionRequest +// only implements ToObjectValue() and Type(). +func (o GetSubscriptionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "schedule_id": o.ScheduleId, + "subscription_id": o.SubscriptionId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetSubscriptionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "schedule_id": types.StringType, + "subscription_id": types.StringType, + }, + } +} + // List dashboards type ListDashboardsRequest struct { // The number of dashboards to return per page. @@ -432,8 +1568,45 @@ func (newState *ListDashboardsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListDashboardsRequest) SyncEffectiveFieldsDuringRead(existingState ListDashboardsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListDashboardsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListDashboardsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListDashboardsRequest +// only implements ToObjectValue() and Type(). +func (o ListDashboardsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + "show_trashed": o.ShowTrashed, + "view": o.View, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListDashboardsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + "show_trashed": types.BoolType, + "view": types.StringType, + }, + } +} + type ListDashboardsResponse struct { - Dashboards []Dashboard `tfsdk:"dashboards" tf:"optional"` + Dashboards types.List `tfsdk:"dashboards" tf:"optional"` // A token, which can be sent as `page_token` to retrieve the next page. If // this field is omitted, there are no subsequent dashboards. NextPageToken types.String `tfsdk:"next_page_token" tf:"computed,optional"` @@ -445,6 +1618,69 @@ func (newState *ListDashboardsResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListDashboardsResponse) SyncEffectiveFieldsDuringRead(existingState ListDashboardsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListDashboardsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListDashboardsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dashboards": reflect.TypeOf(Dashboard{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListDashboardsResponse +// only implements ToObjectValue() and Type(). +func (o ListDashboardsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboards": o.Dashboards, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListDashboardsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboards": basetypes.ListType{ + ElemType: Dashboard{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetDashboards returns the value of the Dashboards field in ListDashboardsResponse as +// a slice of Dashboard values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListDashboardsResponse) GetDashboards(ctx context.Context) ([]Dashboard, bool) { + if o.Dashboards.IsNull() || o.Dashboards.IsUnknown() { + return nil, false + } + var v []Dashboard + d := o.Dashboards.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDashboards sets the value of the Dashboards field in ListDashboardsResponse. +func (o *ListDashboardsResponse) SetDashboards(ctx context.Context, v []Dashboard) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dashboards"] + t = t.(attr.TypeWithElementType).ElementType() + o.Dashboards = types.ListValueMust(t, vs) +} + // List dashboard schedules type ListSchedulesRequest struct { // UUID identifying the dashboard to which the schedules belongs. @@ -462,13 +1698,48 @@ func (newState *ListSchedulesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListSchedulesRequest) SyncEffectiveFieldsDuringRead(existingState ListSchedulesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSchedulesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSchedulesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSchedulesRequest +// only implements ToObjectValue() and Type(). +func (o ListSchedulesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSchedulesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListSchedulesResponse struct { // A token that can be used as a `page_token` in subsequent requests to // retrieve the next page of results. If this field is omitted, there are no // subsequent schedules. NextPageToken types.String `tfsdk:"next_page_token" tf:"computed,optional"` - Schedules []Schedule `tfsdk:"schedules" tf:"optional"` + Schedules types.List `tfsdk:"schedules" tf:"optional"` } func (newState *ListSchedulesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListSchedulesResponse) { @@ -477,6 +1748,69 @@ func (newState *ListSchedulesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListSchedulesResponse) SyncEffectiveFieldsDuringRead(existingState ListSchedulesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSchedulesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSchedulesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "schedules": reflect.TypeOf(Schedule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSchedulesResponse +// only implements ToObjectValue() and Type(). +func (o ListSchedulesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "schedules": o.Schedules, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSchedulesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "schedules": basetypes.ListType{ + ElemType: Schedule{}.Type(ctx), + }, + }, + } +} + +// GetSchedules returns the value of the Schedules field in ListSchedulesResponse as +// a slice of Schedule values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListSchedulesResponse) GetSchedules(ctx context.Context) ([]Schedule, bool) { + if o.Schedules.IsNull() || o.Schedules.IsUnknown() { + return nil, false + } + var v []Schedule + d := o.Schedules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchedules sets the value of the Schedules field in ListSchedulesResponse. +func (o *ListSchedulesResponse) SetSchedules(ctx context.Context, v []Schedule) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedules"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schedules = types.ListValueMust(t, vs) +} + // List schedule subscriptions type ListSubscriptionsRequest struct { // UUID identifying the dashboard which the subscriptions belongs. @@ -496,13 +1830,50 @@ func (newState *ListSubscriptionsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListSubscriptionsRequest) SyncEffectiveFieldsDuringRead(existingState ListSubscriptionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSubscriptionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSubscriptionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSubscriptionsRequest +// only implements ToObjectValue() and Type(). +func (o ListSubscriptionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "page_size": o.PageSize, + "page_token": o.PageToken, + "schedule_id": o.ScheduleId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSubscriptionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + "schedule_id": types.StringType, + }, + } +} + type ListSubscriptionsResponse struct { // A token that can be used as a `page_token` in subsequent requests to // retrieve the next page of results. If this field is omitted, there are no // subsequent subscriptions. NextPageToken types.String `tfsdk:"next_page_token" tf:"computed,optional"` - Subscriptions []Subscription `tfsdk:"subscriptions" tf:"optional"` + Subscriptions types.List `tfsdk:"subscriptions" tf:"optional"` } func (newState *ListSubscriptionsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListSubscriptionsResponse) { @@ -511,10 +1882,73 @@ func (newState *ListSubscriptionsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListSubscriptionsResponse) SyncEffectiveFieldsDuringRead(existingState ListSubscriptionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSubscriptionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSubscriptionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "subscriptions": reflect.TypeOf(Subscription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSubscriptionsResponse +// only implements ToObjectValue() and Type(). +func (o ListSubscriptionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "subscriptions": o.Subscriptions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSubscriptionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "subscriptions": basetypes.ListType{ + ElemType: Subscription{}.Type(ctx), + }, + }, + } +} + +// GetSubscriptions returns the value of the Subscriptions field in ListSubscriptionsResponse as +// a slice of Subscription values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListSubscriptionsResponse) GetSubscriptions(ctx context.Context) ([]Subscription, bool) { + if o.Subscriptions.IsNull() || o.Subscriptions.IsUnknown() { + return nil, false + } + var v []Subscription + d := o.Subscriptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSubscriptions sets the value of the Subscriptions field in ListSubscriptionsResponse. +func (o *ListSubscriptionsResponse) SetSubscriptions(ctx context.Context, v []Subscription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subscriptions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Subscriptions = types.ListValueMust(t, vs) +} + type MessageError struct { Error types.String `tfsdk:"error" tf:"optional"` - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *MessageError) SyncEffectiveFieldsDuringCreateOrUpdate(plan MessageError) { @@ -523,6 +1957,39 @@ func (newState *MessageError) SyncEffectiveFieldsDuringCreateOrUpdate(plan Messa func (newState *MessageError) SyncEffectiveFieldsDuringRead(existingState MessageError) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MessageError. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MessageError) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MessageError +// only implements ToObjectValue() and Type(). +func (o MessageError) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error": o.Error, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MessageError) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error": types.StringType, + "type": types.StringType, + }, + } +} + type MigrateDashboardRequest struct { // Display name for the new Lakeview dashboard. DisplayName types.String `tfsdk:"display_name" tf:"optional"` @@ -539,6 +2006,41 @@ func (newState *MigrateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *MigrateDashboardRequest) SyncEffectiveFieldsDuringRead(existingState MigrateDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MigrateDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MigrateDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MigrateDashboardRequest +// only implements ToObjectValue() and Type(). +func (o MigrateDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display_name": o.DisplayName, + "parent_path": o.ParentPath, + "source_dashboard_id": o.SourceDashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MigrateDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display_name": types.StringType, + "parent_path": types.StringType, + "source_dashboard_id": types.StringType, + }, + } +} + type PublishRequest struct { // UUID identifying the dashboard to be published. DashboardId types.String `tfsdk:"-"` @@ -557,6 +2059,41 @@ func (newState *PublishRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pub func (newState *PublishRequest) SyncEffectiveFieldsDuringRead(existingState PublishRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PublishRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PublishRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PublishRequest +// only implements ToObjectValue() and Type(). +func (o PublishRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "embed_credentials": o.EmbedCredentials, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PublishRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "embed_credentials": types.BoolType, + "warehouse_id": types.StringType, + }, + } +} + type PublishedDashboard struct { // The display name of the published dashboard. DisplayName types.String `tfsdk:"display_name" tf:"computed,optional"` @@ -574,8 +2111,45 @@ func (newState *PublishedDashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PublishedDashboard) SyncEffectiveFieldsDuringRead(existingState PublishedDashboard) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PublishedDashboard. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PublishedDashboard) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PublishedDashboard +// only implements ToObjectValue() and Type(). +func (o PublishedDashboard) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display_name": o.DisplayName, + "embed_credentials": o.EmbedCredentials, + "revision_create_time": o.RevisionCreateTime, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PublishedDashboard) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display_name": types.StringType, + "embed_credentials": types.BoolType, + "revision_create_time": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + type QueryAttachment struct { - CachedQuerySchema []QuerySchema `tfsdk:"cached_query_schema" tf:"optional,object"` + CachedQuerySchema types.List `tfsdk:"cached_query_schema" tf:"optional,object"` // Description of the query Description types.String `tfsdk:"description" tf:"optional"` @@ -600,8 +2174,83 @@ func (newState *QueryAttachment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Qu func (newState *QueryAttachment) SyncEffectiveFieldsDuringRead(existingState QueryAttachment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryAttachment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryAttachment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cached_query_schema": reflect.TypeOf(QuerySchema{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryAttachment +// only implements ToObjectValue() and Type(). +func (o QueryAttachment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cached_query_schema": o.CachedQuerySchema, + "description": o.Description, + "id": o.Id, + "instruction_id": o.InstructionId, + "instruction_title": o.InstructionTitle, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "query": o.Query, + "title": o.Title, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryAttachment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cached_query_schema": basetypes.ListType{ + ElemType: QuerySchema{}.Type(ctx), + }, + "description": types.StringType, + "id": types.StringType, + "instruction_id": types.StringType, + "instruction_title": types.StringType, + "last_updated_timestamp": types.Int64Type, + "query": types.StringType, + "title": types.StringType, + }, + } +} + +// GetCachedQuerySchema returns the value of the CachedQuerySchema field in QueryAttachment as +// a QuerySchema value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryAttachment) GetCachedQuerySchema(ctx context.Context) (QuerySchema, bool) { + var e QuerySchema + if o.CachedQuerySchema.IsNull() || o.CachedQuerySchema.IsUnknown() { + return e, false + } + var v []QuerySchema + d := o.CachedQuerySchema.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCachedQuerySchema sets the value of the CachedQuerySchema field in QueryAttachment. +func (o *QueryAttachment) SetCachedQuerySchema(ctx context.Context, v QuerySchema) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cached_query_schema"] + o.CachedQuerySchema = types.ListValueMust(t, vs) +} + type QuerySchema struct { - Columns []QuerySchemaColumn `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` // Used to determine if the stored query schema is compatible with the // latest run. The service should always clear the schema when the query is // re-executed. @@ -614,6 +2263,69 @@ func (newState *QuerySchema) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryS func (newState *QuerySchema) SyncEffectiveFieldsDuringRead(existingState QuerySchema) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QuerySchema. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QuerySchema) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(QuerySchemaColumn{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QuerySchema +// only implements ToObjectValue() and Type(). +func (o QuerySchema) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns": o.Columns, + "statement_id": o.StatementId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QuerySchema) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns": basetypes.ListType{ + ElemType: QuerySchemaColumn{}.Type(ctx), + }, + "statement_id": types.StringType, + }, + } +} + +// GetColumns returns the value of the Columns field in QuerySchema as +// a slice of QuerySchemaColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *QuerySchema) GetColumns(ctx context.Context) ([]QuerySchemaColumn, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []QuerySchemaColumn + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in QuerySchema. +func (o *QuerySchema) SetColumns(ctx context.Context, v []QuerySchemaColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + type QuerySchemaColumn struct { // Populated from // https://docs.databricks.com/sql/language-manual/sql-ref-datatypes.html @@ -630,6 +2342,41 @@ func (newState *QuerySchemaColumn) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *QuerySchemaColumn) SyncEffectiveFieldsDuringRead(existingState QuerySchemaColumn) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QuerySchemaColumn. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QuerySchemaColumn) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QuerySchemaColumn +// only implements ToObjectValue() and Type(). +func (o QuerySchemaColumn) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_type": o.DataType, + "name": o.Name, + "type_text": o.TypeText, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QuerySchemaColumn) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_type": types.StringType, + "name": types.StringType, + "type_text": types.StringType, + }, + } +} + type Result struct { // If result is truncated IsTruncated types.Bool `tfsdk:"is_truncated" tf:"optional"` @@ -647,12 +2394,47 @@ func (newState *Result) SyncEffectiveFieldsDuringCreateOrUpdate(plan Result) { func (newState *Result) SyncEffectiveFieldsDuringRead(existingState Result) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Result. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Result) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Result +// only implements ToObjectValue() and Type(). +func (o Result) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_truncated": o.IsTruncated, + "row_count": o.RowCount, + "statement_id": o.StatementId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Result) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_truncated": types.BoolType, + "row_count": types.Int64Type, + "statement_id": types.StringType, + }, + } +} + type Schedule struct { // A timestamp indicating when the schedule was created. CreateTime types.String `tfsdk:"create_time" tf:"computed,optional"` // The cron expression describing the frequency of the periodic refresh for // this schedule. - CronSchedule []CronSchedule `tfsdk:"cron_schedule" tf:"object"` + CronSchedule types.List `tfsdk:"cron_schedule" tf:"object"` // UUID identifying the dashboard to which the schedule belongs. DashboardId types.String `tfsdk:"dashboard_id" tf:"computed,optional"` // The display name for schedule. @@ -677,13 +2459,90 @@ func (newState *Schedule) SyncEffectiveFieldsDuringCreateOrUpdate(plan Schedule) func (newState *Schedule) SyncEffectiveFieldsDuringRead(existingState Schedule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Schedule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Schedule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cron_schedule": reflect.TypeOf(CronSchedule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Schedule +// only implements ToObjectValue() and Type(). +func (o Schedule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "cron_schedule": o.CronSchedule, + "dashboard_id": o.DashboardId, + "display_name": o.DisplayName, + "etag": o.Etag, + "pause_status": o.PauseStatus, + "schedule_id": o.ScheduleId, + "update_time": o.UpdateTime, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Schedule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "cron_schedule": basetypes.ListType{ + ElemType: CronSchedule{}.Type(ctx), + }, + "dashboard_id": types.StringType, + "display_name": types.StringType, + "etag": types.StringType, + "pause_status": types.StringType, + "schedule_id": types.StringType, + "update_time": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetCronSchedule returns the value of the CronSchedule field in Schedule as +// a CronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *Schedule) GetCronSchedule(ctx context.Context) (CronSchedule, bool) { + var e CronSchedule + if o.CronSchedule.IsNull() || o.CronSchedule.IsUnknown() { + return e, false + } + var v []CronSchedule + d := o.CronSchedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCronSchedule sets the value of the CronSchedule field in Schedule. +func (o *Schedule) SetCronSchedule(ctx context.Context, v CronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cron_schedule"] + o.CronSchedule = types.ListValueMust(t, vs) +} + type Subscriber struct { // The destination to receive the subscription email. This parameter is // mutually exclusive with `user_subscriber`. - DestinationSubscriber []SubscriptionSubscriberDestination `tfsdk:"destination_subscriber" tf:"optional,object"` + DestinationSubscriber types.List `tfsdk:"destination_subscriber" tf:"optional,object"` // The user to receive the subscription email. This parameter is mutually // exclusive with `destination_subscriber`. - UserSubscriber []SubscriptionSubscriberUser `tfsdk:"user_subscriber" tf:"optional,object"` + UserSubscriber types.List `tfsdk:"user_subscriber" tf:"optional,object"` } func (newState *Subscriber) SyncEffectiveFieldsDuringCreateOrUpdate(plan Subscriber) { @@ -692,6 +2551,98 @@ func (newState *Subscriber) SyncEffectiveFieldsDuringCreateOrUpdate(plan Subscri func (newState *Subscriber) SyncEffectiveFieldsDuringRead(existingState Subscriber) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Subscriber. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Subscriber) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "destination_subscriber": reflect.TypeOf(SubscriptionSubscriberDestination{}), + "user_subscriber": reflect.TypeOf(SubscriptionSubscriberUser{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Subscriber +// only implements ToObjectValue() and Type(). +func (o Subscriber) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_subscriber": o.DestinationSubscriber, + "user_subscriber": o.UserSubscriber, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Subscriber) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_subscriber": basetypes.ListType{ + ElemType: SubscriptionSubscriberDestination{}.Type(ctx), + }, + "user_subscriber": basetypes.ListType{ + ElemType: SubscriptionSubscriberUser{}.Type(ctx), + }, + }, + } +} + +// GetDestinationSubscriber returns the value of the DestinationSubscriber field in Subscriber as +// a SubscriptionSubscriberDestination value. +// If the field is unknown or null, the boolean return value is false. +func (o *Subscriber) GetDestinationSubscriber(ctx context.Context) (SubscriptionSubscriberDestination, bool) { + var e SubscriptionSubscriberDestination + if o.DestinationSubscriber.IsNull() || o.DestinationSubscriber.IsUnknown() { + return e, false + } + var v []SubscriptionSubscriberDestination + d := o.DestinationSubscriber.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDestinationSubscriber sets the value of the DestinationSubscriber field in Subscriber. +func (o *Subscriber) SetDestinationSubscriber(ctx context.Context, v SubscriptionSubscriberDestination) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["destination_subscriber"] + o.DestinationSubscriber = types.ListValueMust(t, vs) +} + +// GetUserSubscriber returns the value of the UserSubscriber field in Subscriber as +// a SubscriptionSubscriberUser value. +// If the field is unknown or null, the boolean return value is false. +func (o *Subscriber) GetUserSubscriber(ctx context.Context) (SubscriptionSubscriberUser, bool) { + var e SubscriptionSubscriberUser + if o.UserSubscriber.IsNull() || o.UserSubscriber.IsUnknown() { + return e, false + } + var v []SubscriptionSubscriberUser + d := o.UserSubscriber.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUserSubscriber sets the value of the UserSubscriber field in Subscriber. +func (o *Subscriber) SetUserSubscriber(ctx context.Context, v SubscriptionSubscriberUser) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["user_subscriber"] + o.UserSubscriber = types.ListValueMust(t, vs) +} + type Subscription struct { // A timestamp indicating when the subscription was created. CreateTime types.String `tfsdk:"create_time" tf:"computed,optional"` @@ -708,7 +2659,7 @@ type Subscription struct { ScheduleId types.String `tfsdk:"schedule_id" tf:"computed,optional"` // Subscriber details for users and destinations to be added as subscribers // to the schedule. - Subscriber []Subscriber `tfsdk:"subscriber" tf:"object"` + Subscriber types.List `tfsdk:"subscriber" tf:"object"` // UUID identifying the subscription. SubscriptionId types.String `tfsdk:"subscription_id" tf:"computed,optional"` // A timestamp indicating when the subscription was last updated. @@ -721,6 +2672,81 @@ func (newState *Subscription) SyncEffectiveFieldsDuringCreateOrUpdate(plan Subsc func (newState *Subscription) SyncEffectiveFieldsDuringRead(existingState Subscription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Subscription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Subscription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "subscriber": reflect.TypeOf(Subscriber{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Subscription +// only implements ToObjectValue() and Type(). +func (o Subscription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "created_by_user_id": o.CreatedByUserId, + "dashboard_id": o.DashboardId, + "etag": o.Etag, + "schedule_id": o.ScheduleId, + "subscriber": o.Subscriber, + "subscription_id": o.SubscriptionId, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Subscription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "created_by_user_id": types.Int64Type, + "dashboard_id": types.StringType, + "etag": types.StringType, + "schedule_id": types.StringType, + "subscriber": basetypes.ListType{ + ElemType: Subscriber{}.Type(ctx), + }, + "subscription_id": types.StringType, + "update_time": types.StringType, + }, + } +} + +// GetSubscriber returns the value of the Subscriber field in Subscription as +// a Subscriber value. +// If the field is unknown or null, the boolean return value is false. +func (o *Subscription) GetSubscriber(ctx context.Context) (Subscriber, bool) { + var e Subscriber + if o.Subscriber.IsNull() || o.Subscriber.IsUnknown() { + return e, false + } + var v []Subscriber + d := o.Subscriber.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSubscriber sets the value of the Subscriber field in Subscription. +func (o *Subscription) SetSubscriber(ctx context.Context, v Subscriber) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subscriber"] + o.Subscriber = types.ListValueMust(t, vs) +} + type SubscriptionSubscriberDestination struct { // The canonical identifier of the destination to receive email // notification. @@ -733,6 +2759,37 @@ func (newState *SubscriptionSubscriberDestination) SyncEffectiveFieldsDuringCrea func (newState *SubscriptionSubscriberDestination) SyncEffectiveFieldsDuringRead(existingState SubscriptionSubscriberDestination) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SubscriptionSubscriberDestination. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SubscriptionSubscriberDestination) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SubscriptionSubscriberDestination +// only implements ToObjectValue() and Type(). +func (o SubscriptionSubscriberDestination) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_id": o.DestinationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SubscriptionSubscriberDestination) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_id": types.StringType, + }, + } +} + type SubscriptionSubscriberUser struct { // UserId of the subscriber. UserId types.Int64 `tfsdk:"user_id" tf:"computed,optional"` @@ -744,6 +2801,37 @@ func (newState *SubscriptionSubscriberUser) SyncEffectiveFieldsDuringCreateOrUpd func (newState *SubscriptionSubscriberUser) SyncEffectiveFieldsDuringRead(existingState SubscriptionSubscriberUser) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SubscriptionSubscriberUser. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SubscriptionSubscriberUser) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SubscriptionSubscriberUser +// only implements ToObjectValue() and Type(). +func (o SubscriptionSubscriberUser) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SubscriptionSubscriberUser) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "user_id": types.Int64Type, + }, + } +} + type TextAttachment struct { // AI generated message Content types.String `tfsdk:"content" tf:"optional"` @@ -757,6 +2845,39 @@ func (newState *TextAttachment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Tex func (newState *TextAttachment) SyncEffectiveFieldsDuringRead(existingState TextAttachment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TextAttachment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TextAttachment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TextAttachment +// only implements ToObjectValue() and Type(). +func (o TextAttachment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TextAttachment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "id": types.StringType, + }, + } +} + // Trash dashboard type TrashDashboardRequest struct { // UUID identifying the dashboard. @@ -769,6 +2890,37 @@ func (newState *TrashDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *TrashDashboardRequest) SyncEffectiveFieldsDuringRead(existingState TrashDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TrashDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TrashDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TrashDashboardRequest +// only implements ToObjectValue() and Type(). +func (o TrashDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TrashDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + type TrashDashboardResponse struct { } @@ -778,6 +2930,33 @@ func (newState *TrashDashboardResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *TrashDashboardResponse) SyncEffectiveFieldsDuringRead(existingState TrashDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TrashDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TrashDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TrashDashboardResponse +// only implements ToObjectValue() and Type(). +func (o TrashDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o TrashDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Unpublish dashboard type UnpublishDashboardRequest struct { // UUID identifying the published dashboard. @@ -790,6 +2969,37 @@ func (newState *UnpublishDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UnpublishDashboardRequest) SyncEffectiveFieldsDuringRead(existingState UnpublishDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UnpublishDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UnpublishDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UnpublishDashboardRequest +// only implements ToObjectValue() and Type(). +func (o UnpublishDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UnpublishDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + type UnpublishDashboardResponse struct { } @@ -799,9 +3009,36 @@ func (newState *UnpublishDashboardResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UnpublishDashboardResponse) SyncEffectiveFieldsDuringRead(existingState UnpublishDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UnpublishDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UnpublishDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UnpublishDashboardResponse +// only implements ToObjectValue() and Type(). +func (o UnpublishDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UnpublishDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Update dashboard type UpdateDashboardRequest struct { - Dashboard []Dashboard `tfsdk:"dashboard" tf:"optional,object"` + Dashboard types.List `tfsdk:"dashboard" tf:"optional,object"` // UUID identifying the dashboard. DashboardId types.String `tfsdk:"-"` } @@ -812,12 +3049,75 @@ func (newState *UpdateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateDashboardRequest) SyncEffectiveFieldsDuringRead(existingState UpdateDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dashboard": reflect.TypeOf(Dashboard{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateDashboardRequest +// only implements ToObjectValue() and Type(). +func (o UpdateDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard": o.Dashboard, + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard": basetypes.ListType{ + ElemType: Dashboard{}.Type(ctx), + }, + "dashboard_id": types.StringType, + }, + } +} + +// GetDashboard returns the value of the Dashboard field in UpdateDashboardRequest as +// a Dashboard value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateDashboardRequest) GetDashboard(ctx context.Context) (Dashboard, bool) { + var e Dashboard + if o.Dashboard.IsNull() || o.Dashboard.IsUnknown() { + return e, false + } + var v []Dashboard + d := o.Dashboard.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDashboard sets the value of the Dashboard field in UpdateDashboardRequest. +func (o *UpdateDashboardRequest) SetDashboard(ctx context.Context, v Dashboard) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dashboard"] + o.Dashboard = types.ListValueMust(t, vs) +} + // Update dashboard schedule type UpdateScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. DashboardId types.String `tfsdk:"-"` - Schedule []Schedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // UUID identifying the schedule. ScheduleId types.String `tfsdk:"-"` } @@ -827,3 +3127,68 @@ func (newState *UpdateScheduleRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateScheduleRequest) SyncEffectiveFieldsDuringRead(existingState UpdateScheduleRequest) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateScheduleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateScheduleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "schedule": reflect.TypeOf(Schedule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateScheduleRequest +// only implements ToObjectValue() and Type(). +func (o UpdateScheduleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "schedule": o.Schedule, + "schedule_id": o.ScheduleId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateScheduleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "schedule": basetypes.ListType{ + ElemType: Schedule{}.Type(ctx), + }, + "schedule_id": types.StringType, + }, + } +} + +// GetSchedule returns the value of the Schedule field in UpdateScheduleRequest as +// a Schedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateScheduleRequest) GetSchedule(ctx context.Context) (Schedule, bool) { + var e Schedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []Schedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in UpdateScheduleRequest. +func (o *UpdateScheduleRequest) SetSchedule(ctx context.Context, v Schedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} diff --git a/internal/service/files_tf/model.go b/internal/service/files_tf/model.go index d2296d76e..c596edcbf 100755 --- a/internal/service/files_tf/model.go +++ b/internal/service/files_tf/model.go @@ -11,9 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package files_tf import ( - "io" + "context" + "reflect" + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AddBlock struct { @@ -30,6 +35,39 @@ func (newState *AddBlock) SyncEffectiveFieldsDuringCreateOrUpdate(plan AddBlock) func (newState *AddBlock) SyncEffectiveFieldsDuringRead(existingState AddBlock) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AddBlock. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AddBlock) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AddBlock +// only implements ToObjectValue() and Type(). +func (o AddBlock) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data": o.Data, + "handle": o.Handle, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AddBlock) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data": types.StringType, + "handle": types.Int64Type, + }, + } +} + type AddBlockResponse struct { } @@ -39,6 +77,33 @@ func (newState *AddBlockResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan A func (newState *AddBlockResponse) SyncEffectiveFieldsDuringRead(existingState AddBlockResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AddBlockResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AddBlockResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AddBlockResponse +// only implements ToObjectValue() and Type(). +func (o AddBlockResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o AddBlockResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Close struct { // The handle on an open stream. Handle types.Int64 `tfsdk:"handle" tf:""` @@ -50,6 +115,37 @@ func (newState *Close) SyncEffectiveFieldsDuringCreateOrUpdate(plan Close) { func (newState *Close) SyncEffectiveFieldsDuringRead(existingState Close) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Close. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Close) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Close +// only implements ToObjectValue() and Type(). +func (o Close) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "handle": o.Handle, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Close) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "handle": types.Int64Type, + }, + } +} + type CloseResponse struct { } @@ -59,6 +155,33 @@ func (newState *CloseResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Clos func (newState *CloseResponse) SyncEffectiveFieldsDuringRead(existingState CloseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CloseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CloseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CloseResponse +// only implements ToObjectValue() and Type(). +func (o CloseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CloseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Create struct { // The flag that specifies whether to overwrite existing file/files. Overwrite types.Bool `tfsdk:"overwrite" tf:"optional"` @@ -72,6 +195,39 @@ func (newState *Create) SyncEffectiveFieldsDuringCreateOrUpdate(plan Create) { func (newState *Create) SyncEffectiveFieldsDuringRead(existingState Create) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Create. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Create) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Create +// only implements ToObjectValue() and Type(). +func (o Create) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "overwrite": o.Overwrite, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Create) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "overwrite": types.BoolType, + "path": types.StringType, + }, + } +} + // Create a directory type CreateDirectoryRequest struct { // The absolute path of a directory. @@ -84,6 +240,37 @@ func (newState *CreateDirectoryRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateDirectoryRequest) SyncEffectiveFieldsDuringRead(existingState CreateDirectoryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateDirectoryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateDirectoryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateDirectoryRequest +// only implements ToObjectValue() and Type(). +func (o CreateDirectoryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "directory_path": o.DirectoryPath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateDirectoryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "directory_path": types.StringType, + }, + } +} + type CreateDirectoryResponse struct { } @@ -93,6 +280,33 @@ func (newState *CreateDirectoryResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateDirectoryResponse) SyncEffectiveFieldsDuringRead(existingState CreateDirectoryResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateDirectoryResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateDirectoryResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateDirectoryResponse +// only implements ToObjectValue() and Type(). +func (o CreateDirectoryResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateDirectoryResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type CreateResponse struct { // Handle which should subsequently be passed into the AddBlock and Close // calls when writing to a file through a stream. @@ -105,6 +319,37 @@ func (newState *CreateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateResponse) SyncEffectiveFieldsDuringRead(existingState CreateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateResponse +// only implements ToObjectValue() and Type(). +func (o CreateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "handle": o.Handle, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "handle": types.Int64Type, + }, + } +} + type Delete struct { // The path of the file or directory to delete. The path should be the // absolute DBFS path. @@ -120,6 +365,39 @@ func (newState *Delete) SyncEffectiveFieldsDuringCreateOrUpdate(plan Delete) { func (newState *Delete) SyncEffectiveFieldsDuringRead(existingState Delete) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Delete. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Delete) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Delete +// only implements ToObjectValue() and Type(). +func (o Delete) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + "recursive": o.Recursive, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Delete) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + "recursive": types.BoolType, + }, + } +} + // Delete a directory type DeleteDirectoryRequest struct { // The absolute path of a directory. @@ -132,6 +410,37 @@ func (newState *DeleteDirectoryRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteDirectoryRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDirectoryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDirectoryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDirectoryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDirectoryRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDirectoryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "directory_path": o.DirectoryPath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDirectoryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "directory_path": types.StringType, + }, + } +} + type DeleteDirectoryResponse struct { } @@ -141,6 +450,33 @@ func (newState *DeleteDirectoryResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *DeleteDirectoryResponse) SyncEffectiveFieldsDuringRead(existingState DeleteDirectoryResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDirectoryResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDirectoryResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDirectoryResponse +// only implements ToObjectValue() and Type(). +func (o DeleteDirectoryResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDirectoryResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a file type DeleteFileRequest struct { // The absolute path of the file. @@ -153,6 +489,37 @@ func (newState *DeleteFileRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteFileRequest) SyncEffectiveFieldsDuringRead(existingState DeleteFileRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteFileRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteFileRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteFileRequest +// only implements ToObjectValue() and Type(). +func (o DeleteFileRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_path": o.FilePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteFileRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_path": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -162,6 +529,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DirectoryEntry struct { // The length of the file in bytes. This field is omitted for directories. FileSize types.Int64 `tfsdk:"file_size" tf:"optional"` @@ -182,6 +576,45 @@ func (newState *DirectoryEntry) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dir func (newState *DirectoryEntry) SyncEffectiveFieldsDuringRead(existingState DirectoryEntry) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DirectoryEntry. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DirectoryEntry) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DirectoryEntry +// only implements ToObjectValue() and Type(). +func (o DirectoryEntry) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_size": o.FileSize, + "is_directory": o.IsDirectory, + "last_modified": o.LastModified, + "name": o.Name, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DirectoryEntry) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_size": types.Int64Type, + "is_directory": types.BoolType, + "last_modified": types.Int64Type, + "name": types.StringType, + "path": types.StringType, + }, + } +} + // Download a file type DownloadRequest struct { // The absolute path of the file. @@ -194,12 +627,43 @@ func (newState *DownloadRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Do func (newState *DownloadRequest) SyncEffectiveFieldsDuringRead(existingState DownloadRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DownloadRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DownloadRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DownloadRequest +// only implements ToObjectValue() and Type(). +func (o DownloadRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_path": o.FilePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DownloadRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_path": types.StringType, + }, + } +} + type DownloadResponse struct { ContentLength types.Int64 `tfsdk:"-"` ContentType types.String `tfsdk:"-"` - Contents io.ReadCloser `tfsdk:"-"` + Contents types.Object `tfsdk:"-"` LastModified types.String `tfsdk:"-"` } @@ -210,6 +674,43 @@ func (newState *DownloadResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan D func (newState *DownloadResponse) SyncEffectiveFieldsDuringRead(existingState DownloadResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DownloadResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DownloadResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DownloadResponse +// only implements ToObjectValue() and Type(). +func (o DownloadResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content-length": o.ContentLength, + "content-type": o.ContentType, + "contents": o.Contents, + "last-modified": o.LastModified, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DownloadResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content-length": types.Int64Type, + "content-type": types.StringType, + "contents": types.ObjectType{}, + "last-modified": types.StringType, + }, + } +} + type FileInfo struct { // The length of the file in bytes. This field is omitted for directories. FileSize types.Int64 `tfsdk:"file_size" tf:"optional"` @@ -227,6 +728,43 @@ func (newState *FileInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan FileInfo) func (newState *FileInfo) SyncEffectiveFieldsDuringRead(existingState FileInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FileInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FileInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FileInfo +// only implements ToObjectValue() and Type(). +func (o FileInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_size": o.FileSize, + "is_dir": o.IsDir, + "modification_time": o.ModificationTime, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FileInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_size": types.Int64Type, + "is_dir": types.BoolType, + "modification_time": types.Int64Type, + "path": types.StringType, + }, + } +} + // Get directory metadata type GetDirectoryMetadataRequest struct { // The absolute path of a directory. @@ -239,6 +777,37 @@ func (newState *GetDirectoryMetadataRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetDirectoryMetadataRequest) SyncEffectiveFieldsDuringRead(existingState GetDirectoryMetadataRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDirectoryMetadataRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDirectoryMetadataRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDirectoryMetadataRequest +// only implements ToObjectValue() and Type(). +func (o GetDirectoryMetadataRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "directory_path": o.DirectoryPath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDirectoryMetadataRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "directory_path": types.StringType, + }, + } +} + type GetDirectoryMetadataResponse struct { } @@ -248,6 +817,33 @@ func (newState *GetDirectoryMetadataResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *GetDirectoryMetadataResponse) SyncEffectiveFieldsDuringRead(existingState GetDirectoryMetadataResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDirectoryMetadataResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDirectoryMetadataResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDirectoryMetadataResponse +// only implements ToObjectValue() and Type(). +func (o GetDirectoryMetadataResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDirectoryMetadataResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Get file metadata type GetMetadataRequest struct { // The absolute path of the file. @@ -260,6 +856,37 @@ func (newState *GetMetadataRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetMetadataRequest) SyncEffectiveFieldsDuringRead(existingState GetMetadataRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetMetadataRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetMetadataRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetMetadataRequest +// only implements ToObjectValue() and Type(). +func (o GetMetadataRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_path": o.FilePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetMetadataRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_path": types.StringType, + }, + } +} + type GetMetadataResponse struct { ContentLength types.Int64 `tfsdk:"-"` @@ -274,6 +901,41 @@ func (newState *GetMetadataResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetMetadataResponse) SyncEffectiveFieldsDuringRead(existingState GetMetadataResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetMetadataResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetMetadataResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetMetadataResponse +// only implements ToObjectValue() and Type(). +func (o GetMetadataResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content-length": o.ContentLength, + "content-type": o.ContentType, + "last-modified": o.LastModified, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetMetadataResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content-length": types.Int64Type, + "content-type": types.StringType, + "last-modified": types.StringType, + }, + } +} + // Get the information of a file or directory type GetStatusRequest struct { // The path of the file or directory. The path should be the absolute DBFS @@ -287,6 +949,37 @@ func (newState *GetStatusRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetStatusRequest) SyncEffectiveFieldsDuringRead(existingState GetStatusRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStatusRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStatusRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStatusRequest +// only implements ToObjectValue() and Type(). +func (o GetStatusRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStatusRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + // List directory contents or file details type ListDbfsRequest struct { // The path of the file or directory. The path should be the absolute DBFS @@ -300,6 +993,37 @@ func (newState *ListDbfsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Li func (newState *ListDbfsRequest) SyncEffectiveFieldsDuringRead(existingState ListDbfsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListDbfsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListDbfsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListDbfsRequest +// only implements ToObjectValue() and Type(). +func (o ListDbfsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListDbfsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + // List directory contents type ListDirectoryContentsRequest struct { // The absolute path of a directory. @@ -332,9 +1056,44 @@ func (newState *ListDirectoryContentsRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *ListDirectoryContentsRequest) SyncEffectiveFieldsDuringRead(existingState ListDirectoryContentsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListDirectoryContentsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListDirectoryContentsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListDirectoryContentsRequest +// only implements ToObjectValue() and Type(). +func (o ListDirectoryContentsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "directory_path": o.DirectoryPath, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListDirectoryContentsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "directory_path": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListDirectoryResponse struct { // Array of DirectoryEntry. - Contents []DirectoryEntry `tfsdk:"contents" tf:"optional"` + Contents types.List `tfsdk:"contents" tf:"optional"` // A token, which can be sent as `page_token` to retrieve the next page. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -345,10 +1104,73 @@ func (newState *ListDirectoryResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListDirectoryResponse) SyncEffectiveFieldsDuringRead(existingState ListDirectoryResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListDirectoryResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListDirectoryResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "contents": reflect.TypeOf(DirectoryEntry{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListDirectoryResponse +// only implements ToObjectValue() and Type(). +func (o ListDirectoryResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "contents": o.Contents, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListDirectoryResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "contents": basetypes.ListType{ + ElemType: DirectoryEntry{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetContents returns the value of the Contents field in ListDirectoryResponse as +// a slice of DirectoryEntry values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListDirectoryResponse) GetContents(ctx context.Context) ([]DirectoryEntry, bool) { + if o.Contents.IsNull() || o.Contents.IsUnknown() { + return nil, false + } + var v []DirectoryEntry + d := o.Contents.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetContents sets the value of the Contents field in ListDirectoryResponse. +func (o *ListDirectoryResponse) SetContents(ctx context.Context, v []DirectoryEntry) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["contents"] + t = t.(attr.TypeWithElementType).ElementType() + o.Contents = types.ListValueMust(t, vs) +} + type ListStatusResponse struct { // A list of FileInfo's that describe contents of directory or file. See // example above. - Files []FileInfo `tfsdk:"files" tf:"optional"` + Files types.List `tfsdk:"files" tf:"optional"` } func (newState *ListStatusResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListStatusResponse) { @@ -357,6 +1179,67 @@ func (newState *ListStatusResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListStatusResponse) SyncEffectiveFieldsDuringRead(existingState ListStatusResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListStatusResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListStatusResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "files": reflect.TypeOf(FileInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListStatusResponse +// only implements ToObjectValue() and Type(). +func (o ListStatusResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "files": o.Files, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListStatusResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "files": basetypes.ListType{ + ElemType: FileInfo{}.Type(ctx), + }, + }, + } +} + +// GetFiles returns the value of the Files field in ListStatusResponse as +// a slice of FileInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListStatusResponse) GetFiles(ctx context.Context) ([]FileInfo, bool) { + if o.Files.IsNull() || o.Files.IsUnknown() { + return nil, false + } + var v []FileInfo + d := o.Files.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFiles sets the value of the Files field in ListStatusResponse. +func (o *ListStatusResponse) SetFiles(ctx context.Context, v []FileInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["files"] + t = t.(attr.TypeWithElementType).ElementType() + o.Files = types.ListValueMust(t, vs) +} + type MkDirs struct { // The path of the new directory. The path should be the absolute DBFS path. Path types.String `tfsdk:"path" tf:""` @@ -368,6 +1251,37 @@ func (newState *MkDirs) SyncEffectiveFieldsDuringCreateOrUpdate(plan MkDirs) { func (newState *MkDirs) SyncEffectiveFieldsDuringRead(existingState MkDirs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MkDirs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MkDirs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MkDirs +// only implements ToObjectValue() and Type(). +func (o MkDirs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MkDirs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + type MkDirsResponse struct { } @@ -377,6 +1291,33 @@ func (newState *MkDirsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan MkD func (newState *MkDirsResponse) SyncEffectiveFieldsDuringRead(existingState MkDirsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MkDirsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MkDirsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MkDirsResponse +// only implements ToObjectValue() and Type(). +func (o MkDirsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o MkDirsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Move struct { // The destination path of the file or directory. The path should be the // absolute DBFS path. @@ -392,6 +1333,39 @@ func (newState *Move) SyncEffectiveFieldsDuringCreateOrUpdate(plan Move) { func (newState *Move) SyncEffectiveFieldsDuringRead(existingState Move) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Move. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Move) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Move +// only implements ToObjectValue() and Type(). +func (o Move) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_path": o.DestinationPath, + "source_path": o.SourcePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Move) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_path": types.StringType, + "source_path": types.StringType, + }, + } +} + type MoveResponse struct { } @@ -401,6 +1375,33 @@ func (newState *MoveResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan MoveR func (newState *MoveResponse) SyncEffectiveFieldsDuringRead(existingState MoveResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MoveResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MoveResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MoveResponse +// only implements ToObjectValue() and Type(). +func (o MoveResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o MoveResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Put struct { // This parameter might be absent, and instead a posted file will be used. Contents types.String `tfsdk:"contents" tf:"optional"` @@ -416,6 +1417,41 @@ func (newState *Put) SyncEffectiveFieldsDuringCreateOrUpdate(plan Put) { func (newState *Put) SyncEffectiveFieldsDuringRead(existingState Put) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Put. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Put) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Put +// only implements ToObjectValue() and Type(). +func (o Put) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "contents": o.Contents, + "overwrite": o.Overwrite, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Put) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "contents": types.StringType, + "overwrite": types.BoolType, + "path": types.StringType, + }, + } +} + type PutResponse struct { } @@ -425,6 +1461,33 @@ func (newState *PutResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutRes func (newState *PutResponse) SyncEffectiveFieldsDuringRead(existingState PutResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutResponse +// only implements ToObjectValue() and Type(). +func (o PutResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PutResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Get the contents of a file type ReadDbfsRequest struct { // The number of bytes to read starting from the offset. This has a limit of @@ -442,6 +1505,41 @@ func (newState *ReadDbfsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Re func (newState *ReadDbfsRequest) SyncEffectiveFieldsDuringRead(existingState ReadDbfsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReadDbfsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReadDbfsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReadDbfsRequest +// only implements ToObjectValue() and Type(). +func (o ReadDbfsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "length": o.Length, + "offset": o.Offset, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ReadDbfsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "length": types.Int64Type, + "offset": types.Int64Type, + "path": types.StringType, + }, + } +} + type ReadResponse struct { // The number of bytes read (could be less than ``length`` if we hit end of // file). This refers to number of bytes read in unencoded version (response @@ -457,9 +1555,42 @@ func (newState *ReadResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ReadR func (newState *ReadResponse) SyncEffectiveFieldsDuringRead(existingState ReadResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReadResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReadResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReadResponse +// only implements ToObjectValue() and Type(). +func (o ReadResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bytes_read": o.BytesRead, + "data": o.Data, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ReadResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bytes_read": types.Int64Type, + "data": types.StringType, + }, + } +} + // Upload a file type UploadRequest struct { - Contents io.ReadCloser `tfsdk:"-"` + Contents types.Object `tfsdk:"-"` // The absolute path of the file. FilePath types.String `tfsdk:"-"` // If true, an existing file will be overwritten. @@ -472,6 +1603,41 @@ func (newState *UploadRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Uplo func (newState *UploadRequest) SyncEffectiveFieldsDuringRead(existingState UploadRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UploadRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UploadRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UploadRequest +// only implements ToObjectValue() and Type(). +func (o UploadRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "contents": o.Contents, + "file_path": o.FilePath, + "overwrite": o.Overwrite, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UploadRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "contents": types.ObjectType{}, + "file_path": types.StringType, + "overwrite": types.BoolType, + }, + } +} + type UploadResponse struct { } @@ -480,3 +1646,30 @@ func (newState *UploadResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upl func (newState *UploadResponse) SyncEffectiveFieldsDuringRead(existingState UploadResponse) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UploadResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UploadResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UploadResponse +// only implements ToObjectValue() and Type(). +func (o UploadResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UploadResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} diff --git a/internal/service/iam_tf/model.go b/internal/service/iam_tf/model.go index 869726ccb..04df338c0 100755 --- a/internal/service/iam_tf/model.go +++ b/internal/service/iam_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package iam_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AccessControlRequest struct { @@ -31,9 +38,46 @@ func (newState *AccessControlRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *AccessControlRequest) SyncEffectiveFieldsDuringRead(existingState AccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccessControlRequest +// only implements ToObjectValue() and Type(). +func (o AccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type AccessControlResponse struct { // All permissions. - AllPermissions []Permission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -50,6 +94,75 @@ func (newState *AccessControlResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *AccessControlResponse) SyncEffectiveFieldsDuringRead(existingState AccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(Permission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccessControlResponse +// only implements ToObjectValue() and Type(). +func (o AccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: Permission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in AccessControlResponse as +// a slice of Permission values. +// If the field is unknown or null, the boolean return value is false. +func (o *AccessControlResponse) GetAllPermissions(ctx context.Context) ([]Permission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []Permission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in AccessControlResponse. +func (o *AccessControlResponse) SetAllPermissions(ctx context.Context, v []Permission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type ComplexValue struct { Display types.String `tfsdk:"display" tf:"optional"` @@ -57,7 +170,7 @@ type ComplexValue struct { Ref types.String `tfsdk:"$ref" tf:"optional"` - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` Value types.String `tfsdk:"value" tf:"optional"` } @@ -68,6 +181,45 @@ func (newState *ComplexValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan Compl func (newState *ComplexValue) SyncEffectiveFieldsDuringRead(existingState ComplexValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ComplexValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ComplexValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ComplexValue +// only implements ToObjectValue() and Type(). +func (o ComplexValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display": o.Display, + "primary": o.Primary, + "$ref": o.Ref, + "type": o.Type_, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ComplexValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display": types.StringType, + "primary": types.BoolType, + "$ref": types.StringType, + "type": types.StringType, + "value": types.StringType, + }, + } +} + // Delete a group type DeleteAccountGroupRequest struct { // Unique ID for a group in the Databricks account. @@ -80,6 +232,37 @@ func (newState *DeleteAccountGroupRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteAccountGroupRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountGroupRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountGroupRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountGroupRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountGroupRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountGroupRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountGroupRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a service principal type DeleteAccountServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks account. @@ -92,6 +275,37 @@ func (newState *DeleteAccountServicePrincipalRequest) SyncEffectiveFieldsDuringC func (newState *DeleteAccountServicePrincipalRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountServicePrincipalRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountServicePrincipalRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountServicePrincipalRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountServicePrincipalRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountServicePrincipalRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountServicePrincipalRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a user type DeleteAccountUserRequest struct { // Unique ID for a user in the Databricks account. @@ -104,6 +318,37 @@ func (newState *DeleteAccountUserRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *DeleteAccountUserRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountUserRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountUserRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountUserRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountUserRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountUserRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountUserRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a group type DeleteGroupRequest struct { // Unique ID for a group in the Databricks workspace. @@ -116,6 +361,37 @@ func (newState *DeleteGroupRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteGroupRequest) SyncEffectiveFieldsDuringRead(existingState DeleteGroupRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteGroupRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteGroupRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteGroupRequest +// only implements ToObjectValue() and Type(). +func (o DeleteGroupRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteGroupRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -125,6 +401,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a service principal type DeleteServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks workspace. @@ -137,6 +440,37 @@ func (newState *DeleteServicePrincipalRequest) SyncEffectiveFieldsDuringCreateOr func (newState *DeleteServicePrincipalRequest) SyncEffectiveFieldsDuringRead(existingState DeleteServicePrincipalRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteServicePrincipalRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteServicePrincipalRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteServicePrincipalRequest +// only implements ToObjectValue() and Type(). +func (o DeleteServicePrincipalRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteServicePrincipalRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a user type DeleteUserRequest struct { // Unique ID for a user in the Databricks workspace. @@ -149,6 +483,37 @@ func (newState *DeleteUserRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteUserRequest) SyncEffectiveFieldsDuringRead(existingState DeleteUserRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteUserRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteUserRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteUserRequest +// only implements ToObjectValue() and Type(). +func (o DeleteUserRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteUserRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete permissions assignment type DeleteWorkspaceAssignmentRequest struct { // The ID of the user, service principal, or group. @@ -163,6 +528,39 @@ func (newState *DeleteWorkspaceAssignmentRequest) SyncEffectiveFieldsDuringCreat func (newState *DeleteWorkspaceAssignmentRequest) SyncEffectiveFieldsDuringRead(existingState DeleteWorkspaceAssignmentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWorkspaceAssignmentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWorkspaceAssignmentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWorkspaceAssignmentRequest +// only implements ToObjectValue() and Type(). +func (o DeleteWorkspaceAssignmentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principal_id": o.PrincipalId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWorkspaceAssignmentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principal_id": types.Int64Type, + "workspace_id": types.Int64Type, + }, + } +} + type DeleteWorkspacePermissionAssignmentResponse struct { } @@ -172,6 +570,33 @@ func (newState *DeleteWorkspacePermissionAssignmentResponse) SyncEffectiveFields func (newState *DeleteWorkspacePermissionAssignmentResponse) SyncEffectiveFieldsDuringRead(existingState DeleteWorkspacePermissionAssignmentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWorkspacePermissionAssignmentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWorkspacePermissionAssignmentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWorkspacePermissionAssignmentResponse +// only implements ToObjectValue() and Type(). +func (o DeleteWorkspacePermissionAssignmentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWorkspacePermissionAssignmentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Get group details type GetAccountGroupRequest struct { // Unique ID for a group in the Databricks account. @@ -184,6 +609,37 @@ func (newState *GetAccountGroupRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetAccountGroupRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountGroupRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountGroupRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountGroupRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountGroupRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountGroupRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountGroupRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Get service principal details type GetAccountServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks account. @@ -196,6 +652,37 @@ func (newState *GetAccountServicePrincipalRequest) SyncEffectiveFieldsDuringCrea func (newState *GetAccountServicePrincipalRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountServicePrincipalRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountServicePrincipalRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountServicePrincipalRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountServicePrincipalRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountServicePrincipalRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountServicePrincipalRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Get user details type GetAccountUserRequest struct { // Comma-separated list of attributes to return in response. @@ -229,6 +716,51 @@ func (newState *GetAccountUserRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *GetAccountUserRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountUserRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountUserRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountUserRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountUserRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountUserRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "id": o.Id, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountUserRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "id": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + // Get assignable roles for a resource type GetAssignableRolesForResourceRequest struct { // The resource name for which assignable roles will be listed. @@ -241,8 +773,39 @@ func (newState *GetAssignableRolesForResourceRequest) SyncEffectiveFieldsDuringC func (newState *GetAssignableRolesForResourceRequest) SyncEffectiveFieldsDuringRead(existingState GetAssignableRolesForResourceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAssignableRolesForResourceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAssignableRolesForResourceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAssignableRolesForResourceRequest +// only implements ToObjectValue() and Type(). +func (o GetAssignableRolesForResourceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "resource": o.Resource, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAssignableRolesForResourceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "resource": types.StringType, + }, + } +} + type GetAssignableRolesForResourceResponse struct { - Roles []Role `tfsdk:"roles" tf:"optional"` + Roles types.List `tfsdk:"roles" tf:"optional"` } func (newState *GetAssignableRolesForResourceResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetAssignableRolesForResourceResponse) { @@ -251,6 +814,67 @@ func (newState *GetAssignableRolesForResourceResponse) SyncEffectiveFieldsDuring func (newState *GetAssignableRolesForResourceResponse) SyncEffectiveFieldsDuringRead(existingState GetAssignableRolesForResourceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAssignableRolesForResourceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAssignableRolesForResourceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "roles": reflect.TypeOf(Role{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAssignableRolesForResourceResponse +// only implements ToObjectValue() and Type(). +func (o GetAssignableRolesForResourceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "roles": o.Roles, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAssignableRolesForResourceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "roles": basetypes.ListType{ + ElemType: Role{}.Type(ctx), + }, + }, + } +} + +// GetRoles returns the value of the Roles field in GetAssignableRolesForResourceResponse as +// a slice of Role values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetAssignableRolesForResourceResponse) GetRoles(ctx context.Context) ([]Role, bool) { + if o.Roles.IsNull() || o.Roles.IsUnknown() { + return nil, false + } + var v []Role + d := o.Roles.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRoles sets the value of the Roles field in GetAssignableRolesForResourceResponse. +func (o *GetAssignableRolesForResourceResponse) SetRoles(ctx context.Context, v []Role) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["roles"] + t = t.(attr.TypeWithElementType).ElementType() + o.Roles = types.ListValueMust(t, vs) +} + // Get group details type GetGroupRequest struct { // Unique ID for a group in the Databricks workspace. @@ -263,9 +887,40 @@ func (newState *GetGroupRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetGroupRequest) SyncEffectiveFieldsDuringRead(existingState GetGroupRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetGroupRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetGroupRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetGroupRequest +// only implements ToObjectValue() and Type(). +func (o GetGroupRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetGroupRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetPasswordPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []PasswordPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetPasswordPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetPasswordPermissionLevelsResponse) { @@ -274,6 +929,67 @@ func (newState *GetPasswordPermissionLevelsResponse) SyncEffectiveFieldsDuringCr func (newState *GetPasswordPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetPasswordPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPasswordPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPasswordPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(PasswordPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPasswordPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetPasswordPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPasswordPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: PasswordPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetPasswordPermissionLevelsResponse as +// a slice of PasswordPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPasswordPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]PasswordPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []PasswordPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetPasswordPermissionLevelsResponse. +func (o *GetPasswordPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []PasswordPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get object permission levels type GetPermissionLevelsRequest struct { // @@ -288,9 +1004,42 @@ func (newState *GetPermissionLevelsRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "request_object_id": o.RequestObjectId, + "request_object_type": o.RequestObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "request_object_id": types.StringType, + "request_object_type": types.StringType, + }, + } +} + type GetPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []PermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetPermissionLevelsResponse) { @@ -299,6 +1048,67 @@ func (newState *GetPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(PermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: PermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetPermissionLevelsResponse as +// a slice of PermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]PermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []PermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetPermissionLevelsResponse. +func (o *GetPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []PermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get object permissions type GetPermissionRequest struct { // The id of the request object. @@ -317,6 +1127,39 @@ func (newState *GetPermissionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GetPermissionRequest) SyncEffectiveFieldsDuringRead(existingState GetPermissionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPermissionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPermissionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPermissionRequest +// only implements ToObjectValue() and Type(). +func (o GetPermissionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "request_object_id": o.RequestObjectId, + "request_object_type": o.RequestObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPermissionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "request_object_id": types.StringType, + "request_object_type": types.StringType, + }, + } +} + // Get a rule set type GetRuleSetRequest struct { // Etag used for versioning. The response is at least as fresh as the eTag @@ -338,6 +1181,39 @@ func (newState *GetRuleSetRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetRuleSetRequest) SyncEffectiveFieldsDuringRead(existingState GetRuleSetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRuleSetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRuleSetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRuleSetRequest +// only implements ToObjectValue() and Type(). +func (o GetRuleSetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRuleSetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "name": types.StringType, + }, + } +} + // Get service principal details type GetServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks workspace. @@ -350,6 +1226,37 @@ func (newState *GetServicePrincipalRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetServicePrincipalRequest) SyncEffectiveFieldsDuringRead(existingState GetServicePrincipalRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetServicePrincipalRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetServicePrincipalRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetServicePrincipalRequest +// only implements ToObjectValue() and Type(). +func (o GetServicePrincipalRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetServicePrincipalRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Get user details type GetUserRequest struct { // Comma-separated list of attributes to return in response. @@ -383,6 +1290,51 @@ func (newState *GetUserRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Get func (newState *GetUserRequest) SyncEffectiveFieldsDuringRead(existingState GetUserRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetUserRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetUserRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetUserRequest +// only implements ToObjectValue() and Type(). +func (o GetUserRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "id": o.Id, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetUserRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "id": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + // List workspace permissions type GetWorkspaceAssignmentRequest struct { // The workspace ID. @@ -395,9 +1347,40 @@ func (newState *GetWorkspaceAssignmentRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetWorkspaceAssignmentRequest) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceAssignmentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceAssignmentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceAssignmentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceAssignmentRequest +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceAssignmentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceAssignmentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_id": types.Int64Type, + }, + } +} + type GrantRule struct { // Principals this grant rule applies to. - Principals []types.String `tfsdk:"principals" tf:"optional"` + Principals types.List `tfsdk:"principals" tf:"optional"` // Role that is assigned to the list of principals. Role types.String `tfsdk:"role" tf:""` } @@ -408,6 +1391,69 @@ func (newState *GrantRule) SyncEffectiveFieldsDuringCreateOrUpdate(plan GrantRul func (newState *GrantRule) SyncEffectiveFieldsDuringRead(existingState GrantRule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GrantRule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GrantRule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "principals": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GrantRule +// only implements ToObjectValue() and Type(). +func (o GrantRule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principals": o.Principals, + "role": o.Role, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GrantRule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principals": basetypes.ListType{ + ElemType: types.StringType, + }, + "role": types.StringType, + }, + } +} + +// GetPrincipals returns the value of the Principals field in GrantRule as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GrantRule) GetPrincipals(ctx context.Context) ([]types.String, bool) { + if o.Principals.IsNull() || o.Principals.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Principals.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrincipals sets the value of the Principals field in GrantRule. +func (o *GrantRule) SetPrincipals(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["principals"] + t = t.(attr.TypeWithElementType).ElementType() + o.Principals = types.ListValueMust(t, vs) +} + type Group struct { // String that represents a human-readable group name DisplayName types.String `tfsdk:"displayName" tf:"optional"` @@ -415,21 +1461,21 @@ type Group struct { // full list of supported values. // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - Entitlements []ComplexValue `tfsdk:"entitlements" tf:"optional"` + Entitlements types.List `tfsdk:"entitlements" tf:"optional"` ExternalId types.String `tfsdk:"externalId" tf:"optional"` - Groups []ComplexValue `tfsdk:"groups" tf:"optional"` + Groups types.List `tfsdk:"groups" tf:"optional"` // Databricks group ID Id types.String `tfsdk:"id" tf:"optional"` - Members []ComplexValue `tfsdk:"members" tf:"optional"` + Members types.List `tfsdk:"members" tf:"optional"` // Container for the group identifier. Workspace local versus account. - Meta []ResourceMeta `tfsdk:"meta" tf:"optional,object"` + Meta types.List `tfsdk:"meta" tf:"optional,object"` // Corresponds to AWS instance profile/arn role. - Roles []ComplexValue `tfsdk:"roles" tf:"optional"` + Roles types.List `tfsdk:"roles" tf:"optional"` // The schema of the group. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` } func (newState *Group) SyncEffectiveFieldsDuringCreateOrUpdate(plan Group) { @@ -438,6 +1484,228 @@ func (newState *Group) SyncEffectiveFieldsDuringCreateOrUpdate(plan Group) { func (newState *Group) SyncEffectiveFieldsDuringRead(existingState Group) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Group. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Group) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "entitlements": reflect.TypeOf(ComplexValue{}), + "groups": reflect.TypeOf(ComplexValue{}), + "members": reflect.TypeOf(ComplexValue{}), + "meta": reflect.TypeOf(ResourceMeta{}), + "roles": reflect.TypeOf(ComplexValue{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Group +// only implements ToObjectValue() and Type(). +func (o Group) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "displayName": o.DisplayName, + "entitlements": o.Entitlements, + "externalId": o.ExternalId, + "groups": o.Groups, + "id": o.Id, + "members": o.Members, + "meta": o.Meta, + "roles": o.Roles, + "schemas": o.Schemas, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Group) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "displayName": types.StringType, + "entitlements": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "externalId": types.StringType, + "groups": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "id": types.StringType, + "members": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "meta": basetypes.ListType{ + ElemType: ResourceMeta{}.Type(ctx), + }, + "roles": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetEntitlements returns the value of the Entitlements field in Group as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *Group) GetEntitlements(ctx context.Context) ([]ComplexValue, bool) { + if o.Entitlements.IsNull() || o.Entitlements.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Entitlements.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEntitlements sets the value of the Entitlements field in Group. +func (o *Group) SetEntitlements(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["entitlements"] + t = t.(attr.TypeWithElementType).ElementType() + o.Entitlements = types.ListValueMust(t, vs) +} + +// GetGroups returns the value of the Groups field in Group as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *Group) GetGroups(ctx context.Context) ([]ComplexValue, bool) { + if o.Groups.IsNull() || o.Groups.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Groups.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGroups sets the value of the Groups field in Group. +func (o *Group) SetGroups(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["groups"] + t = t.(attr.TypeWithElementType).ElementType() + o.Groups = types.ListValueMust(t, vs) +} + +// GetMembers returns the value of the Members field in Group as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *Group) GetMembers(ctx context.Context) ([]ComplexValue, bool) { + if o.Members.IsNull() || o.Members.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Members.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMembers sets the value of the Members field in Group. +func (o *Group) SetMembers(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["members"] + t = t.(attr.TypeWithElementType).ElementType() + o.Members = types.ListValueMust(t, vs) +} + +// GetMeta returns the value of the Meta field in Group as +// a ResourceMeta value. +// If the field is unknown or null, the boolean return value is false. +func (o *Group) GetMeta(ctx context.Context) (ResourceMeta, bool) { + var e ResourceMeta + if o.Meta.IsNull() || o.Meta.IsUnknown() { + return e, false + } + var v []ResourceMeta + d := o.Meta.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMeta sets the value of the Meta field in Group. +func (o *Group) SetMeta(ctx context.Context, v ResourceMeta) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["meta"] + o.Meta = types.ListValueMust(t, vs) +} + +// GetRoles returns the value of the Roles field in Group as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *Group) GetRoles(ctx context.Context) ([]ComplexValue, bool) { + if o.Roles.IsNull() || o.Roles.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Roles.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRoles sets the value of the Roles field in Group. +func (o *Group) SetRoles(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["roles"] + t = t.(attr.TypeWithElementType).ElementType() + o.Roles = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in Group as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Group) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in Group. +func (o *Group) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + // List group details type ListAccountGroupsRequest struct { // Comma-separated list of attributes to return in response. @@ -468,6 +1736,49 @@ func (newState *ListAccountGroupsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListAccountGroupsRequest) SyncEffectiveFieldsDuringRead(existingState ListAccountGroupsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountGroupsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountGroupsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountGroupsRequest +// only implements ToObjectValue() and Type(). +func (o ListAccountGroupsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountGroupsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + // List service principals type ListAccountServicePrincipalsRequest struct { // Comma-separated list of attributes to return in response. @@ -498,6 +1809,49 @@ func (newState *ListAccountServicePrincipalsRequest) SyncEffectiveFieldsDuringCr func (newState *ListAccountServicePrincipalsRequest) SyncEffectiveFieldsDuringRead(existingState ListAccountServicePrincipalsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountServicePrincipalsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountServicePrincipalsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountServicePrincipalsRequest +// only implements ToObjectValue() and Type(). +func (o ListAccountServicePrincipalsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountServicePrincipalsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + // List users type ListAccountUsersRequest struct { // Comma-separated list of attributes to return in response. @@ -529,6 +1883,49 @@ func (newState *ListAccountUsersRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListAccountUsersRequest) SyncEffectiveFieldsDuringRead(existingState ListAccountUsersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountUsersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountUsersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountUsersRequest +// only implements ToObjectValue() and Type(). +func (o ListAccountUsersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountUsersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + // List group details type ListGroupsRequest struct { // Comma-separated list of attributes to return in response. @@ -559,13 +1956,56 @@ func (newState *ListGroupsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListGroupsRequest) SyncEffectiveFieldsDuringRead(existingState ListGroupsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListGroupsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListGroupsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListGroupsRequest +// only implements ToObjectValue() and Type(). +func (o ListGroupsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListGroupsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + type ListGroupsResponse struct { // Total results returned in the response. ItemsPerPage types.Int64 `tfsdk:"itemsPerPage" tf:"optional"` // User objects returned in the response. - Resources []Group `tfsdk:"Resources" tf:"optional"` + Resources types.List `tfsdk:"Resources" tf:"optional"` // The schema of the service principal. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` // Starting index of all the results that matched the request filters. First // item is number 1. StartIndex types.Int64 `tfsdk:"startIndex" tf:"optional"` @@ -579,13 +2019,111 @@ func (newState *ListGroupsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListGroupsResponse) SyncEffectiveFieldsDuringRead(existingState ListGroupsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListGroupsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListGroupsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "Resources": reflect.TypeOf(Group{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListGroupsResponse +// only implements ToObjectValue() and Type(). +func (o ListGroupsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "itemsPerPage": o.ItemsPerPage, + "Resources": o.Resources, + "schemas": o.Schemas, + "startIndex": o.StartIndex, + "totalResults": o.TotalResults, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListGroupsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "itemsPerPage": types.Int64Type, + "Resources": basetypes.ListType{ + ElemType: Group{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + "startIndex": types.Int64Type, + "totalResults": types.Int64Type, + }, + } +} + +// GetResources returns the value of the Resources field in ListGroupsResponse as +// a slice of Group values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListGroupsResponse) GetResources(ctx context.Context) ([]Group, bool) { + if o.Resources.IsNull() || o.Resources.IsUnknown() { + return nil, false + } + var v []Group + d := o.Resources.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResources sets the value of the Resources field in ListGroupsResponse. +func (o *ListGroupsResponse) SetResources(ctx context.Context, v []Group) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["Resources"] + t = t.(attr.TypeWithElementType).ElementType() + o.Resources = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in ListGroupsResponse as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListGroupsResponse) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in ListGroupsResponse. +func (o *ListGroupsResponse) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + type ListServicePrincipalResponse struct { // Total results returned in the response. ItemsPerPage types.Int64 `tfsdk:"itemsPerPage" tf:"optional"` // User objects returned in the response. - Resources []ServicePrincipal `tfsdk:"Resources" tf:"optional"` + Resources types.List `tfsdk:"Resources" tf:"optional"` // The schema of the List response. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` // Starting index of all the results that matched the request filters. First // item is number 1. StartIndex types.Int64 `tfsdk:"startIndex" tf:"optional"` @@ -599,6 +2137,104 @@ func (newState *ListServicePrincipalResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *ListServicePrincipalResponse) SyncEffectiveFieldsDuringRead(existingState ListServicePrincipalResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListServicePrincipalResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListServicePrincipalResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "Resources": reflect.TypeOf(ServicePrincipal{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListServicePrincipalResponse +// only implements ToObjectValue() and Type(). +func (o ListServicePrincipalResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "itemsPerPage": o.ItemsPerPage, + "Resources": o.Resources, + "schemas": o.Schemas, + "startIndex": o.StartIndex, + "totalResults": o.TotalResults, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListServicePrincipalResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "itemsPerPage": types.Int64Type, + "Resources": basetypes.ListType{ + ElemType: ServicePrincipal{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + "startIndex": types.Int64Type, + "totalResults": types.Int64Type, + }, + } +} + +// GetResources returns the value of the Resources field in ListServicePrincipalResponse as +// a slice of ServicePrincipal values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListServicePrincipalResponse) GetResources(ctx context.Context) ([]ServicePrincipal, bool) { + if o.Resources.IsNull() || o.Resources.IsUnknown() { + return nil, false + } + var v []ServicePrincipal + d := o.Resources.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResources sets the value of the Resources field in ListServicePrincipalResponse. +func (o *ListServicePrincipalResponse) SetResources(ctx context.Context, v []ServicePrincipal) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["Resources"] + t = t.(attr.TypeWithElementType).ElementType() + o.Resources = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in ListServicePrincipalResponse as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListServicePrincipalResponse) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in ListServicePrincipalResponse. +func (o *ListServicePrincipalResponse) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + // List service principals type ListServicePrincipalsRequest struct { // Comma-separated list of attributes to return in response. @@ -629,6 +2265,49 @@ func (newState *ListServicePrincipalsRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *ListServicePrincipalsRequest) SyncEffectiveFieldsDuringRead(existingState ListServicePrincipalsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListServicePrincipalsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListServicePrincipalsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListServicePrincipalsRequest +// only implements ToObjectValue() and Type(). +func (o ListServicePrincipalsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListServicePrincipalsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + // List users type ListUsersRequest struct { // Comma-separated list of attributes to return in response. @@ -660,13 +2339,56 @@ func (newState *ListUsersRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListUsersRequest) SyncEffectiveFieldsDuringRead(existingState ListUsersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListUsersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListUsersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListUsersRequest +// only implements ToObjectValue() and Type(). +func (o ListUsersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attributes": o.Attributes, + "count": o.Count, + "excludedAttributes": o.ExcludedAttributes, + "filter": o.Filter, + "sortBy": o.SortBy, + "sortOrder": o.SortOrder, + "startIndex": o.StartIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListUsersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attributes": types.StringType, + "count": types.Int64Type, + "excludedAttributes": types.StringType, + "filter": types.StringType, + "sortBy": types.StringType, + "sortOrder": types.StringType, + "startIndex": types.Int64Type, + }, + } +} + type ListUsersResponse struct { // Total results returned in the response. ItemsPerPage types.Int64 `tfsdk:"itemsPerPage" tf:"optional"` // User objects returned in the response. - Resources []User `tfsdk:"Resources" tf:"optional"` + Resources types.List `tfsdk:"Resources" tf:"optional"` // The schema of the List response. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` // Starting index of all the results that matched the request filters. First // item is number 1. StartIndex types.Int64 `tfsdk:"startIndex" tf:"optional"` @@ -680,6 +2402,104 @@ func (newState *ListUsersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListUsersResponse) SyncEffectiveFieldsDuringRead(existingState ListUsersResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListUsersResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListUsersResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "Resources": reflect.TypeOf(User{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListUsersResponse +// only implements ToObjectValue() and Type(). +func (o ListUsersResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "itemsPerPage": o.ItemsPerPage, + "Resources": o.Resources, + "schemas": o.Schemas, + "startIndex": o.StartIndex, + "totalResults": o.TotalResults, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListUsersResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "itemsPerPage": types.Int64Type, + "Resources": basetypes.ListType{ + ElemType: User{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + "startIndex": types.Int64Type, + "totalResults": types.Int64Type, + }, + } +} + +// GetResources returns the value of the Resources field in ListUsersResponse as +// a slice of User values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListUsersResponse) GetResources(ctx context.Context) ([]User, bool) { + if o.Resources.IsNull() || o.Resources.IsUnknown() { + return nil, false + } + var v []User + d := o.Resources.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResources sets the value of the Resources field in ListUsersResponse. +func (o *ListUsersResponse) SetResources(ctx context.Context, v []User) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["Resources"] + t = t.(attr.TypeWithElementType).ElementType() + o.Resources = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in ListUsersResponse as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListUsersResponse) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in ListUsersResponse. +func (o *ListUsersResponse) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + // Get permission assignments type ListWorkspaceAssignmentRequest struct { // The workspace ID for the account. @@ -692,6 +2512,37 @@ func (newState *ListWorkspaceAssignmentRequest) SyncEffectiveFieldsDuringCreateO func (newState *ListWorkspaceAssignmentRequest) SyncEffectiveFieldsDuringRead(existingState ListWorkspaceAssignmentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListWorkspaceAssignmentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListWorkspaceAssignmentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListWorkspaceAssignmentRequest +// only implements ToObjectValue() and Type(). +func (o ListWorkspaceAssignmentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListWorkspaceAssignmentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_id": types.Int64Type, + }, + } +} + type MigratePermissionsRequest struct { // The name of the workspace group that permissions will be migrated from. FromWorkspaceGroupName types.String `tfsdk:"from_workspace_group_name" tf:""` @@ -710,6 +2561,43 @@ func (newState *MigratePermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *MigratePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState MigratePermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MigratePermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MigratePermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MigratePermissionsRequest +// only implements ToObjectValue() and Type(). +func (o MigratePermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "from_workspace_group_name": o.FromWorkspaceGroupName, + "size": o.Size, + "to_account_group_name": o.ToAccountGroupName, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MigratePermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "from_workspace_group_name": types.StringType, + "size": types.Int64Type, + "to_account_group_name": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type MigratePermissionsResponse struct { // Number of permissions migrated. PermissionsMigrated types.Int64 `tfsdk:"permissions_migrated" tf:"optional"` @@ -721,6 +2609,37 @@ func (newState *MigratePermissionsResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *MigratePermissionsResponse) SyncEffectiveFieldsDuringRead(existingState MigratePermissionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MigratePermissionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MigratePermissionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MigratePermissionsResponse +// only implements ToObjectValue() and Type(). +func (o MigratePermissionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permissions_migrated": o.PermissionsMigrated, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MigratePermissionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permissions_migrated": types.Int64Type, + }, + } +} + type Name struct { // Family name of the Databricks user. FamilyName types.String `tfsdk:"familyName" tf:"optional"` @@ -734,8 +2653,41 @@ func (newState *Name) SyncEffectiveFieldsDuringCreateOrUpdate(plan Name) { func (newState *Name) SyncEffectiveFieldsDuringRead(existingState Name) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Name. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Name) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Name +// only implements ToObjectValue() and Type(). +func (o Name) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "familyName": o.FamilyName, + "givenName": o.GivenName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Name) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "familyName": types.StringType, + "givenName": types.StringType, + }, + } +} + type ObjectPermissions struct { - AccessControlList []AccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -748,14 +2700,79 @@ func (newState *ObjectPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ObjectPermissions) SyncEffectiveFieldsDuringRead(existingState ObjectPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ObjectPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ObjectPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ObjectPermissions +// only implements ToObjectValue() and Type(). +func (o ObjectPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ObjectPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ObjectPermissions as +// a slice of AccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *ObjectPermissions) GetAccessControlList(ctx context.Context) ([]AccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ObjectPermissions. +func (o *ObjectPermissions) SetAccessControlList(ctx context.Context, v []AccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type PartialUpdate struct { // Unique ID for a user in the Databricks workspace. Id types.String `tfsdk:"-"` - Operations []Patch `tfsdk:"Operations" tf:"optional"` + Operations types.List `tfsdk:"Operations" tf:"optional"` // The schema of the patch request. Must be // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` } func (newState *PartialUpdate) SyncEffectiveFieldsDuringCreateOrUpdate(plan PartialUpdate) { @@ -764,6 +2781,100 @@ func (newState *PartialUpdate) SyncEffectiveFieldsDuringCreateOrUpdate(plan Part func (newState *PartialUpdate) SyncEffectiveFieldsDuringRead(existingState PartialUpdate) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PartialUpdate. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PartialUpdate) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "Operations": reflect.TypeOf(Patch{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PartialUpdate +// only implements ToObjectValue() and Type(). +func (o PartialUpdate) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "Operations": o.Operations, + "schemas": o.Schemas, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PartialUpdate) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "Operations": basetypes.ListType{ + ElemType: Patch{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetOperations returns the value of the Operations field in PartialUpdate as +// a slice of Patch values. +// If the field is unknown or null, the boolean return value is false. +func (o *PartialUpdate) GetOperations(ctx context.Context) ([]Patch, bool) { + if o.Operations.IsNull() || o.Operations.IsUnknown() { + return nil, false + } + var v []Patch + d := o.Operations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOperations sets the value of the Operations field in PartialUpdate. +func (o *PartialUpdate) SetOperations(ctx context.Context, v []Patch) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["Operations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Operations = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in PartialUpdate as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PartialUpdate) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in PartialUpdate. +func (o *PartialUpdate) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + type PasswordAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -781,9 +2892,46 @@ func (newState *PasswordAccessControlRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *PasswordAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState PasswordAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PasswordAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PasswordAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PasswordAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o PasswordAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PasswordAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type PasswordAccessControlResponse struct { // All permissions. - AllPermissions []PasswordPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -800,10 +2948,79 @@ func (newState *PasswordAccessControlResponse) SyncEffectiveFieldsDuringCreateOr func (newState *PasswordAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState PasswordAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PasswordAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PasswordAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(PasswordPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PasswordAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o PasswordAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PasswordAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: PasswordPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in PasswordAccessControlResponse as +// a slice of PasswordPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *PasswordAccessControlResponse) GetAllPermissions(ctx context.Context) ([]PasswordPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []PasswordPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in PasswordAccessControlResponse. +func (o *PasswordAccessControlResponse) SetAllPermissions(ctx context.Context, v []PasswordPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type PasswordPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -814,8 +3031,73 @@ func (newState *PasswordPermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PasswordPermission) SyncEffectiveFieldsDuringRead(existingState PasswordPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PasswordPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PasswordPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PasswordPermission +// only implements ToObjectValue() and Type(). +func (o PasswordPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PasswordPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in PasswordPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PasswordPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in PasswordPermission. +func (o *PasswordPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type PasswordPermissions struct { - AccessControlList []PasswordAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -828,6 +3110,71 @@ func (newState *PasswordPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *PasswordPermissions) SyncEffectiveFieldsDuringRead(existingState PasswordPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PasswordPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PasswordPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(PasswordAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PasswordPermissions +// only implements ToObjectValue() and Type(). +func (o PasswordPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PasswordPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: PasswordAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in PasswordPermissions as +// a slice of PasswordAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *PasswordPermissions) GetAccessControlList(ctx context.Context) ([]PasswordAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []PasswordAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in PasswordPermissions. +func (o *PasswordPermissions) SetAccessControlList(ctx context.Context, v []PasswordAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type PasswordPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -840,8 +3187,41 @@ func (newState *PasswordPermissionsDescription) SyncEffectiveFieldsDuringCreateO func (newState *PasswordPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState PasswordPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PasswordPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PasswordPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PasswordPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o PasswordPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PasswordPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type PasswordPermissionsRequest struct { - AccessControlList []PasswordAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` } func (newState *PasswordPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan PasswordPermissionsRequest) { @@ -850,13 +3230,74 @@ func (newState *PasswordPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *PasswordPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState PasswordPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PasswordPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PasswordPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(PasswordAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PasswordPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o PasswordPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PasswordPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: PasswordAccessControlRequest{}.Type(ctx), + }, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in PasswordPermissionsRequest as +// a slice of PasswordAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *PasswordPermissionsRequest) GetAccessControlList(ctx context.Context) ([]PasswordAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []PasswordAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in PasswordPermissionsRequest. +func (o *PasswordPermissionsRequest) SetAccessControlList(ctx context.Context, v []PasswordAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type Patch struct { // Type of patch operation. Op types.String `tfsdk:"op" tf:"optional"` // Selection of patch operation Path types.String `tfsdk:"path" tf:"optional"` // Value to modify - Value any `tfsdk:"value" tf:"optional"` + Value types.Object `tfsdk:"value" tf:"optional"` } func (newState *Patch) SyncEffectiveFieldsDuringCreateOrUpdate(plan Patch) { @@ -865,6 +3306,41 @@ func (newState *Patch) SyncEffectiveFieldsDuringCreateOrUpdate(plan Patch) { func (newState *Patch) SyncEffectiveFieldsDuringRead(existingState Patch) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Patch. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Patch) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Patch +// only implements ToObjectValue() and Type(). +func (o Patch) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "op": o.Op, + "path": o.Path, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Patch) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "op": types.StringType, + "path": types.StringType, + "value": types.ObjectType{}, + }, + } +} + type PatchResponse struct { } @@ -874,10 +3350,37 @@ func (newState *PatchResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Patc func (newState *PatchResponse) SyncEffectiveFieldsDuringRead(existingState PatchResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PatchResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PatchResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PatchResponse +// only implements ToObjectValue() and Type(). +func (o PatchResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PatchResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Permission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -888,15 +3391,80 @@ func (newState *Permission) SyncEffectiveFieldsDuringCreateOrUpdate(plan Permiss func (newState *Permission) SyncEffectiveFieldsDuringRead(existingState Permission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Permission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Permission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Permission +// only implements ToObjectValue() and Type(). +func (o Permission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Permission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in Permission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Permission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in Permission. +func (o *Permission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + // The output format for existing workspace PermissionAssignment records, which // contains some info for user consumption. type PermissionAssignment struct { // Error response associated with a workspace permission assignment, if any. Error types.String `tfsdk:"error" tf:"optional"` // The permissions level of the principal. - Permissions []types.String `tfsdk:"permissions" tf:"optional"` + Permissions types.List `tfsdk:"permissions" tf:"optional"` // Information about the principal assigned to the workspace. - Principal []PrincipalOutput `tfsdk:"principal" tf:"optional,object"` + Principal types.List `tfsdk:"principal" tf:"optional,object"` } func (newState *PermissionAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(plan PermissionAssignment) { @@ -905,9 +3473,103 @@ func (newState *PermissionAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *PermissionAssignment) SyncEffectiveFieldsDuringRead(existingState PermissionAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permissions": reflect.TypeOf(types.String{}), + "principal": reflect.TypeOf(PrincipalOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionAssignment +// only implements ToObjectValue() and Type(). +func (o PermissionAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error": o.Error, + "permissions": o.Permissions, + "principal": o.Principal, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error": types.StringType, + "permissions": basetypes.ListType{ + ElemType: types.StringType, + }, + "principal": basetypes.ListType{ + ElemType: PrincipalOutput{}.Type(ctx), + }, + }, + } +} + +// GetPermissions returns the value of the Permissions field in PermissionAssignment as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionAssignment) GetPermissions(ctx context.Context) ([]types.String, bool) { + if o.Permissions.IsNull() || o.Permissions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Permissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissions sets the value of the Permissions field in PermissionAssignment. +func (o *PermissionAssignment) SetPermissions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Permissions = types.ListValueMust(t, vs) +} + +// GetPrincipal returns the value of the Principal field in PermissionAssignment as +// a PrincipalOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionAssignment) GetPrincipal(ctx context.Context) (PrincipalOutput, bool) { + var e PrincipalOutput + if o.Principal.IsNull() || o.Principal.IsUnknown() { + return e, false + } + var v []PrincipalOutput + d := o.Principal.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPrincipal sets the value of the Principal field in PermissionAssignment. +func (o *PermissionAssignment) SetPrincipal(ctx context.Context, v PrincipalOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["principal"] + o.Principal = types.ListValueMust(t, vs) +} + type PermissionAssignments struct { // Array of permissions assignments defined for a workspace. - PermissionAssignments []PermissionAssignment `tfsdk:"permission_assignments" tf:"optional"` + PermissionAssignments types.List `tfsdk:"permission_assignments" tf:"optional"` } func (newState *PermissionAssignments) SyncEffectiveFieldsDuringCreateOrUpdate(plan PermissionAssignments) { @@ -916,6 +3578,67 @@ func (newState *PermissionAssignments) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *PermissionAssignments) SyncEffectiveFieldsDuringRead(existingState PermissionAssignments) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionAssignments. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionAssignments) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_assignments": reflect.TypeOf(PermissionAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionAssignments +// only implements ToObjectValue() and Type(). +func (o PermissionAssignments) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_assignments": o.PermissionAssignments, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionAssignments) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_assignments": basetypes.ListType{ + ElemType: PermissionAssignment{}.Type(ctx), + }, + }, + } +} + +// GetPermissionAssignments returns the value of the PermissionAssignments field in PermissionAssignments as +// a slice of PermissionAssignment values. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionAssignments) GetPermissionAssignments(ctx context.Context) ([]PermissionAssignment, bool) { + if o.PermissionAssignments.IsNull() || o.PermissionAssignments.IsUnknown() { + return nil, false + } + var v []PermissionAssignment + d := o.PermissionAssignments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionAssignments sets the value of the PermissionAssignments field in PermissionAssignments. +func (o *PermissionAssignments) SetPermissionAssignments(ctx context.Context, v []PermissionAssignment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_assignments"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionAssignments = types.ListValueMust(t, vs) +} + type PermissionOutput struct { // The results of a permissions query. Description types.String `tfsdk:"description" tf:"optional"` @@ -929,6 +3652,39 @@ func (newState *PermissionOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan P func (newState *PermissionOutput) SyncEffectiveFieldsDuringRead(existingState PermissionOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionOutput +// only implements ToObjectValue() and Type(). +func (o PermissionOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type PermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -941,8 +3697,41 @@ func (newState *PermissionsDescription) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *PermissionsDescription) SyncEffectiveFieldsDuringRead(existingState PermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionsDescription +// only implements ToObjectValue() and Type(). +func (o PermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type PermissionsRequest struct { - AccessControlList []AccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The id of the request object. RequestObjectId types.String `tfsdk:"-"` // The type of the request object. Can be one of the following: alerts, @@ -959,6 +3748,71 @@ func (newState *PermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PermissionsRequest) SyncEffectiveFieldsDuringRead(existingState PermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PermissionsRequest +// only implements ToObjectValue() and Type(). +func (o PermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "request_object_id": o.RequestObjectId, + "request_object_type": o.RequestObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AccessControlRequest{}.Type(ctx), + }, + "request_object_id": types.StringType, + "request_object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in PermissionsRequest as +// a slice of AccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *PermissionsRequest) GetAccessControlList(ctx context.Context) ([]AccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in PermissionsRequest. +func (o *PermissionsRequest) SetAccessControlList(ctx context.Context, v []AccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + // Information about the principal assigned to the workspace. type PrincipalOutput struct { // The display name of the principal. @@ -980,6 +3834,45 @@ func (newState *PrincipalOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pr func (newState *PrincipalOutput) SyncEffectiveFieldsDuringRead(existingState PrincipalOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PrincipalOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PrincipalOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PrincipalOutput +// only implements ToObjectValue() and Type(). +func (o PrincipalOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display_name": o.DisplayName, + "group_name": o.GroupName, + "principal_id": o.PrincipalId, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PrincipalOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display_name": types.StringType, + "group_name": types.StringType, + "principal_id": types.Int64Type, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type ResourceMeta struct { // Identifier for group type. Can be local workspace group // (`WorkspaceGroup`) or account group (`Group`). @@ -992,6 +3885,37 @@ func (newState *ResourceMeta) SyncEffectiveFieldsDuringCreateOrUpdate(plan Resou func (newState *ResourceMeta) SyncEffectiveFieldsDuringRead(existingState ResourceMeta) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResourceMeta. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResourceMeta) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResourceMeta +// only implements ToObjectValue() and Type(). +func (o ResourceMeta) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "resourceType": o.ResourceType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResourceMeta) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "resourceType": types.StringType, + }, + } +} + type Role struct { // Role to assign to a principal or a list of principals on a resource. Name types.String `tfsdk:"name" tf:""` @@ -1003,11 +3927,42 @@ func (newState *Role) SyncEffectiveFieldsDuringCreateOrUpdate(plan Role) { func (newState *Role) SyncEffectiveFieldsDuringRead(existingState Role) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Role. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Role) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Role +// only implements ToObjectValue() and Type(). +func (o Role) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Role) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type RuleSetResponse struct { // Identifies the version of the rule set returned. Etag types.String `tfsdk:"etag" tf:"optional"` - GrantRules []GrantRule `tfsdk:"grant_rules" tf:"optional"` + GrantRules types.List `tfsdk:"grant_rules" tf:"optional"` // Name of the rule set. Name types.String `tfsdk:"name" tf:"optional"` } @@ -1018,13 +3973,78 @@ func (newState *RuleSetResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ru func (newState *RuleSetResponse) SyncEffectiveFieldsDuringRead(existingState RuleSetResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RuleSetResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RuleSetResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "grant_rules": reflect.TypeOf(GrantRule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RuleSetResponse +// only implements ToObjectValue() and Type(). +func (o RuleSetResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "grant_rules": o.GrantRules, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RuleSetResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "grant_rules": basetypes.ListType{ + ElemType: GrantRule{}.Type(ctx), + }, + "name": types.StringType, + }, + } +} + +// GetGrantRules returns the value of the GrantRules field in RuleSetResponse as +// a slice of GrantRule values. +// If the field is unknown or null, the boolean return value is false. +func (o *RuleSetResponse) GetGrantRules(ctx context.Context) ([]GrantRule, bool) { + if o.GrantRules.IsNull() || o.GrantRules.IsUnknown() { + return nil, false + } + var v []GrantRule + d := o.GrantRules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGrantRules sets the value of the GrantRules field in RuleSetResponse. +func (o *RuleSetResponse) SetGrantRules(ctx context.Context, v []GrantRule) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["grant_rules"] + t = t.(attr.TypeWithElementType).ElementType() + o.GrantRules = types.ListValueMust(t, vs) +} + type RuleSetUpdateRequest struct { // The expected etag of the rule set to update. The update will fail if the // value does not match the value that is stored in account access control // service. Etag types.String `tfsdk:"etag" tf:""` - GrantRules []GrantRule `tfsdk:"grant_rules" tf:"optional"` + GrantRules types.List `tfsdk:"grant_rules" tf:"optional"` // Name of the rule set. Name types.String `tfsdk:"name" tf:""` } @@ -1035,6 +4055,71 @@ func (newState *RuleSetUpdateRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *RuleSetUpdateRequest) SyncEffectiveFieldsDuringRead(existingState RuleSetUpdateRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RuleSetUpdateRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RuleSetUpdateRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "grant_rules": reflect.TypeOf(GrantRule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RuleSetUpdateRequest +// only implements ToObjectValue() and Type(). +func (o RuleSetUpdateRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "grant_rules": o.GrantRules, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RuleSetUpdateRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "grant_rules": basetypes.ListType{ + ElemType: GrantRule{}.Type(ctx), + }, + "name": types.StringType, + }, + } +} + +// GetGrantRules returns the value of the GrantRules field in RuleSetUpdateRequest as +// a slice of GrantRule values. +// If the field is unknown or null, the boolean return value is false. +func (o *RuleSetUpdateRequest) GetGrantRules(ctx context.Context) ([]GrantRule, bool) { + if o.GrantRules.IsNull() || o.GrantRules.IsUnknown() { + return nil, false + } + var v []GrantRule + d := o.GrantRules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGrantRules sets the value of the GrantRules field in RuleSetUpdateRequest. +func (o *RuleSetUpdateRequest) SetGrantRules(ctx context.Context, v []GrantRule) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["grant_rules"] + t = t.(attr.TypeWithElementType).ElementType() + o.GrantRules = types.ListValueMust(t, vs) +} + type ServicePrincipal struct { // If this user is active Active types.Bool `tfsdk:"active" tf:"optional"` @@ -1046,17 +4131,17 @@ type ServicePrincipal struct { // entitlements] for a full list of supported values. // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - Entitlements []ComplexValue `tfsdk:"entitlements" tf:"optional"` + Entitlements types.List `tfsdk:"entitlements" tf:"optional"` ExternalId types.String `tfsdk:"externalId" tf:"optional"` - Groups []ComplexValue `tfsdk:"groups" tf:"optional"` + Groups types.List `tfsdk:"groups" tf:"optional"` // Databricks service principal ID. Id types.String `tfsdk:"id" tf:"optional"` // Corresponds to AWS instance profile/arn role. - Roles []ComplexValue `tfsdk:"roles" tf:"optional"` + Roles types.List `tfsdk:"roles" tf:"optional"` // The schema of the List response. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` } func (newState *ServicePrincipal) SyncEffectiveFieldsDuringCreateOrUpdate(plan ServicePrincipal) { @@ -1065,6 +4150,170 @@ func (newState *ServicePrincipal) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *ServicePrincipal) SyncEffectiveFieldsDuringRead(existingState ServicePrincipal) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServicePrincipal. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServicePrincipal) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "entitlements": reflect.TypeOf(ComplexValue{}), + "groups": reflect.TypeOf(ComplexValue{}), + "roles": reflect.TypeOf(ComplexValue{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServicePrincipal +// only implements ToObjectValue() and Type(). +func (o ServicePrincipal) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "active": o.Active, + "applicationId": o.ApplicationId, + "displayName": o.DisplayName, + "entitlements": o.Entitlements, + "externalId": o.ExternalId, + "groups": o.Groups, + "id": o.Id, + "roles": o.Roles, + "schemas": o.Schemas, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServicePrincipal) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "active": types.BoolType, + "applicationId": types.StringType, + "displayName": types.StringType, + "entitlements": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "externalId": types.StringType, + "groups": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "id": types.StringType, + "roles": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetEntitlements returns the value of the Entitlements field in ServicePrincipal as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServicePrincipal) GetEntitlements(ctx context.Context) ([]ComplexValue, bool) { + if o.Entitlements.IsNull() || o.Entitlements.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Entitlements.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEntitlements sets the value of the Entitlements field in ServicePrincipal. +func (o *ServicePrincipal) SetEntitlements(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["entitlements"] + t = t.(attr.TypeWithElementType).ElementType() + o.Entitlements = types.ListValueMust(t, vs) +} + +// GetGroups returns the value of the Groups field in ServicePrincipal as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServicePrincipal) GetGroups(ctx context.Context) ([]ComplexValue, bool) { + if o.Groups.IsNull() || o.Groups.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Groups.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGroups sets the value of the Groups field in ServicePrincipal. +func (o *ServicePrincipal) SetGroups(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["groups"] + t = t.(attr.TypeWithElementType).ElementType() + o.Groups = types.ListValueMust(t, vs) +} + +// GetRoles returns the value of the Roles field in ServicePrincipal as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServicePrincipal) GetRoles(ctx context.Context) ([]ComplexValue, bool) { + if o.Roles.IsNull() || o.Roles.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Roles.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRoles sets the value of the Roles field in ServicePrincipal. +func (o *ServicePrincipal) SetRoles(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["roles"] + t = t.(attr.TypeWithElementType).ElementType() + o.Roles = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in ServicePrincipal as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServicePrincipal) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in ServicePrincipal. +func (o *ServicePrincipal) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + type UpdateResponse struct { } @@ -1074,11 +4323,38 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateRuleSetRequest struct { // Name of the rule set. Name types.String `tfsdk:"name" tf:""` - RuleSet []RuleSetUpdateRequest `tfsdk:"rule_set" tf:"object"` + RuleSet types.List `tfsdk:"rule_set" tf:"object"` } func (newState *UpdateRuleSetRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateRuleSetRequest) { @@ -1087,6 +4363,69 @@ func (newState *UpdateRuleSetRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *UpdateRuleSetRequest) SyncEffectiveFieldsDuringRead(existingState UpdateRuleSetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRuleSetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRuleSetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "rule_set": reflect.TypeOf(RuleSetUpdateRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRuleSetRequest +// only implements ToObjectValue() and Type(). +func (o UpdateRuleSetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "rule_set": o.RuleSet, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRuleSetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "rule_set": basetypes.ListType{ + ElemType: RuleSetUpdateRequest{}.Type(ctx), + }, + }, + } +} + +// GetRuleSet returns the value of the RuleSet field in UpdateRuleSetRequest as +// a RuleSetUpdateRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRuleSetRequest) GetRuleSet(ctx context.Context) (RuleSetUpdateRequest, bool) { + var e RuleSetUpdateRequest + if o.RuleSet.IsNull() || o.RuleSet.IsUnknown() { + return e, false + } + var v []RuleSetUpdateRequest + d := o.RuleSet.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRuleSet sets the value of the RuleSet field in UpdateRuleSetRequest. +func (o *UpdateRuleSetRequest) SetRuleSet(ctx context.Context, v RuleSetUpdateRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rule_set"] + o.RuleSet = types.ListValueMust(t, vs) +} + type UpdateWorkspaceAssignments struct { // Array of permissions assignments to update on the workspace. Valid values // are "USER" and "ADMIN" (case-sensitive). If both "USER" and "ADMIN" are @@ -1094,7 +4433,7 @@ type UpdateWorkspaceAssignments struct { // that excluding this field, or providing unsupported values, will have the // same effect as providing an empty list, which will result in the deletion // of all permissions for the principal. - Permissions []types.String `tfsdk:"permissions" tf:"optional"` + Permissions types.List `tfsdk:"permissions" tf:"optional"` // The ID of the user, service principal, or group. PrincipalId types.Int64 `tfsdk:"-"` // The workspace ID. @@ -1107,6 +4446,71 @@ func (newState *UpdateWorkspaceAssignments) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UpdateWorkspaceAssignments) SyncEffectiveFieldsDuringRead(existingState UpdateWorkspaceAssignments) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateWorkspaceAssignments. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateWorkspaceAssignments) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permissions": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateWorkspaceAssignments +// only implements ToObjectValue() and Type(). +func (o UpdateWorkspaceAssignments) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permissions": o.Permissions, + "principal_id": o.PrincipalId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateWorkspaceAssignments) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permissions": basetypes.ListType{ + ElemType: types.StringType, + }, + "principal_id": types.Int64Type, + "workspace_id": types.Int64Type, + }, + } +} + +// GetPermissions returns the value of the Permissions field in UpdateWorkspaceAssignments as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateWorkspaceAssignments) GetPermissions(ctx context.Context) ([]types.String, bool) { + if o.Permissions.IsNull() || o.Permissions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Permissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissions sets the value of the Permissions field in UpdateWorkspaceAssignments. +func (o *UpdateWorkspaceAssignments) SetPermissions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Permissions = types.ListValueMust(t, vs) +} + type User struct { // If this user is active Active types.Bool `tfsdk:"active" tf:"optional"` @@ -1118,25 +4522,25 @@ type User struct { // [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation DisplayName types.String `tfsdk:"displayName" tf:"optional"` // All the emails associated with the Databricks user. - Emails []ComplexValue `tfsdk:"emails" tf:"optional"` + Emails types.List `tfsdk:"emails" tf:"optional"` // Entitlements assigned to the user. See [assigning entitlements] for a // full list of supported values. // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - Entitlements []ComplexValue `tfsdk:"entitlements" tf:"optional"` + Entitlements types.List `tfsdk:"entitlements" tf:"optional"` // External ID is not currently supported. It is reserved for future use. ExternalId types.String `tfsdk:"externalId" tf:"optional"` - Groups []ComplexValue `tfsdk:"groups" tf:"optional"` + Groups types.List `tfsdk:"groups" tf:"optional"` // Databricks user ID. This is automatically set by Databricks. Any value // provided by the client will be ignored. Id types.String `tfsdk:"id" tf:"optional"` - Name []Name `tfsdk:"name" tf:"optional,object"` + Name types.List `tfsdk:"name" tf:"optional,object"` // Corresponds to AWS instance profile/arn role. - Roles []ComplexValue `tfsdk:"roles" tf:"optional"` + Roles types.List `tfsdk:"roles" tf:"optional"` // The schema of the user. - Schemas []types.String `tfsdk:"schemas" tf:"optional"` + Schemas types.List `tfsdk:"schemas" tf:"optional"` // Email address of the Databricks user. UserName types.String `tfsdk:"userName" tf:"optional"` } @@ -1147,9 +4551,235 @@ func (newState *User) SyncEffectiveFieldsDuringCreateOrUpdate(plan User) { func (newState *User) SyncEffectiveFieldsDuringRead(existingState User) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in User. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a User) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "emails": reflect.TypeOf(ComplexValue{}), + "entitlements": reflect.TypeOf(ComplexValue{}), + "groups": reflect.TypeOf(ComplexValue{}), + "name": reflect.TypeOf(Name{}), + "roles": reflect.TypeOf(ComplexValue{}), + "schemas": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, User +// only implements ToObjectValue() and Type(). +func (o User) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "active": o.Active, + "displayName": o.DisplayName, + "emails": o.Emails, + "entitlements": o.Entitlements, + "externalId": o.ExternalId, + "groups": o.Groups, + "id": o.Id, + "name": o.Name, + "roles": o.Roles, + "schemas": o.Schemas, + "userName": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o User) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "active": types.BoolType, + "displayName": types.StringType, + "emails": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "entitlements": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "externalId": types.StringType, + "groups": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "id": types.StringType, + "name": basetypes.ListType{ + ElemType: Name{}.Type(ctx), + }, + "roles": basetypes.ListType{ + ElemType: ComplexValue{}.Type(ctx), + }, + "schemas": basetypes.ListType{ + ElemType: types.StringType, + }, + "userName": types.StringType, + }, + } +} + +// GetEmails returns the value of the Emails field in User as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *User) GetEmails(ctx context.Context) ([]ComplexValue, bool) { + if o.Emails.IsNull() || o.Emails.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Emails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmails sets the value of the Emails field in User. +func (o *User) SetEmails(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["emails"] + t = t.(attr.TypeWithElementType).ElementType() + o.Emails = types.ListValueMust(t, vs) +} + +// GetEntitlements returns the value of the Entitlements field in User as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *User) GetEntitlements(ctx context.Context) ([]ComplexValue, bool) { + if o.Entitlements.IsNull() || o.Entitlements.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Entitlements.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEntitlements sets the value of the Entitlements field in User. +func (o *User) SetEntitlements(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["entitlements"] + t = t.(attr.TypeWithElementType).ElementType() + o.Entitlements = types.ListValueMust(t, vs) +} + +// GetGroups returns the value of the Groups field in User as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *User) GetGroups(ctx context.Context) ([]ComplexValue, bool) { + if o.Groups.IsNull() || o.Groups.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Groups.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetGroups sets the value of the Groups field in User. +func (o *User) SetGroups(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["groups"] + t = t.(attr.TypeWithElementType).ElementType() + o.Groups = types.ListValueMust(t, vs) +} + +// GetName returns the value of the Name field in User as +// a Name value. +// If the field is unknown or null, the boolean return value is false. +func (o *User) GetName(ctx context.Context) (Name, bool) { + var e Name + if o.Name.IsNull() || o.Name.IsUnknown() { + return e, false + } + var v []Name + d := o.Name.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetName sets the value of the Name field in User. +func (o *User) SetName(ctx context.Context, v Name) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["name"] + o.Name = types.ListValueMust(t, vs) +} + +// GetRoles returns the value of the Roles field in User as +// a slice of ComplexValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *User) GetRoles(ctx context.Context) ([]ComplexValue, bool) { + if o.Roles.IsNull() || o.Roles.IsUnknown() { + return nil, false + } + var v []ComplexValue + d := o.Roles.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRoles sets the value of the Roles field in User. +func (o *User) SetRoles(ctx context.Context, v []ComplexValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["roles"] + t = t.(attr.TypeWithElementType).ElementType() + o.Roles = types.ListValueMust(t, vs) +} + +// GetSchemas returns the value of the Schemas field in User as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *User) GetSchemas(ctx context.Context) ([]types.String, bool) { + if o.Schemas.IsNull() || o.Schemas.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Schemas.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSchemas sets the value of the Schemas field in User. +func (o *User) SetSchemas(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schemas"] + t = t.(attr.TypeWithElementType).ElementType() + o.Schemas = types.ListValueMust(t, vs) +} + type WorkspacePermissions struct { // Array of permissions defined for a workspace. - Permissions []PermissionOutput `tfsdk:"permissions" tf:"optional"` + Permissions types.List `tfsdk:"permissions" tf:"optional"` } func (newState *WorkspacePermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan WorkspacePermissions) { @@ -1157,3 +4787,64 @@ func (newState *WorkspacePermissions) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *WorkspacePermissions) SyncEffectiveFieldsDuringRead(existingState WorkspacePermissions) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspacePermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspacePermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permissions": reflect.TypeOf(PermissionOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspacePermissions +// only implements ToObjectValue() and Type(). +func (o WorkspacePermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permissions": o.Permissions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspacePermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permissions": basetypes.ListType{ + ElemType: PermissionOutput{}.Type(ctx), + }, + }, + } +} + +// GetPermissions returns the value of the Permissions field in WorkspacePermissions as +// a slice of PermissionOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkspacePermissions) GetPermissions(ctx context.Context) ([]PermissionOutput, bool) { + if o.Permissions.IsNull() || o.Permissions.IsUnknown() { + return nil, false + } + var v []PermissionOutput + d := o.Permissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissions sets the value of the Permissions field in WorkspacePermissions. +func (o *WorkspacePermissions) SetPermissions(ctx context.Context, v []PermissionOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Permissions = types.ListValueMust(t, vs) +} diff --git a/internal/service/jobs_tf/model.go b/internal/service/jobs_tf/model.go index 80b305667..c1c45c860 100755 --- a/internal/service/jobs_tf/model.go +++ b/internal/service/jobs_tf/model.go @@ -11,8 +11,15 @@ We use go-native types for lists and maps intentionally for the ease for convert package jobs_tf import ( - "github.com/databricks/databricks-sdk-go/service/compute" + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/databricks/terraform-provider-databricks/internal/service/compute_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type BaseJob struct { @@ -33,7 +40,7 @@ type BaseJob struct { JobId types.Int64 `tfsdk:"job_id" tf:"optional"` // Settings for this job and all of its runs. These settings can be updated // using the `resetJob` method. - Settings []JobSettings `tfsdk:"settings" tf:"optional,object"` + Settings types.List `tfsdk:"settings" tf:"optional,object"` } func (newState *BaseJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan BaseJob) { @@ -42,6 +49,75 @@ func (newState *BaseJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan BaseJob) { func (newState *BaseJob) SyncEffectiveFieldsDuringRead(existingState BaseJob) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BaseJob. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BaseJob) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "settings": reflect.TypeOf(JobSettings{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BaseJob +// only implements ToObjectValue() and Type(). +func (o BaseJob) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_time": o.CreatedTime, + "creator_user_name": o.CreatorUserName, + "effective_budget_policy_id": o.EffectiveBudgetPolicyId, + "job_id": o.JobId, + "settings": o.Settings, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BaseJob) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_time": types.Int64Type, + "creator_user_name": types.StringType, + "effective_budget_policy_id": types.StringType, + "job_id": types.Int64Type, + "settings": basetypes.ListType{ + ElemType: JobSettings{}.Type(ctx), + }, + }, + } +} + +// GetSettings returns the value of the Settings field in BaseJob as +// a JobSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseJob) GetSettings(ctx context.Context) (JobSettings, bool) { + var e JobSettings + if o.Settings.IsNull() || o.Settings.IsUnknown() { + return e, false + } + var v []JobSettings + d := o.Settings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSettings sets the value of the Settings field in BaseJob. +func (o *BaseJob) SetSettings(ctx context.Context, v JobSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["settings"] + o.Settings = types.ListValueMust(t, vs) +} + type BaseRun struct { // The sequence number of this run attempt for a triggered job run. The // initial attempt of a run has an attempt_number of 0. If the initial run @@ -60,10 +136,10 @@ type BaseRun struct { // The cluster used for this run. If the run is specified to use a new // cluster, this field is set once the Jobs service has requested a cluster // for the run. - ClusterInstance []ClusterInstance `tfsdk:"cluster_instance" tf:"optional,object"` + ClusterInstance types.List `tfsdk:"cluster_instance" tf:"optional,object"` // A snapshot of the job’s cluster specification when this run was // created. - ClusterSpec []ClusterSpec `tfsdk:"cluster_spec" tf:"optional,object"` + ClusterSpec types.List `tfsdk:"cluster_spec" tf:"optional,object"` // The creator user name. This field won’t be included in the response if // the user has already been deleted. CreatorUserName types.String `tfsdk:"creator_user_name" tf:"optional"` @@ -90,15 +166,15 @@ type BaseRun struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - GitSource []GitSource `tfsdk:"git_source" tf:"optional,object"` + GitSource types.List `tfsdk:"git_source" tf:"optional,object"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. - JobClusters []JobCluster `tfsdk:"job_clusters" tf:"optional"` + JobClusters types.List `tfsdk:"job_clusters" tf:"optional"` // The canonical identifier of the job that contains this run. JobId types.Int64 `tfsdk:"job_id" tf:"optional"` // Job-level parameters used in the run - JobParameters []JobParameter `tfsdk:"job_parameters" tf:"optional"` + JobParameters types.List `tfsdk:"job_parameters" tf:"optional"` // ID of the job run that this run belongs to. For legacy and single-task // job runs the field is populated with the job run ID. For task runs, the // field is populated with the ID of the job run that the task run belongs @@ -111,11 +187,11 @@ type BaseRun struct { // run_id of the original attempt; otherwise, it is the same as the run_id. OriginalAttemptRunId types.Int64 `tfsdk:"original_attempt_run_id" tf:"optional"` // The parameters used for this run. - OverridingParameters []RunParameters `tfsdk:"overriding_parameters" tf:"optional,object"` + OverridingParameters types.List `tfsdk:"overriding_parameters" tf:"optional,object"` // The time in milliseconds that the run has spent in the queue. QueueDuration types.Int64 `tfsdk:"queue_duration" tf:"optional"` // The repair history of the run. - RepairHistory []RepairHistoryItem `tfsdk:"repair_history" tf:"optional"` + RepairHistory types.List `tfsdk:"repair_history" tf:"optional"` // The time in milliseconds it took the job run and all of its repairs to // finish. RunDuration types.Int64 `tfsdk:"run_duration" tf:"optional"` @@ -136,7 +212,7 @@ type BaseRun struct { RunType types.String `tfsdk:"run_type" tf:"optional"` // The cron schedule that triggered this run if it was triggered by the // periodic scheduler. - Schedule []CronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // The time in milliseconds it took to set up the cluster. For runs that run // on new clusters this is the cluster creation time, for runs that run on // existing clusters this time should be very short. The duration of a task @@ -151,12 +227,12 @@ type BaseRun struct { // new cluster, this is the time the cluster creation call is issued. StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` // Deprecated. Please use the `status` field instead. - State []RunState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The current status of the run - Status []RunStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` // The list of tasks performed by the run. Each task has its own `run_id` // which you can use to call `JobsGetOutput` to retrieve the run resutls. - Tasks []RunTask `tfsdk:"tasks" tf:"optional"` + Tasks types.List `tfsdk:"tasks" tf:"optional"` // The type of trigger that fired this run. // // * `PERIODIC`: Schedules that periodically trigger runs, such as a cron @@ -169,7 +245,7 @@ type BaseRun struct { // arrival. * `TABLE`: Indicates a run that is triggered by a table update. Trigger types.String `tfsdk:"trigger" tf:"optional"` // Additional details about what triggered the run - TriggerInfo []TriggerInfo `tfsdk:"trigger_info" tf:"optional,object"` + TriggerInfo types.List `tfsdk:"trigger_info" tf:"optional,object"` } func (newState *BaseRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan BaseRun) { @@ -178,6 +254,446 @@ func (newState *BaseRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan BaseRun) { func (newState *BaseRun) SyncEffectiveFieldsDuringRead(existingState BaseRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BaseRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BaseRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster_instance": reflect.TypeOf(ClusterInstance{}), + "cluster_spec": reflect.TypeOf(ClusterSpec{}), + "git_source": reflect.TypeOf(GitSource{}), + "job_clusters": reflect.TypeOf(JobCluster{}), + "job_parameters": reflect.TypeOf(JobParameter{}), + "overriding_parameters": reflect.TypeOf(RunParameters{}), + "repair_history": reflect.TypeOf(RepairHistoryItem{}), + "schedule": reflect.TypeOf(CronSchedule{}), + "state": reflect.TypeOf(RunState{}), + "status": reflect.TypeOf(RunStatus{}), + "tasks": reflect.TypeOf(RunTask{}), + "trigger_info": reflect.TypeOf(TriggerInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BaseRun +// only implements ToObjectValue() and Type(). +func (o BaseRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attempt_number": o.AttemptNumber, + "cleanup_duration": o.CleanupDuration, + "cluster_instance": o.ClusterInstance, + "cluster_spec": o.ClusterSpec, + "creator_user_name": o.CreatorUserName, + "description": o.Description, + "end_time": o.EndTime, + "execution_duration": o.ExecutionDuration, + "git_source": o.GitSource, + "job_clusters": o.JobClusters, + "job_id": o.JobId, + "job_parameters": o.JobParameters, + "job_run_id": o.JobRunId, + "number_in_job": o.NumberInJob, + "original_attempt_run_id": o.OriginalAttemptRunId, + "overriding_parameters": o.OverridingParameters, + "queue_duration": o.QueueDuration, + "repair_history": o.RepairHistory, + "run_duration": o.RunDuration, + "run_id": o.RunId, + "run_name": o.RunName, + "run_page_url": o.RunPageUrl, + "run_type": o.RunType, + "schedule": o.Schedule, + "setup_duration": o.SetupDuration, + "start_time": o.StartTime, + "state": o.State, + "status": o.Status, + "tasks": o.Tasks, + "trigger": o.Trigger, + "trigger_info": o.TriggerInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BaseRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attempt_number": types.Int64Type, + "cleanup_duration": types.Int64Type, + "cluster_instance": basetypes.ListType{ + ElemType: ClusterInstance{}.Type(ctx), + }, + "cluster_spec": basetypes.ListType{ + ElemType: ClusterSpec{}.Type(ctx), + }, + "creator_user_name": types.StringType, + "description": types.StringType, + "end_time": types.Int64Type, + "execution_duration": types.Int64Type, + "git_source": basetypes.ListType{ + ElemType: GitSource{}.Type(ctx), + }, + "job_clusters": basetypes.ListType{ + ElemType: JobCluster{}.Type(ctx), + }, + "job_id": types.Int64Type, + "job_parameters": basetypes.ListType{ + ElemType: JobParameter{}.Type(ctx), + }, + "job_run_id": types.Int64Type, + "number_in_job": types.Int64Type, + "original_attempt_run_id": types.Int64Type, + "overriding_parameters": basetypes.ListType{ + ElemType: RunParameters{}.Type(ctx), + }, + "queue_duration": types.Int64Type, + "repair_history": basetypes.ListType{ + ElemType: RepairHistoryItem{}.Type(ctx), + }, + "run_duration": types.Int64Type, + "run_id": types.Int64Type, + "run_name": types.StringType, + "run_page_url": types.StringType, + "run_type": types.StringType, + "schedule": basetypes.ListType{ + ElemType: CronSchedule{}.Type(ctx), + }, + "setup_duration": types.Int64Type, + "start_time": types.Int64Type, + "state": basetypes.ListType{ + ElemType: RunState{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: RunStatus{}.Type(ctx), + }, + "tasks": basetypes.ListType{ + ElemType: RunTask{}.Type(ctx), + }, + "trigger": types.StringType, + "trigger_info": basetypes.ListType{ + ElemType: TriggerInfo{}.Type(ctx), + }, + }, + } +} + +// GetClusterInstance returns the value of the ClusterInstance field in BaseRun as +// a ClusterInstance value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetClusterInstance(ctx context.Context) (ClusterInstance, bool) { + var e ClusterInstance + if o.ClusterInstance.IsNull() || o.ClusterInstance.IsUnknown() { + return e, false + } + var v []ClusterInstance + d := o.ClusterInstance.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterInstance sets the value of the ClusterInstance field in BaseRun. +func (o *BaseRun) SetClusterInstance(ctx context.Context, v ClusterInstance) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_instance"] + o.ClusterInstance = types.ListValueMust(t, vs) +} + +// GetClusterSpec returns the value of the ClusterSpec field in BaseRun as +// a ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetClusterSpec(ctx context.Context) (ClusterSpec, bool) { + var e ClusterSpec + if o.ClusterSpec.IsNull() || o.ClusterSpec.IsUnknown() { + return e, false + } + var v []ClusterSpec + d := o.ClusterSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterSpec sets the value of the ClusterSpec field in BaseRun. +func (o *BaseRun) SetClusterSpec(ctx context.Context, v ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_spec"] + o.ClusterSpec = types.ListValueMust(t, vs) +} + +// GetGitSource returns the value of the GitSource field in BaseRun as +// a GitSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetGitSource(ctx context.Context) (GitSource, bool) { + var e GitSource + if o.GitSource.IsNull() || o.GitSource.IsUnknown() { + return e, false + } + var v []GitSource + d := o.GitSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSource sets the value of the GitSource field in BaseRun. +func (o *BaseRun) SetGitSource(ctx context.Context, v GitSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_source"] + o.GitSource = types.ListValueMust(t, vs) +} + +// GetJobClusters returns the value of the JobClusters field in BaseRun as +// a slice of JobCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetJobClusters(ctx context.Context) ([]JobCluster, bool) { + if o.JobClusters.IsNull() || o.JobClusters.IsUnknown() { + return nil, false + } + var v []JobCluster + d := o.JobClusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobClusters sets the value of the JobClusters field in BaseRun. +func (o *BaseRun) SetJobClusters(ctx context.Context, v []JobCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobClusters = types.ListValueMust(t, vs) +} + +// GetJobParameters returns the value of the JobParameters field in BaseRun as +// a slice of JobParameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetJobParameters(ctx context.Context) ([]JobParameter, bool) { + if o.JobParameters.IsNull() || o.JobParameters.IsUnknown() { + return nil, false + } + var v []JobParameter + d := o.JobParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobParameters sets the value of the JobParameters field in BaseRun. +func (o *BaseRun) SetJobParameters(ctx context.Context, v []JobParameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobParameters = types.ListValueMust(t, vs) +} + +// GetOverridingParameters returns the value of the OverridingParameters field in BaseRun as +// a RunParameters value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetOverridingParameters(ctx context.Context) (RunParameters, bool) { + var e RunParameters + if o.OverridingParameters.IsNull() || o.OverridingParameters.IsUnknown() { + return e, false + } + var v []RunParameters + d := o.OverridingParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOverridingParameters sets the value of the OverridingParameters field in BaseRun. +func (o *BaseRun) SetOverridingParameters(ctx context.Context, v RunParameters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["overriding_parameters"] + o.OverridingParameters = types.ListValueMust(t, vs) +} + +// GetRepairHistory returns the value of the RepairHistory field in BaseRun as +// a slice of RepairHistoryItem values. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetRepairHistory(ctx context.Context) ([]RepairHistoryItem, bool) { + if o.RepairHistory.IsNull() || o.RepairHistory.IsUnknown() { + return nil, false + } + var v []RepairHistoryItem + d := o.RepairHistory.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRepairHistory sets the value of the RepairHistory field in BaseRun. +func (o *BaseRun) SetRepairHistory(ctx context.Context, v []RepairHistoryItem) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["repair_history"] + t = t.(attr.TypeWithElementType).ElementType() + o.RepairHistory = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in BaseRun as +// a CronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetSchedule(ctx context.Context) (CronSchedule, bool) { + var e CronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []CronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in BaseRun. +func (o *BaseRun) SetSchedule(ctx context.Context, v CronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetState returns the value of the State field in BaseRun as +// a RunState value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetState(ctx context.Context) (RunState, bool) { + var e RunState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []RunState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in BaseRun. +func (o *BaseRun) SetState(ctx context.Context, v RunState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in BaseRun as +// a RunStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetStatus(ctx context.Context) (RunStatus, bool) { + var e RunStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []RunStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in BaseRun. +func (o *BaseRun) SetStatus(ctx context.Context, v RunStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + +// GetTasks returns the value of the Tasks field in BaseRun as +// a slice of RunTask values. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetTasks(ctx context.Context) ([]RunTask, bool) { + if o.Tasks.IsNull() || o.Tasks.IsUnknown() { + return nil, false + } + var v []RunTask + d := o.Tasks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTasks sets the value of the Tasks field in BaseRun. +func (o *BaseRun) SetTasks(ctx context.Context, v []RunTask) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tasks"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tasks = types.ListValueMust(t, vs) +} + +// GetTriggerInfo returns the value of the TriggerInfo field in BaseRun as +// a TriggerInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *BaseRun) GetTriggerInfo(ctx context.Context) (TriggerInfo, bool) { + var e TriggerInfo + if o.TriggerInfo.IsNull() || o.TriggerInfo.IsUnknown() { + return e, false + } + var v []TriggerInfo + d := o.TriggerInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTriggerInfo sets the value of the TriggerInfo field in BaseRun. +func (o *BaseRun) SetTriggerInfo(ctx context.Context, v TriggerInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger_info"] + o.TriggerInfo = types.ListValueMust(t, vs) +} + type CancelAllRuns struct { // Optional boolean parameter to cancel all queued runs. If no job_id is // provided, all queued runs in the workspace are canceled. @@ -192,6 +708,39 @@ func (newState *CancelAllRuns) SyncEffectiveFieldsDuringCreateOrUpdate(plan Canc func (newState *CancelAllRuns) SyncEffectiveFieldsDuringRead(existingState CancelAllRuns) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelAllRuns. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelAllRuns) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelAllRuns +// only implements ToObjectValue() and Type(). +func (o CancelAllRuns) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_queued_runs": o.AllQueuedRuns, + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelAllRuns) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_queued_runs": types.BoolType, + "job_id": types.Int64Type, + }, + } +} + type CancelAllRunsResponse struct { } @@ -201,6 +750,33 @@ func (newState *CancelAllRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CancelAllRunsResponse) SyncEffectiveFieldsDuringRead(existingState CancelAllRunsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelAllRunsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelAllRunsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelAllRunsResponse +// only implements ToObjectValue() and Type(). +func (o CancelAllRunsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelAllRunsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type CancelRun struct { // This field is required. RunId types.Int64 `tfsdk:"run_id" tf:""` @@ -212,6 +788,37 @@ func (newState *CancelRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan CancelRu func (newState *CancelRun) SyncEffectiveFieldsDuringRead(existingState CancelRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelRun +// only implements ToObjectValue() and Type(). +func (o CancelRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + }, + } +} + type CancelRunResponse struct { } @@ -221,6 +828,33 @@ func (newState *CancelRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CancelRunResponse) SyncEffectiveFieldsDuringRead(existingState CancelRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelRunResponse +// only implements ToObjectValue() and Type(). +func (o CancelRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Stores the run state of the clean room notebook V1 task. type CleanRoomTaskRunState struct { // A value indicating the run's current lifecycle state. This field is @@ -237,6 +871,39 @@ func (newState *CleanRoomTaskRunState) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CleanRoomTaskRunState) SyncEffectiveFieldsDuringRead(existingState CleanRoomTaskRunState) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomTaskRunState. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomTaskRunState) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomTaskRunState +// only implements ToObjectValue() and Type(). +func (o CleanRoomTaskRunState) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "life_cycle_state": o.LifeCycleState, + "result_state": o.ResultState, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomTaskRunState) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "life_cycle_state": types.StringType, + "result_state": types.StringType, + }, + } +} + type ClusterInstance struct { // The canonical identifier for the cluster used by a run. This field is // always available for runs on existing clusters. For runs on new clusters, @@ -264,6 +931,39 @@ func (newState *ClusterInstance) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cl func (newState *ClusterInstance) SyncEffectiveFieldsDuringRead(existingState ClusterInstance) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterInstance. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterInstance) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterInstance +// only implements ToObjectValue() and Type(). +func (o ClusterInstance) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "spark_context_id": o.SparkContextId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterInstance) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "spark_context_id": types.StringType, + }, + } +} + type ClusterSpec struct { // If existing_cluster_id, the ID of an existing cluster that is used for // all runs. When running jobs or tasks on an existing cluster, you may need @@ -275,10 +975,10 @@ type ClusterSpec struct { JobClusterKey types.String `tfsdk:"job_cluster_key" tf:"optional"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - Libraries compute.Library `tfsdk:"library" tf:"optional"` + Libraries types.List `tfsdk:"library" tf:"optional"` // If new_cluster, a description of a new cluster that is created for each // run. - NewCluster compute.ClusterSpec `tfsdk:"new_cluster" tf:"optional,object"` + NewCluster types.List `tfsdk:"new_cluster" tf:"optional,object"` } func (newState *ClusterSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterSpec) { @@ -287,6 +987,102 @@ func (newState *ClusterSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cluste func (newState *ClusterSpec) SyncEffectiveFieldsDuringRead(existingState ClusterSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterSpec +// only implements ToObjectValue() and Type(). +func (o ClusterSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "existing_cluster_id": o.ExistingClusterId, + "job_cluster_key": o.JobClusterKey, + "library": o.Libraries, + "new_cluster": o.NewCluster, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "existing_cluster_id": types.StringType, + "job_cluster_key": types.StringType, + "library": basetypes.ListType{ + ElemType: compute_tf.Library{}.Type(ctx), + }, + "new_cluster": basetypes.ListType{ + ElemType: compute_tf.ClusterSpec{}.Type(ctx), + }, + }, + } +} + +// GetLibraries returns the value of the Libraries field in ClusterSpec as +// a slice of compute_tf.Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetLibraries(ctx context.Context) ([]compute_tf.Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []compute_tf.Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in ClusterSpec. +func (o *ClusterSpec) SetLibraries(ctx context.Context, v []compute_tf.Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["library"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNewCluster returns the value of the NewCluster field in ClusterSpec as +// a compute_tf.ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterSpec) GetNewCluster(ctx context.Context) (compute_tf.ClusterSpec, bool) { + var e compute_tf.ClusterSpec + if o.NewCluster.IsNull() || o.NewCluster.IsUnknown() { + return e, false + } + var v []compute_tf.ClusterSpec + d := o.NewCluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewCluster sets the value of the NewCluster field in ClusterSpec. +func (o *ClusterSpec) SetNewCluster(ctx context.Context, v compute_tf.ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_cluster"] + o.NewCluster = types.ListValueMust(t, vs) +} + type ConditionTask struct { // The left operand of the condition task. Can be either a string value or a // job state or parameter reference. @@ -313,6 +1109,41 @@ func (newState *ConditionTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cond func (newState *ConditionTask) SyncEffectiveFieldsDuringRead(existingState ConditionTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ConditionTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ConditionTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ConditionTask +// only implements ToObjectValue() and Type(). +func (o ConditionTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "left": o.Left, + "op": o.Op, + "right": o.Right, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ConditionTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "left": types.StringType, + "op": types.StringType, + "right": types.StringType, + }, + } +} + type Continuous struct { // Indicate whether the continuous execution of the job is paused or not. // Defaults to UNPAUSED. @@ -325,9 +1156,40 @@ func (newState *Continuous) SyncEffectiveFieldsDuringCreateOrUpdate(plan Continu func (newState *Continuous) SyncEffectiveFieldsDuringRead(existingState Continuous) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Continuous. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Continuous) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Continuous +// only implements ToObjectValue() and Type(). +func (o Continuous) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pause_status": o.PauseStatus, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Continuous) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pause_status": types.StringType, + }, + } +} + type CreateJob struct { // List of permissions to set on the job. - AccessControlList []JobAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The id of the user specified budget policy to use for this job. If not // specified, a default budget policy may be applied when creating or // modifying the job. See `effective_budget_policy_id` for the budget policy @@ -336,9 +1198,9 @@ type CreateJob struct { // An optional continuous property for this job. The continuous property // will ensure that there is always one run executing. Only one of // `schedule` and `continuous` can be used. - Continuous []Continuous `tfsdk:"continuous" tf:"optional,object"` + Continuous types.List `tfsdk:"continuous" tf:"optional,object"` // Deployment information for jobs managed by external sources. - Deployment []JobDeployment `tfsdk:"deployment" tf:"optional,object"` + Deployment types.List `tfsdk:"deployment" tf:"optional,object"` // An optional description for the job. The maximum length is 27700 // characters in UTF-8 encoding. Description types.String `tfsdk:"description" tf:"optional"` @@ -349,14 +1211,14 @@ type CreateJob struct { EditMode types.String `tfsdk:"edit_mode" tf:"optional"` // An optional set of email addresses that is notified when runs of this job // begin or complete as well as when this job is deleted. - EmailNotifications []JobEmailNotifications `tfsdk:"email_notifications" tf:"optional,object"` + EmailNotifications types.List `tfsdk:"email_notifications" tf:"optional,object"` // A list of task execution environment specifications that can be // referenced by serverless tasks of this job. An environment is required to // be present for serverless tasks. For serverless notebook tasks, the // environment is accessible in the notebook environment panel. For other // serverless tasks, the task environment is required to be specified using // environment_key in the task settings. - Environments []JobEnvironment `tfsdk:"environment" tf:"optional"` + Environments types.List `tfsdk:"environment" tf:"optional"` // Used to tell what is the format of the job. This field is ignored in // Create/Update/Reset calls. When using the Jobs API 2.1 this value is // always set to `"MULTI_TASK"`. @@ -371,13 +1233,13 @@ type CreateJob struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - GitSource []GitSource `tfsdk:"git_source" tf:"optional,object"` + GitSource types.List `tfsdk:"git_source" tf:"optional,object"` // An optional set of health rules that can be defined for this job. - Health []JobsHealthRules `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. - JobClusters []JobCluster `tfsdk:"job_cluster" tf:"optional"` + JobClusters types.List `tfsdk:"job_cluster" tf:"optional"` // An optional maximum allowed number of concurrent runs of the job. Set // this value if you want to be able to execute multiple runs of the same // job concurrently. This is useful for example if you trigger your job on a @@ -396,38 +1258,38 @@ type CreateJob struct { // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // job. - NotificationSettings []JobNotificationSettings `tfsdk:"notification_settings" tf:"optional,object"` + NotificationSettings types.List `tfsdk:"notification_settings" tf:"optional,object"` // Job-level parameter definitions - Parameters []JobParameterDefinition `tfsdk:"parameter" tf:"optional"` + Parameters types.List `tfsdk:"parameter" tf:"optional"` // The queue settings of the job. - Queue []QueueSettings `tfsdk:"queue" tf:"optional,object"` + Queue types.List `tfsdk:"queue" tf:"optional,object"` // Write-only setting. Specifies the user or service principal that the job // runs as. If not specified, the job runs as the user who created the job. // // Either `user_name` or `service_principal_name` should be specified. If // not, an error is thrown. - RunAs []JobRunAs `tfsdk:"run_as" tf:"optional,object"` + RunAs types.List `tfsdk:"run_as" tf:"optional,object"` // An optional periodic schedule for this job. The default behavior is that // the job only runs when triggered by clicking “Run Now” in the Jobs UI // or sending an API request to `runNow`. - Schedule []CronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // A map of tags associated with the job. These are forwarded to the cluster // as cluster tags for jobs clusters, and are subject to the same // limitations as cluster tags. A maximum of 25 tags can be added to the // job. - Tags map[string]types.String `tfsdk:"tags" tf:"optional"` + Tags types.Map `tfsdk:"tags" tf:"optional"` // A list of task specifications to be executed by this job. - Tasks []Task `tfsdk:"task" tf:"optional"` + Tasks types.List `tfsdk:"task" tf:"optional"` // An optional timeout applied to each run of this job. A value of `0` means // no timeout. TimeoutSeconds types.Int64 `tfsdk:"timeout_seconds" tf:"optional"` // A configuration to trigger a run when certain conditions are met. The // default behavior is that the job runs only when triggered by clicking // “Run Now” in the Jobs UI or sending an API request to `runNow`. - Trigger []TriggerSettings `tfsdk:"trigger" tf:"optional,object"` + Trigger types.List `tfsdk:"trigger" tf:"optional,object"` // A collection of system notification IDs to notify when runs of this job // begin or complete. - WebhookNotifications []WebhookNotifications `tfsdk:"webhook_notifications" tf:"optional,object"` + WebhookNotifications types.List `tfsdk:"webhook_notifications" tf:"optional,object"` } func (newState *CreateJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateJob) { @@ -436,6 +1298,577 @@ func (newState *CreateJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateJo func (newState *CreateJob) SyncEffectiveFieldsDuringRead(existingState CreateJob) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateJob. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateJob) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(JobAccessControlRequest{}), + "continuous": reflect.TypeOf(Continuous{}), + "deployment": reflect.TypeOf(JobDeployment{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "environment": reflect.TypeOf(JobEnvironment{}), + "git_source": reflect.TypeOf(GitSource{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "job_cluster": reflect.TypeOf(JobCluster{}), + "notification_settings": reflect.TypeOf(JobNotificationSettings{}), + "parameter": reflect.TypeOf(JobParameterDefinition{}), + "queue": reflect.TypeOf(QueueSettings{}), + "run_as": reflect.TypeOf(JobRunAs{}), + "schedule": reflect.TypeOf(CronSchedule{}), + "tags": reflect.TypeOf(types.String{}), + "task": reflect.TypeOf(Task{}), + "trigger": reflect.TypeOf(TriggerSettings{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateJob +// only implements ToObjectValue() and Type(). +func (o CreateJob) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "budget_policy_id": o.BudgetPolicyId, + "continuous": o.Continuous, + "deployment": o.Deployment, + "description": o.Description, + "edit_mode": o.EditMode, + "email_notifications": o.EmailNotifications, + "environment": o.Environments, + "format": o.Format, + "git_source": o.GitSource, + "health": o.Health, + "job_cluster": o.JobClusters, + "max_concurrent_runs": o.MaxConcurrentRuns, + "name": o.Name, + "notification_settings": o.NotificationSettings, + "parameter": o.Parameters, + "queue": o.Queue, + "run_as": o.RunAs, + "schedule": o.Schedule, + "tags": o.Tags, + "task": o.Tasks, + "timeout_seconds": o.TimeoutSeconds, + "trigger": o.Trigger, + "webhook_notifications": o.WebhookNotifications, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateJob) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: JobAccessControlRequest{}.Type(ctx), + }, + "budget_policy_id": types.StringType, + "continuous": basetypes.ListType{ + ElemType: Continuous{}.Type(ctx), + }, + "deployment": basetypes.ListType{ + ElemType: JobDeployment{}.Type(ctx), + }, + "description": types.StringType, + "edit_mode": types.StringType, + "email_notifications": basetypes.ListType{ + ElemType: JobEmailNotifications{}.Type(ctx), + }, + "environment": basetypes.ListType{ + ElemType: JobEnvironment{}.Type(ctx), + }, + "format": types.StringType, + "git_source": basetypes.ListType{ + ElemType: GitSource{}.Type(ctx), + }, + "health": basetypes.ListType{ + ElemType: JobsHealthRules{}.Type(ctx), + }, + "job_cluster": basetypes.ListType{ + ElemType: JobCluster{}.Type(ctx), + }, + "max_concurrent_runs": types.Int64Type, + "name": types.StringType, + "notification_settings": basetypes.ListType{ + ElemType: JobNotificationSettings{}.Type(ctx), + }, + "parameter": basetypes.ListType{ + ElemType: JobParameterDefinition{}.Type(ctx), + }, + "queue": basetypes.ListType{ + ElemType: QueueSettings{}.Type(ctx), + }, + "run_as": basetypes.ListType{ + ElemType: JobRunAs{}.Type(ctx), + }, + "schedule": basetypes.ListType{ + ElemType: CronSchedule{}.Type(ctx), + }, + "tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "task": basetypes.ListType{ + ElemType: Task{}.Type(ctx), + }, + "timeout_seconds": types.Int64Type, + "trigger": basetypes.ListType{ + ElemType: TriggerSettings{}.Type(ctx), + }, + "webhook_notifications": basetypes.ListType{ + ElemType: WebhookNotifications{}.Type(ctx), + }, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in CreateJob as +// a slice of JobAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetAccessControlList(ctx context.Context) ([]JobAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []JobAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in CreateJob. +func (o *CreateJob) SetAccessControlList(ctx context.Context, v []JobAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + +// GetContinuous returns the value of the Continuous field in CreateJob as +// a Continuous value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetContinuous(ctx context.Context) (Continuous, bool) { + var e Continuous + if o.Continuous.IsNull() || o.Continuous.IsUnknown() { + return e, false + } + var v []Continuous + d := o.Continuous.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetContinuous sets the value of the Continuous field in CreateJob. +func (o *CreateJob) SetContinuous(ctx context.Context, v Continuous) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["continuous"] + o.Continuous = types.ListValueMust(t, vs) +} + +// GetDeployment returns the value of the Deployment field in CreateJob as +// a JobDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetDeployment(ctx context.Context) (JobDeployment, bool) { + var e JobDeployment + if o.Deployment.IsNull() || o.Deployment.IsUnknown() { + return e, false + } + var v []JobDeployment + d := o.Deployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeployment sets the value of the Deployment field in CreateJob. +func (o *CreateJob) SetDeployment(ctx context.Context, v JobDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["deployment"] + o.Deployment = types.ListValueMust(t, vs) +} + +// GetEmailNotifications returns the value of the EmailNotifications field in CreateJob as +// a JobEmailNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetEmailNotifications(ctx context.Context) (JobEmailNotifications, bool) { + var e JobEmailNotifications + if o.EmailNotifications.IsNull() || o.EmailNotifications.IsUnknown() { + return e, false + } + var v []JobEmailNotifications + d := o.EmailNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmailNotifications sets the value of the EmailNotifications field in CreateJob. +func (o *CreateJob) SetEmailNotifications(ctx context.Context, v JobEmailNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_notifications"] + o.EmailNotifications = types.ListValueMust(t, vs) +} + +// GetEnvironments returns the value of the Environments field in CreateJob as +// a slice of JobEnvironment values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetEnvironments(ctx context.Context) ([]JobEnvironment, bool) { + if o.Environments.IsNull() || o.Environments.IsUnknown() { + return nil, false + } + var v []JobEnvironment + d := o.Environments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironments sets the value of the Environments field in CreateJob. +func (o *CreateJob) SetEnvironments(ctx context.Context, v []JobEnvironment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environment"] + t = t.(attr.TypeWithElementType).ElementType() + o.Environments = types.ListValueMust(t, vs) +} + +// GetGitSource returns the value of the GitSource field in CreateJob as +// a GitSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetGitSource(ctx context.Context) (GitSource, bool) { + var e GitSource + if o.GitSource.IsNull() || o.GitSource.IsUnknown() { + return e, false + } + var v []GitSource + d := o.GitSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSource sets the value of the GitSource field in CreateJob. +func (o *CreateJob) SetGitSource(ctx context.Context, v GitSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_source"] + o.GitSource = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in CreateJob as +// a JobsHealthRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetHealth(ctx context.Context) (JobsHealthRules, bool) { + var e JobsHealthRules + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []JobsHealthRules + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in CreateJob. +func (o *CreateJob) SetHealth(ctx context.Context, v JobsHealthRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetJobClusters returns the value of the JobClusters field in CreateJob as +// a slice of JobCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetJobClusters(ctx context.Context) ([]JobCluster, bool) { + if o.JobClusters.IsNull() || o.JobClusters.IsUnknown() { + return nil, false + } + var v []JobCluster + d := o.JobClusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobClusters sets the value of the JobClusters field in CreateJob. +func (o *CreateJob) SetJobClusters(ctx context.Context, v []JobCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_cluster"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobClusters = types.ListValueMust(t, vs) +} + +// GetNotificationSettings returns the value of the NotificationSettings field in CreateJob as +// a JobNotificationSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetNotificationSettings(ctx context.Context) (JobNotificationSettings, bool) { + var e JobNotificationSettings + if o.NotificationSettings.IsNull() || o.NotificationSettings.IsUnknown() { + return e, false + } + var v []JobNotificationSettings + d := o.NotificationSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotificationSettings sets the value of the NotificationSettings field in CreateJob. +func (o *CreateJob) SetNotificationSettings(ctx context.Context, v JobNotificationSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notification_settings"] + o.NotificationSettings = types.ListValueMust(t, vs) +} + +// GetParameters returns the value of the Parameters field in CreateJob as +// a slice of JobParameterDefinition values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetParameters(ctx context.Context) ([]JobParameterDefinition, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []JobParameterDefinition + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in CreateJob. +func (o *CreateJob) SetParameters(ctx context.Context, v []JobParameterDefinition) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameter"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + +// GetQueue returns the value of the Queue field in CreateJob as +// a QueueSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetQueue(ctx context.Context) (QueueSettings, bool) { + var e QueueSettings + if o.Queue.IsNull() || o.Queue.IsUnknown() { + return e, false + } + var v []QueueSettings + d := o.Queue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueue sets the value of the Queue field in CreateJob. +func (o *CreateJob) SetQueue(ctx context.Context, v QueueSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["queue"] + o.Queue = types.ListValueMust(t, vs) +} + +// GetRunAs returns the value of the RunAs field in CreateJob as +// a JobRunAs value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetRunAs(ctx context.Context) (JobRunAs, bool) { + var e JobRunAs + if o.RunAs.IsNull() || o.RunAs.IsUnknown() { + return e, false + } + var v []JobRunAs + d := o.RunAs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunAs sets the value of the RunAs field in CreateJob. +func (o *CreateJob) SetRunAs(ctx context.Context, v JobRunAs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_as"] + o.RunAs = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in CreateJob as +// a CronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetSchedule(ctx context.Context) (CronSchedule, bool) { + var e CronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []CronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in CreateJob. +func (o *CreateJob) SetSchedule(ctx context.Context, v CronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in CreateJob as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetTags(ctx context.Context) (map[string]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateJob. +func (o *CreateJob) SetTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.MapValueMust(t, vs) +} + +// GetTasks returns the value of the Tasks field in CreateJob as +// a slice of Task values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetTasks(ctx context.Context) ([]Task, bool) { + if o.Tasks.IsNull() || o.Tasks.IsUnknown() { + return nil, false + } + var v []Task + d := o.Tasks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTasks sets the value of the Tasks field in CreateJob. +func (o *CreateJob) SetTasks(ctx context.Context, v []Task) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["task"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tasks = types.ListValueMust(t, vs) +} + +// GetTrigger returns the value of the Trigger field in CreateJob as +// a TriggerSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetTrigger(ctx context.Context) (TriggerSettings, bool) { + var e TriggerSettings + if o.Trigger.IsNull() || o.Trigger.IsUnknown() { + return e, false + } + var v []TriggerSettings + d := o.Trigger.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrigger sets the value of the Trigger field in CreateJob. +func (o *CreateJob) SetTrigger(ctx context.Context, v TriggerSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger"] + o.Trigger = types.ListValueMust(t, vs) +} + +// GetWebhookNotifications returns the value of the WebhookNotifications field in CreateJob as +// a WebhookNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateJob) GetWebhookNotifications(ctx context.Context) (WebhookNotifications, bool) { + var e WebhookNotifications + if o.WebhookNotifications.IsNull() || o.WebhookNotifications.IsUnknown() { + return e, false + } + var v []WebhookNotifications + d := o.WebhookNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhookNotifications sets the value of the WebhookNotifications field in CreateJob. +func (o *CreateJob) SetWebhookNotifications(ctx context.Context, v WebhookNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook_notifications"] + o.WebhookNotifications = types.ListValueMust(t, vs) +} + // Job was created successfully type CreateResponse struct { // The canonical identifier for the newly created job. @@ -448,6 +1881,37 @@ func (newState *CreateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateResponse) SyncEffectiveFieldsDuringRead(existingState CreateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateResponse +// only implements ToObjectValue() and Type(). +func (o CreateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.Int64Type, + }, + } +} + type CronSchedule struct { // Indicate whether this schedule is paused or not. PauseStatus types.String `tfsdk:"pause_status" tf:"optional"` @@ -469,10 +1933,45 @@ func (newState *CronSchedule) SyncEffectiveFieldsDuringCreateOrUpdate(plan CronS func (newState *CronSchedule) SyncEffectiveFieldsDuringRead(existingState CronSchedule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CronSchedule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CronSchedule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CronSchedule +// only implements ToObjectValue() and Type(). +func (o CronSchedule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pause_status": o.PauseStatus, + "quartz_cron_expression": o.QuartzCronExpression, + "timezone_id": o.TimezoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CronSchedule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pause_status": types.StringType, + "quartz_cron_expression": types.StringType, + "timezone_id": types.StringType, + }, + } +} + type DbtOutput struct { // An optional map of headers to send when retrieving the artifact from the // `artifacts_link`. - ArtifactsHeaders map[string]types.String `tfsdk:"artifacts_headers" tf:"optional"` + ArtifactsHeaders types.Map `tfsdk:"artifacts_headers" tf:"optional"` // A pre-signed URL to download the (compressed) dbt artifacts. This link is // valid for a limited time (30 minutes). This information is only available // after the run has finished. @@ -485,6 +1984,69 @@ func (newState *DbtOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan DbtOutpu func (newState *DbtOutput) SyncEffectiveFieldsDuringRead(existingState DbtOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DbtOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DbtOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "artifacts_headers": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DbtOutput +// only implements ToObjectValue() and Type(). +func (o DbtOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifacts_headers": o.ArtifactsHeaders, + "artifacts_link": o.ArtifactsLink, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DbtOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifacts_headers": basetypes.MapType{ + ElemType: types.StringType, + }, + "artifacts_link": types.StringType, + }, + } +} + +// GetArtifactsHeaders returns the value of the ArtifactsHeaders field in DbtOutput as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DbtOutput) GetArtifactsHeaders(ctx context.Context) (map[string]types.String, bool) { + if o.ArtifactsHeaders.IsNull() || o.ArtifactsHeaders.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.ArtifactsHeaders.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetArtifactsHeaders sets the value of the ArtifactsHeaders field in DbtOutput. +func (o *DbtOutput) SetArtifactsHeaders(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["artifacts_headers"] + t = t.(attr.TypeWithElementType).ElementType() + o.ArtifactsHeaders = types.MapValueMust(t, vs) +} + type DbtTask struct { // Optional name of the catalog to use. The value is the top level in the // 3-level namespace of Unity Catalog (catalog / schema / relation). The @@ -494,7 +2056,7 @@ type DbtTask struct { // A list of dbt commands to execute. All commands must start with `dbt`. // This parameter must not be empty. A maximum of up to 10 commands can be // provided. - Commands []types.String `tfsdk:"commands" tf:""` + Commands types.List `tfsdk:"commands" tf:""` // Optional (relative) path to the profiles directory. Can only be specified // if no warehouse_id is specified. If no warehouse_id is specified and this // folder is unset, the root directory is used. @@ -528,6 +2090,79 @@ func (newState *DbtTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan DbtTask) { func (newState *DbtTask) SyncEffectiveFieldsDuringRead(existingState DbtTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DbtTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DbtTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "commands": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DbtTask +// only implements ToObjectValue() and Type(). +func (o DbtTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog": o.Catalog, + "commands": o.Commands, + "profiles_directory": o.ProfilesDirectory, + "project_directory": o.ProjectDirectory, + "schema": o.Schema, + "source": o.Source, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DbtTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog": types.StringType, + "commands": basetypes.ListType{ + ElemType: types.StringType, + }, + "profiles_directory": types.StringType, + "project_directory": types.StringType, + "schema": types.StringType, + "source": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetCommands returns the value of the Commands field in DbtTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DbtTask) GetCommands(ctx context.Context) ([]types.String, bool) { + if o.Commands.IsNull() || o.Commands.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Commands.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCommands sets the value of the Commands field in DbtTask. +func (o *DbtTask) SetCommands(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["commands"] + t = t.(attr.TypeWithElementType).ElementType() + o.Commands = types.ListValueMust(t, vs) +} + type DeleteJob struct { // The canonical identifier of the job to delete. This field is required. JobId types.Int64 `tfsdk:"job_id" tf:""` @@ -539,6 +2174,37 @@ func (newState *DeleteJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteJo func (newState *DeleteJob) SyncEffectiveFieldsDuringRead(existingState DeleteJob) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteJob. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteJob) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteJob +// only implements ToObjectValue() and Type(). +func (o DeleteJob) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteJob) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.Int64Type, + }, + } +} + type DeleteResponse struct { } @@ -548,6 +2214,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteRun struct { // ID of the run to delete. RunId types.Int64 `tfsdk:"run_id" tf:""` @@ -559,6 +2252,37 @@ func (newState *DeleteRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteRu func (newState *DeleteRun) SyncEffectiveFieldsDuringRead(existingState DeleteRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRun +// only implements ToObjectValue() and Type(). +func (o DeleteRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + }, + } +} + type DeleteRunResponse struct { } @@ -568,6 +2292,33 @@ func (newState *DeleteRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteRunResponse) SyncEffectiveFieldsDuringRead(existingState DeleteRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRunResponse +// only implements ToObjectValue() and Type(). +func (o DeleteRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Represents a change to the job cluster's settings that would be required for // the job clusters to become compliant with their policies. type EnforcePolicyComplianceForJobResponseJobClusterSettingsChange struct { @@ -592,6 +2343,41 @@ func (newState *EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) S func (newState *EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) SyncEffectiveFieldsDuringRead(existingState EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnforcePolicyComplianceForJobResponseJobClusterSettingsChange. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnforcePolicyComplianceForJobResponseJobClusterSettingsChange +// only implements ToObjectValue() and Type(). +func (o EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "field": o.Field, + "new_value": o.NewValue, + "previous_value": o.PreviousValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "field": types.StringType, + "new_value": types.StringType, + "previous_value": types.StringType, + }, + } +} + type EnforcePolicyComplianceRequest struct { // The ID of the job you want to enforce policy compliance on. JobId types.Int64 `tfsdk:"job_id" tf:""` @@ -606,6 +2392,39 @@ func (newState *EnforcePolicyComplianceRequest) SyncEffectiveFieldsDuringCreateO func (newState *EnforcePolicyComplianceRequest) SyncEffectiveFieldsDuringRead(existingState EnforcePolicyComplianceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnforcePolicyComplianceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnforcePolicyComplianceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnforcePolicyComplianceRequest +// only implements ToObjectValue() and Type(). +func (o EnforcePolicyComplianceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + "validate_only": o.ValidateOnly, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnforcePolicyComplianceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.Int64Type, + "validate_only": types.BoolType, + }, + } +} + type EnforcePolicyComplianceResponse struct { // Whether any changes have been made to the job cluster settings for the // job to become compliant with its policies. @@ -613,14 +2432,14 @@ type EnforcePolicyComplianceResponse struct { // A list of job cluster changes that have been made to the job’s cluster // settings in order for all job clusters to become compliant with their // policies. - JobClusterChanges []EnforcePolicyComplianceForJobResponseJobClusterSettingsChange `tfsdk:"job_cluster_changes" tf:"optional"` + JobClusterChanges types.List `tfsdk:"job_cluster_changes" tf:"optional"` // Updated job settings after policy enforcement. Policy enforcement only // applies to job clusters that are created when running the job (which are // specified in new_cluster) and does not apply to existing all-purpose // clusters. Updated job settings are derived by applying policy default // values to the existing job clusters in order to satisfy policy // requirements. - Settings []JobSettings `tfsdk:"settings" tf:"optional,object"` + Settings types.List `tfsdk:"settings" tf:"optional,object"` } func (newState *EnforcePolicyComplianceResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan EnforcePolicyComplianceResponse) { @@ -629,6 +2448,100 @@ func (newState *EnforcePolicyComplianceResponse) SyncEffectiveFieldsDuringCreate func (newState *EnforcePolicyComplianceResponse) SyncEffectiveFieldsDuringRead(existingState EnforcePolicyComplianceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnforcePolicyComplianceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnforcePolicyComplianceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "job_cluster_changes": reflect.TypeOf(EnforcePolicyComplianceForJobResponseJobClusterSettingsChange{}), + "settings": reflect.TypeOf(JobSettings{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnforcePolicyComplianceResponse +// only implements ToObjectValue() and Type(). +func (o EnforcePolicyComplianceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "has_changes": o.HasChanges, + "job_cluster_changes": o.JobClusterChanges, + "settings": o.Settings, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnforcePolicyComplianceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "has_changes": types.BoolType, + "job_cluster_changes": basetypes.ListType{ + ElemType: EnforcePolicyComplianceForJobResponseJobClusterSettingsChange{}.Type(ctx), + }, + "settings": basetypes.ListType{ + ElemType: JobSettings{}.Type(ctx), + }, + }, + } +} + +// GetJobClusterChanges returns the value of the JobClusterChanges field in EnforcePolicyComplianceResponse as +// a slice of EnforcePolicyComplianceForJobResponseJobClusterSettingsChange values. +// If the field is unknown or null, the boolean return value is false. +func (o *EnforcePolicyComplianceResponse) GetJobClusterChanges(ctx context.Context) ([]EnforcePolicyComplianceForJobResponseJobClusterSettingsChange, bool) { + if o.JobClusterChanges.IsNull() || o.JobClusterChanges.IsUnknown() { + return nil, false + } + var v []EnforcePolicyComplianceForJobResponseJobClusterSettingsChange + d := o.JobClusterChanges.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobClusterChanges sets the value of the JobClusterChanges field in EnforcePolicyComplianceResponse. +func (o *EnforcePolicyComplianceResponse) SetJobClusterChanges(ctx context.Context, v []EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_cluster_changes"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobClusterChanges = types.ListValueMust(t, vs) +} + +// GetSettings returns the value of the Settings field in EnforcePolicyComplianceResponse as +// a JobSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *EnforcePolicyComplianceResponse) GetSettings(ctx context.Context) (JobSettings, bool) { + var e JobSettings + if o.Settings.IsNull() || o.Settings.IsUnknown() { + return e, false + } + var v []JobSettings + d := o.Settings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSettings sets the value of the Settings field in EnforcePolicyComplianceResponse. +func (o *EnforcePolicyComplianceResponse) SetSettings(ctx context.Context, v JobSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["settings"] + o.Settings = types.ListValueMust(t, vs) +} + // Run was exported successfully. type ExportRunOutput struct { // The exported content in HTML format (one for every view item). To extract @@ -636,7 +2549,7 @@ type ExportRunOutput struct { // script]. // // [Python script]: https://docs.databricks.com/en/_static/examples/extract.py - Views []ViewItem `tfsdk:"views" tf:"optional"` + Views types.List `tfsdk:"views" tf:"optional"` } func (newState *ExportRunOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan ExportRunOutput) { @@ -645,6 +2558,67 @@ func (newState *ExportRunOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ex func (newState *ExportRunOutput) SyncEffectiveFieldsDuringRead(existingState ExportRunOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExportRunOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExportRunOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "views": reflect.TypeOf(ViewItem{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExportRunOutput +// only implements ToObjectValue() and Type(). +func (o ExportRunOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "views": o.Views, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExportRunOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "views": basetypes.ListType{ + ElemType: ViewItem{}.Type(ctx), + }, + }, + } +} + +// GetViews returns the value of the Views field in ExportRunOutput as +// a slice of ViewItem values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExportRunOutput) GetViews(ctx context.Context) ([]ViewItem, bool) { + if o.Views.IsNull() || o.Views.IsUnknown() { + return nil, false + } + var v []ViewItem + d := o.Views.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetViews sets the value of the Views field in ExportRunOutput. +func (o *ExportRunOutput) SetViews(ctx context.Context, v []ViewItem) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["views"] + t = t.(attr.TypeWithElementType).ElementType() + o.Views = types.ListValueMust(t, vs) +} + // Export and retrieve a job run type ExportRunRequest struct { // The canonical identifier for the run. This field is required. @@ -659,6 +2633,39 @@ func (newState *ExportRunRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan E func (newState *ExportRunRequest) SyncEffectiveFieldsDuringRead(existingState ExportRunRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExportRunRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExportRunRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExportRunRequest +// only implements ToObjectValue() and Type(). +func (o ExportRunRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + "views_to_export": o.ViewsToExport, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExportRunRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + "views_to_export": types.StringType, + }, + } +} + type FileArrivalTriggerConfiguration struct { // If set, the trigger starts a run only after the specified amount of time // passed since the last time the trigger fired. The minimum allowed value @@ -680,11 +2687,46 @@ func (newState *FileArrivalTriggerConfiguration) SyncEffectiveFieldsDuringCreate func (newState *FileArrivalTriggerConfiguration) SyncEffectiveFieldsDuringRead(existingState FileArrivalTriggerConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FileArrivalTriggerConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FileArrivalTriggerConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FileArrivalTriggerConfiguration +// only implements ToObjectValue() and Type(). +func (o FileArrivalTriggerConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "min_time_between_triggers_seconds": o.MinTimeBetweenTriggersSeconds, + "url": o.Url, + "wait_after_last_change_seconds": o.WaitAfterLastChangeSeconds, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FileArrivalTriggerConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "min_time_between_triggers_seconds": types.Int64Type, + "url": types.StringType, + "wait_after_last_change_seconds": types.Int64Type, + }, + } +} + type ForEachStats struct { // Sample of 3 most common error messages occurred during the iteration. - ErrorMessageStats []ForEachTaskErrorMessageStats `tfsdk:"error_message_stats" tf:"optional"` + ErrorMessageStats types.List `tfsdk:"error_message_stats" tf:"optional"` // Describes stats of the iteration. Only latest retries are considered. - TaskRunStats []ForEachTaskTaskRunStats `tfsdk:"task_run_stats" tf:"optional,object"` + TaskRunStats types.List `tfsdk:"task_run_stats" tf:"optional,object"` } func (newState *ForEachStats) SyncEffectiveFieldsDuringCreateOrUpdate(plan ForEachStats) { @@ -693,6 +2735,98 @@ func (newState *ForEachStats) SyncEffectiveFieldsDuringCreateOrUpdate(plan ForEa func (newState *ForEachStats) SyncEffectiveFieldsDuringRead(existingState ForEachStats) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ForEachStats. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ForEachStats) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "error_message_stats": reflect.TypeOf(ForEachTaskErrorMessageStats{}), + "task_run_stats": reflect.TypeOf(ForEachTaskTaskRunStats{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ForEachStats +// only implements ToObjectValue() and Type(). +func (o ForEachStats) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error_message_stats": o.ErrorMessageStats, + "task_run_stats": o.TaskRunStats, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ForEachStats) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error_message_stats": basetypes.ListType{ + ElemType: ForEachTaskErrorMessageStats{}.Type(ctx), + }, + "task_run_stats": basetypes.ListType{ + ElemType: ForEachTaskTaskRunStats{}.Type(ctx), + }, + }, + } +} + +// GetErrorMessageStats returns the value of the ErrorMessageStats field in ForEachStats as +// a slice of ForEachTaskErrorMessageStats values. +// If the field is unknown or null, the boolean return value is false. +func (o *ForEachStats) GetErrorMessageStats(ctx context.Context) ([]ForEachTaskErrorMessageStats, bool) { + if o.ErrorMessageStats.IsNull() || o.ErrorMessageStats.IsUnknown() { + return nil, false + } + var v []ForEachTaskErrorMessageStats + d := o.ErrorMessageStats.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetErrorMessageStats sets the value of the ErrorMessageStats field in ForEachStats. +func (o *ForEachStats) SetErrorMessageStats(ctx context.Context, v []ForEachTaskErrorMessageStats) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["error_message_stats"] + t = t.(attr.TypeWithElementType).ElementType() + o.ErrorMessageStats = types.ListValueMust(t, vs) +} + +// GetTaskRunStats returns the value of the TaskRunStats field in ForEachStats as +// a ForEachTaskTaskRunStats value. +// If the field is unknown or null, the boolean return value is false. +func (o *ForEachStats) GetTaskRunStats(ctx context.Context) (ForEachTaskTaskRunStats, bool) { + var e ForEachTaskTaskRunStats + if o.TaskRunStats.IsNull() || o.TaskRunStats.IsUnknown() { + return e, false + } + var v []ForEachTaskTaskRunStats + d := o.TaskRunStats.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTaskRunStats sets the value of the TaskRunStats field in ForEachStats. +func (o *ForEachStats) SetTaskRunStats(ctx context.Context, v ForEachTaskTaskRunStats) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["task_run_stats"] + o.TaskRunStats = types.ListValueMust(t, vs) +} + type ForEachTask struct { // An optional maximum allowed number of concurrent runs of the task. Set // this value if you want to be able to execute multiple runs of the task @@ -702,7 +2836,7 @@ type ForEachTask struct { // an array parameter. Inputs types.String `tfsdk:"inputs" tf:""` // Configuration for the task that will be run for each element in the array - Task []Task `tfsdk:"task" tf:"object"` + Task types.List `tfsdk:"task" tf:"object"` } func (newState *ForEachTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan ForEachTask) { @@ -711,6 +2845,71 @@ func (newState *ForEachTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan ForEac func (newState *ForEachTask) SyncEffectiveFieldsDuringRead(existingState ForEachTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ForEachTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ForEachTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "task": reflect.TypeOf(Task{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ForEachTask +// only implements ToObjectValue() and Type(). +func (o ForEachTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "concurrency": o.Concurrency, + "inputs": o.Inputs, + "task": o.Task, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ForEachTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "concurrency": types.Int64Type, + "inputs": types.StringType, + "task": basetypes.ListType{ + ElemType: Task{}.Type(ctx), + }, + }, + } +} + +// GetTask returns the value of the Task field in ForEachTask as +// a Task value. +// If the field is unknown or null, the boolean return value is false. +func (o *ForEachTask) GetTask(ctx context.Context) (Task, bool) { + var e Task + if o.Task.IsNull() || o.Task.IsUnknown() { + return e, false + } + var v []Task + d := o.Task.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTask sets the value of the Task field in ForEachTask. +func (o *ForEachTask) SetTask(ctx context.Context, v Task) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["task"] + o.Task = types.ListValueMust(t, vs) +} + type ForEachTaskErrorMessageStats struct { // Describes the count of such error message encountered during the // iterations. @@ -727,6 +2926,41 @@ func (newState *ForEachTaskErrorMessageStats) SyncEffectiveFieldsDuringCreateOrU func (newState *ForEachTaskErrorMessageStats) SyncEffectiveFieldsDuringRead(existingState ForEachTaskErrorMessageStats) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ForEachTaskErrorMessageStats. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ForEachTaskErrorMessageStats) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ForEachTaskErrorMessageStats +// only implements ToObjectValue() and Type(). +func (o ForEachTaskErrorMessageStats) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "count": o.Count, + "error_message": o.ErrorMessage, + "termination_category": o.TerminationCategory, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ForEachTaskErrorMessageStats) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "count": types.Int64Type, + "error_message": types.StringType, + "termination_category": types.StringType, + }, + } +} + type ForEachTaskTaskRunStats struct { // Describes the iteration runs having an active lifecycle state or an // active run sub state. @@ -749,6 +2983,47 @@ func (newState *ForEachTaskTaskRunStats) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ForEachTaskTaskRunStats) SyncEffectiveFieldsDuringRead(existingState ForEachTaskTaskRunStats) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ForEachTaskTaskRunStats. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ForEachTaskTaskRunStats) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ForEachTaskTaskRunStats +// only implements ToObjectValue() and Type(). +func (o ForEachTaskTaskRunStats) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "active_iterations": o.ActiveIterations, + "completed_iterations": o.CompletedIterations, + "failed_iterations": o.FailedIterations, + "scheduled_iterations": o.ScheduledIterations, + "succeeded_iterations": o.SucceededIterations, + "total_iterations": o.TotalIterations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ForEachTaskTaskRunStats) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "active_iterations": types.Int64Type, + "completed_iterations": types.Int64Type, + "failed_iterations": types.Int64Type, + "scheduled_iterations": types.Int64Type, + "succeeded_iterations": types.Int64Type, + "total_iterations": types.Int64Type, + }, + } +} + // Get job permission levels type GetJobPermissionLevelsRequest struct { // The job for which to get or manage permissions. @@ -761,9 +3036,40 @@ func (newState *GetJobPermissionLevelsRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetJobPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetJobPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetJobPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetJobPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetJobPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetJobPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetJobPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.StringType, + }, + } +} + type GetJobPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []JobPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetJobPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetJobPermissionLevelsResponse) { @@ -772,6 +3078,67 @@ func (newState *GetJobPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateO func (newState *GetJobPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetJobPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetJobPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetJobPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(JobPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetJobPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetJobPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetJobPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: JobPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetJobPermissionLevelsResponse as +// a slice of JobPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetJobPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]JobPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []JobPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetJobPermissionLevelsResponse. +func (o *GetJobPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []JobPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get job permissions type GetJobPermissionsRequest struct { // The job for which to get or manage permissions. @@ -784,6 +3151,37 @@ func (newState *GetJobPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetJobPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetJobPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetJobPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetJobPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetJobPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetJobPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetJobPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.StringType, + }, + } +} + // Get a single job type GetJobRequest struct { // The canonical identifier of the job to retrieve information about. This @@ -797,6 +3195,37 @@ func (newState *GetJobRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetJ func (newState *GetJobRequest) SyncEffectiveFieldsDuringRead(existingState GetJobRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetJobRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetJobRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetJobRequest +// only implements ToObjectValue() and Type(). +func (o GetJobRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetJobRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.Int64Type, + }, + } +} + // Get job policy compliance type GetPolicyComplianceRequest struct { // The ID of the job whose compliance status you are requesting. @@ -809,6 +3238,37 @@ func (newState *GetPolicyComplianceRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *GetPolicyComplianceRequest) SyncEffectiveFieldsDuringRead(existingState GetPolicyComplianceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPolicyComplianceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPolicyComplianceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPolicyComplianceRequest +// only implements ToObjectValue() and Type(). +func (o GetPolicyComplianceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPolicyComplianceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.Int64Type, + }, + } +} + type GetPolicyComplianceResponse struct { // Whether the job is compliant with its policies or not. Jobs could be out // of compliance if a policy they are using was updated after the job was @@ -820,7 +3280,7 @@ type GetPolicyComplianceResponse struct { // error is occurring. An identifier for the job cluster is prepended to the // path. The values indicate an error message describing the policy // validation error. - Violations map[string]types.String `tfsdk:"violations" tf:"optional"` + Violations types.Map `tfsdk:"violations" tf:"optional"` } func (newState *GetPolicyComplianceResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetPolicyComplianceResponse) { @@ -829,6 +3289,69 @@ func (newState *GetPolicyComplianceResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetPolicyComplianceResponse) SyncEffectiveFieldsDuringRead(existingState GetPolicyComplianceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPolicyComplianceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPolicyComplianceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "violations": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPolicyComplianceResponse +// only implements ToObjectValue() and Type(). +func (o GetPolicyComplianceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_compliant": o.IsCompliant, + "violations": o.Violations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPolicyComplianceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_compliant": types.BoolType, + "violations": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetViolations returns the value of the Violations field in GetPolicyComplianceResponse as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPolicyComplianceResponse) GetViolations(ctx context.Context) (map[string]types.String, bool) { + if o.Violations.IsNull() || o.Violations.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Violations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetViolations sets the value of the Violations field in GetPolicyComplianceResponse. +func (o *GetPolicyComplianceResponse) SetViolations(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["violations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Violations = types.MapValueMust(t, vs) +} + // Get the output for a single run type GetRunOutputRequest struct { // The canonical identifier for the run. @@ -841,6 +3364,37 @@ func (newState *GetRunOutputRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetRunOutputRequest) SyncEffectiveFieldsDuringRead(existingState GetRunOutputRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRunOutputRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRunOutputRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRunOutputRequest +// only implements ToObjectValue() and Type(). +func (o GetRunOutputRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRunOutputRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + }, + } +} + // Get a single job run type GetRunRequest struct { // Whether to include the repair history in the response. @@ -861,6 +3415,43 @@ func (newState *GetRunRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetR func (newState *GetRunRequest) SyncEffectiveFieldsDuringRead(existingState GetRunRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRunRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRunRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRunRequest +// only implements ToObjectValue() and Type(). +func (o GetRunRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_history": o.IncludeHistory, + "include_resolved_values": o.IncludeResolvedValues, + "page_token": o.PageToken, + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRunRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_history": types.BoolType, + "include_resolved_values": types.BoolType, + "page_token": types.StringType, + "run_id": types.Int64Type, + }, + } +} + // Read-only state of the remote repository at the time the job was run. This // field is only included on job runs. type GitSnapshot struct { @@ -876,6 +3467,37 @@ func (newState *GitSnapshot) SyncEffectiveFieldsDuringCreateOrUpdate(plan GitSna func (newState *GitSnapshot) SyncEffectiveFieldsDuringRead(existingState GitSnapshot) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GitSnapshot. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GitSnapshot) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GitSnapshot +// only implements ToObjectValue() and Type(). +func (o GitSnapshot) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "used_commit": o.UsedCommit, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GitSnapshot) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "used_commit": types.StringType, + }, + } +} + // An optional specification for a remote Git repository containing the source // code used by tasks. Version-controlled source code is supported by notebook, // dbt, Python script, and SQL File tasks. @@ -898,7 +3520,7 @@ type GitSource struct { GitProvider types.String `tfsdk:"git_provider" tf:""` // Read-only state of the remote repository at the time the job was run. // This field is only included on job runs. - GitSnapshot []GitSnapshot `tfsdk:"git_snapshot" tf:"optional,object"` + GitSnapshot types.List `tfsdk:"git_snapshot" tf:"optional,object"` // Name of the tag to be checked out and used by this job. This field cannot // be specified in conjunction with git_branch or git_commit. GitTag types.String `tfsdk:"tag" tf:"optional"` @@ -906,7 +3528,7 @@ type GitSource struct { GitUrl types.String `tfsdk:"url" tf:""` // The source of the job specification in the remote repository when the job // is source controlled. - JobSource []JobSource `tfsdk:"job_source" tf:"optional,object"` + JobSource types.List `tfsdk:"job_source" tf:"optional,object"` } func (newState *GitSource) SyncEffectiveFieldsDuringCreateOrUpdate(plan GitSource) { @@ -915,6 +3537,108 @@ func (newState *GitSource) SyncEffectiveFieldsDuringCreateOrUpdate(plan GitSourc func (newState *GitSource) SyncEffectiveFieldsDuringRead(existingState GitSource) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GitSource. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GitSource) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "git_snapshot": reflect.TypeOf(GitSnapshot{}), + "job_source": reflect.TypeOf(JobSource{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GitSource +// only implements ToObjectValue() and Type(). +func (o GitSource) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "branch": o.GitBranch, + "commit": o.GitCommit, + "git_provider": o.GitProvider, + "git_snapshot": o.GitSnapshot, + "tag": o.GitTag, + "url": o.GitUrl, + "job_source": o.JobSource, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GitSource) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "branch": types.StringType, + "commit": types.StringType, + "git_provider": types.StringType, + "git_snapshot": basetypes.ListType{ + ElemType: GitSnapshot{}.Type(ctx), + }, + "tag": types.StringType, + "url": types.StringType, + "job_source": basetypes.ListType{ + ElemType: JobSource{}.Type(ctx), + }, + }, + } +} + +// GetGitSnapshot returns the value of the GitSnapshot field in GitSource as +// a GitSnapshot value. +// If the field is unknown or null, the boolean return value is false. +func (o *GitSource) GetGitSnapshot(ctx context.Context) (GitSnapshot, bool) { + var e GitSnapshot + if o.GitSnapshot.IsNull() || o.GitSnapshot.IsUnknown() { + return e, false + } + var v []GitSnapshot + d := o.GitSnapshot.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSnapshot sets the value of the GitSnapshot field in GitSource. +func (o *GitSource) SetGitSnapshot(ctx context.Context, v GitSnapshot) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_snapshot"] + o.GitSnapshot = types.ListValueMust(t, vs) +} + +// GetJobSource returns the value of the JobSource field in GitSource as +// a JobSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *GitSource) GetJobSource(ctx context.Context) (JobSource, bool) { + var e JobSource + if o.JobSource.IsNull() || o.JobSource.IsUnknown() { + return e, false + } + var v []JobSource + d := o.JobSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetJobSource sets the value of the JobSource field in GitSource. +func (o *GitSource) SetJobSource(ctx context.Context, v JobSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_source"] + o.JobSource = types.ListValueMust(t, vs) +} + // Job was retrieved successfully. type Job struct { // The time at which this job was created in epoch milliseconds @@ -942,7 +3666,7 @@ type Job struct { RunAsUserName types.String `tfsdk:"run_as_user_name" tf:"optional"` // Settings for this job and all of its runs. These settings can be updated // using the `resetJob` method. - Settings []JobSettings `tfsdk:"settings" tf:"optional,object"` + Settings types.List `tfsdk:"settings" tf:"optional,object"` } func (newState *Job) SyncEffectiveFieldsDuringCreateOrUpdate(plan Job) { @@ -951,6 +3675,77 @@ func (newState *Job) SyncEffectiveFieldsDuringCreateOrUpdate(plan Job) { func (newState *Job) SyncEffectiveFieldsDuringRead(existingState Job) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Job. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Job) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "settings": reflect.TypeOf(JobSettings{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Job +// only implements ToObjectValue() and Type(). +func (o Job) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_time": o.CreatedTime, + "creator_user_name": o.CreatorUserName, + "effective_budget_policy_id": o.EffectiveBudgetPolicyId, + "job_id": o.JobId, + "run_as_user_name": o.RunAsUserName, + "settings": o.Settings, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Job) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_time": types.Int64Type, + "creator_user_name": types.StringType, + "effective_budget_policy_id": types.StringType, + "job_id": types.Int64Type, + "run_as_user_name": types.StringType, + "settings": basetypes.ListType{ + ElemType: JobSettings{}.Type(ctx), + }, + }, + } +} + +// GetSettings returns the value of the Settings field in Job as +// a JobSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *Job) GetSettings(ctx context.Context) (JobSettings, bool) { + var e JobSettings + if o.Settings.IsNull() || o.Settings.IsUnknown() { + return e, false + } + var v []JobSettings + d := o.Settings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSettings sets the value of the Settings field in Job. +func (o *Job) SetSettings(ctx context.Context, v JobSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["settings"] + o.Settings = types.ListValueMust(t, vs) +} + type JobAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -968,9 +3763,46 @@ func (newState *JobAccessControlRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *JobAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState JobAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o JobAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type JobAccessControlResponse struct { // All permissions. - AllPermissions []JobPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -987,13 +3819,82 @@ func (newState *JobAccessControlResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *JobAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState JobAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(JobPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o JobAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: JobPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in JobAccessControlResponse as +// a slice of JobPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobAccessControlResponse) GetAllPermissions(ctx context.Context) ([]JobPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []JobPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in JobAccessControlResponse. +func (o *JobAccessControlResponse) SetAllPermissions(ctx context.Context, v []JobPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type JobCluster struct { // A unique name for the job cluster. This field is required and must be // unique within the job. `JobTaskSettings` may refer to this field to // determine which cluster to launch for the task execution. JobClusterKey types.String `tfsdk:"job_cluster_key" tf:""` // If new_cluster, a description of a cluster that is created for each task. - NewCluster compute.ClusterSpec `tfsdk:"new_cluster" tf:"object"` + NewCluster types.List `tfsdk:"new_cluster" tf:"object"` } func (newState *JobCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobCluster) { @@ -1002,6 +3903,69 @@ func (newState *JobCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobClus func (newState *JobCluster) SyncEffectiveFieldsDuringRead(existingState JobCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobCluster +// only implements ToObjectValue() and Type(). +func (o JobCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_cluster_key": o.JobClusterKey, + "new_cluster": o.NewCluster, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_cluster_key": types.StringType, + "new_cluster": basetypes.ListType{ + ElemType: compute_tf.ClusterSpec{}.Type(ctx), + }, + }, + } +} + +// GetNewCluster returns the value of the NewCluster field in JobCluster as +// a compute_tf.ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobCluster) GetNewCluster(ctx context.Context) (compute_tf.ClusterSpec, bool) { + var e compute_tf.ClusterSpec + if o.NewCluster.IsNull() || o.NewCluster.IsUnknown() { + return e, false + } + var v []compute_tf.ClusterSpec + d := o.NewCluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewCluster sets the value of the NewCluster field in JobCluster. +func (o *JobCluster) SetNewCluster(ctx context.Context, v compute_tf.ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_cluster"] + o.NewCluster = types.ListValueMust(t, vs) +} + type JobCompliance struct { // Whether this job is in compliance with the latest version of its policy. IsCompliant types.Bool `tfsdk:"is_compliant" tf:"optional"` @@ -1012,7 +3976,7 @@ type JobCompliance struct { // error is occurring. An identifier for the job cluster is prepended to the // path. The values indicate an error message describing the policy // validation error. - Violations map[string]types.String `tfsdk:"violations" tf:"optional"` + Violations types.Map `tfsdk:"violations" tf:"optional"` } func (newState *JobCompliance) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobCompliance) { @@ -1021,6 +3985,71 @@ func (newState *JobCompliance) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobC func (newState *JobCompliance) SyncEffectiveFieldsDuringRead(existingState JobCompliance) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobCompliance. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobCompliance) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "violations": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobCompliance +// only implements ToObjectValue() and Type(). +func (o JobCompliance) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_compliant": o.IsCompliant, + "job_id": o.JobId, + "violations": o.Violations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobCompliance) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_compliant": types.BoolType, + "job_id": types.Int64Type, + "violations": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetViolations returns the value of the Violations field in JobCompliance as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobCompliance) GetViolations(ctx context.Context) (map[string]types.String, bool) { + if o.Violations.IsNull() || o.Violations.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Violations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetViolations sets the value of the Violations field in JobCompliance. +func (o *JobCompliance) SetViolations(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["violations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Violations = types.MapValueMust(t, vs) +} + type JobDeployment struct { // The kind of deployment that manages the job. // @@ -1036,6 +4065,39 @@ func (newState *JobDeployment) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobD func (newState *JobDeployment) SyncEffectiveFieldsDuringRead(existingState JobDeployment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobDeployment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobDeployment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobDeployment +// only implements ToObjectValue() and Type(). +func (o JobDeployment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "kind": o.Kind, + "metadata_file_path": o.MetadataFilePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobDeployment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "kind": types.StringType, + "metadata_file_path": types.StringType, + }, + } +} + type JobEmailNotifications struct { // If true, do not send email to recipients specified in `on_failure` if the // run is skipped. This field is `deprecated`. Please use the @@ -1045,17 +4107,17 @@ type JobEmailNotifications struct { // exceeds the threshold specified for the `RUN_DURATION_SECONDS` metric in // the `health` field. If no rule for the `RUN_DURATION_SECONDS` metric is // specified in the `health` field for the job, notifications are not sent. - OnDurationWarningThresholdExceeded []types.String `tfsdk:"on_duration_warning_threshold_exceeded" tf:"optional"` + OnDurationWarningThresholdExceeded types.List `tfsdk:"on_duration_warning_threshold_exceeded" tf:"optional"` // A list of email addresses to be notified when a run unsuccessfully // completes. A run is considered to have completed unsuccessfully if it // ends with an `INTERNAL_ERROR` `life_cycle_state` or a `FAILED`, or // `TIMED_OUT` result_state. If this is not specified on job creation, // reset, or update the list is empty, and notifications are not sent. - OnFailure []types.String `tfsdk:"on_failure" tf:"optional"` + OnFailure types.List `tfsdk:"on_failure" tf:"optional"` // A list of email addresses to be notified when a run begins. If not // specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - OnStart []types.String `tfsdk:"on_start" tf:"optional"` + OnStart types.List `tfsdk:"on_start" tf:"optional"` // A list of email addresses to notify when any streaming backlog thresholds // are exceeded for any stream. Streaming backlog thresholds can be set in // the `health` field using the following metrics: @@ -1063,13 +4125,13 @@ type JobEmailNotifications struct { // `STREAMING_BACKLOG_SECONDS`, or `STREAMING_BACKLOG_FILES`. Alerting is // based on the 10-minute average of these metrics. If the issue persists, // notifications are resent every 30 minutes. - OnStreamingBacklogExceeded []types.String `tfsdk:"on_streaming_backlog_exceeded" tf:"optional"` + OnStreamingBacklogExceeded types.List `tfsdk:"on_streaming_backlog_exceeded" tf:"optional"` // A list of email addresses to be notified when a run successfully // completes. A run is considered to have completed successfully if it ends // with a `TERMINATED` `life_cycle_state` and a `SUCCESS` result_state. If // not specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - OnSuccess []types.String `tfsdk:"on_success" tf:"optional"` + OnSuccess types.List `tfsdk:"on_success" tf:"optional"` } func (newState *JobEmailNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobEmailNotifications) { @@ -1078,13 +4140,200 @@ func (newState *JobEmailNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *JobEmailNotifications) SyncEffectiveFieldsDuringRead(existingState JobEmailNotifications) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobEmailNotifications. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobEmailNotifications) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "on_duration_warning_threshold_exceeded": reflect.TypeOf(types.String{}), + "on_failure": reflect.TypeOf(types.String{}), + "on_start": reflect.TypeOf(types.String{}), + "on_streaming_backlog_exceeded": reflect.TypeOf(types.String{}), + "on_success": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobEmailNotifications +// only implements ToObjectValue() and Type(). +func (o JobEmailNotifications) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "no_alert_for_skipped_runs": o.NoAlertForSkippedRuns, + "on_duration_warning_threshold_exceeded": o.OnDurationWarningThresholdExceeded, + "on_failure": o.OnFailure, + "on_start": o.OnStart, + "on_streaming_backlog_exceeded": o.OnStreamingBacklogExceeded, + "on_success": o.OnSuccess, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobEmailNotifications) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "no_alert_for_skipped_runs": types.BoolType, + "on_duration_warning_threshold_exceeded": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_failure": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_start": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_streaming_backlog_exceeded": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_success": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetOnDurationWarningThresholdExceeded returns the value of the OnDurationWarningThresholdExceeded field in JobEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobEmailNotifications) GetOnDurationWarningThresholdExceeded(ctx context.Context) ([]types.String, bool) { + if o.OnDurationWarningThresholdExceeded.IsNull() || o.OnDurationWarningThresholdExceeded.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnDurationWarningThresholdExceeded.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnDurationWarningThresholdExceeded sets the value of the OnDurationWarningThresholdExceeded field in JobEmailNotifications. +func (o *JobEmailNotifications) SetOnDurationWarningThresholdExceeded(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_duration_warning_threshold_exceeded"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnDurationWarningThresholdExceeded = types.ListValueMust(t, vs) +} + +// GetOnFailure returns the value of the OnFailure field in JobEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobEmailNotifications) GetOnFailure(ctx context.Context) ([]types.String, bool) { + if o.OnFailure.IsNull() || o.OnFailure.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnFailure.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnFailure sets the value of the OnFailure field in JobEmailNotifications. +func (o *JobEmailNotifications) SetOnFailure(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_failure"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnFailure = types.ListValueMust(t, vs) +} + +// GetOnStart returns the value of the OnStart field in JobEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobEmailNotifications) GetOnStart(ctx context.Context) ([]types.String, bool) { + if o.OnStart.IsNull() || o.OnStart.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnStart.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnStart sets the value of the OnStart field in JobEmailNotifications. +func (o *JobEmailNotifications) SetOnStart(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_start"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnStart = types.ListValueMust(t, vs) +} + +// GetOnStreamingBacklogExceeded returns the value of the OnStreamingBacklogExceeded field in JobEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobEmailNotifications) GetOnStreamingBacklogExceeded(ctx context.Context) ([]types.String, bool) { + if o.OnStreamingBacklogExceeded.IsNull() || o.OnStreamingBacklogExceeded.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnStreamingBacklogExceeded.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnStreamingBacklogExceeded sets the value of the OnStreamingBacklogExceeded field in JobEmailNotifications. +func (o *JobEmailNotifications) SetOnStreamingBacklogExceeded(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_streaming_backlog_exceeded"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnStreamingBacklogExceeded = types.ListValueMust(t, vs) +} + +// GetOnSuccess returns the value of the OnSuccess field in JobEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobEmailNotifications) GetOnSuccess(ctx context.Context) ([]types.String, bool) { + if o.OnSuccess.IsNull() || o.OnSuccess.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnSuccess.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnSuccess sets the value of the OnSuccess field in JobEmailNotifications. +func (o *JobEmailNotifications) SetOnSuccess(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_success"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnSuccess = types.ListValueMust(t, vs) +} + type JobEnvironment struct { // The key of an environment. It has to be unique within a job. EnvironmentKey types.String `tfsdk:"environment_key" tf:""` // The environment entity used to preserve serverless environment side panel // and jobs' environment for non-notebook task. In this minimal environment // spec, only pip dependencies are supported. - Spec compute.Environment `tfsdk:"spec" tf:"optional,object"` + Spec types.List `tfsdk:"spec" tf:"optional,object"` } func (newState *JobEnvironment) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobEnvironment) { @@ -1093,6 +4342,69 @@ func (newState *JobEnvironment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Job func (newState *JobEnvironment) SyncEffectiveFieldsDuringRead(existingState JobEnvironment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobEnvironment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobEnvironment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "spec": reflect.TypeOf(compute_tf.Environment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobEnvironment +// only implements ToObjectValue() and Type(). +func (o JobEnvironment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "environment_key": o.EnvironmentKey, + "spec": o.Spec, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobEnvironment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "environment_key": types.StringType, + "spec": basetypes.ListType{ + ElemType: compute_tf.Environment{}.Type(ctx), + }, + }, + } +} + +// GetSpec returns the value of the Spec field in JobEnvironment as +// a compute_tf.Environment value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobEnvironment) GetSpec(ctx context.Context) (compute_tf.Environment, bool) { + var e compute_tf.Environment + if o.Spec.IsNull() || o.Spec.IsUnknown() { + return e, false + } + var v []compute_tf.Environment + d := o.Spec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSpec sets the value of the Spec field in JobEnvironment. +func (o *JobEnvironment) SetSpec(ctx context.Context, v compute_tf.Environment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spec"] + o.Spec = types.ListValueMust(t, vs) +} + type JobNotificationSettings struct { // If true, do not send notifications to recipients specified in // `on_failure` if the run is canceled. @@ -1108,6 +4420,39 @@ func (newState *JobNotificationSettings) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *JobNotificationSettings) SyncEffectiveFieldsDuringRead(existingState JobNotificationSettings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobNotificationSettings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobNotificationSettings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobNotificationSettings +// only implements ToObjectValue() and Type(). +func (o JobNotificationSettings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "no_alert_for_canceled_runs": o.NoAlertForCanceledRuns, + "no_alert_for_skipped_runs": o.NoAlertForSkippedRuns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobNotificationSettings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "no_alert_for_canceled_runs": types.BoolType, + "no_alert_for_skipped_runs": types.BoolType, + }, + } +} + type JobParameter struct { // The optional default value of the parameter Default types.String `tfsdk:"default" tf:"optional"` @@ -1123,6 +4468,41 @@ func (newState *JobParameter) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobPa func (newState *JobParameter) SyncEffectiveFieldsDuringRead(existingState JobParameter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobParameter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobParameter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobParameter +// only implements ToObjectValue() and Type(). +func (o JobParameter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default": o.Default, + "name": o.Name, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobParameter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default": types.StringType, + "name": types.StringType, + "value": types.StringType, + }, + } +} + type JobParameterDefinition struct { // Default value of the parameter. Default types.String `tfsdk:"default" tf:""` @@ -1137,10 +4517,43 @@ func (newState *JobParameterDefinition) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *JobParameterDefinition) SyncEffectiveFieldsDuringRead(existingState JobParameterDefinition) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobParameterDefinition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobParameterDefinition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobParameterDefinition +// only implements ToObjectValue() and Type(). +func (o JobParameterDefinition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default": o.Default, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobParameterDefinition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default": types.StringType, + "name": types.StringType, + }, + } +} + type JobPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -1151,8 +4564,73 @@ func (newState *JobPermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobP func (newState *JobPermission) SyncEffectiveFieldsDuringRead(existingState JobPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobPermission +// only implements ToObjectValue() and Type(). +func (o JobPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in JobPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in JobPermission. +func (o *JobPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type JobPermissions struct { - AccessControlList []JobAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -1165,6 +4643,71 @@ func (newState *JobPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan Job func (newState *JobPermissions) SyncEffectiveFieldsDuringRead(existingState JobPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(JobAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobPermissions +// only implements ToObjectValue() and Type(). +func (o JobPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: JobAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in JobPermissions as +// a slice of JobAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobPermissions) GetAccessControlList(ctx context.Context) ([]JobAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []JobAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in JobPermissions. +func (o *JobPermissions) SetAccessControlList(ctx context.Context, v []JobAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type JobPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -1177,8 +4720,41 @@ func (newState *JobPermissionsDescription) SyncEffectiveFieldsDuringCreateOrUpda func (newState *JobPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState JobPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o JobPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type JobPermissionsRequest struct { - AccessControlList []JobAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The job for which to get or manage permissions. JobId types.String `tfsdk:"-"` } @@ -1189,6 +4765,69 @@ func (newState *JobPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *JobPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState JobPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(JobAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o JobPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "job_id": o.JobId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: JobAccessControlRequest{}.Type(ctx), + }, + "job_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in JobPermissionsRequest as +// a slice of JobAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobPermissionsRequest) GetAccessControlList(ctx context.Context) ([]JobAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []JobAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in JobPermissionsRequest. +func (o *JobPermissionsRequest) SetAccessControlList(ctx context.Context, v []JobAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + // Write-only setting. Specifies the user or service principal that the job runs // as. If not specified, the job runs as the user who created the job. // @@ -1209,6 +4848,39 @@ func (newState *JobRunAs) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobRunAs) func (newState *JobRunAs) SyncEffectiveFieldsDuringRead(existingState JobRunAs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobRunAs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobRunAs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobRunAs +// only implements ToObjectValue() and Type(). +func (o JobRunAs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobRunAs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type JobSettings struct { // The id of the user specified budget policy to use for this job. If not // specified, a default budget policy may be applied when creating or @@ -1218,9 +4890,9 @@ type JobSettings struct { // An optional continuous property for this job. The continuous property // will ensure that there is always one run executing. Only one of // `schedule` and `continuous` can be used. - Continuous []Continuous `tfsdk:"continuous" tf:"optional,object"` + Continuous types.List `tfsdk:"continuous" tf:"optional,object"` // Deployment information for jobs managed by external sources. - Deployment []JobDeployment `tfsdk:"deployment" tf:"optional,object"` + Deployment types.List `tfsdk:"deployment" tf:"optional,object"` // An optional description for the job. The maximum length is 27700 // characters in UTF-8 encoding. Description types.String `tfsdk:"description" tf:"optional"` @@ -1231,14 +4903,14 @@ type JobSettings struct { EditMode types.String `tfsdk:"edit_mode" tf:"optional"` // An optional set of email addresses that is notified when runs of this job // begin or complete as well as when this job is deleted. - EmailNotifications []JobEmailNotifications `tfsdk:"email_notifications" tf:"optional,object"` + EmailNotifications types.List `tfsdk:"email_notifications" tf:"optional,object"` // A list of task execution environment specifications that can be // referenced by serverless tasks of this job. An environment is required to // be present for serverless tasks. For serverless notebook tasks, the // environment is accessible in the notebook environment panel. For other // serverless tasks, the task environment is required to be specified using // environment_key in the task settings. - Environments []JobEnvironment `tfsdk:"environment" tf:"optional"` + Environments types.List `tfsdk:"environment" tf:"optional"` // Used to tell what is the format of the job. This field is ignored in // Create/Update/Reset calls. When using the Jobs API 2.1 this value is // always set to `"MULTI_TASK"`. @@ -1253,13 +4925,13 @@ type JobSettings struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - GitSource []GitSource `tfsdk:"git_source" tf:"optional,object"` + GitSource types.List `tfsdk:"git_source" tf:"optional,object"` // An optional set of health rules that can be defined for this job. - Health []JobsHealthRules `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. - JobClusters []JobCluster `tfsdk:"job_cluster" tf:"optional"` + JobClusters types.List `tfsdk:"job_cluster" tf:"optional"` // An optional maximum allowed number of concurrent runs of the job. Set // this value if you want to be able to execute multiple runs of the same // job concurrently. This is useful for example if you trigger your job on a @@ -1278,38 +4950,38 @@ type JobSettings struct { // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // job. - NotificationSettings []JobNotificationSettings `tfsdk:"notification_settings" tf:"optional,object"` + NotificationSettings types.List `tfsdk:"notification_settings" tf:"optional,object"` // Job-level parameter definitions - Parameters []JobParameterDefinition `tfsdk:"parameter" tf:"optional"` + Parameters types.List `tfsdk:"parameter" tf:"optional"` // The queue settings of the job. - Queue []QueueSettings `tfsdk:"queue" tf:"optional,object"` + Queue types.List `tfsdk:"queue" tf:"optional,object"` // Write-only setting. Specifies the user or service principal that the job // runs as. If not specified, the job runs as the user who created the job. // // Either `user_name` or `service_principal_name` should be specified. If // not, an error is thrown. - RunAs []JobRunAs `tfsdk:"run_as" tf:"optional,object"` + RunAs types.List `tfsdk:"run_as" tf:"optional,object"` // An optional periodic schedule for this job. The default behavior is that // the job only runs when triggered by clicking “Run Now” in the Jobs UI // or sending an API request to `runNow`. - Schedule []CronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // A map of tags associated with the job. These are forwarded to the cluster // as cluster tags for jobs clusters, and are subject to the same // limitations as cluster tags. A maximum of 25 tags can be added to the // job. - Tags map[string]types.String `tfsdk:"tags" tf:"optional"` + Tags types.Map `tfsdk:"tags" tf:"optional"` // A list of task specifications to be executed by this job. - Tasks []Task `tfsdk:"task" tf:"optional"` + Tasks types.List `tfsdk:"task" tf:"optional"` // An optional timeout applied to each run of this job. A value of `0` means // no timeout. TimeoutSeconds types.Int64 `tfsdk:"timeout_seconds" tf:"optional"` // A configuration to trigger a run when certain conditions are met. The // default behavior is that the job runs only when triggered by clicking // “Run Now” in the Jobs UI or sending an API request to `runNow`. - Trigger []TriggerSettings `tfsdk:"trigger" tf:"optional,object"` + Trigger types.List `tfsdk:"trigger" tf:"optional,object"` // A collection of system notification IDs to notify when runs of this job // begin or complete. - WebhookNotifications []WebhookNotifications `tfsdk:"webhook_notifications" tf:"optional,object"` + WebhookNotifications types.List `tfsdk:"webhook_notifications" tf:"optional,object"` } func (newState *JobSettings) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobSettings) { @@ -1318,6 +4990,546 @@ func (newState *JobSettings) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobSet func (newState *JobSettings) SyncEffectiveFieldsDuringRead(existingState JobSettings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobSettings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobSettings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "continuous": reflect.TypeOf(Continuous{}), + "deployment": reflect.TypeOf(JobDeployment{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "environment": reflect.TypeOf(JobEnvironment{}), + "git_source": reflect.TypeOf(GitSource{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "job_cluster": reflect.TypeOf(JobCluster{}), + "notification_settings": reflect.TypeOf(JobNotificationSettings{}), + "parameter": reflect.TypeOf(JobParameterDefinition{}), + "queue": reflect.TypeOf(QueueSettings{}), + "run_as": reflect.TypeOf(JobRunAs{}), + "schedule": reflect.TypeOf(CronSchedule{}), + "tags": reflect.TypeOf(types.String{}), + "task": reflect.TypeOf(Task{}), + "trigger": reflect.TypeOf(TriggerSettings{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobSettings +// only implements ToObjectValue() and Type(). +func (o JobSettings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget_policy_id": o.BudgetPolicyId, + "continuous": o.Continuous, + "deployment": o.Deployment, + "description": o.Description, + "edit_mode": o.EditMode, + "email_notifications": o.EmailNotifications, + "environment": o.Environments, + "format": o.Format, + "git_source": o.GitSource, + "health": o.Health, + "job_cluster": o.JobClusters, + "max_concurrent_runs": o.MaxConcurrentRuns, + "name": o.Name, + "notification_settings": o.NotificationSettings, + "parameter": o.Parameters, + "queue": o.Queue, + "run_as": o.RunAs, + "schedule": o.Schedule, + "tags": o.Tags, + "task": o.Tasks, + "timeout_seconds": o.TimeoutSeconds, + "trigger": o.Trigger, + "webhook_notifications": o.WebhookNotifications, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobSettings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget_policy_id": types.StringType, + "continuous": basetypes.ListType{ + ElemType: Continuous{}.Type(ctx), + }, + "deployment": basetypes.ListType{ + ElemType: JobDeployment{}.Type(ctx), + }, + "description": types.StringType, + "edit_mode": types.StringType, + "email_notifications": basetypes.ListType{ + ElemType: JobEmailNotifications{}.Type(ctx), + }, + "environment": basetypes.ListType{ + ElemType: JobEnvironment{}.Type(ctx), + }, + "format": types.StringType, + "git_source": basetypes.ListType{ + ElemType: GitSource{}.Type(ctx), + }, + "health": basetypes.ListType{ + ElemType: JobsHealthRules{}.Type(ctx), + }, + "job_cluster": basetypes.ListType{ + ElemType: JobCluster{}.Type(ctx), + }, + "max_concurrent_runs": types.Int64Type, + "name": types.StringType, + "notification_settings": basetypes.ListType{ + ElemType: JobNotificationSettings{}.Type(ctx), + }, + "parameter": basetypes.ListType{ + ElemType: JobParameterDefinition{}.Type(ctx), + }, + "queue": basetypes.ListType{ + ElemType: QueueSettings{}.Type(ctx), + }, + "run_as": basetypes.ListType{ + ElemType: JobRunAs{}.Type(ctx), + }, + "schedule": basetypes.ListType{ + ElemType: CronSchedule{}.Type(ctx), + }, + "tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "task": basetypes.ListType{ + ElemType: Task{}.Type(ctx), + }, + "timeout_seconds": types.Int64Type, + "trigger": basetypes.ListType{ + ElemType: TriggerSettings{}.Type(ctx), + }, + "webhook_notifications": basetypes.ListType{ + ElemType: WebhookNotifications{}.Type(ctx), + }, + }, + } +} + +// GetContinuous returns the value of the Continuous field in JobSettings as +// a Continuous value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetContinuous(ctx context.Context) (Continuous, bool) { + var e Continuous + if o.Continuous.IsNull() || o.Continuous.IsUnknown() { + return e, false + } + var v []Continuous + d := o.Continuous.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetContinuous sets the value of the Continuous field in JobSettings. +func (o *JobSettings) SetContinuous(ctx context.Context, v Continuous) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["continuous"] + o.Continuous = types.ListValueMust(t, vs) +} + +// GetDeployment returns the value of the Deployment field in JobSettings as +// a JobDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetDeployment(ctx context.Context) (JobDeployment, bool) { + var e JobDeployment + if o.Deployment.IsNull() || o.Deployment.IsUnknown() { + return e, false + } + var v []JobDeployment + d := o.Deployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeployment sets the value of the Deployment field in JobSettings. +func (o *JobSettings) SetDeployment(ctx context.Context, v JobDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["deployment"] + o.Deployment = types.ListValueMust(t, vs) +} + +// GetEmailNotifications returns the value of the EmailNotifications field in JobSettings as +// a JobEmailNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetEmailNotifications(ctx context.Context) (JobEmailNotifications, bool) { + var e JobEmailNotifications + if o.EmailNotifications.IsNull() || o.EmailNotifications.IsUnknown() { + return e, false + } + var v []JobEmailNotifications + d := o.EmailNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmailNotifications sets the value of the EmailNotifications field in JobSettings. +func (o *JobSettings) SetEmailNotifications(ctx context.Context, v JobEmailNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_notifications"] + o.EmailNotifications = types.ListValueMust(t, vs) +} + +// GetEnvironments returns the value of the Environments field in JobSettings as +// a slice of JobEnvironment values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetEnvironments(ctx context.Context) ([]JobEnvironment, bool) { + if o.Environments.IsNull() || o.Environments.IsUnknown() { + return nil, false + } + var v []JobEnvironment + d := o.Environments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironments sets the value of the Environments field in JobSettings. +func (o *JobSettings) SetEnvironments(ctx context.Context, v []JobEnvironment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environment"] + t = t.(attr.TypeWithElementType).ElementType() + o.Environments = types.ListValueMust(t, vs) +} + +// GetGitSource returns the value of the GitSource field in JobSettings as +// a GitSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetGitSource(ctx context.Context) (GitSource, bool) { + var e GitSource + if o.GitSource.IsNull() || o.GitSource.IsUnknown() { + return e, false + } + var v []GitSource + d := o.GitSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSource sets the value of the GitSource field in JobSettings. +func (o *JobSettings) SetGitSource(ctx context.Context, v GitSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_source"] + o.GitSource = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in JobSettings as +// a JobsHealthRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetHealth(ctx context.Context) (JobsHealthRules, bool) { + var e JobsHealthRules + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []JobsHealthRules + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in JobSettings. +func (o *JobSettings) SetHealth(ctx context.Context, v JobsHealthRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetJobClusters returns the value of the JobClusters field in JobSettings as +// a slice of JobCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetJobClusters(ctx context.Context) ([]JobCluster, bool) { + if o.JobClusters.IsNull() || o.JobClusters.IsUnknown() { + return nil, false + } + var v []JobCluster + d := o.JobClusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobClusters sets the value of the JobClusters field in JobSettings. +func (o *JobSettings) SetJobClusters(ctx context.Context, v []JobCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_cluster"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobClusters = types.ListValueMust(t, vs) +} + +// GetNotificationSettings returns the value of the NotificationSettings field in JobSettings as +// a JobNotificationSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetNotificationSettings(ctx context.Context) (JobNotificationSettings, bool) { + var e JobNotificationSettings + if o.NotificationSettings.IsNull() || o.NotificationSettings.IsUnknown() { + return e, false + } + var v []JobNotificationSettings + d := o.NotificationSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotificationSettings sets the value of the NotificationSettings field in JobSettings. +func (o *JobSettings) SetNotificationSettings(ctx context.Context, v JobNotificationSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notification_settings"] + o.NotificationSettings = types.ListValueMust(t, vs) +} + +// GetParameters returns the value of the Parameters field in JobSettings as +// a slice of JobParameterDefinition values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetParameters(ctx context.Context) ([]JobParameterDefinition, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []JobParameterDefinition + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in JobSettings. +func (o *JobSettings) SetParameters(ctx context.Context, v []JobParameterDefinition) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameter"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + +// GetQueue returns the value of the Queue field in JobSettings as +// a QueueSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetQueue(ctx context.Context) (QueueSettings, bool) { + var e QueueSettings + if o.Queue.IsNull() || o.Queue.IsUnknown() { + return e, false + } + var v []QueueSettings + d := o.Queue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueue sets the value of the Queue field in JobSettings. +func (o *JobSettings) SetQueue(ctx context.Context, v QueueSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["queue"] + o.Queue = types.ListValueMust(t, vs) +} + +// GetRunAs returns the value of the RunAs field in JobSettings as +// a JobRunAs value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetRunAs(ctx context.Context) (JobRunAs, bool) { + var e JobRunAs + if o.RunAs.IsNull() || o.RunAs.IsUnknown() { + return e, false + } + var v []JobRunAs + d := o.RunAs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunAs sets the value of the RunAs field in JobSettings. +func (o *JobSettings) SetRunAs(ctx context.Context, v JobRunAs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_as"] + o.RunAs = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in JobSettings as +// a CronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetSchedule(ctx context.Context) (CronSchedule, bool) { + var e CronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []CronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in JobSettings. +func (o *JobSettings) SetSchedule(ctx context.Context, v CronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in JobSettings as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetTags(ctx context.Context) (map[string]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in JobSettings. +func (o *JobSettings) SetTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.MapValueMust(t, vs) +} + +// GetTasks returns the value of the Tasks field in JobSettings as +// a slice of Task values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetTasks(ctx context.Context) ([]Task, bool) { + if o.Tasks.IsNull() || o.Tasks.IsUnknown() { + return nil, false + } + var v []Task + d := o.Tasks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTasks sets the value of the Tasks field in JobSettings. +func (o *JobSettings) SetTasks(ctx context.Context, v []Task) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["task"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tasks = types.ListValueMust(t, vs) +} + +// GetTrigger returns the value of the Trigger field in JobSettings as +// a TriggerSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetTrigger(ctx context.Context) (TriggerSettings, bool) { + var e TriggerSettings + if o.Trigger.IsNull() || o.Trigger.IsUnknown() { + return e, false + } + var v []TriggerSettings + d := o.Trigger.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrigger sets the value of the Trigger field in JobSettings. +func (o *JobSettings) SetTrigger(ctx context.Context, v TriggerSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger"] + o.Trigger = types.ListValueMust(t, vs) +} + +// GetWebhookNotifications returns the value of the WebhookNotifications field in JobSettings as +// a WebhookNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *JobSettings) GetWebhookNotifications(ctx context.Context) (WebhookNotifications, bool) { + var e WebhookNotifications + if o.WebhookNotifications.IsNull() || o.WebhookNotifications.IsUnknown() { + return e, false + } + var v []WebhookNotifications + d := o.WebhookNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhookNotifications sets the value of the WebhookNotifications field in JobSettings. +func (o *JobSettings) SetWebhookNotifications(ctx context.Context, v WebhookNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook_notifications"] + o.WebhookNotifications = types.ListValueMust(t, vs) +} + // The source of the job specification in the remote repository when the job is // source controlled. type JobSource struct { @@ -1343,6 +5555,41 @@ func (newState *JobSource) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobSourc func (newState *JobSource) SyncEffectiveFieldsDuringRead(existingState JobSource) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobSource. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobSource) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobSource +// only implements ToObjectValue() and Type(). +func (o JobSource) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dirty_state": o.DirtyState, + "import_from_git_branch": o.ImportFromGitBranch, + "job_config_path": o.JobConfigPath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobSource) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dirty_state": types.StringType, + "import_from_git_branch": types.StringType, + "job_config_path": types.StringType, + }, + } +} + type JobsHealthRule struct { // Specifies the health metric that is being evaluated for a particular // health rule. @@ -1371,9 +5618,44 @@ func (newState *JobsHealthRule) SyncEffectiveFieldsDuringCreateOrUpdate(plan Job func (newState *JobsHealthRule) SyncEffectiveFieldsDuringRead(existingState JobsHealthRule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobsHealthRule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobsHealthRule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobsHealthRule +// only implements ToObjectValue() and Type(). +func (o JobsHealthRule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metric": o.Metric, + "op": o.Op, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobsHealthRule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metric": types.StringType, + "op": types.StringType, + "value": types.Int64Type, + }, + } +} + // An optional set of health rules that can be defined for this job. type JobsHealthRules struct { - Rules []JobsHealthRule `tfsdk:"rules" tf:"optional"` + Rules types.List `tfsdk:"rules" tf:"optional"` } func (newState *JobsHealthRules) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobsHealthRules) { @@ -1382,9 +5664,70 @@ func (newState *JobsHealthRules) SyncEffectiveFieldsDuringCreateOrUpdate(plan Jo func (newState *JobsHealthRules) SyncEffectiveFieldsDuringRead(existingState JobsHealthRules) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobsHealthRules. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobsHealthRules) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "rules": reflect.TypeOf(JobsHealthRule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobsHealthRules +// only implements ToObjectValue() and Type(). +func (o JobsHealthRules) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "rules": o.Rules, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobsHealthRules) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "rules": basetypes.ListType{ + ElemType: JobsHealthRule{}.Type(ctx), + }, + }, + } +} + +// GetRules returns the value of the Rules field in JobsHealthRules as +// a slice of JobsHealthRule values. +// If the field is unknown or null, the boolean return value is false. +func (o *JobsHealthRules) GetRules(ctx context.Context) ([]JobsHealthRule, bool) { + if o.Rules.IsNull() || o.Rules.IsUnknown() { + return nil, false + } + var v []JobsHealthRule + d := o.Rules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRules sets the value of the Rules field in JobsHealthRules. +func (o *JobsHealthRules) SetRules(ctx context.Context, v []JobsHealthRule) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rules"] + t = t.(attr.TypeWithElementType).ElementType() + o.Rules = types.ListValueMust(t, vs) +} + type ListJobComplianceForPolicyResponse struct { // A list of jobs and their policy compliance statuses. - Jobs []JobCompliance `tfsdk:"jobs" tf:"optional"` + Jobs types.List `tfsdk:"jobs" tf:"optional"` // This field represents the pagination token to retrieve the next page of // results. If this field is not in the response, it means no further // results for the request. @@ -1401,6 +5744,71 @@ func (newState *ListJobComplianceForPolicyResponse) SyncEffectiveFieldsDuringCre func (newState *ListJobComplianceForPolicyResponse) SyncEffectiveFieldsDuringRead(existingState ListJobComplianceForPolicyResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListJobComplianceForPolicyResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListJobComplianceForPolicyResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "jobs": reflect.TypeOf(JobCompliance{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListJobComplianceForPolicyResponse +// only implements ToObjectValue() and Type(). +func (o ListJobComplianceForPolicyResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "jobs": o.Jobs, + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListJobComplianceForPolicyResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "jobs": basetypes.ListType{ + ElemType: JobCompliance{}.Type(ctx), + }, + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + }, + } +} + +// GetJobs returns the value of the Jobs field in ListJobComplianceForPolicyResponse as +// a slice of JobCompliance values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListJobComplianceForPolicyResponse) GetJobs(ctx context.Context) ([]JobCompliance, bool) { + if o.Jobs.IsNull() || o.Jobs.IsUnknown() { + return nil, false + } + var v []JobCompliance + d := o.Jobs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobs sets the value of the Jobs field in ListJobComplianceForPolicyResponse. +func (o *ListJobComplianceForPolicyResponse) SetJobs(ctx context.Context, v []JobCompliance) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["jobs"] + t = t.(attr.TypeWithElementType).ElementType() + o.Jobs = types.ListValueMust(t, vs) +} + // List job policy compliance type ListJobComplianceRequest struct { // Use this field to specify the maximum number of results to be returned by @@ -1420,6 +5828,41 @@ func (newState *ListJobComplianceRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListJobComplianceRequest) SyncEffectiveFieldsDuringRead(existingState ListJobComplianceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListJobComplianceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListJobComplianceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListJobComplianceRequest +// only implements ToObjectValue() and Type(). +func (o ListJobComplianceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListJobComplianceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + "policy_id": types.StringType, + }, + } +} + // List jobs type ListJobsRequest struct { // Whether to include task and cluster details in the response. @@ -1444,6 +5887,45 @@ func (newState *ListJobsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Li func (newState *ListJobsRequest) SyncEffectiveFieldsDuringRead(existingState ListJobsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListJobsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListJobsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListJobsRequest +// only implements ToObjectValue() and Type(). +func (o ListJobsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "expand_tasks": o.ExpandTasks, + "limit": o.Limit, + "name": o.Name, + "offset": o.Offset, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListJobsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "expand_tasks": types.BoolType, + "limit": types.Int64Type, + "name": types.StringType, + "offset": types.Int64Type, + "page_token": types.StringType, + }, + } +} + // List of jobs was retrieved successfully. type ListJobsResponse struct { // If true, additional jobs matching the provided filter are available for @@ -1451,7 +5933,7 @@ type ListJobsResponse struct { HasMore types.Bool `tfsdk:"has_more" tf:"optional"` // The list of jobs. Only included in the response if there are jobs to // list. - Jobs []BaseJob `tfsdk:"jobs" tf:"optional"` + Jobs types.List `tfsdk:"jobs" tf:"optional"` // A token that can be used to list the next page of jobs (if applicable). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // A token that can be used to list the previous page of jobs (if @@ -1465,6 +5947,73 @@ func (newState *ListJobsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListJobsResponse) SyncEffectiveFieldsDuringRead(existingState ListJobsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListJobsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListJobsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "jobs": reflect.TypeOf(BaseJob{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListJobsResponse +// only implements ToObjectValue() and Type(). +func (o ListJobsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "has_more": o.HasMore, + "jobs": o.Jobs, + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListJobsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "has_more": types.BoolType, + "jobs": basetypes.ListType{ + ElemType: BaseJob{}.Type(ctx), + }, + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + }, + } +} + +// GetJobs returns the value of the Jobs field in ListJobsResponse as +// a slice of BaseJob values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListJobsResponse) GetJobs(ctx context.Context) ([]BaseJob, bool) { + if o.Jobs.IsNull() || o.Jobs.IsUnknown() { + return nil, false + } + var v []BaseJob + d := o.Jobs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobs sets the value of the Jobs field in ListJobsResponse. +func (o *ListJobsResponse) SetJobs(ctx context.Context, v []BaseJob) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["jobs"] + t = t.(attr.TypeWithElementType).ElementType() + o.Jobs = types.ListValueMust(t, vs) +} + // List job runs type ListRunsRequest struct { // If active_only is `true`, only active runs are included in the results; @@ -1511,6 +6060,55 @@ func (newState *ListRunsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Li func (newState *ListRunsRequest) SyncEffectiveFieldsDuringRead(existingState ListRunsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRunsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRunsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRunsRequest +// only implements ToObjectValue() and Type(). +func (o ListRunsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "active_only": o.ActiveOnly, + "completed_only": o.CompletedOnly, + "expand_tasks": o.ExpandTasks, + "job_id": o.JobId, + "limit": o.Limit, + "offset": o.Offset, + "page_token": o.PageToken, + "run_type": o.RunType, + "start_time_from": o.StartTimeFrom, + "start_time_to": o.StartTimeTo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRunsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "active_only": types.BoolType, + "completed_only": types.BoolType, + "expand_tasks": types.BoolType, + "job_id": types.Int64Type, + "limit": types.Int64Type, + "offset": types.Int64Type, + "page_token": types.StringType, + "run_type": types.StringType, + "start_time_from": types.Int64Type, + "start_time_to": types.Int64Type, + }, + } +} + // List of runs was retrieved successfully. type ListRunsResponse struct { // If true, additional runs matching the provided filter are available for @@ -1523,7 +6121,7 @@ type ListRunsResponse struct { PrevPageToken types.String `tfsdk:"prev_page_token" tf:"optional"` // A list of runs, from most recently started to least. Only included in the // response if there are runs to list. - Runs []BaseRun `tfsdk:"runs" tf:"optional"` + Runs types.List `tfsdk:"runs" tf:"optional"` } func (newState *ListRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListRunsResponse) { @@ -1532,6 +6130,73 @@ func (newState *ListRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListRunsResponse) SyncEffectiveFieldsDuringRead(existingState ListRunsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRunsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRunsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "runs": reflect.TypeOf(BaseRun{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRunsResponse +// only implements ToObjectValue() and Type(). +func (o ListRunsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "has_more": o.HasMore, + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + "runs": o.Runs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRunsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "has_more": types.BoolType, + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + "runs": basetypes.ListType{ + ElemType: BaseRun{}.Type(ctx), + }, + }, + } +} + +// GetRuns returns the value of the Runs field in ListRunsResponse as +// a slice of BaseRun values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListRunsResponse) GetRuns(ctx context.Context) ([]BaseRun, bool) { + if o.Runs.IsNull() || o.Runs.IsUnknown() { + return nil, false + } + var v []BaseRun + d := o.Runs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRuns sets the value of the Runs field in ListRunsResponse. +func (o *ListRunsResponse) SetRuns(ctx context.Context, v []BaseRun) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["runs"] + t = t.(attr.TypeWithElementType).ElementType() + o.Runs = types.ListValueMust(t, vs) +} + type NotebookOutput struct { // The value passed to // [dbutils.notebook.exit()](/notebooks/notebook-workflows.html#notebook-workflows-exit). @@ -1550,6 +6215,39 @@ func (newState *NotebookOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan Not func (newState *NotebookOutput) SyncEffectiveFieldsDuringRead(existingState NotebookOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NotebookOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NotebookOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NotebookOutput +// only implements ToObjectValue() and Type(). +func (o NotebookOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "result": o.Result, + "truncated": o.Truncated, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NotebookOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "result": types.StringType, + "truncated": types.BoolType, + }, + } +} + type NotebookTask struct { // Base parameters to be used for each run of this job. If the run is // initiated by a call to :method:jobs/run Now with parameters specified, @@ -1568,7 +6266,7 @@ type NotebookTask struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-widgets - BaseParameters map[string]types.String `tfsdk:"base_parameters" tf:"optional"` + BaseParameters types.Map `tfsdk:"base_parameters" tf:"optional"` // The path of the notebook to be run in the Databricks workspace or remote // repository. For notebooks stored in the Databricks workspace, the path // must be absolute and begin with a slash. For notebooks stored in a remote @@ -1597,6 +6295,73 @@ func (newState *NotebookTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Noteb func (newState *NotebookTask) SyncEffectiveFieldsDuringRead(existingState NotebookTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NotebookTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NotebookTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "base_parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NotebookTask +// only implements ToObjectValue() and Type(). +func (o NotebookTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "base_parameters": o.BaseParameters, + "notebook_path": o.NotebookPath, + "source": o.Source, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NotebookTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "base_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "notebook_path": types.StringType, + "source": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetBaseParameters returns the value of the BaseParameters field in NotebookTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *NotebookTask) GetBaseParameters(ctx context.Context) (map[string]types.String, bool) { + if o.BaseParameters.IsNull() || o.BaseParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.BaseParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetBaseParameters sets the value of the BaseParameters field in NotebookTask. +func (o *NotebookTask) SetBaseParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["base_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.BaseParameters = types.MapValueMust(t, vs) +} + type PeriodicTriggerConfiguration struct { // The interval at which the trigger should run. Interval types.Int64 `tfsdk:"interval" tf:""` @@ -1610,6 +6375,39 @@ func (newState *PeriodicTriggerConfiguration) SyncEffectiveFieldsDuringCreateOrU func (newState *PeriodicTriggerConfiguration) SyncEffectiveFieldsDuringRead(existingState PeriodicTriggerConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PeriodicTriggerConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PeriodicTriggerConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PeriodicTriggerConfiguration +// only implements ToObjectValue() and Type(). +func (o PeriodicTriggerConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "interval": o.Interval, + "unit": o.Unit, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PeriodicTriggerConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "interval": types.Int64Type, + "unit": types.StringType, + }, + } +} + type PipelineParams struct { // If true, triggers a full refresh on the delta live table. FullRefresh types.Bool `tfsdk:"full_refresh" tf:"optional"` @@ -1621,6 +6419,37 @@ func (newState *PipelineParams) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pip func (newState *PipelineParams) SyncEffectiveFieldsDuringRead(existingState PipelineParams) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineParams. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineParams) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineParams +// only implements ToObjectValue() and Type(). +func (o PipelineParams) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_refresh": o.FullRefresh, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineParams) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_refresh": types.BoolType, + }, + } +} + type PipelineTask struct { // If true, triggers a full refresh on the delta live table. FullRefresh types.Bool `tfsdk:"full_refresh" tf:"optional"` @@ -1634,6 +6463,39 @@ func (newState *PipelineTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pipel func (newState *PipelineTask) SyncEffectiveFieldsDuringRead(existingState PipelineTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineTask +// only implements ToObjectValue() and Type(). +func (o PipelineTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "full_refresh": o.FullRefresh, + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "full_refresh": types.BoolType, + "pipeline_id": types.StringType, + }, + } +} + type PythonWheelTask struct { // Named entry point to use, if it does not exist in the metadata of the // package it executes the function from the package directly using @@ -1642,12 +6504,12 @@ type PythonWheelTask struct { // Command-line parameters passed to Python wheel task in the form of // `["--name=task", "--data=dbfs:/path/to/data.json"]`. Leave it empty if // `parameters` is not null. - NamedParameters map[string]types.String `tfsdk:"named_parameters" tf:"optional"` + NamedParameters types.Map `tfsdk:"named_parameters" tf:"optional"` // Name of the package to execute PackageName types.String `tfsdk:"package_name" tf:""` // Command-line parameters passed to Python wheel task. Leave it empty if // `named_parameters` is not null. - Parameters []types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` } func (newState *PythonWheelTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan PythonWheelTask) { @@ -1656,6 +6518,102 @@ func (newState *PythonWheelTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Py func (newState *PythonWheelTask) SyncEffectiveFieldsDuringRead(existingState PythonWheelTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PythonWheelTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PythonWheelTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "named_parameters": reflect.TypeOf(types.String{}), + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PythonWheelTask +// only implements ToObjectValue() and Type(). +func (o PythonWheelTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "entry_point": o.EntryPoint, + "named_parameters": o.NamedParameters, + "package_name": o.PackageName, + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PythonWheelTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "entry_point": types.StringType, + "named_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "package_name": types.StringType, + "parameters": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetNamedParameters returns the value of the NamedParameters field in PythonWheelTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PythonWheelTask) GetNamedParameters(ctx context.Context) (map[string]types.String, bool) { + if o.NamedParameters.IsNull() || o.NamedParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NamedParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNamedParameters sets the value of the NamedParameters field in PythonWheelTask. +func (o *PythonWheelTask) SetNamedParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["named_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.NamedParameters = types.MapValueMust(t, vs) +} + +// GetParameters returns the value of the Parameters field in PythonWheelTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PythonWheelTask) GetParameters(ctx context.Context) ([]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in PythonWheelTask. +func (o *PythonWheelTask) SetParameters(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type QueueDetails struct { // The reason for queuing the run. * `ACTIVE_RUNS_LIMIT_REACHED`: The run // was queued due to reaching the workspace limit of active task runs. * @@ -1675,6 +6633,39 @@ func (newState *QueueDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan Queue func (newState *QueueDetails) SyncEffectiveFieldsDuringRead(existingState QueueDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueueDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueueDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueueDetails +// only implements ToObjectValue() and Type(). +func (o QueueDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "code": o.Code, + "message": o.Message, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueueDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "code": types.StringType, + "message": types.StringType, + }, + } +} + type QueueSettings struct { // If true, enable queueing for the job. This is a required field. Enabled types.Bool `tfsdk:"enabled" tf:""` @@ -1686,6 +6677,37 @@ func (newState *QueueSettings) SyncEffectiveFieldsDuringCreateOrUpdate(plan Queu func (newState *QueueSettings) SyncEffectiveFieldsDuringRead(existingState QueueSettings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueueSettings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueueSettings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueueSettings +// only implements ToObjectValue() and Type(). +func (o QueueSettings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueueSettings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + }, + } +} + type RepairHistoryItem struct { // The end time of the (repaired) run. EndTime types.Int64 `tfsdk:"end_time" tf:"optional"` @@ -1695,15 +6717,15 @@ type RepairHistoryItem struct { // The start time of the (repaired) run. StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` // Deprecated. Please use the `status` field instead. - State []RunState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The current status of the run - Status []RunStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` // The run IDs of the task runs that ran as part of this repair history // item. - TaskRunIds []types.Int64 `tfsdk:"task_run_ids" tf:"optional"` + TaskRunIds types.List `tfsdk:"task_run_ids" tf:"optional"` // The repair history item type. Indicates whether a run is the original run // or a repair run. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *RepairHistoryItem) SyncEffectiveFieldsDuringCreateOrUpdate(plan RepairHistoryItem) { @@ -1712,11 +6734,142 @@ func (newState *RepairHistoryItem) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RepairHistoryItem) SyncEffectiveFieldsDuringRead(existingState RepairHistoryItem) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepairHistoryItem. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepairHistoryItem) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "state": reflect.TypeOf(RunState{}), + "status": reflect.TypeOf(RunStatus{}), + "task_run_ids": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepairHistoryItem +// only implements ToObjectValue() and Type(). +func (o RepairHistoryItem) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end_time": o.EndTime, + "id": o.Id, + "start_time": o.StartTime, + "state": o.State, + "status": o.Status, + "task_run_ids": o.TaskRunIds, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepairHistoryItem) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end_time": types.Int64Type, + "id": types.Int64Type, + "start_time": types.Int64Type, + "state": basetypes.ListType{ + ElemType: RunState{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: RunStatus{}.Type(ctx), + }, + "task_run_ids": basetypes.ListType{ + ElemType: types.Int64Type, + }, + "type": types.StringType, + }, + } +} + +// GetState returns the value of the State field in RepairHistoryItem as +// a RunState value. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairHistoryItem) GetState(ctx context.Context) (RunState, bool) { + var e RunState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []RunState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in RepairHistoryItem. +func (o *RepairHistoryItem) SetState(ctx context.Context, v RunState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in RepairHistoryItem as +// a RunStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairHistoryItem) GetStatus(ctx context.Context) (RunStatus, bool) { + var e RunStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []RunStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in RepairHistoryItem. +func (o *RepairHistoryItem) SetStatus(ctx context.Context, v RunStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + +// GetTaskRunIds returns the value of the TaskRunIds field in RepairHistoryItem as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairHistoryItem) GetTaskRunIds(ctx context.Context) ([]types.Int64, bool) { + if o.TaskRunIds.IsNull() || o.TaskRunIds.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.TaskRunIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTaskRunIds sets the value of the TaskRunIds field in RepairHistoryItem. +func (o *RepairHistoryItem) SetTaskRunIds(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["task_run_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.TaskRunIds = types.ListValueMust(t, vs) +} + type RepairRun struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - DbtCommands []types.String `tfsdk:"dbt_commands" tf:"optional"` + DbtCommands types.List `tfsdk:"dbt_commands" tf:"optional"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the // main function of the main class specified in the Spark JAR task. If not @@ -1729,10 +6882,10 @@ type RepairRun struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - JarParams []types.String `tfsdk:"jar_params" tf:"optional"` + JarParams types.List `tfsdk:"jar_params" tf:"optional"` // Job-level parameters used in the run. for example `"param": // "overriding_val"` - JobParameters map[string]types.String `tfsdk:"job_parameters" tf:"optional"` + JobParameters types.Map `tfsdk:"job_parameters" tf:"optional"` // The ID of the latest repair. This parameter is not required when // repairing a run for the first time, but must be provided on subsequent // requests to repair the same run. @@ -1756,11 +6909,11 @@ type RepairRun struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - NotebookParams map[string]types.String `tfsdk:"notebook_params" tf:"optional"` + NotebookParams types.Map `tfsdk:"notebook_params" tf:"optional"` // Controls whether the pipeline should perform a full refresh - PipelineParams []PipelineParams `tfsdk:"pipeline_params" tf:"optional,object"` + PipelineParams types.List `tfsdk:"pipeline_params" tf:"optional,object"` - PythonNamedParams map[string]types.String `tfsdk:"python_named_params" tf:"optional"` + PythonNamedParams types.Map `tfsdk:"python_named_params" tf:"optional"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to // Python file as command-line parameters. If specified upon `run-now`, it @@ -1778,7 +6931,7 @@ type RepairRun struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - PythonParams []types.String `tfsdk:"python_params" tf:"optional"` + PythonParams types.List `tfsdk:"python_params" tf:"optional"` // If true, repair all failed tasks. Only one of `rerun_tasks` or // `rerun_all_failed_tasks` can be used. RerunAllFailedTasks types.Bool `tfsdk:"rerun_all_failed_tasks" tf:"optional"` @@ -1787,7 +6940,7 @@ type RepairRun struct { // `rerun_all_failed_tasks`. RerunDependentTasks types.Bool `tfsdk:"rerun_dependent_tasks" tf:"optional"` // The task keys of the task runs to repair. - RerunTasks []types.String `tfsdk:"rerun_tasks" tf:"optional"` + RerunTasks types.List `tfsdk:"rerun_tasks" tf:"optional"` // The job run ID of the run to repair. The run must not be in progress. RunId types.Int64 `tfsdk:"run_id" tf:""` // A list of parameters for jobs with spark submit task, for example @@ -1808,11 +6961,11 @@ type RepairRun struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - SparkSubmitParams []types.String `tfsdk:"spark_submit_params" tf:"optional"` + SparkSubmitParams types.List `tfsdk:"spark_submit_params" tf:"optional"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - SqlParams map[string]types.String `tfsdk:"sql_params" tf:"optional"` + SqlParams types.Map `tfsdk:"sql_params" tf:"optional"` } func (newState *RepairRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan RepairRun) { @@ -1821,6 +6974,354 @@ func (newState *RepairRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan RepairRu func (newState *RepairRun) SyncEffectiveFieldsDuringRead(existingState RepairRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepairRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepairRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dbt_commands": reflect.TypeOf(types.String{}), + "jar_params": reflect.TypeOf(types.String{}), + "job_parameters": reflect.TypeOf(types.String{}), + "notebook_params": reflect.TypeOf(types.String{}), + "pipeline_params": reflect.TypeOf(PipelineParams{}), + "python_named_params": reflect.TypeOf(types.String{}), + "python_params": reflect.TypeOf(types.String{}), + "rerun_tasks": reflect.TypeOf(types.String{}), + "spark_submit_params": reflect.TypeOf(types.String{}), + "sql_params": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepairRun +// only implements ToObjectValue() and Type(). +func (o RepairRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbt_commands": o.DbtCommands, + "jar_params": o.JarParams, + "job_parameters": o.JobParameters, + "latest_repair_id": o.LatestRepairId, + "notebook_params": o.NotebookParams, + "pipeline_params": o.PipelineParams, + "python_named_params": o.PythonNamedParams, + "python_params": o.PythonParams, + "rerun_all_failed_tasks": o.RerunAllFailedTasks, + "rerun_dependent_tasks": o.RerunDependentTasks, + "rerun_tasks": o.RerunTasks, + "run_id": o.RunId, + "spark_submit_params": o.SparkSubmitParams, + "sql_params": o.SqlParams, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepairRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbt_commands": basetypes.ListType{ + ElemType: types.StringType, + }, + "jar_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "job_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "latest_repair_id": types.Int64Type, + "notebook_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "pipeline_params": basetypes.ListType{ + ElemType: PipelineParams{}.Type(ctx), + }, + "python_named_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "python_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "rerun_all_failed_tasks": types.BoolType, + "rerun_dependent_tasks": types.BoolType, + "rerun_tasks": basetypes.ListType{ + ElemType: types.StringType, + }, + "run_id": types.Int64Type, + "spark_submit_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "sql_params": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDbtCommands returns the value of the DbtCommands field in RepairRun as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetDbtCommands(ctx context.Context) ([]types.String, bool) { + if o.DbtCommands.IsNull() || o.DbtCommands.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DbtCommands.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDbtCommands sets the value of the DbtCommands field in RepairRun. +func (o *RepairRun) SetDbtCommands(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_commands"] + t = t.(attr.TypeWithElementType).ElementType() + o.DbtCommands = types.ListValueMust(t, vs) +} + +// GetJarParams returns the value of the JarParams field in RepairRun as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetJarParams(ctx context.Context) ([]types.String, bool) { + if o.JarParams.IsNull() || o.JarParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.JarParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJarParams sets the value of the JarParams field in RepairRun. +func (o *RepairRun) SetJarParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["jar_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.JarParams = types.ListValueMust(t, vs) +} + +// GetJobParameters returns the value of the JobParameters field in RepairRun as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetJobParameters(ctx context.Context) (map[string]types.String, bool) { + if o.JobParameters.IsNull() || o.JobParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.JobParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobParameters sets the value of the JobParameters field in RepairRun. +func (o *RepairRun) SetJobParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobParameters = types.MapValueMust(t, vs) +} + +// GetNotebookParams returns the value of the NotebookParams field in RepairRun as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetNotebookParams(ctx context.Context) (map[string]types.String, bool) { + if o.NotebookParams.IsNull() || o.NotebookParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NotebookParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotebookParams sets the value of the NotebookParams field in RepairRun. +func (o *RepairRun) SetNotebookParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.NotebookParams = types.MapValueMust(t, vs) +} + +// GetPipelineParams returns the value of the PipelineParams field in RepairRun as +// a PipelineParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetPipelineParams(ctx context.Context) (PipelineParams, bool) { + var e PipelineParams + if o.PipelineParams.IsNull() || o.PipelineParams.IsUnknown() { + return e, false + } + var v []PipelineParams + d := o.PipelineParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineParams sets the value of the PipelineParams field in RepairRun. +func (o *RepairRun) SetPipelineParams(ctx context.Context, v PipelineParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_params"] + o.PipelineParams = types.ListValueMust(t, vs) +} + +// GetPythonNamedParams returns the value of the PythonNamedParams field in RepairRun as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetPythonNamedParams(ctx context.Context) (map[string]types.String, bool) { + if o.PythonNamedParams.IsNull() || o.PythonNamedParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.PythonNamedParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonNamedParams sets the value of the PythonNamedParams field in RepairRun. +func (o *RepairRun) SetPythonNamedParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_named_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonNamedParams = types.MapValueMust(t, vs) +} + +// GetPythonParams returns the value of the PythonParams field in RepairRun as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetPythonParams(ctx context.Context) ([]types.String, bool) { + if o.PythonParams.IsNull() || o.PythonParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PythonParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonParams sets the value of the PythonParams field in RepairRun. +func (o *RepairRun) SetPythonParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonParams = types.ListValueMust(t, vs) +} + +// GetRerunTasks returns the value of the RerunTasks field in RepairRun as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetRerunTasks(ctx context.Context) ([]types.String, bool) { + if o.RerunTasks.IsNull() || o.RerunTasks.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RerunTasks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRerunTasks sets the value of the RerunTasks field in RepairRun. +func (o *RepairRun) SetRerunTasks(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rerun_tasks"] + t = t.(attr.TypeWithElementType).ElementType() + o.RerunTasks = types.ListValueMust(t, vs) +} + +// GetSparkSubmitParams returns the value of the SparkSubmitParams field in RepairRun as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetSparkSubmitParams(ctx context.Context) ([]types.String, bool) { + if o.SparkSubmitParams.IsNull() || o.SparkSubmitParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SparkSubmitParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkSubmitParams sets the value of the SparkSubmitParams field in RepairRun. +func (o *RepairRun) SetSparkSubmitParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkSubmitParams = types.ListValueMust(t, vs) +} + +// GetSqlParams returns the value of the SqlParams field in RepairRun as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepairRun) GetSqlParams(ctx context.Context) (map[string]types.String, bool) { + if o.SqlParams.IsNull() || o.SqlParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SqlParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSqlParams sets the value of the SqlParams field in RepairRun. +func (o *RepairRun) SetSqlParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SqlParams = types.MapValueMust(t, vs) +} + // Run repair was initiated. type RepairRunResponse struct { // The ID of the repair. Must be provided in subsequent repairs using the @@ -1834,6 +7335,37 @@ func (newState *RepairRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RepairRunResponse) SyncEffectiveFieldsDuringRead(existingState RepairRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepairRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepairRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepairRunResponse +// only implements ToObjectValue() and Type(). +func (o RepairRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "repair_id": o.RepairId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepairRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "repair_id": types.Int64Type, + }, + } +} + type ResetJob struct { // The canonical identifier of the job to reset. This field is required. JobId types.Int64 `tfsdk:"job_id" tf:""` @@ -1842,7 +7374,7 @@ type ResetJob struct { // // Changes to the field `JobBaseSettings.timeout_seconds` are applied to // active runs. Changes to other fields are applied to future runs only. - NewSettings []JobSettings `tfsdk:"new_settings" tf:"object"` + NewSettings types.List `tfsdk:"new_settings" tf:"object"` } func (newState *ResetJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResetJob) { @@ -1851,6 +7383,69 @@ func (newState *ResetJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResetJob) func (newState *ResetJob) SyncEffectiveFieldsDuringRead(existingState ResetJob) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResetJob. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResetJob) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "new_settings": reflect.TypeOf(JobSettings{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResetJob +// only implements ToObjectValue() and Type(). +func (o ResetJob) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + "new_settings": o.NewSettings, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResetJob) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.Int64Type, + "new_settings": basetypes.ListType{ + ElemType: JobSettings{}.Type(ctx), + }, + }, + } +} + +// GetNewSettings returns the value of the NewSettings field in ResetJob as +// a JobSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResetJob) GetNewSettings(ctx context.Context) (JobSettings, bool) { + var e JobSettings + if o.NewSettings.IsNull() || o.NewSettings.IsUnknown() { + return e, false + } + var v []JobSettings + d := o.NewSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewSettings sets the value of the NewSettings field in ResetJob. +func (o *ResetJob) SetNewSettings(ctx context.Context, v JobSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_settings"] + o.NewSettings = types.ListValueMust(t, vs) +} + type ResetResponse struct { } @@ -1860,6 +7455,33 @@ func (newState *ResetResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Rese func (newState *ResetResponse) SyncEffectiveFieldsDuringRead(existingState ResetResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResetResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResetResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResetResponse +// only implements ToObjectValue() and Type(). +func (o ResetResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ResetResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ResolvedConditionTaskValues struct { Left types.String `tfsdk:"left" tf:"optional"` @@ -1872,8 +7494,41 @@ func (newState *ResolvedConditionTaskValues) SyncEffectiveFieldsDuringCreateOrUp func (newState *ResolvedConditionTaskValues) SyncEffectiveFieldsDuringRead(existingState ResolvedConditionTaskValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedConditionTaskValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedConditionTaskValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedConditionTaskValues +// only implements ToObjectValue() and Type(). +func (o ResolvedConditionTaskValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "left": o.Left, + "right": o.Right, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedConditionTaskValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "left": types.StringType, + "right": types.StringType, + }, + } +} + type ResolvedDbtTaskValues struct { - Commands []types.String `tfsdk:"commands" tf:"optional"` + Commands types.List `tfsdk:"commands" tf:"optional"` } func (newState *ResolvedDbtTaskValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedDbtTaskValues) { @@ -1882,8 +7537,69 @@ func (newState *ResolvedDbtTaskValues) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ResolvedDbtTaskValues) SyncEffectiveFieldsDuringRead(existingState ResolvedDbtTaskValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedDbtTaskValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedDbtTaskValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "commands": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedDbtTaskValues +// only implements ToObjectValue() and Type(). +func (o ResolvedDbtTaskValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "commands": o.Commands, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedDbtTaskValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "commands": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetCommands returns the value of the Commands field in ResolvedDbtTaskValues as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedDbtTaskValues) GetCommands(ctx context.Context) ([]types.String, bool) { + if o.Commands.IsNull() || o.Commands.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Commands.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCommands sets the value of the Commands field in ResolvedDbtTaskValues. +func (o *ResolvedDbtTaskValues) SetCommands(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["commands"] + t = t.(attr.TypeWithElementType).ElementType() + o.Commands = types.ListValueMust(t, vs) +} + type ResolvedNotebookTaskValues struct { - BaseParameters map[string]types.String `tfsdk:"base_parameters" tf:"optional"` + BaseParameters types.Map `tfsdk:"base_parameters" tf:"optional"` } func (newState *ResolvedNotebookTaskValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedNotebookTaskValues) { @@ -1892,8 +7608,69 @@ func (newState *ResolvedNotebookTaskValues) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ResolvedNotebookTaskValues) SyncEffectiveFieldsDuringRead(existingState ResolvedNotebookTaskValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedNotebookTaskValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedNotebookTaskValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "base_parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedNotebookTaskValues +// only implements ToObjectValue() and Type(). +func (o ResolvedNotebookTaskValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "base_parameters": o.BaseParameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedNotebookTaskValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "base_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetBaseParameters returns the value of the BaseParameters field in ResolvedNotebookTaskValues as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedNotebookTaskValues) GetBaseParameters(ctx context.Context) (map[string]types.String, bool) { + if o.BaseParameters.IsNull() || o.BaseParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.BaseParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetBaseParameters sets the value of the BaseParameters field in ResolvedNotebookTaskValues. +func (o *ResolvedNotebookTaskValues) SetBaseParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["base_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.BaseParameters = types.MapValueMust(t, vs) +} + type ResolvedParamPairValues struct { - Parameters map[string]types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.Map `tfsdk:"parameters" tf:"optional"` } func (newState *ResolvedParamPairValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedParamPairValues) { @@ -1902,10 +7679,71 @@ func (newState *ResolvedParamPairValues) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ResolvedParamPairValues) SyncEffectiveFieldsDuringRead(existingState ResolvedParamPairValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedParamPairValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedParamPairValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedParamPairValues +// only implements ToObjectValue() and Type(). +func (o ResolvedParamPairValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedParamPairValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetParameters returns the value of the Parameters field in ResolvedParamPairValues as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedParamPairValues) GetParameters(ctx context.Context) (map[string]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in ResolvedParamPairValues. +func (o *ResolvedParamPairValues) SetParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.MapValueMust(t, vs) +} + type ResolvedPythonWheelTaskValues struct { - NamedParameters map[string]types.String `tfsdk:"named_parameters" tf:"optional"` + NamedParameters types.Map `tfsdk:"named_parameters" tf:"optional"` - Parameters []types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` } func (newState *ResolvedPythonWheelTaskValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedPythonWheelTaskValues) { @@ -1914,10 +7752,102 @@ func (newState *ResolvedPythonWheelTaskValues) SyncEffectiveFieldsDuringCreateOr func (newState *ResolvedPythonWheelTaskValues) SyncEffectiveFieldsDuringRead(existingState ResolvedPythonWheelTaskValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedPythonWheelTaskValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedPythonWheelTaskValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "named_parameters": reflect.TypeOf(types.String{}), + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedPythonWheelTaskValues +// only implements ToObjectValue() and Type(). +func (o ResolvedPythonWheelTaskValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "named_parameters": o.NamedParameters, + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedPythonWheelTaskValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "named_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "parameters": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetNamedParameters returns the value of the NamedParameters field in ResolvedPythonWheelTaskValues as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedPythonWheelTaskValues) GetNamedParameters(ctx context.Context) (map[string]types.String, bool) { + if o.NamedParameters.IsNull() || o.NamedParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NamedParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNamedParameters sets the value of the NamedParameters field in ResolvedPythonWheelTaskValues. +func (o *ResolvedPythonWheelTaskValues) SetNamedParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["named_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.NamedParameters = types.MapValueMust(t, vs) +} + +// GetParameters returns the value of the Parameters field in ResolvedPythonWheelTaskValues as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedPythonWheelTaskValues) GetParameters(ctx context.Context) ([]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in ResolvedPythonWheelTaskValues. +func (o *ResolvedPythonWheelTaskValues) SetParameters(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type ResolvedRunJobTaskValues struct { - JobParameters map[string]types.String `tfsdk:"job_parameters" tf:"optional"` + JobParameters types.Map `tfsdk:"job_parameters" tf:"optional"` - Parameters map[string]types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.Map `tfsdk:"parameters" tf:"optional"` } func (newState *ResolvedRunJobTaskValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedRunJobTaskValues) { @@ -1926,8 +7856,100 @@ func (newState *ResolvedRunJobTaskValues) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ResolvedRunJobTaskValues) SyncEffectiveFieldsDuringRead(existingState ResolvedRunJobTaskValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedRunJobTaskValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedRunJobTaskValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "job_parameters": reflect.TypeOf(types.String{}), + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedRunJobTaskValues +// only implements ToObjectValue() and Type(). +func (o ResolvedRunJobTaskValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_parameters": o.JobParameters, + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedRunJobTaskValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetJobParameters returns the value of the JobParameters field in ResolvedRunJobTaskValues as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedRunJobTaskValues) GetJobParameters(ctx context.Context) (map[string]types.String, bool) { + if o.JobParameters.IsNull() || o.JobParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.JobParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobParameters sets the value of the JobParameters field in ResolvedRunJobTaskValues. +func (o *ResolvedRunJobTaskValues) SetJobParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobParameters = types.MapValueMust(t, vs) +} + +// GetParameters returns the value of the Parameters field in ResolvedRunJobTaskValues as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedRunJobTaskValues) GetParameters(ctx context.Context) (map[string]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in ResolvedRunJobTaskValues. +func (o *ResolvedRunJobTaskValues) SetParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.MapValueMust(t, vs) +} + type ResolvedStringParamsValues struct { - Parameters []types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` } func (newState *ResolvedStringParamsValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedStringParamsValues) { @@ -1936,26 +7958,87 @@ func (newState *ResolvedStringParamsValues) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ResolvedStringParamsValues) SyncEffectiveFieldsDuringRead(existingState ResolvedStringParamsValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedStringParamsValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedStringParamsValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedStringParamsValues +// only implements ToObjectValue() and Type(). +func (o ResolvedStringParamsValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedStringParamsValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "parameters": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetParameters returns the value of the Parameters field in ResolvedStringParamsValues as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedStringParamsValues) GetParameters(ctx context.Context) ([]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in ResolvedStringParamsValues. +func (o *ResolvedStringParamsValues) SetParameters(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type ResolvedValues struct { - ConditionTask []ResolvedConditionTaskValues `tfsdk:"condition_task" tf:"optional,object"` + ConditionTask types.List `tfsdk:"condition_task" tf:"optional,object"` - DbtTask []ResolvedDbtTaskValues `tfsdk:"dbt_task" tf:"optional,object"` + DbtTask types.List `tfsdk:"dbt_task" tf:"optional,object"` - NotebookTask []ResolvedNotebookTaskValues `tfsdk:"notebook_task" tf:"optional,object"` + NotebookTask types.List `tfsdk:"notebook_task" tf:"optional,object"` - PythonWheelTask []ResolvedPythonWheelTaskValues `tfsdk:"python_wheel_task" tf:"optional,object"` + PythonWheelTask types.List `tfsdk:"python_wheel_task" tf:"optional,object"` - RunJobTask []ResolvedRunJobTaskValues `tfsdk:"run_job_task" tf:"optional,object"` + RunJobTask types.List `tfsdk:"run_job_task" tf:"optional,object"` - SimulationTask []ResolvedParamPairValues `tfsdk:"simulation_task" tf:"optional,object"` + SimulationTask types.List `tfsdk:"simulation_task" tf:"optional,object"` - SparkJarTask []ResolvedStringParamsValues `tfsdk:"spark_jar_task" tf:"optional,object"` + SparkJarTask types.List `tfsdk:"spark_jar_task" tf:"optional,object"` - SparkPythonTask []ResolvedStringParamsValues `tfsdk:"spark_python_task" tf:"optional,object"` + SparkPythonTask types.List `tfsdk:"spark_python_task" tf:"optional,object"` - SparkSubmitTask []ResolvedStringParamsValues `tfsdk:"spark_submit_task" tf:"optional,object"` + SparkSubmitTask types.List `tfsdk:"spark_submit_task" tf:"optional,object"` - SqlTask []ResolvedParamPairValues `tfsdk:"sql_task" tf:"optional,object"` + SqlTask types.List `tfsdk:"sql_task" tf:"optional,object"` } func (newState *ResolvedValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResolvedValues) { @@ -1964,6 +8047,346 @@ func (newState *ResolvedValues) SyncEffectiveFieldsDuringCreateOrUpdate(plan Res func (newState *ResolvedValues) SyncEffectiveFieldsDuringRead(existingState ResolvedValues) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResolvedValues. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResolvedValues) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition_task": reflect.TypeOf(ResolvedConditionTaskValues{}), + "dbt_task": reflect.TypeOf(ResolvedDbtTaskValues{}), + "notebook_task": reflect.TypeOf(ResolvedNotebookTaskValues{}), + "python_wheel_task": reflect.TypeOf(ResolvedPythonWheelTaskValues{}), + "run_job_task": reflect.TypeOf(ResolvedRunJobTaskValues{}), + "simulation_task": reflect.TypeOf(ResolvedParamPairValues{}), + "spark_jar_task": reflect.TypeOf(ResolvedStringParamsValues{}), + "spark_python_task": reflect.TypeOf(ResolvedStringParamsValues{}), + "spark_submit_task": reflect.TypeOf(ResolvedStringParamsValues{}), + "sql_task": reflect.TypeOf(ResolvedParamPairValues{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResolvedValues +// only implements ToObjectValue() and Type(). +func (o ResolvedValues) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition_task": o.ConditionTask, + "dbt_task": o.DbtTask, + "notebook_task": o.NotebookTask, + "python_wheel_task": o.PythonWheelTask, + "run_job_task": o.RunJobTask, + "simulation_task": o.SimulationTask, + "spark_jar_task": o.SparkJarTask, + "spark_python_task": o.SparkPythonTask, + "spark_submit_task": o.SparkSubmitTask, + "sql_task": o.SqlTask, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResolvedValues) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition_task": basetypes.ListType{ + ElemType: ResolvedConditionTaskValues{}.Type(ctx), + }, + "dbt_task": basetypes.ListType{ + ElemType: ResolvedDbtTaskValues{}.Type(ctx), + }, + "notebook_task": basetypes.ListType{ + ElemType: ResolvedNotebookTaskValues{}.Type(ctx), + }, + "python_wheel_task": basetypes.ListType{ + ElemType: ResolvedPythonWheelTaskValues{}.Type(ctx), + }, + "run_job_task": basetypes.ListType{ + ElemType: ResolvedRunJobTaskValues{}.Type(ctx), + }, + "simulation_task": basetypes.ListType{ + ElemType: ResolvedParamPairValues{}.Type(ctx), + }, + "spark_jar_task": basetypes.ListType{ + ElemType: ResolvedStringParamsValues{}.Type(ctx), + }, + "spark_python_task": basetypes.ListType{ + ElemType: ResolvedStringParamsValues{}.Type(ctx), + }, + "spark_submit_task": basetypes.ListType{ + ElemType: ResolvedStringParamsValues{}.Type(ctx), + }, + "sql_task": basetypes.ListType{ + ElemType: ResolvedParamPairValues{}.Type(ctx), + }, + }, + } +} + +// GetConditionTask returns the value of the ConditionTask field in ResolvedValues as +// a ResolvedConditionTaskValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetConditionTask(ctx context.Context) (ResolvedConditionTaskValues, bool) { + var e ResolvedConditionTaskValues + if o.ConditionTask.IsNull() || o.ConditionTask.IsUnknown() { + return e, false + } + var v []ResolvedConditionTaskValues + d := o.ConditionTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConditionTask sets the value of the ConditionTask field in ResolvedValues. +func (o *ResolvedValues) SetConditionTask(ctx context.Context, v ResolvedConditionTaskValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition_task"] + o.ConditionTask = types.ListValueMust(t, vs) +} + +// GetDbtTask returns the value of the DbtTask field in ResolvedValues as +// a ResolvedDbtTaskValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetDbtTask(ctx context.Context) (ResolvedDbtTaskValues, bool) { + var e ResolvedDbtTaskValues + if o.DbtTask.IsNull() || o.DbtTask.IsUnknown() { + return e, false + } + var v []ResolvedDbtTaskValues + d := o.DbtTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbtTask sets the value of the DbtTask field in ResolvedValues. +func (o *ResolvedValues) SetDbtTask(ctx context.Context, v ResolvedDbtTaskValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_task"] + o.DbtTask = types.ListValueMust(t, vs) +} + +// GetNotebookTask returns the value of the NotebookTask field in ResolvedValues as +// a ResolvedNotebookTaskValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetNotebookTask(ctx context.Context) (ResolvedNotebookTaskValues, bool) { + var e ResolvedNotebookTaskValues + if o.NotebookTask.IsNull() || o.NotebookTask.IsUnknown() { + return e, false + } + var v []ResolvedNotebookTaskValues + d := o.NotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebookTask sets the value of the NotebookTask field in ResolvedValues. +func (o *ResolvedValues) SetNotebookTask(ctx context.Context, v ResolvedNotebookTaskValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_task"] + o.NotebookTask = types.ListValueMust(t, vs) +} + +// GetPythonWheelTask returns the value of the PythonWheelTask field in ResolvedValues as +// a ResolvedPythonWheelTaskValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetPythonWheelTask(ctx context.Context) (ResolvedPythonWheelTaskValues, bool) { + var e ResolvedPythonWheelTaskValues + if o.PythonWheelTask.IsNull() || o.PythonWheelTask.IsUnknown() { + return e, false + } + var v []ResolvedPythonWheelTaskValues + d := o.PythonWheelTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPythonWheelTask sets the value of the PythonWheelTask field in ResolvedValues. +func (o *ResolvedValues) SetPythonWheelTask(ctx context.Context, v ResolvedPythonWheelTaskValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_wheel_task"] + o.PythonWheelTask = types.ListValueMust(t, vs) +} + +// GetRunJobTask returns the value of the RunJobTask field in ResolvedValues as +// a ResolvedRunJobTaskValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetRunJobTask(ctx context.Context) (ResolvedRunJobTaskValues, bool) { + var e ResolvedRunJobTaskValues + if o.RunJobTask.IsNull() || o.RunJobTask.IsUnknown() { + return e, false + } + var v []ResolvedRunJobTaskValues + d := o.RunJobTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunJobTask sets the value of the RunJobTask field in ResolvedValues. +func (o *ResolvedValues) SetRunJobTask(ctx context.Context, v ResolvedRunJobTaskValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_job_task"] + o.RunJobTask = types.ListValueMust(t, vs) +} + +// GetSimulationTask returns the value of the SimulationTask field in ResolvedValues as +// a ResolvedParamPairValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetSimulationTask(ctx context.Context) (ResolvedParamPairValues, bool) { + var e ResolvedParamPairValues + if o.SimulationTask.IsNull() || o.SimulationTask.IsUnknown() { + return e, false + } + var v []ResolvedParamPairValues + d := o.SimulationTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSimulationTask sets the value of the SimulationTask field in ResolvedValues. +func (o *ResolvedValues) SetSimulationTask(ctx context.Context, v ResolvedParamPairValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["simulation_task"] + o.SimulationTask = types.ListValueMust(t, vs) +} + +// GetSparkJarTask returns the value of the SparkJarTask field in ResolvedValues as +// a ResolvedStringParamsValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetSparkJarTask(ctx context.Context) (ResolvedStringParamsValues, bool) { + var e ResolvedStringParamsValues + if o.SparkJarTask.IsNull() || o.SparkJarTask.IsUnknown() { + return e, false + } + var v []ResolvedStringParamsValues + d := o.SparkJarTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkJarTask sets the value of the SparkJarTask field in ResolvedValues. +func (o *ResolvedValues) SetSparkJarTask(ctx context.Context, v ResolvedStringParamsValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_jar_task"] + o.SparkJarTask = types.ListValueMust(t, vs) +} + +// GetSparkPythonTask returns the value of the SparkPythonTask field in ResolvedValues as +// a ResolvedStringParamsValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetSparkPythonTask(ctx context.Context) (ResolvedStringParamsValues, bool) { + var e ResolvedStringParamsValues + if o.SparkPythonTask.IsNull() || o.SparkPythonTask.IsUnknown() { + return e, false + } + var v []ResolvedStringParamsValues + d := o.SparkPythonTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkPythonTask sets the value of the SparkPythonTask field in ResolvedValues. +func (o *ResolvedValues) SetSparkPythonTask(ctx context.Context, v ResolvedStringParamsValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_python_task"] + o.SparkPythonTask = types.ListValueMust(t, vs) +} + +// GetSparkSubmitTask returns the value of the SparkSubmitTask field in ResolvedValues as +// a ResolvedStringParamsValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetSparkSubmitTask(ctx context.Context) (ResolvedStringParamsValues, bool) { + var e ResolvedStringParamsValues + if o.SparkSubmitTask.IsNull() || o.SparkSubmitTask.IsUnknown() { + return e, false + } + var v []ResolvedStringParamsValues + d := o.SparkSubmitTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkSubmitTask sets the value of the SparkSubmitTask field in ResolvedValues. +func (o *ResolvedValues) SetSparkSubmitTask(ctx context.Context, v ResolvedStringParamsValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_task"] + o.SparkSubmitTask = types.ListValueMust(t, vs) +} + +// GetSqlTask returns the value of the SqlTask field in ResolvedValues as +// a ResolvedParamPairValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResolvedValues) GetSqlTask(ctx context.Context) (ResolvedParamPairValues, bool) { + var e ResolvedParamPairValues + if o.SqlTask.IsNull() || o.SqlTask.IsUnknown() { + return e, false + } + var v []ResolvedParamPairValues + d := o.SqlTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlTask sets the value of the SqlTask field in ResolvedValues. +func (o *ResolvedValues) SetSqlTask(ctx context.Context, v ResolvedParamPairValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_task"] + o.SqlTask = types.ListValueMust(t, vs) +} + // Run was retrieved successfully type Run struct { // The sequence number of this run attempt for a triggered job run. The @@ -1983,10 +8406,10 @@ type Run struct { // The cluster used for this run. If the run is specified to use a new // cluster, this field is set once the Jobs service has requested a cluster // for the run. - ClusterInstance []ClusterInstance `tfsdk:"cluster_instance" tf:"optional,object"` + ClusterInstance types.List `tfsdk:"cluster_instance" tf:"optional,object"` // A snapshot of the job’s cluster specification when this run was // created. - ClusterSpec []ClusterSpec `tfsdk:"cluster_spec" tf:"optional,object"` + ClusterSpec types.List `tfsdk:"cluster_spec" tf:"optional,object"` // The creator user name. This field won’t be included in the response if // the user has already been deleted. CreatorUserName types.String `tfsdk:"creator_user_name" tf:"optional"` @@ -2013,18 +8436,18 @@ type Run struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - GitSource []GitSource `tfsdk:"git_source" tf:"optional,object"` + GitSource types.List `tfsdk:"git_source" tf:"optional,object"` // Only populated by for-each iterations. The parent for-each task is // located in tasks array. - Iterations []RunTask `tfsdk:"iterations" tf:"optional"` + Iterations types.List `tfsdk:"iterations" tf:"optional"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. - JobClusters []JobCluster `tfsdk:"job_clusters" tf:"optional"` + JobClusters types.List `tfsdk:"job_clusters" tf:"optional"` // The canonical identifier of the job that contains this run. JobId types.Int64 `tfsdk:"job_id" tf:"optional"` // Job-level parameters used in the run - JobParameters []JobParameter `tfsdk:"job_parameters" tf:"optional"` + JobParameters types.List `tfsdk:"job_parameters" tf:"optional"` // ID of the job run that this run belongs to. For legacy and single-task // job runs the field is populated with the job run ID. For task runs, the // field is populated with the ID of the job run that the task run belongs @@ -2039,11 +8462,11 @@ type Run struct { // run_id of the original attempt; otherwise, it is the same as the run_id. OriginalAttemptRunId types.Int64 `tfsdk:"original_attempt_run_id" tf:"optional"` // The parameters used for this run. - OverridingParameters []RunParameters `tfsdk:"overriding_parameters" tf:"optional,object"` + OverridingParameters types.List `tfsdk:"overriding_parameters" tf:"optional,object"` // The time in milliseconds that the run has spent in the queue. QueueDuration types.Int64 `tfsdk:"queue_duration" tf:"optional"` // The repair history of the run. - RepairHistory []RepairHistoryItem `tfsdk:"repair_history" tf:"optional"` + RepairHistory types.List `tfsdk:"repair_history" tf:"optional"` // The time in milliseconds it took the job run and all of its repairs to // finish. RunDuration types.Int64 `tfsdk:"run_duration" tf:"optional"` @@ -2064,7 +8487,7 @@ type Run struct { RunType types.String `tfsdk:"run_type" tf:"optional"` // The cron schedule that triggered this run if it was triggered by the // periodic scheduler. - Schedule []CronSchedule `tfsdk:"schedule" tf:"optional,object"` + Schedule types.List `tfsdk:"schedule" tf:"optional,object"` // The time in milliseconds it took to set up the cluster. For runs that run // on new clusters this is the cluster creation time, for runs that run on // existing clusters this time should be very short. The duration of a task @@ -2079,12 +8502,12 @@ type Run struct { // new cluster, this is the time the cluster creation call is issued. StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` // Deprecated. Please use the `status` field instead. - State []RunState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The current status of the run - Status []RunStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` // The list of tasks performed by the run. Each task has its own `run_id` // which you can use to call `JobsGetOutput` to retrieve the run resutls. - Tasks []RunTask `tfsdk:"tasks" tf:"optional"` + Tasks types.List `tfsdk:"tasks" tf:"optional"` // The type of trigger that fired this run. // // * `PERIODIC`: Schedules that periodically trigger runs, such as a cron @@ -2097,7 +8520,7 @@ type Run struct { // arrival. * `TABLE`: Indicates a run that is triggered by a table update. Trigger types.String `tfsdk:"trigger" tf:"optional"` // Additional details about what triggered the run - TriggerInfo []TriggerInfo `tfsdk:"trigger_info" tf:"optional,object"` + TriggerInfo types.List `tfsdk:"trigger_info" tf:"optional,object"` } func (newState *Run) SyncEffectiveFieldsDuringCreateOrUpdate(plan Run) { @@ -2106,6 +8529,479 @@ func (newState *Run) SyncEffectiveFieldsDuringCreateOrUpdate(plan Run) { func (newState *Run) SyncEffectiveFieldsDuringRead(existingState Run) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Run. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Run) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster_instance": reflect.TypeOf(ClusterInstance{}), + "cluster_spec": reflect.TypeOf(ClusterSpec{}), + "git_source": reflect.TypeOf(GitSource{}), + "iterations": reflect.TypeOf(RunTask{}), + "job_clusters": reflect.TypeOf(JobCluster{}), + "job_parameters": reflect.TypeOf(JobParameter{}), + "overriding_parameters": reflect.TypeOf(RunParameters{}), + "repair_history": reflect.TypeOf(RepairHistoryItem{}), + "schedule": reflect.TypeOf(CronSchedule{}), + "state": reflect.TypeOf(RunState{}), + "status": reflect.TypeOf(RunStatus{}), + "tasks": reflect.TypeOf(RunTask{}), + "trigger_info": reflect.TypeOf(TriggerInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Run +// only implements ToObjectValue() and Type(). +func (o Run) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attempt_number": o.AttemptNumber, + "cleanup_duration": o.CleanupDuration, + "cluster_instance": o.ClusterInstance, + "cluster_spec": o.ClusterSpec, + "creator_user_name": o.CreatorUserName, + "description": o.Description, + "end_time": o.EndTime, + "execution_duration": o.ExecutionDuration, + "git_source": o.GitSource, + "iterations": o.Iterations, + "job_clusters": o.JobClusters, + "job_id": o.JobId, + "job_parameters": o.JobParameters, + "job_run_id": o.JobRunId, + "next_page_token": o.NextPageToken, + "number_in_job": o.NumberInJob, + "original_attempt_run_id": o.OriginalAttemptRunId, + "overriding_parameters": o.OverridingParameters, + "queue_duration": o.QueueDuration, + "repair_history": o.RepairHistory, + "run_duration": o.RunDuration, + "run_id": o.RunId, + "run_name": o.RunName, + "run_page_url": o.RunPageUrl, + "run_type": o.RunType, + "schedule": o.Schedule, + "setup_duration": o.SetupDuration, + "start_time": o.StartTime, + "state": o.State, + "status": o.Status, + "tasks": o.Tasks, + "trigger": o.Trigger, + "trigger_info": o.TriggerInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Run) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attempt_number": types.Int64Type, + "cleanup_duration": types.Int64Type, + "cluster_instance": basetypes.ListType{ + ElemType: ClusterInstance{}.Type(ctx), + }, + "cluster_spec": basetypes.ListType{ + ElemType: ClusterSpec{}.Type(ctx), + }, + "creator_user_name": types.StringType, + "description": types.StringType, + "end_time": types.Int64Type, + "execution_duration": types.Int64Type, + "git_source": basetypes.ListType{ + ElemType: GitSource{}.Type(ctx), + }, + "iterations": basetypes.ListType{ + ElemType: RunTask{}.Type(ctx), + }, + "job_clusters": basetypes.ListType{ + ElemType: JobCluster{}.Type(ctx), + }, + "job_id": types.Int64Type, + "job_parameters": basetypes.ListType{ + ElemType: JobParameter{}.Type(ctx), + }, + "job_run_id": types.Int64Type, + "next_page_token": types.StringType, + "number_in_job": types.Int64Type, + "original_attempt_run_id": types.Int64Type, + "overriding_parameters": basetypes.ListType{ + ElemType: RunParameters{}.Type(ctx), + }, + "queue_duration": types.Int64Type, + "repair_history": basetypes.ListType{ + ElemType: RepairHistoryItem{}.Type(ctx), + }, + "run_duration": types.Int64Type, + "run_id": types.Int64Type, + "run_name": types.StringType, + "run_page_url": types.StringType, + "run_type": types.StringType, + "schedule": basetypes.ListType{ + ElemType: CronSchedule{}.Type(ctx), + }, + "setup_duration": types.Int64Type, + "start_time": types.Int64Type, + "state": basetypes.ListType{ + ElemType: RunState{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: RunStatus{}.Type(ctx), + }, + "tasks": basetypes.ListType{ + ElemType: RunTask{}.Type(ctx), + }, + "trigger": types.StringType, + "trigger_info": basetypes.ListType{ + ElemType: TriggerInfo{}.Type(ctx), + }, + }, + } +} + +// GetClusterInstance returns the value of the ClusterInstance field in Run as +// a ClusterInstance value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetClusterInstance(ctx context.Context) (ClusterInstance, bool) { + var e ClusterInstance + if o.ClusterInstance.IsNull() || o.ClusterInstance.IsUnknown() { + return e, false + } + var v []ClusterInstance + d := o.ClusterInstance.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterInstance sets the value of the ClusterInstance field in Run. +func (o *Run) SetClusterInstance(ctx context.Context, v ClusterInstance) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_instance"] + o.ClusterInstance = types.ListValueMust(t, vs) +} + +// GetClusterSpec returns the value of the ClusterSpec field in Run as +// a ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetClusterSpec(ctx context.Context) (ClusterSpec, bool) { + var e ClusterSpec + if o.ClusterSpec.IsNull() || o.ClusterSpec.IsUnknown() { + return e, false + } + var v []ClusterSpec + d := o.ClusterSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterSpec sets the value of the ClusterSpec field in Run. +func (o *Run) SetClusterSpec(ctx context.Context, v ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_spec"] + o.ClusterSpec = types.ListValueMust(t, vs) +} + +// GetGitSource returns the value of the GitSource field in Run as +// a GitSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetGitSource(ctx context.Context) (GitSource, bool) { + var e GitSource + if o.GitSource.IsNull() || o.GitSource.IsUnknown() { + return e, false + } + var v []GitSource + d := o.GitSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSource sets the value of the GitSource field in Run. +func (o *Run) SetGitSource(ctx context.Context, v GitSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_source"] + o.GitSource = types.ListValueMust(t, vs) +} + +// GetIterations returns the value of the Iterations field in Run as +// a slice of RunTask values. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetIterations(ctx context.Context) ([]RunTask, bool) { + if o.Iterations.IsNull() || o.Iterations.IsUnknown() { + return nil, false + } + var v []RunTask + d := o.Iterations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIterations sets the value of the Iterations field in Run. +func (o *Run) SetIterations(ctx context.Context, v []RunTask) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["iterations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Iterations = types.ListValueMust(t, vs) +} + +// GetJobClusters returns the value of the JobClusters field in Run as +// a slice of JobCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetJobClusters(ctx context.Context) ([]JobCluster, bool) { + if o.JobClusters.IsNull() || o.JobClusters.IsUnknown() { + return nil, false + } + var v []JobCluster + d := o.JobClusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobClusters sets the value of the JobClusters field in Run. +func (o *Run) SetJobClusters(ctx context.Context, v []JobCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobClusters = types.ListValueMust(t, vs) +} + +// GetJobParameters returns the value of the JobParameters field in Run as +// a slice of JobParameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetJobParameters(ctx context.Context) ([]JobParameter, bool) { + if o.JobParameters.IsNull() || o.JobParameters.IsUnknown() { + return nil, false + } + var v []JobParameter + d := o.JobParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobParameters sets the value of the JobParameters field in Run. +func (o *Run) SetJobParameters(ctx context.Context, v []JobParameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobParameters = types.ListValueMust(t, vs) +} + +// GetOverridingParameters returns the value of the OverridingParameters field in Run as +// a RunParameters value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetOverridingParameters(ctx context.Context) (RunParameters, bool) { + var e RunParameters + if o.OverridingParameters.IsNull() || o.OverridingParameters.IsUnknown() { + return e, false + } + var v []RunParameters + d := o.OverridingParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOverridingParameters sets the value of the OverridingParameters field in Run. +func (o *Run) SetOverridingParameters(ctx context.Context, v RunParameters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["overriding_parameters"] + o.OverridingParameters = types.ListValueMust(t, vs) +} + +// GetRepairHistory returns the value of the RepairHistory field in Run as +// a slice of RepairHistoryItem values. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetRepairHistory(ctx context.Context) ([]RepairHistoryItem, bool) { + if o.RepairHistory.IsNull() || o.RepairHistory.IsUnknown() { + return nil, false + } + var v []RepairHistoryItem + d := o.RepairHistory.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRepairHistory sets the value of the RepairHistory field in Run. +func (o *Run) SetRepairHistory(ctx context.Context, v []RepairHistoryItem) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["repair_history"] + t = t.(attr.TypeWithElementType).ElementType() + o.RepairHistory = types.ListValueMust(t, vs) +} + +// GetSchedule returns the value of the Schedule field in Run as +// a CronSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetSchedule(ctx context.Context) (CronSchedule, bool) { + var e CronSchedule + if o.Schedule.IsNull() || o.Schedule.IsUnknown() { + return e, false + } + var v []CronSchedule + d := o.Schedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchedule sets the value of the Schedule field in Run. +func (o *Run) SetSchedule(ctx context.Context, v CronSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schedule"] + o.Schedule = types.ListValueMust(t, vs) +} + +// GetState returns the value of the State field in Run as +// a RunState value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetState(ctx context.Context) (RunState, bool) { + var e RunState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []RunState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in Run. +func (o *Run) SetState(ctx context.Context, v RunState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in Run as +// a RunStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetStatus(ctx context.Context) (RunStatus, bool) { + var e RunStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []RunStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in Run. +func (o *Run) SetStatus(ctx context.Context, v RunStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + +// GetTasks returns the value of the Tasks field in Run as +// a slice of RunTask values. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetTasks(ctx context.Context) ([]RunTask, bool) { + if o.Tasks.IsNull() || o.Tasks.IsUnknown() { + return nil, false + } + var v []RunTask + d := o.Tasks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTasks sets the value of the Tasks field in Run. +func (o *Run) SetTasks(ctx context.Context, v []RunTask) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tasks"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tasks = types.ListValueMust(t, vs) +} + +// GetTriggerInfo returns the value of the TriggerInfo field in Run as +// a TriggerInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetTriggerInfo(ctx context.Context) (TriggerInfo, bool) { + var e TriggerInfo + if o.TriggerInfo.IsNull() || o.TriggerInfo.IsUnknown() { + return e, false + } + var v []TriggerInfo + d := o.TriggerInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTriggerInfo sets the value of the TriggerInfo field in Run. +func (o *Run) SetTriggerInfo(ctx context.Context, v TriggerInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger_info"] + o.TriggerInfo = types.ListValueMust(t, vs) +} + type RunConditionTask struct { // The left operand of the condition task. Can be either a string value or a // job state or parameter reference. @@ -2135,6 +9031,43 @@ func (newState *RunConditionTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan R func (newState *RunConditionTask) SyncEffectiveFieldsDuringRead(existingState RunConditionTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunConditionTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunConditionTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunConditionTask +// only implements ToObjectValue() and Type(). +func (o RunConditionTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "left": o.Left, + "op": o.Op, + "outcome": o.Outcome, + "right": o.Right, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunConditionTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "left": types.StringType, + "op": types.StringType, + "outcome": types.StringType, + "right": types.StringType, + }, + } +} + type RunForEachTask struct { // An optional maximum allowed number of concurrent runs of the task. Set // this value if you want to be able to execute multiple runs of the task @@ -2145,9 +9078,9 @@ type RunForEachTask struct { Inputs types.String `tfsdk:"inputs" tf:""` // Read only field. Populated for GetRun and ListRuns RPC calls and stores // the execution stats of an For each task - Stats []ForEachStats `tfsdk:"stats" tf:"optional,object"` + Stats types.List `tfsdk:"stats" tf:"optional,object"` // Configuration for the task that will be run for each element in the array - Task []Task `tfsdk:"task" tf:"object"` + Task types.List `tfsdk:"task" tf:"object"` } func (newState *RunForEachTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunForEachTask) { @@ -2156,6 +9089,102 @@ func (newState *RunForEachTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Run func (newState *RunForEachTask) SyncEffectiveFieldsDuringRead(existingState RunForEachTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunForEachTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunForEachTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "stats": reflect.TypeOf(ForEachStats{}), + "task": reflect.TypeOf(Task{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunForEachTask +// only implements ToObjectValue() and Type(). +func (o RunForEachTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "concurrency": o.Concurrency, + "inputs": o.Inputs, + "stats": o.Stats, + "task": o.Task, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunForEachTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "concurrency": types.Int64Type, + "inputs": types.StringType, + "stats": basetypes.ListType{ + ElemType: ForEachStats{}.Type(ctx), + }, + "task": basetypes.ListType{ + ElemType: Task{}.Type(ctx), + }, + }, + } +} + +// GetStats returns the value of the Stats field in RunForEachTask as +// a ForEachStats value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunForEachTask) GetStats(ctx context.Context) (ForEachStats, bool) { + var e ForEachStats + if o.Stats.IsNull() || o.Stats.IsUnknown() { + return e, false + } + var v []ForEachStats + d := o.Stats.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStats sets the value of the Stats field in RunForEachTask. +func (o *RunForEachTask) SetStats(ctx context.Context, v ForEachStats) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["stats"] + o.Stats = types.ListValueMust(t, vs) +} + +// GetTask returns the value of the Task field in RunForEachTask as +// a Task value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunForEachTask) GetTask(ctx context.Context) (Task, bool) { + var e Task + if o.Task.IsNull() || o.Task.IsUnknown() { + return e, false + } + var v []Task + d := o.Task.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTask sets the value of the Task field in RunForEachTask. +func (o *RunForEachTask) SetTask(ctx context.Context, v Task) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["task"] + o.Task = types.ListValueMust(t, vs) +} + type RunJobOutput struct { // The run id of the triggered job run RunId types.Int64 `tfsdk:"run_id" tf:"optional"` @@ -2167,11 +9196,42 @@ func (newState *RunJobOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunJo func (newState *RunJobOutput) SyncEffectiveFieldsDuringRead(existingState RunJobOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunJobOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunJobOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunJobOutput +// only implements ToObjectValue() and Type(). +func (o RunJobOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunJobOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + }, + } +} + type RunJobTask struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - DbtCommands []types.String `tfsdk:"dbt_commands" tf:"optional"` + DbtCommands types.List `tfsdk:"dbt_commands" tf:"optional"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the // main function of the main class specified in the Spark JAR task. If not @@ -2184,11 +9244,11 @@ type RunJobTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - JarParams []types.String `tfsdk:"jar_params" tf:"optional"` + JarParams types.List `tfsdk:"jar_params" tf:"optional"` // ID of the job to trigger. JobId types.Int64 `tfsdk:"job_id" tf:""` // Job-level parameters used to trigger the job. - JobParameters map[string]types.String `tfsdk:"job_parameters" tf:"optional"` + JobParameters types.Map `tfsdk:"job_parameters" tf:"optional"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed // to the notebook and is accessible through the [dbutils.widgets.get] @@ -2208,11 +9268,11 @@ type RunJobTask struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - NotebookParams map[string]types.String `tfsdk:"notebook_params" tf:"optional"` + NotebookParams types.Map `tfsdk:"notebook_params" tf:"optional"` // Controls whether the pipeline should perform a full refresh - PipelineParams []PipelineParams `tfsdk:"pipeline_params" tf:"optional,object"` + PipelineParams types.List `tfsdk:"pipeline_params" tf:"optional,object"` - PythonNamedParams map[string]types.String `tfsdk:"python_named_params" tf:"optional"` + PythonNamedParams types.Map `tfsdk:"python_named_params" tf:"optional"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to // Python file as command-line parameters. If specified upon `run-now`, it @@ -2230,7 +9290,7 @@ type RunJobTask struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - PythonParams []types.String `tfsdk:"python_params" tf:"optional"` + PythonParams types.List `tfsdk:"python_params" tf:"optional"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", // "org.apache.spark.examples.SparkPi"]`. The parameters are passed to @@ -2249,11 +9309,11 @@ type RunJobTask struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - SparkSubmitParams []types.String `tfsdk:"spark_submit_params" tf:"optional"` + SparkSubmitParams types.List `tfsdk:"spark_submit_params" tf:"optional"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - SqlParams map[string]types.String `tfsdk:"sql_params" tf:"optional"` + SqlParams types.Map `tfsdk:"sql_params" tf:"optional"` } func (newState *RunJobTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunJobTask) { @@ -2262,11 +9322,322 @@ func (newState *RunJobTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunJobT func (newState *RunJobTask) SyncEffectiveFieldsDuringRead(existingState RunJobTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunJobTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunJobTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dbt_commands": reflect.TypeOf(types.String{}), + "jar_params": reflect.TypeOf(types.String{}), + "job_parameters": reflect.TypeOf(types.String{}), + "notebook_params": reflect.TypeOf(types.String{}), + "pipeline_params": reflect.TypeOf(PipelineParams{}), + "python_named_params": reflect.TypeOf(types.String{}), + "python_params": reflect.TypeOf(types.String{}), + "spark_submit_params": reflect.TypeOf(types.String{}), + "sql_params": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunJobTask +// only implements ToObjectValue() and Type(). +func (o RunJobTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbt_commands": o.DbtCommands, + "jar_params": o.JarParams, + "job_id": o.JobId, + "job_parameters": o.JobParameters, + "notebook_params": o.NotebookParams, + "pipeline_params": o.PipelineParams, + "python_named_params": o.PythonNamedParams, + "python_params": o.PythonParams, + "spark_submit_params": o.SparkSubmitParams, + "sql_params": o.SqlParams, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunJobTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbt_commands": basetypes.ListType{ + ElemType: types.StringType, + }, + "jar_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "job_id": types.Int64Type, + "job_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "notebook_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "pipeline_params": basetypes.ListType{ + ElemType: PipelineParams{}.Type(ctx), + }, + "python_named_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "python_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "spark_submit_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "sql_params": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDbtCommands returns the value of the DbtCommands field in RunJobTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetDbtCommands(ctx context.Context) ([]types.String, bool) { + if o.DbtCommands.IsNull() || o.DbtCommands.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DbtCommands.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDbtCommands sets the value of the DbtCommands field in RunJobTask. +func (o *RunJobTask) SetDbtCommands(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_commands"] + t = t.(attr.TypeWithElementType).ElementType() + o.DbtCommands = types.ListValueMust(t, vs) +} + +// GetJarParams returns the value of the JarParams field in RunJobTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetJarParams(ctx context.Context) ([]types.String, bool) { + if o.JarParams.IsNull() || o.JarParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.JarParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJarParams sets the value of the JarParams field in RunJobTask. +func (o *RunJobTask) SetJarParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["jar_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.JarParams = types.ListValueMust(t, vs) +} + +// GetJobParameters returns the value of the JobParameters field in RunJobTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetJobParameters(ctx context.Context) (map[string]types.String, bool) { + if o.JobParameters.IsNull() || o.JobParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.JobParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobParameters sets the value of the JobParameters field in RunJobTask. +func (o *RunJobTask) SetJobParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobParameters = types.MapValueMust(t, vs) +} + +// GetNotebookParams returns the value of the NotebookParams field in RunJobTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetNotebookParams(ctx context.Context) (map[string]types.String, bool) { + if o.NotebookParams.IsNull() || o.NotebookParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NotebookParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotebookParams sets the value of the NotebookParams field in RunJobTask. +func (o *RunJobTask) SetNotebookParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.NotebookParams = types.MapValueMust(t, vs) +} + +// GetPipelineParams returns the value of the PipelineParams field in RunJobTask as +// a PipelineParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetPipelineParams(ctx context.Context) (PipelineParams, bool) { + var e PipelineParams + if o.PipelineParams.IsNull() || o.PipelineParams.IsUnknown() { + return e, false + } + var v []PipelineParams + d := o.PipelineParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineParams sets the value of the PipelineParams field in RunJobTask. +func (o *RunJobTask) SetPipelineParams(ctx context.Context, v PipelineParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_params"] + o.PipelineParams = types.ListValueMust(t, vs) +} + +// GetPythonNamedParams returns the value of the PythonNamedParams field in RunJobTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetPythonNamedParams(ctx context.Context) (map[string]types.String, bool) { + if o.PythonNamedParams.IsNull() || o.PythonNamedParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.PythonNamedParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonNamedParams sets the value of the PythonNamedParams field in RunJobTask. +func (o *RunJobTask) SetPythonNamedParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_named_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonNamedParams = types.MapValueMust(t, vs) +} + +// GetPythonParams returns the value of the PythonParams field in RunJobTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetPythonParams(ctx context.Context) ([]types.String, bool) { + if o.PythonParams.IsNull() || o.PythonParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PythonParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonParams sets the value of the PythonParams field in RunJobTask. +func (o *RunJobTask) SetPythonParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonParams = types.ListValueMust(t, vs) +} + +// GetSparkSubmitParams returns the value of the SparkSubmitParams field in RunJobTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetSparkSubmitParams(ctx context.Context) ([]types.String, bool) { + if o.SparkSubmitParams.IsNull() || o.SparkSubmitParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SparkSubmitParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkSubmitParams sets the value of the SparkSubmitParams field in RunJobTask. +func (o *RunJobTask) SetSparkSubmitParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkSubmitParams = types.ListValueMust(t, vs) +} + +// GetSqlParams returns the value of the SqlParams field in RunJobTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunJobTask) GetSqlParams(ctx context.Context) (map[string]types.String, bool) { + if o.SqlParams.IsNull() || o.SqlParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SqlParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSqlParams sets the value of the SqlParams field in RunJobTask. +func (o *RunJobTask) SetSqlParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SqlParams = types.MapValueMust(t, vs) +} + type RunNow struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - DbtCommands []types.String `tfsdk:"dbt_commands" tf:"optional"` + DbtCommands types.List `tfsdk:"dbt_commands" tf:"optional"` // An optional token to guarantee the idempotency of job run requests. If a // run with the provided token already exists, the request does not create a // new run but returns the ID of the existing run instead. If a run with the @@ -2294,12 +9665,12 @@ type RunNow struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - JarParams []types.String `tfsdk:"jar_params" tf:"optional"` + JarParams types.List `tfsdk:"jar_params" tf:"optional"` // The ID of the job to be executed JobId types.Int64 `tfsdk:"job_id" tf:""` // Job-level parameters used in the run. for example `"param": // "overriding_val"` - JobParameters map[string]types.String `tfsdk:"job_parameters" tf:"optional"` + JobParameters types.Map `tfsdk:"job_parameters" tf:"optional"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed // to the notebook and is accessible through the [dbutils.widgets.get] @@ -2319,14 +9690,14 @@ type RunNow struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - NotebookParams map[string]types.String `tfsdk:"notebook_params" tf:"optional"` + NotebookParams types.Map `tfsdk:"notebook_params" tf:"optional"` // A list of task keys to run inside of the job. If this field is not // provided, all tasks in the job will be run. - Only []types.String `tfsdk:"only" tf:"optional"` + Only types.List `tfsdk:"only" tf:"optional"` // Controls whether the pipeline should perform a full refresh - PipelineParams []PipelineParams `tfsdk:"pipeline_params" tf:"optional,object"` + PipelineParams types.List `tfsdk:"pipeline_params" tf:"optional,object"` - PythonNamedParams map[string]types.String `tfsdk:"python_named_params" tf:"optional"` + PythonNamedParams types.Map `tfsdk:"python_named_params" tf:"optional"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to // Python file as command-line parameters. If specified upon `run-now`, it @@ -2344,9 +9715,9 @@ type RunNow struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - PythonParams []types.String `tfsdk:"python_params" tf:"optional"` + PythonParams types.List `tfsdk:"python_params" tf:"optional"` // The queue settings of the run. - Queue []QueueSettings `tfsdk:"queue" tf:"optional,object"` + Queue types.List `tfsdk:"queue" tf:"optional,object"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", // "org.apache.spark.examples.SparkPi"]`. The parameters are passed to @@ -2365,11 +9736,11 @@ type RunNow struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - SparkSubmitParams []types.String `tfsdk:"spark_submit_params" tf:"optional"` + SparkSubmitParams types.List `tfsdk:"spark_submit_params" tf:"optional"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - SqlParams map[string]types.String `tfsdk:"sql_params" tf:"optional"` + SqlParams types.Map `tfsdk:"sql_params" tf:"optional"` } func (newState *RunNow) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunNow) { @@ -2378,6 +9749,381 @@ func (newState *RunNow) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunNow) { func (newState *RunNow) SyncEffectiveFieldsDuringRead(existingState RunNow) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunNow. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunNow) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dbt_commands": reflect.TypeOf(types.String{}), + "jar_params": reflect.TypeOf(types.String{}), + "job_parameters": reflect.TypeOf(types.String{}), + "notebook_params": reflect.TypeOf(types.String{}), + "only": reflect.TypeOf(types.String{}), + "pipeline_params": reflect.TypeOf(PipelineParams{}), + "python_named_params": reflect.TypeOf(types.String{}), + "python_params": reflect.TypeOf(types.String{}), + "queue": reflect.TypeOf(QueueSettings{}), + "spark_submit_params": reflect.TypeOf(types.String{}), + "sql_params": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunNow +// only implements ToObjectValue() and Type(). +func (o RunNow) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbt_commands": o.DbtCommands, + "idempotency_token": o.IdempotencyToken, + "jar_params": o.JarParams, + "job_id": o.JobId, + "job_parameters": o.JobParameters, + "notebook_params": o.NotebookParams, + "only": o.Only, + "pipeline_params": o.PipelineParams, + "python_named_params": o.PythonNamedParams, + "python_params": o.PythonParams, + "queue": o.Queue, + "spark_submit_params": o.SparkSubmitParams, + "sql_params": o.SqlParams, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunNow) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbt_commands": basetypes.ListType{ + ElemType: types.StringType, + }, + "idempotency_token": types.StringType, + "jar_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "job_id": types.Int64Type, + "job_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "notebook_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "only": basetypes.ListType{ + ElemType: types.StringType, + }, + "pipeline_params": basetypes.ListType{ + ElemType: PipelineParams{}.Type(ctx), + }, + "python_named_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "python_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "queue": basetypes.ListType{ + ElemType: QueueSettings{}.Type(ctx), + }, + "spark_submit_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "sql_params": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDbtCommands returns the value of the DbtCommands field in RunNow as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetDbtCommands(ctx context.Context) ([]types.String, bool) { + if o.DbtCommands.IsNull() || o.DbtCommands.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DbtCommands.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDbtCommands sets the value of the DbtCommands field in RunNow. +func (o *RunNow) SetDbtCommands(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_commands"] + t = t.(attr.TypeWithElementType).ElementType() + o.DbtCommands = types.ListValueMust(t, vs) +} + +// GetJarParams returns the value of the JarParams field in RunNow as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetJarParams(ctx context.Context) ([]types.String, bool) { + if o.JarParams.IsNull() || o.JarParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.JarParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJarParams sets the value of the JarParams field in RunNow. +func (o *RunNow) SetJarParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["jar_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.JarParams = types.ListValueMust(t, vs) +} + +// GetJobParameters returns the value of the JobParameters field in RunNow as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetJobParameters(ctx context.Context) (map[string]types.String, bool) { + if o.JobParameters.IsNull() || o.JobParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.JobParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJobParameters sets the value of the JobParameters field in RunNow. +func (o *RunNow) SetJobParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.JobParameters = types.MapValueMust(t, vs) +} + +// GetNotebookParams returns the value of the NotebookParams field in RunNow as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetNotebookParams(ctx context.Context) (map[string]types.String, bool) { + if o.NotebookParams.IsNull() || o.NotebookParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NotebookParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotebookParams sets the value of the NotebookParams field in RunNow. +func (o *RunNow) SetNotebookParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.NotebookParams = types.MapValueMust(t, vs) +} + +// GetOnly returns the value of the Only field in RunNow as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetOnly(ctx context.Context) ([]types.String, bool) { + if o.Only.IsNull() || o.Only.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Only.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnly sets the value of the Only field in RunNow. +func (o *RunNow) SetOnly(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["only"] + t = t.(attr.TypeWithElementType).ElementType() + o.Only = types.ListValueMust(t, vs) +} + +// GetPipelineParams returns the value of the PipelineParams field in RunNow as +// a PipelineParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetPipelineParams(ctx context.Context) (PipelineParams, bool) { + var e PipelineParams + if o.PipelineParams.IsNull() || o.PipelineParams.IsUnknown() { + return e, false + } + var v []PipelineParams + d := o.PipelineParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineParams sets the value of the PipelineParams field in RunNow. +func (o *RunNow) SetPipelineParams(ctx context.Context, v PipelineParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_params"] + o.PipelineParams = types.ListValueMust(t, vs) +} + +// GetPythonNamedParams returns the value of the PythonNamedParams field in RunNow as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetPythonNamedParams(ctx context.Context) (map[string]types.String, bool) { + if o.PythonNamedParams.IsNull() || o.PythonNamedParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.PythonNamedParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonNamedParams sets the value of the PythonNamedParams field in RunNow. +func (o *RunNow) SetPythonNamedParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_named_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonNamedParams = types.MapValueMust(t, vs) +} + +// GetPythonParams returns the value of the PythonParams field in RunNow as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetPythonParams(ctx context.Context) ([]types.String, bool) { + if o.PythonParams.IsNull() || o.PythonParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PythonParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonParams sets the value of the PythonParams field in RunNow. +func (o *RunNow) SetPythonParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonParams = types.ListValueMust(t, vs) +} + +// GetQueue returns the value of the Queue field in RunNow as +// a QueueSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetQueue(ctx context.Context) (QueueSettings, bool) { + var e QueueSettings + if o.Queue.IsNull() || o.Queue.IsUnknown() { + return e, false + } + var v []QueueSettings + d := o.Queue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueue sets the value of the Queue field in RunNow. +func (o *RunNow) SetQueue(ctx context.Context, v QueueSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["queue"] + o.Queue = types.ListValueMust(t, vs) +} + +// GetSparkSubmitParams returns the value of the SparkSubmitParams field in RunNow as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetSparkSubmitParams(ctx context.Context) ([]types.String, bool) { + if o.SparkSubmitParams.IsNull() || o.SparkSubmitParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SparkSubmitParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkSubmitParams sets the value of the SparkSubmitParams field in RunNow. +func (o *RunNow) SetSparkSubmitParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkSubmitParams = types.ListValueMust(t, vs) +} + +// GetSqlParams returns the value of the SqlParams field in RunNow as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunNow) GetSqlParams(ctx context.Context) (map[string]types.String, bool) { + if o.SqlParams.IsNull() || o.SqlParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SqlParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSqlParams sets the value of the SqlParams field in RunNow. +func (o *RunNow) SetSqlParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SqlParams = types.MapValueMust(t, vs) +} + // Run was started successfully. type RunNowResponse struct { // A unique identifier for this job run. This is set to the same value as @@ -2393,10 +10139,43 @@ func (newState *RunNowResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Run func (newState *RunNowResponse) SyncEffectiveFieldsDuringRead(existingState RunNowResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunNowResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunNowResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunNowResponse +// only implements ToObjectValue() and Type(). +func (o RunNowResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "number_in_job": o.NumberInJob, + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunNowResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "number_in_job": types.Int64Type, + "run_id": types.Int64Type, + }, + } +} + // Run output was retrieved successfully. type RunOutput struct { // The output of a dbt task, if available. - DbtOutput []DbtOutput `tfsdk:"dbt_output" tf:"optional,object"` + DbtOutput types.List `tfsdk:"dbt_output" tf:"optional,object"` // An error message indicating why a task failed or why output is not // available. The message is unstructured, and its exact format is subject // to change. @@ -2417,7 +10196,7 @@ type RunOutput struct { // Whether the logs are truncated. LogsTruncated types.Bool `tfsdk:"logs_truncated" tf:"optional"` // All details of the run except for its output. - Metadata []Run `tfsdk:"metadata" tf:"optional,object"` + Metadata types.List `tfsdk:"metadata" tf:"optional,object"` // The output of a notebook task, if available. A notebook task that // terminates (either successfully or with a failure) without calling // `dbutils.notebook.exit()` is considered to have an empty output. This @@ -2426,11 +10205,11 @@ type RunOutput struct { // the [ClusterLogConf] field to configure log storage for the job cluster. // // [ClusterLogConf]: https://docs.databricks.com/dev-tools/api/latest/clusters.html#clusterlogconf - NotebookOutput []NotebookOutput `tfsdk:"notebook_output" tf:"optional,object"` + NotebookOutput types.List `tfsdk:"notebook_output" tf:"optional,object"` // The output of a run job task, if available - RunJobOutput []RunJobOutput `tfsdk:"run_job_output" tf:"optional,object"` + RunJobOutput types.List `tfsdk:"run_job_output" tf:"optional,object"` // The output of a SQL task, if available. - SqlOutput []SqlOutput `tfsdk:"sql_output" tf:"optional,object"` + SqlOutput types.List `tfsdk:"sql_output" tf:"optional,object"` } func (newState *RunOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunOutput) { @@ -2439,11 +10218,206 @@ func (newState *RunOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunOutpu func (newState *RunOutput) SyncEffectiveFieldsDuringRead(existingState RunOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dbt_output": reflect.TypeOf(DbtOutput{}), + "metadata": reflect.TypeOf(Run{}), + "notebook_output": reflect.TypeOf(NotebookOutput{}), + "run_job_output": reflect.TypeOf(RunJobOutput{}), + "sql_output": reflect.TypeOf(SqlOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunOutput +// only implements ToObjectValue() and Type(). +func (o RunOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbt_output": o.DbtOutput, + "error": o.Error, + "error_trace": o.ErrorTrace, + "info": o.Info, + "logs": o.Logs, + "logs_truncated": o.LogsTruncated, + "metadata": o.Metadata, + "notebook_output": o.NotebookOutput, + "run_job_output": o.RunJobOutput, + "sql_output": o.SqlOutput, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbt_output": basetypes.ListType{ + ElemType: DbtOutput{}.Type(ctx), + }, + "error": types.StringType, + "error_trace": types.StringType, + "info": types.StringType, + "logs": types.StringType, + "logs_truncated": types.BoolType, + "metadata": basetypes.ListType{ + ElemType: Run{}.Type(ctx), + }, + "notebook_output": basetypes.ListType{ + ElemType: NotebookOutput{}.Type(ctx), + }, + "run_job_output": basetypes.ListType{ + ElemType: RunJobOutput{}.Type(ctx), + }, + "sql_output": basetypes.ListType{ + ElemType: SqlOutput{}.Type(ctx), + }, + }, + } +} + +// GetDbtOutput returns the value of the DbtOutput field in RunOutput as +// a DbtOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunOutput) GetDbtOutput(ctx context.Context) (DbtOutput, bool) { + var e DbtOutput + if o.DbtOutput.IsNull() || o.DbtOutput.IsUnknown() { + return e, false + } + var v []DbtOutput + d := o.DbtOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbtOutput sets the value of the DbtOutput field in RunOutput. +func (o *RunOutput) SetDbtOutput(ctx context.Context, v DbtOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_output"] + o.DbtOutput = types.ListValueMust(t, vs) +} + +// GetMetadata returns the value of the Metadata field in RunOutput as +// a Run value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunOutput) GetMetadata(ctx context.Context) (Run, bool) { + var e Run + if o.Metadata.IsNull() || o.Metadata.IsUnknown() { + return e, false + } + var v []Run + d := o.Metadata.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetadata sets the value of the Metadata field in RunOutput. +func (o *RunOutput) SetMetadata(ctx context.Context, v Run) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metadata"] + o.Metadata = types.ListValueMust(t, vs) +} + +// GetNotebookOutput returns the value of the NotebookOutput field in RunOutput as +// a NotebookOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunOutput) GetNotebookOutput(ctx context.Context) (NotebookOutput, bool) { + var e NotebookOutput + if o.NotebookOutput.IsNull() || o.NotebookOutput.IsUnknown() { + return e, false + } + var v []NotebookOutput + d := o.NotebookOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebookOutput sets the value of the NotebookOutput field in RunOutput. +func (o *RunOutput) SetNotebookOutput(ctx context.Context, v NotebookOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_output"] + o.NotebookOutput = types.ListValueMust(t, vs) +} + +// GetRunJobOutput returns the value of the RunJobOutput field in RunOutput as +// a RunJobOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunOutput) GetRunJobOutput(ctx context.Context) (RunJobOutput, bool) { + var e RunJobOutput + if o.RunJobOutput.IsNull() || o.RunJobOutput.IsUnknown() { + return e, false + } + var v []RunJobOutput + d := o.RunJobOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunJobOutput sets the value of the RunJobOutput field in RunOutput. +func (o *RunOutput) SetRunJobOutput(ctx context.Context, v RunJobOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_job_output"] + o.RunJobOutput = types.ListValueMust(t, vs) +} + +// GetSqlOutput returns the value of the SqlOutput field in RunOutput as +// a SqlOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunOutput) GetSqlOutput(ctx context.Context) (SqlOutput, bool) { + var e SqlOutput + if o.SqlOutput.IsNull() || o.SqlOutput.IsUnknown() { + return e, false + } + var v []SqlOutput + d := o.SqlOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlOutput sets the value of the SqlOutput field in RunOutput. +func (o *RunOutput) SetSqlOutput(ctx context.Context, v SqlOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_output"] + o.SqlOutput = types.ListValueMust(t, vs) +} + type RunParameters struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - DbtCommands []types.String `tfsdk:"dbt_commands" tf:"optional"` + DbtCommands types.List `tfsdk:"dbt_commands" tf:"optional"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the // main function of the main class specified in the Spark JAR task. If not @@ -2456,7 +10430,7 @@ type RunParameters struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - JarParams []types.String `tfsdk:"jar_params" tf:"optional"` + JarParams types.List `tfsdk:"jar_params" tf:"optional"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed // to the notebook and is accessible through the [dbutils.widgets.get] @@ -2476,11 +10450,11 @@ type RunParameters struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - NotebookParams map[string]types.String `tfsdk:"notebook_params" tf:"optional"` + NotebookParams types.Map `tfsdk:"notebook_params" tf:"optional"` // Controls whether the pipeline should perform a full refresh - PipelineParams []PipelineParams `tfsdk:"pipeline_params" tf:"optional,object"` + PipelineParams types.List `tfsdk:"pipeline_params" tf:"optional,object"` - PythonNamedParams map[string]types.String `tfsdk:"python_named_params" tf:"optional"` + PythonNamedParams types.Map `tfsdk:"python_named_params" tf:"optional"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to // Python file as command-line parameters. If specified upon `run-now`, it @@ -2498,7 +10472,7 @@ type RunParameters struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - PythonParams []types.String `tfsdk:"python_params" tf:"optional"` + PythonParams types.List `tfsdk:"python_params" tf:"optional"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", // "org.apache.spark.examples.SparkPi"]`. The parameters are passed to @@ -2517,11 +10491,11 @@ type RunParameters struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - SparkSubmitParams []types.String `tfsdk:"spark_submit_params" tf:"optional"` + SparkSubmitParams types.List `tfsdk:"spark_submit_params" tf:"optional"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - SqlParams map[string]types.String `tfsdk:"sql_params" tf:"optional"` + SqlParams types.Map `tfsdk:"sql_params" tf:"optional"` } func (newState *RunParameters) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunParameters) { @@ -2530,6 +10504,284 @@ func (newState *RunParameters) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunP func (newState *RunParameters) SyncEffectiveFieldsDuringRead(existingState RunParameters) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunParameters. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunParameters) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dbt_commands": reflect.TypeOf(types.String{}), + "jar_params": reflect.TypeOf(types.String{}), + "notebook_params": reflect.TypeOf(types.String{}), + "pipeline_params": reflect.TypeOf(PipelineParams{}), + "python_named_params": reflect.TypeOf(types.String{}), + "python_params": reflect.TypeOf(types.String{}), + "spark_submit_params": reflect.TypeOf(types.String{}), + "sql_params": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunParameters +// only implements ToObjectValue() and Type(). +func (o RunParameters) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbt_commands": o.DbtCommands, + "jar_params": o.JarParams, + "notebook_params": o.NotebookParams, + "pipeline_params": o.PipelineParams, + "python_named_params": o.PythonNamedParams, + "python_params": o.PythonParams, + "spark_submit_params": o.SparkSubmitParams, + "sql_params": o.SqlParams, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunParameters) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbt_commands": basetypes.ListType{ + ElemType: types.StringType, + }, + "jar_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "notebook_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "pipeline_params": basetypes.ListType{ + ElemType: PipelineParams{}.Type(ctx), + }, + "python_named_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "python_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "spark_submit_params": basetypes.ListType{ + ElemType: types.StringType, + }, + "sql_params": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDbtCommands returns the value of the DbtCommands field in RunParameters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetDbtCommands(ctx context.Context) ([]types.String, bool) { + if o.DbtCommands.IsNull() || o.DbtCommands.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DbtCommands.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDbtCommands sets the value of the DbtCommands field in RunParameters. +func (o *RunParameters) SetDbtCommands(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_commands"] + t = t.(attr.TypeWithElementType).ElementType() + o.DbtCommands = types.ListValueMust(t, vs) +} + +// GetJarParams returns the value of the JarParams field in RunParameters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetJarParams(ctx context.Context) ([]types.String, bool) { + if o.JarParams.IsNull() || o.JarParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.JarParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetJarParams sets the value of the JarParams field in RunParameters. +func (o *RunParameters) SetJarParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["jar_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.JarParams = types.ListValueMust(t, vs) +} + +// GetNotebookParams returns the value of the NotebookParams field in RunParameters as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetNotebookParams(ctx context.Context) (map[string]types.String, bool) { + if o.NotebookParams.IsNull() || o.NotebookParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NotebookParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotebookParams sets the value of the NotebookParams field in RunParameters. +func (o *RunParameters) SetNotebookParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.NotebookParams = types.MapValueMust(t, vs) +} + +// GetPipelineParams returns the value of the PipelineParams field in RunParameters as +// a PipelineParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetPipelineParams(ctx context.Context) (PipelineParams, bool) { + var e PipelineParams + if o.PipelineParams.IsNull() || o.PipelineParams.IsUnknown() { + return e, false + } + var v []PipelineParams + d := o.PipelineParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineParams sets the value of the PipelineParams field in RunParameters. +func (o *RunParameters) SetPipelineParams(ctx context.Context, v PipelineParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_params"] + o.PipelineParams = types.ListValueMust(t, vs) +} + +// GetPythonNamedParams returns the value of the PythonNamedParams field in RunParameters as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetPythonNamedParams(ctx context.Context) (map[string]types.String, bool) { + if o.PythonNamedParams.IsNull() || o.PythonNamedParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.PythonNamedParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonNamedParams sets the value of the PythonNamedParams field in RunParameters. +func (o *RunParameters) SetPythonNamedParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_named_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonNamedParams = types.MapValueMust(t, vs) +} + +// GetPythonParams returns the value of the PythonParams field in RunParameters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetPythonParams(ctx context.Context) ([]types.String, bool) { + if o.PythonParams.IsNull() || o.PythonParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PythonParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPythonParams sets the value of the PythonParams field in RunParameters. +func (o *RunParameters) SetPythonParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.PythonParams = types.ListValueMust(t, vs) +} + +// GetSparkSubmitParams returns the value of the SparkSubmitParams field in RunParameters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetSparkSubmitParams(ctx context.Context) ([]types.String, bool) { + if o.SparkSubmitParams.IsNull() || o.SparkSubmitParams.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SparkSubmitParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkSubmitParams sets the value of the SparkSubmitParams field in RunParameters. +func (o *RunParameters) SetSparkSubmitParams(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkSubmitParams = types.ListValueMust(t, vs) +} + +// GetSqlParams returns the value of the SqlParams field in RunParameters as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunParameters) GetSqlParams(ctx context.Context) (map[string]types.String, bool) { + if o.SqlParams.IsNull() || o.SqlParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SqlParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSqlParams sets the value of the SqlParams field in RunParameters. +func (o *RunParameters) SetSqlParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.SqlParams = types.MapValueMust(t, vs) +} + // The current state of the run. type RunState struct { // A value indicating the run's current lifecycle state. This field is @@ -2554,15 +10806,54 @@ func (newState *RunState) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunState) func (newState *RunState) SyncEffectiveFieldsDuringRead(existingState RunState) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunState. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunState) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunState +// only implements ToObjectValue() and Type(). +func (o RunState) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "life_cycle_state": o.LifeCycleState, + "queue_reason": o.QueueReason, + "result_state": o.ResultState, + "state_message": o.StateMessage, + "user_cancelled_or_timedout": o.UserCancelledOrTimedout, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunState) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "life_cycle_state": types.StringType, + "queue_reason": types.StringType, + "result_state": types.StringType, + "state_message": types.StringType, + "user_cancelled_or_timedout": types.BoolType, + }, + } +} + // The current status of the run type RunStatus struct { // If the run was queued, details about the reason for queuing the run. - QueueDetails []QueueDetails `tfsdk:"queue_details" tf:"optional,object"` + QueueDetails types.List `tfsdk:"queue_details" tf:"optional,object"` // The current state of the run. State types.String `tfsdk:"state" tf:"optional"` // If the run is in a TERMINATING or TERMINATED state, details about the // reason for terminating the run. - TerminationDetails []TerminationDetails `tfsdk:"termination_details" tf:"optional,object"` + TerminationDetails types.List `tfsdk:"termination_details" tf:"optional,object"` } func (newState *RunStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunStatus) { @@ -2571,6 +10862,100 @@ func (newState *RunStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunStatu func (newState *RunStatus) SyncEffectiveFieldsDuringRead(existingState RunStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "queue_details": reflect.TypeOf(QueueDetails{}), + "termination_details": reflect.TypeOf(TerminationDetails{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunStatus +// only implements ToObjectValue() and Type(). +func (o RunStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "queue_details": o.QueueDetails, + "state": o.State, + "termination_details": o.TerminationDetails, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "queue_details": basetypes.ListType{ + ElemType: QueueDetails{}.Type(ctx), + }, + "state": types.StringType, + "termination_details": basetypes.ListType{ + ElemType: TerminationDetails{}.Type(ctx), + }, + }, + } +} + +// GetQueueDetails returns the value of the QueueDetails field in RunStatus as +// a QueueDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunStatus) GetQueueDetails(ctx context.Context) (QueueDetails, bool) { + var e QueueDetails + if o.QueueDetails.IsNull() || o.QueueDetails.IsUnknown() { + return e, false + } + var v []QueueDetails + d := o.QueueDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueueDetails sets the value of the QueueDetails field in RunStatus. +func (o *RunStatus) SetQueueDetails(ctx context.Context, v QueueDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["queue_details"] + o.QueueDetails = types.ListValueMust(t, vs) +} + +// GetTerminationDetails returns the value of the TerminationDetails field in RunStatus as +// a TerminationDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunStatus) GetTerminationDetails(ctx context.Context) (TerminationDetails, bool) { + var e TerminationDetails + if o.TerminationDetails.IsNull() || o.TerminationDetails.IsUnknown() { + return e, false + } + var v []TerminationDetails + d := o.TerminationDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTerminationDetails sets the value of the TerminationDetails field in RunStatus. +func (o *RunStatus) SetTerminationDetails(ctx context.Context, v TerminationDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["termination_details"] + o.TerminationDetails = types.ListValueMust(t, vs) +} + // Used when outputting a child run, in GetRun or ListRuns. type RunTask struct { // The sequence number of this run attempt for a triggered job run. The @@ -2590,26 +10975,26 @@ type RunTask struct { // The cluster used for this run. If the run is specified to use a new // cluster, this field is set once the Jobs service has requested a cluster // for the run. - ClusterInstance []ClusterInstance `tfsdk:"cluster_instance" tf:"optional,object"` + ClusterInstance types.List `tfsdk:"cluster_instance" tf:"optional,object"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries // or notifications. - ConditionTask []RunConditionTask `tfsdk:"condition_task" tf:"optional,object"` + ConditionTask types.List `tfsdk:"condition_task" tf:"optional,object"` // The task runs one or more dbt commands when the `dbt_task` field is // present. The dbt task requires both Databricks SQL and the ability to use // a serverless or a pro SQL warehouse. - DbtTask []DbtTask `tfsdk:"dbt_task" tf:"optional,object"` + DbtTask types.List `tfsdk:"dbt_task" tf:"optional,object"` // An optional array of objects specifying the dependency graph of the task. // All tasks specified in this field must complete successfully before // executing this task. The key is `task_key`, and the value is the name // assigned to the dependent task. - DependsOn []TaskDependency `tfsdk:"depends_on" tf:"optional"` + DependsOn types.List `tfsdk:"depends_on" tf:"optional"` // An optional description for this task. Description types.String `tfsdk:"description" tf:"optional"` // An optional set of email addresses notified when the task run begins or // completes. The default behavior is to not send any emails. - EmailNotifications []JobEmailNotifications `tfsdk:"email_notifications" tf:"optional,object"` + EmailNotifications types.List `tfsdk:"email_notifications" tf:"optional,object"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. EndTime types.Int64 `tfsdk:"end_time" tf:"optional"` @@ -2632,7 +11017,7 @@ type RunTask struct { ExistingClusterId types.String `tfsdk:"existing_cluster_id" tf:"optional"` // The task executes a nested task for every input provided when the // `for_each_task` field is present. - ForEachTask []RunForEachTask `tfsdk:"for_each_task" tf:"optional,object"` + ForEachTask types.List `tfsdk:"for_each_task" tf:"optional,object"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by // notebook, dbt, Python script, and SQL File tasks. If `git_source` is set, @@ -2641,32 +11026,32 @@ type RunTask struct { // `WORKSPACE` on the task. Note: dbt and SQL File tasks support only // version-controlled sources. If dbt or SQL File tasks are used, // `git_source` must be defined on the job. - GitSource []GitSource `tfsdk:"git_source" tf:"optional,object"` + GitSource types.List `tfsdk:"git_source" tf:"optional,object"` // If job_cluster_key, this task is executed reusing the cluster specified // in `job.settings.job_clusters`. JobClusterKey types.String `tfsdk:"job_cluster_key" tf:"optional"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - Libraries compute.Library `tfsdk:"library" tf:"optional"` + Libraries types.List `tfsdk:"library" tf:"optional"` // If new_cluster, a description of a new cluster that is created for each // run. - NewCluster compute.ClusterSpec `tfsdk:"new_cluster" tf:"optional,object"` + NewCluster types.List `tfsdk:"new_cluster" tf:"optional,object"` // The task runs a notebook when the `notebook_task` field is present. - NotebookTask []NotebookTask `tfsdk:"notebook_task" tf:"optional,object"` + NotebookTask types.List `tfsdk:"notebook_task" tf:"optional,object"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // task run. - NotificationSettings []TaskNotificationSettings `tfsdk:"notification_settings" tf:"optional,object"` + NotificationSettings types.List `tfsdk:"notification_settings" tf:"optional,object"` // The task triggers a pipeline update when the `pipeline_task` field is // present. Only pipelines configured to use triggered more are supported. - PipelineTask []PipelineTask `tfsdk:"pipeline_task" tf:"optional,object"` + PipelineTask types.List `tfsdk:"pipeline_task" tf:"optional,object"` // The task runs a Python wheel when the `python_wheel_task` field is // present. - PythonWheelTask []PythonWheelTask `tfsdk:"python_wheel_task" tf:"optional,object"` + PythonWheelTask types.List `tfsdk:"python_wheel_task" tf:"optional,object"` // The time in milliseconds that the run has spent in the queue. QueueDuration types.Int64 `tfsdk:"queue_duration" tf:"optional"` // Parameter values including resolved references - ResolvedValues []ResolvedValues `tfsdk:"resolved_values" tf:"optional,object"` + ResolvedValues types.List `tfsdk:"resolved_values" tf:"optional,object"` // The time in milliseconds it took the job run and all of its repairs to // finish. RunDuration types.Int64 `tfsdk:"run_duration" tf:"optional"` @@ -2678,7 +11063,7 @@ type RunTask struct { // possible values. RunIf types.String `tfsdk:"run_if" tf:"optional"` // The task triggers another job when the `run_job_task` field is present. - RunJobTask []RunJobTask `tfsdk:"run_job_task" tf:"optional,object"` + RunJobTask types.List `tfsdk:"run_job_task" tf:"optional,object"` RunPageUrl types.String `tfsdk:"run_page_url" tf:"optional"` // The time in milliseconds it took to set up the cluster. For runs that run @@ -2690,10 +11075,10 @@ type RunTask struct { // `run_duration` field. SetupDuration types.Int64 `tfsdk:"setup_duration" tf:"optional"` // The task runs a JAR when the `spark_jar_task` field is present. - SparkJarTask []SparkJarTask `tfsdk:"spark_jar_task" tf:"optional,object"` + SparkJarTask types.List `tfsdk:"spark_jar_task" tf:"optional,object"` // The task runs a Python file when the `spark_python_task` field is // present. - SparkPythonTask []SparkPythonTask `tfsdk:"spark_python_task" tf:"optional,object"` + SparkPythonTask types.List `tfsdk:"spark_python_task" tf:"optional,object"` // (Legacy) The task runs the spark-submit script when the // `spark_submit_task` field is present. This task can run only on new // clusters and is not compatible with serverless compute. @@ -2712,19 +11097,19 @@ type RunTask struct { // // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 // paths. - SparkSubmitTask []SparkSubmitTask `tfsdk:"spark_submit_task" tf:"optional,object"` + SparkSubmitTask types.List `tfsdk:"spark_submit_task" tf:"optional,object"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. - SqlTask []SqlTask `tfsdk:"sql_task" tf:"optional,object"` + SqlTask types.List `tfsdk:"sql_task" tf:"optional,object"` // The time at which this run was started in epoch milliseconds // (milliseconds since 1/1/1970 UTC). This may not be the time when the job // task starts executing, for example, if the job is scheduled to run on a // new cluster, this is the time the cluster creation call is issued. StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` // Deprecated. Please use the `status` field instead. - State []RunState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The current status of the run - Status []RunStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` // A unique name for the task. This field is used to refer to this task from // other tasks. This field is required and must be unique within its parent // job. On Update or Reset, this field is used to reference the tasks to be @@ -2736,7 +11121,7 @@ type RunTask struct { // A collection of system notification IDs to notify when the run begins or // completes. The default behavior is to not send any system notifications. // Task webhooks respect the task notification settings. - WebhookNotifications []WebhookNotifications `tfsdk:"webhook_notifications" tf:"optional,object"` + WebhookNotifications types.List `tfsdk:"webhook_notifications" tf:"optional,object"` } func (newState *RunTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunTask) { @@ -2745,6 +11130,752 @@ func (newState *RunTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunTask) { func (newState *RunTask) SyncEffectiveFieldsDuringRead(existingState RunTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cluster_instance": reflect.TypeOf(ClusterInstance{}), + "condition_task": reflect.TypeOf(RunConditionTask{}), + "dbt_task": reflect.TypeOf(DbtTask{}), + "depends_on": reflect.TypeOf(TaskDependency{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "for_each_task": reflect.TypeOf(RunForEachTask{}), + "git_source": reflect.TypeOf(GitSource{}), + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + "notebook_task": reflect.TypeOf(NotebookTask{}), + "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), + "pipeline_task": reflect.TypeOf(PipelineTask{}), + "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), + "resolved_values": reflect.TypeOf(ResolvedValues{}), + "run_job_task": reflect.TypeOf(RunJobTask{}), + "spark_jar_task": reflect.TypeOf(SparkJarTask{}), + "spark_python_task": reflect.TypeOf(SparkPythonTask{}), + "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), + "sql_task": reflect.TypeOf(SqlTask{}), + "state": reflect.TypeOf(RunState{}), + "status": reflect.TypeOf(RunStatus{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunTask +// only implements ToObjectValue() and Type(). +func (o RunTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "attempt_number": o.AttemptNumber, + "cleanup_duration": o.CleanupDuration, + "cluster_instance": o.ClusterInstance, + "condition_task": o.ConditionTask, + "dbt_task": o.DbtTask, + "depends_on": o.DependsOn, + "description": o.Description, + "email_notifications": o.EmailNotifications, + "end_time": o.EndTime, + "environment_key": o.EnvironmentKey, + "execution_duration": o.ExecutionDuration, + "existing_cluster_id": o.ExistingClusterId, + "for_each_task": o.ForEachTask, + "git_source": o.GitSource, + "job_cluster_key": o.JobClusterKey, + "library": o.Libraries, + "new_cluster": o.NewCluster, + "notebook_task": o.NotebookTask, + "notification_settings": o.NotificationSettings, + "pipeline_task": o.PipelineTask, + "python_wheel_task": o.PythonWheelTask, + "queue_duration": o.QueueDuration, + "resolved_values": o.ResolvedValues, + "run_duration": o.RunDuration, + "run_id": o.RunId, + "run_if": o.RunIf, + "run_job_task": o.RunJobTask, + "run_page_url": o.RunPageUrl, + "setup_duration": o.SetupDuration, + "spark_jar_task": o.SparkJarTask, + "spark_python_task": o.SparkPythonTask, + "spark_submit_task": o.SparkSubmitTask, + "sql_task": o.SqlTask, + "start_time": o.StartTime, + "state": o.State, + "status": o.Status, + "task_key": o.TaskKey, + "timeout_seconds": o.TimeoutSeconds, + "webhook_notifications": o.WebhookNotifications, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "attempt_number": types.Int64Type, + "cleanup_duration": types.Int64Type, + "cluster_instance": basetypes.ListType{ + ElemType: ClusterInstance{}.Type(ctx), + }, + "condition_task": basetypes.ListType{ + ElemType: RunConditionTask{}.Type(ctx), + }, + "dbt_task": basetypes.ListType{ + ElemType: DbtTask{}.Type(ctx), + }, + "depends_on": basetypes.ListType{ + ElemType: TaskDependency{}.Type(ctx), + }, + "description": types.StringType, + "email_notifications": basetypes.ListType{ + ElemType: JobEmailNotifications{}.Type(ctx), + }, + "end_time": types.Int64Type, + "environment_key": types.StringType, + "execution_duration": types.Int64Type, + "existing_cluster_id": types.StringType, + "for_each_task": basetypes.ListType{ + ElemType: RunForEachTask{}.Type(ctx), + }, + "git_source": basetypes.ListType{ + ElemType: GitSource{}.Type(ctx), + }, + "job_cluster_key": types.StringType, + "library": basetypes.ListType{ + ElemType: compute_tf.Library{}.Type(ctx), + }, + "new_cluster": basetypes.ListType{ + ElemType: compute_tf.ClusterSpec{}.Type(ctx), + }, + "notebook_task": basetypes.ListType{ + ElemType: NotebookTask{}.Type(ctx), + }, + "notification_settings": basetypes.ListType{ + ElemType: TaskNotificationSettings{}.Type(ctx), + }, + "pipeline_task": basetypes.ListType{ + ElemType: PipelineTask{}.Type(ctx), + }, + "python_wheel_task": basetypes.ListType{ + ElemType: PythonWheelTask{}.Type(ctx), + }, + "queue_duration": types.Int64Type, + "resolved_values": basetypes.ListType{ + ElemType: ResolvedValues{}.Type(ctx), + }, + "run_duration": types.Int64Type, + "run_id": types.Int64Type, + "run_if": types.StringType, + "run_job_task": basetypes.ListType{ + ElemType: RunJobTask{}.Type(ctx), + }, + "run_page_url": types.StringType, + "setup_duration": types.Int64Type, + "spark_jar_task": basetypes.ListType{ + ElemType: SparkJarTask{}.Type(ctx), + }, + "spark_python_task": basetypes.ListType{ + ElemType: SparkPythonTask{}.Type(ctx), + }, + "spark_submit_task": basetypes.ListType{ + ElemType: SparkSubmitTask{}.Type(ctx), + }, + "sql_task": basetypes.ListType{ + ElemType: SqlTask{}.Type(ctx), + }, + "start_time": types.Int64Type, + "state": basetypes.ListType{ + ElemType: RunState{}.Type(ctx), + }, + "status": basetypes.ListType{ + ElemType: RunStatus{}.Type(ctx), + }, + "task_key": types.StringType, + "timeout_seconds": types.Int64Type, + "webhook_notifications": basetypes.ListType{ + ElemType: WebhookNotifications{}.Type(ctx), + }, + }, + } +} + +// GetClusterInstance returns the value of the ClusterInstance field in RunTask as +// a ClusterInstance value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetClusterInstance(ctx context.Context) (ClusterInstance, bool) { + var e ClusterInstance + if o.ClusterInstance.IsNull() || o.ClusterInstance.IsUnknown() { + return e, false + } + var v []ClusterInstance + d := o.ClusterInstance.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterInstance sets the value of the ClusterInstance field in RunTask. +func (o *RunTask) SetClusterInstance(ctx context.Context, v ClusterInstance) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_instance"] + o.ClusterInstance = types.ListValueMust(t, vs) +} + +// GetConditionTask returns the value of the ConditionTask field in RunTask as +// a RunConditionTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetConditionTask(ctx context.Context) (RunConditionTask, bool) { + var e RunConditionTask + if o.ConditionTask.IsNull() || o.ConditionTask.IsUnknown() { + return e, false + } + var v []RunConditionTask + d := o.ConditionTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConditionTask sets the value of the ConditionTask field in RunTask. +func (o *RunTask) SetConditionTask(ctx context.Context, v RunConditionTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition_task"] + o.ConditionTask = types.ListValueMust(t, vs) +} + +// GetDbtTask returns the value of the DbtTask field in RunTask as +// a DbtTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetDbtTask(ctx context.Context) (DbtTask, bool) { + var e DbtTask + if o.DbtTask.IsNull() || o.DbtTask.IsUnknown() { + return e, false + } + var v []DbtTask + d := o.DbtTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbtTask sets the value of the DbtTask field in RunTask. +func (o *RunTask) SetDbtTask(ctx context.Context, v DbtTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_task"] + o.DbtTask = types.ListValueMust(t, vs) +} + +// GetDependsOn returns the value of the DependsOn field in RunTask as +// a slice of TaskDependency values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetDependsOn(ctx context.Context) ([]TaskDependency, bool) { + if o.DependsOn.IsNull() || o.DependsOn.IsUnknown() { + return nil, false + } + var v []TaskDependency + d := o.DependsOn.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDependsOn sets the value of the DependsOn field in RunTask. +func (o *RunTask) SetDependsOn(ctx context.Context, v []TaskDependency) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["depends_on"] + t = t.(attr.TypeWithElementType).ElementType() + o.DependsOn = types.ListValueMust(t, vs) +} + +// GetEmailNotifications returns the value of the EmailNotifications field in RunTask as +// a JobEmailNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetEmailNotifications(ctx context.Context) (JobEmailNotifications, bool) { + var e JobEmailNotifications + if o.EmailNotifications.IsNull() || o.EmailNotifications.IsUnknown() { + return e, false + } + var v []JobEmailNotifications + d := o.EmailNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmailNotifications sets the value of the EmailNotifications field in RunTask. +func (o *RunTask) SetEmailNotifications(ctx context.Context, v JobEmailNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_notifications"] + o.EmailNotifications = types.ListValueMust(t, vs) +} + +// GetForEachTask returns the value of the ForEachTask field in RunTask as +// a RunForEachTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetForEachTask(ctx context.Context) (RunForEachTask, bool) { + var e RunForEachTask + if o.ForEachTask.IsNull() || o.ForEachTask.IsUnknown() { + return e, false + } + var v []RunForEachTask + d := o.ForEachTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetForEachTask sets the value of the ForEachTask field in RunTask. +func (o *RunTask) SetForEachTask(ctx context.Context, v RunForEachTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["for_each_task"] + o.ForEachTask = types.ListValueMust(t, vs) +} + +// GetGitSource returns the value of the GitSource field in RunTask as +// a GitSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetGitSource(ctx context.Context) (GitSource, bool) { + var e GitSource + if o.GitSource.IsNull() || o.GitSource.IsUnknown() { + return e, false + } + var v []GitSource + d := o.GitSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSource sets the value of the GitSource field in RunTask. +func (o *RunTask) SetGitSource(ctx context.Context, v GitSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_source"] + o.GitSource = types.ListValueMust(t, vs) +} + +// GetLibraries returns the value of the Libraries field in RunTask as +// a slice of compute_tf.Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetLibraries(ctx context.Context) ([]compute_tf.Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []compute_tf.Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in RunTask. +func (o *RunTask) SetLibraries(ctx context.Context, v []compute_tf.Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["library"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNewCluster returns the value of the NewCluster field in RunTask as +// a compute_tf.ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetNewCluster(ctx context.Context) (compute_tf.ClusterSpec, bool) { + var e compute_tf.ClusterSpec + if o.NewCluster.IsNull() || o.NewCluster.IsUnknown() { + return e, false + } + var v []compute_tf.ClusterSpec + d := o.NewCluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewCluster sets the value of the NewCluster field in RunTask. +func (o *RunTask) SetNewCluster(ctx context.Context, v compute_tf.ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_cluster"] + o.NewCluster = types.ListValueMust(t, vs) +} + +// GetNotebookTask returns the value of the NotebookTask field in RunTask as +// a NotebookTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetNotebookTask(ctx context.Context) (NotebookTask, bool) { + var e NotebookTask + if o.NotebookTask.IsNull() || o.NotebookTask.IsUnknown() { + return e, false + } + var v []NotebookTask + d := o.NotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebookTask sets the value of the NotebookTask field in RunTask. +func (o *RunTask) SetNotebookTask(ctx context.Context, v NotebookTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_task"] + o.NotebookTask = types.ListValueMust(t, vs) +} + +// GetNotificationSettings returns the value of the NotificationSettings field in RunTask as +// a TaskNotificationSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetNotificationSettings(ctx context.Context) (TaskNotificationSettings, bool) { + var e TaskNotificationSettings + if o.NotificationSettings.IsNull() || o.NotificationSettings.IsUnknown() { + return e, false + } + var v []TaskNotificationSettings + d := o.NotificationSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotificationSettings sets the value of the NotificationSettings field in RunTask. +func (o *RunTask) SetNotificationSettings(ctx context.Context, v TaskNotificationSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notification_settings"] + o.NotificationSettings = types.ListValueMust(t, vs) +} + +// GetPipelineTask returns the value of the PipelineTask field in RunTask as +// a PipelineTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetPipelineTask(ctx context.Context) (PipelineTask, bool) { + var e PipelineTask + if o.PipelineTask.IsNull() || o.PipelineTask.IsUnknown() { + return e, false + } + var v []PipelineTask + d := o.PipelineTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineTask sets the value of the PipelineTask field in RunTask. +func (o *RunTask) SetPipelineTask(ctx context.Context, v PipelineTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_task"] + o.PipelineTask = types.ListValueMust(t, vs) +} + +// GetPythonWheelTask returns the value of the PythonWheelTask field in RunTask as +// a PythonWheelTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetPythonWheelTask(ctx context.Context) (PythonWheelTask, bool) { + var e PythonWheelTask + if o.PythonWheelTask.IsNull() || o.PythonWheelTask.IsUnknown() { + return e, false + } + var v []PythonWheelTask + d := o.PythonWheelTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPythonWheelTask sets the value of the PythonWheelTask field in RunTask. +func (o *RunTask) SetPythonWheelTask(ctx context.Context, v PythonWheelTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_wheel_task"] + o.PythonWheelTask = types.ListValueMust(t, vs) +} + +// GetResolvedValues returns the value of the ResolvedValues field in RunTask as +// a ResolvedValues value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetResolvedValues(ctx context.Context) (ResolvedValues, bool) { + var e ResolvedValues + if o.ResolvedValues.IsNull() || o.ResolvedValues.IsUnknown() { + return e, false + } + var v []ResolvedValues + d := o.ResolvedValues.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetResolvedValues sets the value of the ResolvedValues field in RunTask. +func (o *RunTask) SetResolvedValues(ctx context.Context, v ResolvedValues) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["resolved_values"] + o.ResolvedValues = types.ListValueMust(t, vs) +} + +// GetRunJobTask returns the value of the RunJobTask field in RunTask as +// a RunJobTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetRunJobTask(ctx context.Context) (RunJobTask, bool) { + var e RunJobTask + if o.RunJobTask.IsNull() || o.RunJobTask.IsUnknown() { + return e, false + } + var v []RunJobTask + d := o.RunJobTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunJobTask sets the value of the RunJobTask field in RunTask. +func (o *RunTask) SetRunJobTask(ctx context.Context, v RunJobTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_job_task"] + o.RunJobTask = types.ListValueMust(t, vs) +} + +// GetSparkJarTask returns the value of the SparkJarTask field in RunTask as +// a SparkJarTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetSparkJarTask(ctx context.Context) (SparkJarTask, bool) { + var e SparkJarTask + if o.SparkJarTask.IsNull() || o.SparkJarTask.IsUnknown() { + return e, false + } + var v []SparkJarTask + d := o.SparkJarTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkJarTask sets the value of the SparkJarTask field in RunTask. +func (o *RunTask) SetSparkJarTask(ctx context.Context, v SparkJarTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_jar_task"] + o.SparkJarTask = types.ListValueMust(t, vs) +} + +// GetSparkPythonTask returns the value of the SparkPythonTask field in RunTask as +// a SparkPythonTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetSparkPythonTask(ctx context.Context) (SparkPythonTask, bool) { + var e SparkPythonTask + if o.SparkPythonTask.IsNull() || o.SparkPythonTask.IsUnknown() { + return e, false + } + var v []SparkPythonTask + d := o.SparkPythonTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkPythonTask sets the value of the SparkPythonTask field in RunTask. +func (o *RunTask) SetSparkPythonTask(ctx context.Context, v SparkPythonTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_python_task"] + o.SparkPythonTask = types.ListValueMust(t, vs) +} + +// GetSparkSubmitTask returns the value of the SparkSubmitTask field in RunTask as +// a SparkSubmitTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetSparkSubmitTask(ctx context.Context) (SparkSubmitTask, bool) { + var e SparkSubmitTask + if o.SparkSubmitTask.IsNull() || o.SparkSubmitTask.IsUnknown() { + return e, false + } + var v []SparkSubmitTask + d := o.SparkSubmitTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkSubmitTask sets the value of the SparkSubmitTask field in RunTask. +func (o *RunTask) SetSparkSubmitTask(ctx context.Context, v SparkSubmitTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_task"] + o.SparkSubmitTask = types.ListValueMust(t, vs) +} + +// GetSqlTask returns the value of the SqlTask field in RunTask as +// a SqlTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetSqlTask(ctx context.Context) (SqlTask, bool) { + var e SqlTask + if o.SqlTask.IsNull() || o.SqlTask.IsUnknown() { + return e, false + } + var v []SqlTask + d := o.SqlTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlTask sets the value of the SqlTask field in RunTask. +func (o *RunTask) SetSqlTask(ctx context.Context, v SqlTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_task"] + o.SqlTask = types.ListValueMust(t, vs) +} + +// GetState returns the value of the State field in RunTask as +// a RunState value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetState(ctx context.Context) (RunState, bool) { + var e RunState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []RunState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in RunTask. +func (o *RunTask) SetState(ctx context.Context, v RunState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in RunTask as +// a RunStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetStatus(ctx context.Context) (RunStatus, bool) { + var e RunStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []RunStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in RunTask. +func (o *RunTask) SetStatus(ctx context.Context, v RunStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + +// GetWebhookNotifications returns the value of the WebhookNotifications field in RunTask as +// a WebhookNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetWebhookNotifications(ctx context.Context) (WebhookNotifications, bool) { + var e WebhookNotifications + if o.WebhookNotifications.IsNull() || o.WebhookNotifications.IsUnknown() { + return e, false + } + var v []WebhookNotifications + d := o.WebhookNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhookNotifications sets the value of the WebhookNotifications field in RunTask. +func (o *RunTask) SetWebhookNotifications(ctx context.Context, v WebhookNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook_notifications"] + o.WebhookNotifications = types.ListValueMust(t, vs) +} + type SparkJarTask struct { // Deprecated since 04/2016. Provide a `jar` through the `libraries` field // instead. For an example, see :method:jobs/create. @@ -2761,7 +11892,7 @@ type SparkJarTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - Parameters []types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` } func (newState *SparkJarTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan SparkJarTask) { @@ -2770,6 +11901,71 @@ func (newState *SparkJarTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Spark func (newState *SparkJarTask) SyncEffectiveFieldsDuringRead(existingState SparkJarTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparkJarTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparkJarTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparkJarTask +// only implements ToObjectValue() and Type(). +func (o SparkJarTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "jar_uri": o.JarUri, + "main_class_name": o.MainClassName, + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparkJarTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "jar_uri": types.StringType, + "main_class_name": types.StringType, + "parameters": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetParameters returns the value of the Parameters field in SparkJarTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SparkJarTask) GetParameters(ctx context.Context) ([]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in SparkJarTask. +func (o *SparkJarTask) SetParameters(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type SparkPythonTask struct { // Command line parameters passed to the Python file. // @@ -2777,7 +11973,7 @@ type SparkPythonTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - Parameters []types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, // adls:/, gcs:/) and workspace paths are supported. For python files stored // in the Databricks workspace, the path must be absolute and begin with @@ -2802,6 +11998,71 @@ func (newState *SparkPythonTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sp func (newState *SparkPythonTask) SyncEffectiveFieldsDuringRead(existingState SparkPythonTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparkPythonTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparkPythonTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparkPythonTask +// only implements ToObjectValue() and Type(). +func (o SparkPythonTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "parameters": o.Parameters, + "python_file": o.PythonFile, + "source": o.Source, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparkPythonTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "parameters": basetypes.ListType{ + ElemType: types.StringType, + }, + "python_file": types.StringType, + "source": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in SparkPythonTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SparkPythonTask) GetParameters(ctx context.Context) ([]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in SparkPythonTask. +func (o *SparkPythonTask) SetParameters(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type SparkSubmitTask struct { // Command-line parameters passed to spark submit. // @@ -2809,7 +12070,7 @@ type SparkSubmitTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - Parameters []types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` } func (newState *SparkSubmitTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan SparkSubmitTask) { @@ -2818,6 +12079,67 @@ func (newState *SparkSubmitTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sp func (newState *SparkSubmitTask) SyncEffectiveFieldsDuringRead(existingState SparkSubmitTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparkSubmitTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparkSubmitTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparkSubmitTask +// only implements ToObjectValue() and Type(). +func (o SparkSubmitTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "parameters": o.Parameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparkSubmitTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "parameters": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetParameters returns the value of the Parameters field in SparkSubmitTask as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SparkSubmitTask) GetParameters(ctx context.Context) ([]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in SparkSubmitTask. +func (o *SparkSubmitTask) SetParameters(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type SqlAlertOutput struct { // The state of the SQL alert. // @@ -2831,7 +12153,7 @@ type SqlAlertOutput struct { // with the SQL alert is required to view this field. QueryText types.String `tfsdk:"query_text" tf:"optional"` // Information about SQL statements executed in the run. - SqlStatements []SqlStatementOutput `tfsdk:"sql_statements" tf:"optional"` + SqlStatements types.List `tfsdk:"sql_statements" tf:"optional"` // The canonical identifier of the SQL warehouse. WarehouseId types.String `tfsdk:"warehouse_id" tf:"optional"` } @@ -2842,11 +12164,80 @@ func (newState *SqlAlertOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sql func (newState *SqlAlertOutput) SyncEffectiveFieldsDuringRead(existingState SqlAlertOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlAlertOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlAlertOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sql_statements": reflect.TypeOf(SqlStatementOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlAlertOutput +// only implements ToObjectValue() and Type(). +func (o SqlAlertOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_state": o.AlertState, + "output_link": o.OutputLink, + "query_text": o.QueryText, + "sql_statements": o.SqlStatements, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlAlertOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_state": types.StringType, + "output_link": types.StringType, + "query_text": types.StringType, + "sql_statements": basetypes.ListType{ + ElemType: SqlStatementOutput{}.Type(ctx), + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetSqlStatements returns the value of the SqlStatements field in SqlAlertOutput as +// a slice of SqlStatementOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlAlertOutput) GetSqlStatements(ctx context.Context) ([]SqlStatementOutput, bool) { + if o.SqlStatements.IsNull() || o.SqlStatements.IsUnknown() { + return nil, false + } + var v []SqlStatementOutput + d := o.SqlStatements.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSqlStatements sets the value of the SqlStatements field in SqlAlertOutput. +func (o *SqlAlertOutput) SetSqlStatements(ctx context.Context, v []SqlStatementOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_statements"] + t = t.(attr.TypeWithElementType).ElementType() + o.SqlStatements = types.ListValueMust(t, vs) +} + type SqlDashboardOutput struct { // The canonical identifier of the SQL warehouse. WarehouseId types.String `tfsdk:"warehouse_id" tf:"optional"` // Widgets executed in the run. Only SQL query based widgets are listed. - Widgets []SqlDashboardWidgetOutput `tfsdk:"widgets" tf:"optional"` + Widgets types.List `tfsdk:"widgets" tf:"optional"` } func (newState *SqlDashboardOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlDashboardOutput) { @@ -2855,11 +12246,74 @@ func (newState *SqlDashboardOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SqlDashboardOutput) SyncEffectiveFieldsDuringRead(existingState SqlDashboardOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlDashboardOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlDashboardOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "widgets": reflect.TypeOf(SqlDashboardWidgetOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlDashboardOutput +// only implements ToObjectValue() and Type(). +func (o SqlDashboardOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "warehouse_id": o.WarehouseId, + "widgets": o.Widgets, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlDashboardOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "warehouse_id": types.StringType, + "widgets": basetypes.ListType{ + ElemType: SqlDashboardWidgetOutput{}.Type(ctx), + }, + }, + } +} + +// GetWidgets returns the value of the Widgets field in SqlDashboardOutput as +// a slice of SqlDashboardWidgetOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlDashboardOutput) GetWidgets(ctx context.Context) ([]SqlDashboardWidgetOutput, bool) { + if o.Widgets.IsNull() || o.Widgets.IsUnknown() { + return nil, false + } + var v []SqlDashboardWidgetOutput + d := o.Widgets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWidgets sets the value of the Widgets field in SqlDashboardOutput. +func (o *SqlDashboardOutput) SetWidgets(ctx context.Context, v []SqlDashboardWidgetOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["widgets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Widgets = types.ListValueMust(t, vs) +} + type SqlDashboardWidgetOutput struct { // Time (in epoch milliseconds) when execution of the SQL widget ends. EndTime types.Int64 `tfsdk:"end_time" tf:"optional"` // The information about the error when execution fails. - Error []SqlOutputError `tfsdk:"error" tf:"optional,object"` + Error types.List `tfsdk:"error" tf:"optional,object"` // The link to find the output results. OutputLink types.String `tfsdk:"output_link" tf:"optional"` // Time (in epoch milliseconds) when execution of the SQL widget starts. @@ -2878,13 +12332,86 @@ func (newState *SqlDashboardWidgetOutput) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *SqlDashboardWidgetOutput) SyncEffectiveFieldsDuringRead(existingState SqlDashboardWidgetOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlDashboardWidgetOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlDashboardWidgetOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "error": reflect.TypeOf(SqlOutputError{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlDashboardWidgetOutput +// only implements ToObjectValue() and Type(). +func (o SqlDashboardWidgetOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end_time": o.EndTime, + "error": o.Error, + "output_link": o.OutputLink, + "start_time": o.StartTime, + "status": o.Status, + "widget_id": o.WidgetId, + "widget_title": o.WidgetTitle, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlDashboardWidgetOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end_time": types.Int64Type, + "error": basetypes.ListType{ + ElemType: SqlOutputError{}.Type(ctx), + }, + "output_link": types.StringType, + "start_time": types.Int64Type, + "status": types.StringType, + "widget_id": types.StringType, + "widget_title": types.StringType, + }, + } +} + +// GetError returns the value of the Error field in SqlDashboardWidgetOutput as +// a SqlOutputError value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlDashboardWidgetOutput) GetError(ctx context.Context) (SqlOutputError, bool) { + var e SqlOutputError + if o.Error.IsNull() || o.Error.IsUnknown() { + return e, false + } + var v []SqlOutputError + d := o.Error.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetError sets the value of the Error field in SqlDashboardWidgetOutput. +func (o *SqlDashboardWidgetOutput) SetError(ctx context.Context, v SqlOutputError) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["error"] + o.Error = types.ListValueMust(t, vs) +} + type SqlOutput struct { // The output of a SQL alert task, if available. - AlertOutput []SqlAlertOutput `tfsdk:"alert_output" tf:"optional,object"` + AlertOutput types.List `tfsdk:"alert_output" tf:"optional,object"` // The output of a SQL dashboard task, if available. - DashboardOutput []SqlDashboardOutput `tfsdk:"dashboard_output" tf:"optional,object"` + DashboardOutput types.List `tfsdk:"dashboard_output" tf:"optional,object"` // The output of a SQL query task, if available. - QueryOutput []SqlQueryOutput `tfsdk:"query_output" tf:"optional,object"` + QueryOutput types.List `tfsdk:"query_output" tf:"optional,object"` } func (newState *SqlOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlOutput) { @@ -2893,6 +12420,129 @@ func (newState *SqlOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlOutpu func (newState *SqlOutput) SyncEffectiveFieldsDuringRead(existingState SqlOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert_output": reflect.TypeOf(SqlAlertOutput{}), + "dashboard_output": reflect.TypeOf(SqlDashboardOutput{}), + "query_output": reflect.TypeOf(SqlQueryOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlOutput +// only implements ToObjectValue() and Type(). +func (o SqlOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_output": o.AlertOutput, + "dashboard_output": o.DashboardOutput, + "query_output": o.QueryOutput, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_output": basetypes.ListType{ + ElemType: SqlAlertOutput{}.Type(ctx), + }, + "dashboard_output": basetypes.ListType{ + ElemType: SqlDashboardOutput{}.Type(ctx), + }, + "query_output": basetypes.ListType{ + ElemType: SqlQueryOutput{}.Type(ctx), + }, + }, + } +} + +// GetAlertOutput returns the value of the AlertOutput field in SqlOutput as +// a SqlAlertOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlOutput) GetAlertOutput(ctx context.Context) (SqlAlertOutput, bool) { + var e SqlAlertOutput + if o.AlertOutput.IsNull() || o.AlertOutput.IsUnknown() { + return e, false + } + var v []SqlAlertOutput + d := o.AlertOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAlertOutput sets the value of the AlertOutput field in SqlOutput. +func (o *SqlOutput) SetAlertOutput(ctx context.Context, v SqlAlertOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert_output"] + o.AlertOutput = types.ListValueMust(t, vs) +} + +// GetDashboardOutput returns the value of the DashboardOutput field in SqlOutput as +// a SqlDashboardOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlOutput) GetDashboardOutput(ctx context.Context) (SqlDashboardOutput, bool) { + var e SqlDashboardOutput + if o.DashboardOutput.IsNull() || o.DashboardOutput.IsUnknown() { + return e, false + } + var v []SqlDashboardOutput + d := o.DashboardOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDashboardOutput sets the value of the DashboardOutput field in SqlOutput. +func (o *SqlOutput) SetDashboardOutput(ctx context.Context, v SqlDashboardOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dashboard_output"] + o.DashboardOutput = types.ListValueMust(t, vs) +} + +// GetQueryOutput returns the value of the QueryOutput field in SqlOutput as +// a SqlQueryOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlOutput) GetQueryOutput(ctx context.Context) (SqlQueryOutput, bool) { + var e SqlQueryOutput + if o.QueryOutput.IsNull() || o.QueryOutput.IsUnknown() { + return e, false + } + var v []SqlQueryOutput + d := o.QueryOutput.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueryOutput sets the value of the QueryOutput field in SqlOutput. +func (o *SqlOutput) SetQueryOutput(ctx context.Context, v SqlQueryOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query_output"] + o.QueryOutput = types.ListValueMust(t, vs) +} + type SqlOutputError struct { // The error message when execution fails. Message types.String `tfsdk:"message" tf:"optional"` @@ -2904,6 +12554,37 @@ func (newState *SqlOutputError) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sql func (newState *SqlOutputError) SyncEffectiveFieldsDuringRead(existingState SqlOutputError) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlOutputError. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlOutputError) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlOutputError +// only implements ToObjectValue() and Type(). +func (o SqlOutputError) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlOutputError) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + }, + } +} + type SqlQueryOutput struct { EndpointId types.String `tfsdk:"endpoint_id" tf:"optional"` // The link to find the output results. @@ -2912,7 +12593,7 @@ type SqlQueryOutput struct { // required to view this field. QueryText types.String `tfsdk:"query_text" tf:"optional"` // Information about SQL statements executed in the run. - SqlStatements []SqlStatementOutput `tfsdk:"sql_statements" tf:"optional"` + SqlStatements types.List `tfsdk:"sql_statements" tf:"optional"` // The canonical identifier of the SQL warehouse. WarehouseId types.String `tfsdk:"warehouse_id" tf:"optional"` } @@ -2923,6 +12604,75 @@ func (newState *SqlQueryOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sql func (newState *SqlQueryOutput) SyncEffectiveFieldsDuringRead(existingState SqlQueryOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlQueryOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlQueryOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sql_statements": reflect.TypeOf(SqlStatementOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlQueryOutput +// only implements ToObjectValue() and Type(). +func (o SqlQueryOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_id": o.EndpointId, + "output_link": o.OutputLink, + "query_text": o.QueryText, + "sql_statements": o.SqlStatements, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlQueryOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_id": types.StringType, + "output_link": types.StringType, + "query_text": types.StringType, + "sql_statements": basetypes.ListType{ + ElemType: SqlStatementOutput{}.Type(ctx), + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetSqlStatements returns the value of the SqlStatements field in SqlQueryOutput as +// a slice of SqlStatementOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlQueryOutput) GetSqlStatements(ctx context.Context) ([]SqlStatementOutput, bool) { + if o.SqlStatements.IsNull() || o.SqlStatements.IsUnknown() { + return nil, false + } + var v []SqlStatementOutput + d := o.SqlStatements.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSqlStatements sets the value of the SqlStatements field in SqlQueryOutput. +func (o *SqlQueryOutput) SetSqlStatements(ctx context.Context, v []SqlStatementOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_statements"] + t = t.(attr.TypeWithElementType).ElementType() + o.SqlStatements = types.ListValueMust(t, vs) +} + type SqlStatementOutput struct { // A key that can be used to look up query details. LookupKey types.String `tfsdk:"lookup_key" tf:"optional"` @@ -2934,19 +12684,50 @@ func (newState *SqlStatementOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SqlStatementOutput) SyncEffectiveFieldsDuringRead(existingState SqlStatementOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlStatementOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlStatementOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlStatementOutput +// only implements ToObjectValue() and Type(). +func (o SqlStatementOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "lookup_key": o.LookupKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlStatementOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "lookup_key": types.StringType, + }, + } +} + type SqlTask struct { // If alert, indicates that this job must refresh a SQL alert. - Alert []SqlTaskAlert `tfsdk:"alert" tf:"optional,object"` + Alert types.List `tfsdk:"alert" tf:"optional,object"` // If dashboard, indicates that this job must refresh a SQL dashboard. - Dashboard []SqlTaskDashboard `tfsdk:"dashboard" tf:"optional,object"` + Dashboard types.List `tfsdk:"dashboard" tf:"optional,object"` // If file, indicates that this job runs a SQL file in a remote Git // repository. - File []SqlTaskFile `tfsdk:"file" tf:"optional,object"` + File types.List `tfsdk:"file" tf:"optional,object"` // Parameters to be used for each run of this job. The SQL alert task does // not support custom parameters. - Parameters map[string]types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.Map `tfsdk:"parameters" tf:"optional"` // If query, indicates that this job must execute a SQL query. - Query []SqlTaskQuery `tfsdk:"query" tf:"optional,object"` + Query types.List `tfsdk:"query" tf:"optional,object"` // The canonical identifier of the SQL warehouse. Recommended to use with // serverless or pro SQL warehouses. Classic SQL warehouses are only // supported for SQL alert, dashboard and query tasks and are limited to @@ -2960,13 +12741,200 @@ func (newState *SqlTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlTask) { func (newState *SqlTask) SyncEffectiveFieldsDuringRead(existingState SqlTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert": reflect.TypeOf(SqlTaskAlert{}), + "dashboard": reflect.TypeOf(SqlTaskDashboard{}), + "file": reflect.TypeOf(SqlTaskFile{}), + "parameters": reflect.TypeOf(types.String{}), + "query": reflect.TypeOf(SqlTaskQuery{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlTask +// only implements ToObjectValue() and Type(). +func (o SqlTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert": o.Alert, + "dashboard": o.Dashboard, + "file": o.File, + "parameters": o.Parameters, + "query": o.Query, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert": basetypes.ListType{ + ElemType: SqlTaskAlert{}.Type(ctx), + }, + "dashboard": basetypes.ListType{ + ElemType: SqlTaskDashboard{}.Type(ctx), + }, + "file": basetypes.ListType{ + ElemType: SqlTaskFile{}.Type(ctx), + }, + "parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "query": basetypes.ListType{ + ElemType: SqlTaskQuery{}.Type(ctx), + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetAlert returns the value of the Alert field in SqlTask as +// a SqlTaskAlert value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTask) GetAlert(ctx context.Context) (SqlTaskAlert, bool) { + var e SqlTaskAlert + if o.Alert.IsNull() || o.Alert.IsUnknown() { + return e, false + } + var v []SqlTaskAlert + d := o.Alert.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAlert sets the value of the Alert field in SqlTask. +func (o *SqlTask) SetAlert(ctx context.Context, v SqlTaskAlert) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert"] + o.Alert = types.ListValueMust(t, vs) +} + +// GetDashboard returns the value of the Dashboard field in SqlTask as +// a SqlTaskDashboard value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTask) GetDashboard(ctx context.Context) (SqlTaskDashboard, bool) { + var e SqlTaskDashboard + if o.Dashboard.IsNull() || o.Dashboard.IsUnknown() { + return e, false + } + var v []SqlTaskDashboard + d := o.Dashboard.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDashboard sets the value of the Dashboard field in SqlTask. +func (o *SqlTask) SetDashboard(ctx context.Context, v SqlTaskDashboard) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dashboard"] + o.Dashboard = types.ListValueMust(t, vs) +} + +// GetFile returns the value of the File field in SqlTask as +// a SqlTaskFile value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTask) GetFile(ctx context.Context) (SqlTaskFile, bool) { + var e SqlTaskFile + if o.File.IsNull() || o.File.IsUnknown() { + return e, false + } + var v []SqlTaskFile + d := o.File.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFile sets the value of the File field in SqlTask. +func (o *SqlTask) SetFile(ctx context.Context, v SqlTaskFile) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file"] + o.File = types.ListValueMust(t, vs) +} + +// GetParameters returns the value of the Parameters field in SqlTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTask) GetParameters(ctx context.Context) (map[string]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in SqlTask. +func (o *SqlTask) SetParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.MapValueMust(t, vs) +} + +// GetQuery returns the value of the Query field in SqlTask as +// a SqlTaskQuery value. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTask) GetQuery(ctx context.Context) (SqlTaskQuery, bool) { + var e SqlTaskQuery + if o.Query.IsNull() || o.Query.IsUnknown() { + return e, false + } + var v []SqlTaskQuery + d := o.Query.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuery sets the value of the Query field in SqlTask. +func (o *SqlTask) SetQuery(ctx context.Context, v SqlTaskQuery) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query"] + o.Query = types.ListValueMust(t, vs) +} + type SqlTaskAlert struct { // The canonical identifier of the SQL alert. AlertId types.String `tfsdk:"alert_id" tf:""` // If true, the alert notifications are not sent to subscribers. PauseSubscriptions types.Bool `tfsdk:"pause_subscriptions" tf:"optional"` // If specified, alert notifications are sent to subscribers. - Subscriptions []SqlTaskSubscription `tfsdk:"subscriptions" tf:"optional"` + Subscriptions types.List `tfsdk:"subscriptions" tf:"optional"` } func (newState *SqlTaskAlert) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlTaskAlert) { @@ -2975,6 +12943,71 @@ func (newState *SqlTaskAlert) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlTa func (newState *SqlTaskAlert) SyncEffectiveFieldsDuringRead(existingState SqlTaskAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlTaskAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlTaskAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "subscriptions": reflect.TypeOf(SqlTaskSubscription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlTaskAlert +// only implements ToObjectValue() and Type(). +func (o SqlTaskAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_id": o.AlertId, + "pause_subscriptions": o.PauseSubscriptions, + "subscriptions": o.Subscriptions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlTaskAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_id": types.StringType, + "pause_subscriptions": types.BoolType, + "subscriptions": basetypes.ListType{ + ElemType: SqlTaskSubscription{}.Type(ctx), + }, + }, + } +} + +// GetSubscriptions returns the value of the Subscriptions field in SqlTaskAlert as +// a slice of SqlTaskSubscription values. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTaskAlert) GetSubscriptions(ctx context.Context) ([]SqlTaskSubscription, bool) { + if o.Subscriptions.IsNull() || o.Subscriptions.IsUnknown() { + return nil, false + } + var v []SqlTaskSubscription + d := o.Subscriptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSubscriptions sets the value of the Subscriptions field in SqlTaskAlert. +func (o *SqlTaskAlert) SetSubscriptions(ctx context.Context, v []SqlTaskSubscription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subscriptions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Subscriptions = types.ListValueMust(t, vs) +} + type SqlTaskDashboard struct { // Subject of the email sent to subscribers of this task. CustomSubject types.String `tfsdk:"custom_subject" tf:"optional"` @@ -2984,7 +13017,7 @@ type SqlTaskDashboard struct { // subscribers. PauseSubscriptions types.Bool `tfsdk:"pause_subscriptions" tf:"optional"` // If specified, dashboard snapshots are sent to subscriptions. - Subscriptions []SqlTaskSubscription `tfsdk:"subscriptions" tf:"optional"` + Subscriptions types.List `tfsdk:"subscriptions" tf:"optional"` } func (newState *SqlTaskDashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlTaskDashboard) { @@ -2993,6 +13026,73 @@ func (newState *SqlTaskDashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *SqlTaskDashboard) SyncEffectiveFieldsDuringRead(existingState SqlTaskDashboard) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlTaskDashboard. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlTaskDashboard) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "subscriptions": reflect.TypeOf(SqlTaskSubscription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlTaskDashboard +// only implements ToObjectValue() and Type(). +func (o SqlTaskDashboard) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "custom_subject": o.CustomSubject, + "dashboard_id": o.DashboardId, + "pause_subscriptions": o.PauseSubscriptions, + "subscriptions": o.Subscriptions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlTaskDashboard) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "custom_subject": types.StringType, + "dashboard_id": types.StringType, + "pause_subscriptions": types.BoolType, + "subscriptions": basetypes.ListType{ + ElemType: SqlTaskSubscription{}.Type(ctx), + }, + }, + } +} + +// GetSubscriptions returns the value of the Subscriptions field in SqlTaskDashboard as +// a slice of SqlTaskSubscription values. +// If the field is unknown or null, the boolean return value is false. +func (o *SqlTaskDashboard) GetSubscriptions(ctx context.Context) ([]SqlTaskSubscription, bool) { + if o.Subscriptions.IsNull() || o.Subscriptions.IsUnknown() { + return nil, false + } + var v []SqlTaskSubscription + d := o.Subscriptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSubscriptions sets the value of the Subscriptions field in SqlTaskDashboard. +func (o *SqlTaskDashboard) SetSubscriptions(ctx context.Context, v []SqlTaskSubscription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subscriptions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Subscriptions = types.ListValueMust(t, vs) +} + type SqlTaskFile struct { // Path of the SQL file. Must be relative if the source is a remote Git // repository and absolute for workspace paths. @@ -3014,6 +13114,39 @@ func (newState *SqlTaskFile) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlTas func (newState *SqlTaskFile) SyncEffectiveFieldsDuringRead(existingState SqlTaskFile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlTaskFile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlTaskFile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlTaskFile +// only implements ToObjectValue() and Type(). +func (o SqlTaskFile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + "source": o.Source, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlTaskFile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + "source": types.StringType, + }, + } +} + type SqlTaskQuery struct { // The canonical identifier of the SQL query. QueryId types.String `tfsdk:"query_id" tf:""` @@ -3025,6 +13158,37 @@ func (newState *SqlTaskQuery) SyncEffectiveFieldsDuringCreateOrUpdate(plan SqlTa func (newState *SqlTaskQuery) SyncEffectiveFieldsDuringRead(existingState SqlTaskQuery) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlTaskQuery. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlTaskQuery) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlTaskQuery +// only implements ToObjectValue() and Type(). +func (o SqlTaskQuery) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query_id": o.QueryId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlTaskQuery) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query_id": types.StringType, + }, + } +} + type SqlTaskSubscription struct { // The canonical identifier of the destination to receive email // notification. This parameter is mutually exclusive with user_name. You @@ -3043,18 +13207,51 @@ func (newState *SqlTaskSubscription) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *SqlTaskSubscription) SyncEffectiveFieldsDuringRead(existingState SqlTaskSubscription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SqlTaskSubscription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SqlTaskSubscription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SqlTaskSubscription +// only implements ToObjectValue() and Type(). +func (o SqlTaskSubscription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_id": o.DestinationId, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SqlTaskSubscription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_id": types.StringType, + "user_name": types.StringType, + }, + } +} + type SubmitRun struct { // List of permissions to set on the job. - AccessControlList []JobAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The user specified id of the budget policy to use for this one-time run. // If not specified, the run will be not be attributed to any budget policy. BudgetPolicyId types.String `tfsdk:"budget_policy_id" tf:"optional"` // An optional set of email addresses notified when the run begins or // completes. - EmailNotifications []JobEmailNotifications `tfsdk:"email_notifications" tf:"optional,object"` + EmailNotifications types.List `tfsdk:"email_notifications" tf:"optional,object"` // A list of task execution environment specifications that can be // referenced by tasks of this run. - Environments []JobEnvironment `tfsdk:"environments" tf:"optional"` + Environments types.List `tfsdk:"environments" tf:"optional"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by // notebook, dbt, Python script, and SQL File tasks. @@ -3065,9 +13262,9 @@ type SubmitRun struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - GitSource []GitSource `tfsdk:"git_source" tf:"optional,object"` + GitSource types.List `tfsdk:"git_source" tf:"optional,object"` // An optional set of health rules that can be defined for this job. - Health []JobsHealthRules `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // An optional token that can be used to guarantee the idempotency of job // run requests. If a run with the provided token already exists, the // request does not create a new run but returns the ID of the existing run @@ -3087,22 +13284,22 @@ type SubmitRun struct { // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // run. - NotificationSettings []JobNotificationSettings `tfsdk:"notification_settings" tf:"optional,object"` + NotificationSettings types.List `tfsdk:"notification_settings" tf:"optional,object"` // The queue settings of the one-time run. - Queue []QueueSettings `tfsdk:"queue" tf:"optional,object"` + Queue types.List `tfsdk:"queue" tf:"optional,object"` // Specifies the user or service principal that the job runs as. If not // specified, the job runs as the user who submits the request. - RunAs []JobRunAs `tfsdk:"run_as" tf:"optional,object"` + RunAs types.List `tfsdk:"run_as" tf:"optional,object"` // An optional name for the run. The default value is `Untitled`. RunName types.String `tfsdk:"run_name" tf:"optional"` - Tasks []SubmitTask `tfsdk:"tasks" tf:"optional"` + Tasks types.List `tfsdk:"tasks" tf:"optional"` // An optional timeout applied to each run of this job. A value of `0` means // no timeout. TimeoutSeconds types.Int64 `tfsdk:"timeout_seconds" tf:"optional"` // A collection of system notification IDs to notify when the run begins or // completes. - WebhookNotifications []WebhookNotifications `tfsdk:"webhook_notifications" tf:"optional,object"` + WebhookNotifications types.List `tfsdk:"webhook_notifications" tf:"optional,object"` } func (newState *SubmitRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan SubmitRun) { @@ -3111,6 +13308,354 @@ func (newState *SubmitRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan SubmitRu func (newState *SubmitRun) SyncEffectiveFieldsDuringRead(existingState SubmitRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SubmitRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SubmitRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(JobAccessControlRequest{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "environments": reflect.TypeOf(JobEnvironment{}), + "git_source": reflect.TypeOf(GitSource{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "notification_settings": reflect.TypeOf(JobNotificationSettings{}), + "queue": reflect.TypeOf(QueueSettings{}), + "run_as": reflect.TypeOf(JobRunAs{}), + "tasks": reflect.TypeOf(SubmitTask{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SubmitRun +// only implements ToObjectValue() and Type(). +func (o SubmitRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "budget_policy_id": o.BudgetPolicyId, + "email_notifications": o.EmailNotifications, + "environments": o.Environments, + "git_source": o.GitSource, + "health": o.Health, + "idempotency_token": o.IdempotencyToken, + "notification_settings": o.NotificationSettings, + "queue": o.Queue, + "run_as": o.RunAs, + "run_name": o.RunName, + "tasks": o.Tasks, + "timeout_seconds": o.TimeoutSeconds, + "webhook_notifications": o.WebhookNotifications, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SubmitRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: JobAccessControlRequest{}.Type(ctx), + }, + "budget_policy_id": types.StringType, + "email_notifications": basetypes.ListType{ + ElemType: JobEmailNotifications{}.Type(ctx), + }, + "environments": basetypes.ListType{ + ElemType: JobEnvironment{}.Type(ctx), + }, + "git_source": basetypes.ListType{ + ElemType: GitSource{}.Type(ctx), + }, + "health": basetypes.ListType{ + ElemType: JobsHealthRules{}.Type(ctx), + }, + "idempotency_token": types.StringType, + "notification_settings": basetypes.ListType{ + ElemType: JobNotificationSettings{}.Type(ctx), + }, + "queue": basetypes.ListType{ + ElemType: QueueSettings{}.Type(ctx), + }, + "run_as": basetypes.ListType{ + ElemType: JobRunAs{}.Type(ctx), + }, + "run_name": types.StringType, + "tasks": basetypes.ListType{ + ElemType: SubmitTask{}.Type(ctx), + }, + "timeout_seconds": types.Int64Type, + "webhook_notifications": basetypes.ListType{ + ElemType: WebhookNotifications{}.Type(ctx), + }, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in SubmitRun as +// a slice of JobAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetAccessControlList(ctx context.Context) ([]JobAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []JobAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in SubmitRun. +func (o *SubmitRun) SetAccessControlList(ctx context.Context, v []JobAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + +// GetEmailNotifications returns the value of the EmailNotifications field in SubmitRun as +// a JobEmailNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetEmailNotifications(ctx context.Context) (JobEmailNotifications, bool) { + var e JobEmailNotifications + if o.EmailNotifications.IsNull() || o.EmailNotifications.IsUnknown() { + return e, false + } + var v []JobEmailNotifications + d := o.EmailNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmailNotifications sets the value of the EmailNotifications field in SubmitRun. +func (o *SubmitRun) SetEmailNotifications(ctx context.Context, v JobEmailNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_notifications"] + o.EmailNotifications = types.ListValueMust(t, vs) +} + +// GetEnvironments returns the value of the Environments field in SubmitRun as +// a slice of JobEnvironment values. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetEnvironments(ctx context.Context) ([]JobEnvironment, bool) { + if o.Environments.IsNull() || o.Environments.IsUnknown() { + return nil, false + } + var v []JobEnvironment + d := o.Environments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironments sets the value of the Environments field in SubmitRun. +func (o *SubmitRun) SetEnvironments(ctx context.Context, v []JobEnvironment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environments"] + t = t.(attr.TypeWithElementType).ElementType() + o.Environments = types.ListValueMust(t, vs) +} + +// GetGitSource returns the value of the GitSource field in SubmitRun as +// a GitSource value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetGitSource(ctx context.Context) (GitSource, bool) { + var e GitSource + if o.GitSource.IsNull() || o.GitSource.IsUnknown() { + return e, false + } + var v []GitSource + d := o.GitSource.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitSource sets the value of the GitSource field in SubmitRun. +func (o *SubmitRun) SetGitSource(ctx context.Context, v GitSource) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_source"] + o.GitSource = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in SubmitRun as +// a JobsHealthRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetHealth(ctx context.Context) (JobsHealthRules, bool) { + var e JobsHealthRules + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []JobsHealthRules + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in SubmitRun. +func (o *SubmitRun) SetHealth(ctx context.Context, v JobsHealthRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetNotificationSettings returns the value of the NotificationSettings field in SubmitRun as +// a JobNotificationSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetNotificationSettings(ctx context.Context) (JobNotificationSettings, bool) { + var e JobNotificationSettings + if o.NotificationSettings.IsNull() || o.NotificationSettings.IsUnknown() { + return e, false + } + var v []JobNotificationSettings + d := o.NotificationSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotificationSettings sets the value of the NotificationSettings field in SubmitRun. +func (o *SubmitRun) SetNotificationSettings(ctx context.Context, v JobNotificationSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notification_settings"] + o.NotificationSettings = types.ListValueMust(t, vs) +} + +// GetQueue returns the value of the Queue field in SubmitRun as +// a QueueSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetQueue(ctx context.Context) (QueueSettings, bool) { + var e QueueSettings + if o.Queue.IsNull() || o.Queue.IsUnknown() { + return e, false + } + var v []QueueSettings + d := o.Queue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueue sets the value of the Queue field in SubmitRun. +func (o *SubmitRun) SetQueue(ctx context.Context, v QueueSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["queue"] + o.Queue = types.ListValueMust(t, vs) +} + +// GetRunAs returns the value of the RunAs field in SubmitRun as +// a JobRunAs value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetRunAs(ctx context.Context) (JobRunAs, bool) { + var e JobRunAs + if o.RunAs.IsNull() || o.RunAs.IsUnknown() { + return e, false + } + var v []JobRunAs + d := o.RunAs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunAs sets the value of the RunAs field in SubmitRun. +func (o *SubmitRun) SetRunAs(ctx context.Context, v JobRunAs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_as"] + o.RunAs = types.ListValueMust(t, vs) +} + +// GetTasks returns the value of the Tasks field in SubmitRun as +// a slice of SubmitTask values. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetTasks(ctx context.Context) ([]SubmitTask, bool) { + if o.Tasks.IsNull() || o.Tasks.IsUnknown() { + return nil, false + } + var v []SubmitTask + d := o.Tasks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTasks sets the value of the Tasks field in SubmitRun. +func (o *SubmitRun) SetTasks(ctx context.Context, v []SubmitTask) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tasks"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tasks = types.ListValueMust(t, vs) +} + +// GetWebhookNotifications returns the value of the WebhookNotifications field in SubmitRun as +// a WebhookNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitRun) GetWebhookNotifications(ctx context.Context) (WebhookNotifications, bool) { + var e WebhookNotifications + if o.WebhookNotifications.IsNull() || o.WebhookNotifications.IsUnknown() { + return e, false + } + var v []WebhookNotifications + d := o.WebhookNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhookNotifications sets the value of the WebhookNotifications field in SubmitRun. +func (o *SubmitRun) SetWebhookNotifications(ctx context.Context, v WebhookNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook_notifications"] + o.WebhookNotifications = types.ListValueMust(t, vs) +} + // Run was created and started successfully. type SubmitRunResponse struct { // The canonical identifier for the newly submitted run. @@ -3123,26 +13668,57 @@ func (newState *SubmitRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SubmitRunResponse) SyncEffectiveFieldsDuringRead(existingState SubmitRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SubmitRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SubmitRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SubmitRunResponse +// only implements ToObjectValue() and Type(). +func (o SubmitRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SubmitRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + }, + } +} + type SubmitTask struct { // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries // or notifications. - ConditionTask []ConditionTask `tfsdk:"condition_task" tf:"optional,object"` + ConditionTask types.List `tfsdk:"condition_task" tf:"optional,object"` // The task runs one or more dbt commands when the `dbt_task` field is // present. The dbt task requires both Databricks SQL and the ability to use // a serverless or a pro SQL warehouse. - DbtTask []DbtTask `tfsdk:"dbt_task" tf:"optional,object"` + DbtTask types.List `tfsdk:"dbt_task" tf:"optional,object"` // An optional array of objects specifying the dependency graph of the task. // All tasks specified in this field must complete successfully before // executing this task. The key is `task_key`, and the value is the name // assigned to the dependent task. - DependsOn []TaskDependency `tfsdk:"depends_on" tf:"optional"` + DependsOn types.List `tfsdk:"depends_on" tf:"optional"` // An optional description for this task. Description types.String `tfsdk:"description" tf:"optional"` // An optional set of email addresses notified when the task run begins or // completes. The default behavior is to not send any emails. - EmailNotifications []JobEmailNotifications `tfsdk:"email_notifications" tf:"optional,object"` + EmailNotifications types.List `tfsdk:"email_notifications" tf:"optional,object"` // The key that references an environment spec in a job. This field is // required for Python script, Python wheel and dbt tasks when using // serverless compute. @@ -3154,39 +13730,39 @@ type SubmitTask struct { ExistingClusterId types.String `tfsdk:"existing_cluster_id" tf:"optional"` // The task executes a nested task for every input provided when the // `for_each_task` field is present. - ForEachTask []ForEachTask `tfsdk:"for_each_task" tf:"optional,object"` + ForEachTask types.List `tfsdk:"for_each_task" tf:"optional,object"` // An optional set of health rules that can be defined for this job. - Health []JobsHealthRules `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - Libraries compute.Library `tfsdk:"library" tf:"optional"` + Libraries types.List `tfsdk:"library" tf:"optional"` // If new_cluster, a description of a new cluster that is created for each // run. - NewCluster compute.ClusterSpec `tfsdk:"new_cluster" tf:"optional,object"` + NewCluster types.List `tfsdk:"new_cluster" tf:"optional,object"` // The task runs a notebook when the `notebook_task` field is present. - NotebookTask []NotebookTask `tfsdk:"notebook_task" tf:"optional,object"` + NotebookTask types.List `tfsdk:"notebook_task" tf:"optional,object"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // task run. - NotificationSettings []TaskNotificationSettings `tfsdk:"notification_settings" tf:"optional,object"` + NotificationSettings types.List `tfsdk:"notification_settings" tf:"optional,object"` // The task triggers a pipeline update when the `pipeline_task` field is // present. Only pipelines configured to use triggered more are supported. - PipelineTask []PipelineTask `tfsdk:"pipeline_task" tf:"optional,object"` + PipelineTask types.List `tfsdk:"pipeline_task" tf:"optional,object"` // The task runs a Python wheel when the `python_wheel_task` field is // present. - PythonWheelTask []PythonWheelTask `tfsdk:"python_wheel_task" tf:"optional,object"` + PythonWheelTask types.List `tfsdk:"python_wheel_task" tf:"optional,object"` // An optional value indicating the condition that determines whether the // task should be run once its dependencies have been completed. When // omitted, defaults to `ALL_SUCCESS`. See :method:jobs/create for a list of // possible values. RunIf types.String `tfsdk:"run_if" tf:"optional"` // The task triggers another job when the `run_job_task` field is present. - RunJobTask []RunJobTask `tfsdk:"run_job_task" tf:"optional,object"` + RunJobTask types.List `tfsdk:"run_job_task" tf:"optional,object"` // The task runs a JAR when the `spark_jar_task` field is present. - SparkJarTask []SparkJarTask `tfsdk:"spark_jar_task" tf:"optional,object"` + SparkJarTask types.List `tfsdk:"spark_jar_task" tf:"optional,object"` // The task runs a Python file when the `spark_python_task` field is // present. - SparkPythonTask []SparkPythonTask `tfsdk:"spark_python_task" tf:"optional,object"` + SparkPythonTask types.List `tfsdk:"spark_python_task" tf:"optional,object"` // (Legacy) The task runs the spark-submit script when the // `spark_submit_task` field is present. This task can run only on new // clusters and is not compatible with serverless compute. @@ -3205,10 +13781,10 @@ type SubmitTask struct { // // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 // paths. - SparkSubmitTask []SparkSubmitTask `tfsdk:"spark_submit_task" tf:"optional,object"` + SparkSubmitTask types.List `tfsdk:"spark_submit_task" tf:"optional,object"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. - SqlTask []SqlTask `tfsdk:"sql_task" tf:"optional,object"` + SqlTask types.List `tfsdk:"sql_task" tf:"optional,object"` // A unique name for the task. This field is used to refer to this task from // other tasks. This field is required and must be unique within its parent // job. On Update or Reset, this field is used to reference the tasks to be @@ -3220,7 +13796,7 @@ type SubmitTask struct { // A collection of system notification IDs to notify when the run begins or // completes. The default behavior is to not send any system notifications. // Task webhooks respect the task notification settings. - WebhookNotifications []WebhookNotifications `tfsdk:"webhook_notifications" tf:"optional,object"` + WebhookNotifications types.List `tfsdk:"webhook_notifications" tf:"optional,object"` } func (newState *SubmitTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan SubmitTask) { @@ -3229,6 +13805,606 @@ func (newState *SubmitTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan SubmitT func (newState *SubmitTask) SyncEffectiveFieldsDuringRead(existingState SubmitTask) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SubmitTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SubmitTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition_task": reflect.TypeOf(ConditionTask{}), + "dbt_task": reflect.TypeOf(DbtTask{}), + "depends_on": reflect.TypeOf(TaskDependency{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "for_each_task": reflect.TypeOf(ForEachTask{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + "notebook_task": reflect.TypeOf(NotebookTask{}), + "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), + "pipeline_task": reflect.TypeOf(PipelineTask{}), + "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), + "run_job_task": reflect.TypeOf(RunJobTask{}), + "spark_jar_task": reflect.TypeOf(SparkJarTask{}), + "spark_python_task": reflect.TypeOf(SparkPythonTask{}), + "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), + "sql_task": reflect.TypeOf(SqlTask{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SubmitTask +// only implements ToObjectValue() and Type(). +func (o SubmitTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition_task": o.ConditionTask, + "dbt_task": o.DbtTask, + "depends_on": o.DependsOn, + "description": o.Description, + "email_notifications": o.EmailNotifications, + "environment_key": o.EnvironmentKey, + "existing_cluster_id": o.ExistingClusterId, + "for_each_task": o.ForEachTask, + "health": o.Health, + "library": o.Libraries, + "new_cluster": o.NewCluster, + "notebook_task": o.NotebookTask, + "notification_settings": o.NotificationSettings, + "pipeline_task": o.PipelineTask, + "python_wheel_task": o.PythonWheelTask, + "run_if": o.RunIf, + "run_job_task": o.RunJobTask, + "spark_jar_task": o.SparkJarTask, + "spark_python_task": o.SparkPythonTask, + "spark_submit_task": o.SparkSubmitTask, + "sql_task": o.SqlTask, + "task_key": o.TaskKey, + "timeout_seconds": o.TimeoutSeconds, + "webhook_notifications": o.WebhookNotifications, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SubmitTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition_task": basetypes.ListType{ + ElemType: ConditionTask{}.Type(ctx), + }, + "dbt_task": basetypes.ListType{ + ElemType: DbtTask{}.Type(ctx), + }, + "depends_on": basetypes.ListType{ + ElemType: TaskDependency{}.Type(ctx), + }, + "description": types.StringType, + "email_notifications": basetypes.ListType{ + ElemType: JobEmailNotifications{}.Type(ctx), + }, + "environment_key": types.StringType, + "existing_cluster_id": types.StringType, + "for_each_task": basetypes.ListType{ + ElemType: ForEachTask{}.Type(ctx), + }, + "health": basetypes.ListType{ + ElemType: JobsHealthRules{}.Type(ctx), + }, + "library": basetypes.ListType{ + ElemType: compute_tf.Library{}.Type(ctx), + }, + "new_cluster": basetypes.ListType{ + ElemType: compute_tf.ClusterSpec{}.Type(ctx), + }, + "notebook_task": basetypes.ListType{ + ElemType: NotebookTask{}.Type(ctx), + }, + "notification_settings": basetypes.ListType{ + ElemType: TaskNotificationSettings{}.Type(ctx), + }, + "pipeline_task": basetypes.ListType{ + ElemType: PipelineTask{}.Type(ctx), + }, + "python_wheel_task": basetypes.ListType{ + ElemType: PythonWheelTask{}.Type(ctx), + }, + "run_if": types.StringType, + "run_job_task": basetypes.ListType{ + ElemType: RunJobTask{}.Type(ctx), + }, + "spark_jar_task": basetypes.ListType{ + ElemType: SparkJarTask{}.Type(ctx), + }, + "spark_python_task": basetypes.ListType{ + ElemType: SparkPythonTask{}.Type(ctx), + }, + "spark_submit_task": basetypes.ListType{ + ElemType: SparkSubmitTask{}.Type(ctx), + }, + "sql_task": basetypes.ListType{ + ElemType: SqlTask{}.Type(ctx), + }, + "task_key": types.StringType, + "timeout_seconds": types.Int64Type, + "webhook_notifications": basetypes.ListType{ + ElemType: WebhookNotifications{}.Type(ctx), + }, + }, + } +} + +// GetConditionTask returns the value of the ConditionTask field in SubmitTask as +// a ConditionTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetConditionTask(ctx context.Context) (ConditionTask, bool) { + var e ConditionTask + if o.ConditionTask.IsNull() || o.ConditionTask.IsUnknown() { + return e, false + } + var v []ConditionTask + d := o.ConditionTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConditionTask sets the value of the ConditionTask field in SubmitTask. +func (o *SubmitTask) SetConditionTask(ctx context.Context, v ConditionTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition_task"] + o.ConditionTask = types.ListValueMust(t, vs) +} + +// GetDbtTask returns the value of the DbtTask field in SubmitTask as +// a DbtTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetDbtTask(ctx context.Context) (DbtTask, bool) { + var e DbtTask + if o.DbtTask.IsNull() || o.DbtTask.IsUnknown() { + return e, false + } + var v []DbtTask + d := o.DbtTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbtTask sets the value of the DbtTask field in SubmitTask. +func (o *SubmitTask) SetDbtTask(ctx context.Context, v DbtTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_task"] + o.DbtTask = types.ListValueMust(t, vs) +} + +// GetDependsOn returns the value of the DependsOn field in SubmitTask as +// a slice of TaskDependency values. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetDependsOn(ctx context.Context) ([]TaskDependency, bool) { + if o.DependsOn.IsNull() || o.DependsOn.IsUnknown() { + return nil, false + } + var v []TaskDependency + d := o.DependsOn.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDependsOn sets the value of the DependsOn field in SubmitTask. +func (o *SubmitTask) SetDependsOn(ctx context.Context, v []TaskDependency) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["depends_on"] + t = t.(attr.TypeWithElementType).ElementType() + o.DependsOn = types.ListValueMust(t, vs) +} + +// GetEmailNotifications returns the value of the EmailNotifications field in SubmitTask as +// a JobEmailNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetEmailNotifications(ctx context.Context) (JobEmailNotifications, bool) { + var e JobEmailNotifications + if o.EmailNotifications.IsNull() || o.EmailNotifications.IsUnknown() { + return e, false + } + var v []JobEmailNotifications + d := o.EmailNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmailNotifications sets the value of the EmailNotifications field in SubmitTask. +func (o *SubmitTask) SetEmailNotifications(ctx context.Context, v JobEmailNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_notifications"] + o.EmailNotifications = types.ListValueMust(t, vs) +} + +// GetForEachTask returns the value of the ForEachTask field in SubmitTask as +// a ForEachTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetForEachTask(ctx context.Context) (ForEachTask, bool) { + var e ForEachTask + if o.ForEachTask.IsNull() || o.ForEachTask.IsUnknown() { + return e, false + } + var v []ForEachTask + d := o.ForEachTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetForEachTask sets the value of the ForEachTask field in SubmitTask. +func (o *SubmitTask) SetForEachTask(ctx context.Context, v ForEachTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["for_each_task"] + o.ForEachTask = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in SubmitTask as +// a JobsHealthRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetHealth(ctx context.Context) (JobsHealthRules, bool) { + var e JobsHealthRules + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []JobsHealthRules + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in SubmitTask. +func (o *SubmitTask) SetHealth(ctx context.Context, v JobsHealthRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetLibraries returns the value of the Libraries field in SubmitTask as +// a slice of compute_tf.Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetLibraries(ctx context.Context) ([]compute_tf.Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []compute_tf.Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in SubmitTask. +func (o *SubmitTask) SetLibraries(ctx context.Context, v []compute_tf.Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["library"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNewCluster returns the value of the NewCluster field in SubmitTask as +// a compute_tf.ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetNewCluster(ctx context.Context) (compute_tf.ClusterSpec, bool) { + var e compute_tf.ClusterSpec + if o.NewCluster.IsNull() || o.NewCluster.IsUnknown() { + return e, false + } + var v []compute_tf.ClusterSpec + d := o.NewCluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewCluster sets the value of the NewCluster field in SubmitTask. +func (o *SubmitTask) SetNewCluster(ctx context.Context, v compute_tf.ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_cluster"] + o.NewCluster = types.ListValueMust(t, vs) +} + +// GetNotebookTask returns the value of the NotebookTask field in SubmitTask as +// a NotebookTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetNotebookTask(ctx context.Context) (NotebookTask, bool) { + var e NotebookTask + if o.NotebookTask.IsNull() || o.NotebookTask.IsUnknown() { + return e, false + } + var v []NotebookTask + d := o.NotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebookTask sets the value of the NotebookTask field in SubmitTask. +func (o *SubmitTask) SetNotebookTask(ctx context.Context, v NotebookTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_task"] + o.NotebookTask = types.ListValueMust(t, vs) +} + +// GetNotificationSettings returns the value of the NotificationSettings field in SubmitTask as +// a TaskNotificationSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetNotificationSettings(ctx context.Context) (TaskNotificationSettings, bool) { + var e TaskNotificationSettings + if o.NotificationSettings.IsNull() || o.NotificationSettings.IsUnknown() { + return e, false + } + var v []TaskNotificationSettings + d := o.NotificationSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotificationSettings sets the value of the NotificationSettings field in SubmitTask. +func (o *SubmitTask) SetNotificationSettings(ctx context.Context, v TaskNotificationSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notification_settings"] + o.NotificationSettings = types.ListValueMust(t, vs) +} + +// GetPipelineTask returns the value of the PipelineTask field in SubmitTask as +// a PipelineTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetPipelineTask(ctx context.Context) (PipelineTask, bool) { + var e PipelineTask + if o.PipelineTask.IsNull() || o.PipelineTask.IsUnknown() { + return e, false + } + var v []PipelineTask + d := o.PipelineTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineTask sets the value of the PipelineTask field in SubmitTask. +func (o *SubmitTask) SetPipelineTask(ctx context.Context, v PipelineTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_task"] + o.PipelineTask = types.ListValueMust(t, vs) +} + +// GetPythonWheelTask returns the value of the PythonWheelTask field in SubmitTask as +// a PythonWheelTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetPythonWheelTask(ctx context.Context) (PythonWheelTask, bool) { + var e PythonWheelTask + if o.PythonWheelTask.IsNull() || o.PythonWheelTask.IsUnknown() { + return e, false + } + var v []PythonWheelTask + d := o.PythonWheelTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPythonWheelTask sets the value of the PythonWheelTask field in SubmitTask. +func (o *SubmitTask) SetPythonWheelTask(ctx context.Context, v PythonWheelTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_wheel_task"] + o.PythonWheelTask = types.ListValueMust(t, vs) +} + +// GetRunJobTask returns the value of the RunJobTask field in SubmitTask as +// a RunJobTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetRunJobTask(ctx context.Context) (RunJobTask, bool) { + var e RunJobTask + if o.RunJobTask.IsNull() || o.RunJobTask.IsUnknown() { + return e, false + } + var v []RunJobTask + d := o.RunJobTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunJobTask sets the value of the RunJobTask field in SubmitTask. +func (o *SubmitTask) SetRunJobTask(ctx context.Context, v RunJobTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_job_task"] + o.RunJobTask = types.ListValueMust(t, vs) +} + +// GetSparkJarTask returns the value of the SparkJarTask field in SubmitTask as +// a SparkJarTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetSparkJarTask(ctx context.Context) (SparkJarTask, bool) { + var e SparkJarTask + if o.SparkJarTask.IsNull() || o.SparkJarTask.IsUnknown() { + return e, false + } + var v []SparkJarTask + d := o.SparkJarTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkJarTask sets the value of the SparkJarTask field in SubmitTask. +func (o *SubmitTask) SetSparkJarTask(ctx context.Context, v SparkJarTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_jar_task"] + o.SparkJarTask = types.ListValueMust(t, vs) +} + +// GetSparkPythonTask returns the value of the SparkPythonTask field in SubmitTask as +// a SparkPythonTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetSparkPythonTask(ctx context.Context) (SparkPythonTask, bool) { + var e SparkPythonTask + if o.SparkPythonTask.IsNull() || o.SparkPythonTask.IsUnknown() { + return e, false + } + var v []SparkPythonTask + d := o.SparkPythonTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkPythonTask sets the value of the SparkPythonTask field in SubmitTask. +func (o *SubmitTask) SetSparkPythonTask(ctx context.Context, v SparkPythonTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_python_task"] + o.SparkPythonTask = types.ListValueMust(t, vs) +} + +// GetSparkSubmitTask returns the value of the SparkSubmitTask field in SubmitTask as +// a SparkSubmitTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetSparkSubmitTask(ctx context.Context) (SparkSubmitTask, bool) { + var e SparkSubmitTask + if o.SparkSubmitTask.IsNull() || o.SparkSubmitTask.IsUnknown() { + return e, false + } + var v []SparkSubmitTask + d := o.SparkSubmitTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkSubmitTask sets the value of the SparkSubmitTask field in SubmitTask. +func (o *SubmitTask) SetSparkSubmitTask(ctx context.Context, v SparkSubmitTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_task"] + o.SparkSubmitTask = types.ListValueMust(t, vs) +} + +// GetSqlTask returns the value of the SqlTask field in SubmitTask as +// a SqlTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetSqlTask(ctx context.Context) (SqlTask, bool) { + var e SqlTask + if o.SqlTask.IsNull() || o.SqlTask.IsUnknown() { + return e, false + } + var v []SqlTask + d := o.SqlTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlTask sets the value of the SqlTask field in SubmitTask. +func (o *SubmitTask) SetSqlTask(ctx context.Context, v SqlTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_task"] + o.SqlTask = types.ListValueMust(t, vs) +} + +// GetWebhookNotifications returns the value of the WebhookNotifications field in SubmitTask as +// a WebhookNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetWebhookNotifications(ctx context.Context) (WebhookNotifications, bool) { + var e WebhookNotifications + if o.WebhookNotifications.IsNull() || o.WebhookNotifications.IsUnknown() { + return e, false + } + var v []WebhookNotifications + d := o.WebhookNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhookNotifications sets the value of the WebhookNotifications field in SubmitTask. +func (o *SubmitTask) SetWebhookNotifications(ctx context.Context, v WebhookNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook_notifications"] + o.WebhookNotifications = types.ListValueMust(t, vs) +} + type TableUpdateTriggerConfiguration struct { // The table(s) condition based on which to trigger a job run. Condition types.String `tfsdk:"condition" tf:"optional"` @@ -3238,7 +14414,7 @@ type TableUpdateTriggerConfiguration struct { MinTimeBetweenTriggersSeconds types.Int64 `tfsdk:"min_time_between_triggers_seconds" tf:"optional"` // A list of Delta tables to monitor for changes. The table name must be in // the format `catalog_name.schema_name.table_name`. - TableNames []types.String `tfsdk:"table_names" tf:"optional"` + TableNames types.List `tfsdk:"table_names" tf:"optional"` // If set, the trigger starts a run only after no table updates have // occurred for the specified time and can be used to wait for a series of // table updates before triggering a run. The minimum allowed value is 60 @@ -3252,21 +14428,88 @@ func (newState *TableUpdateTriggerConfiguration) SyncEffectiveFieldsDuringCreate func (newState *TableUpdateTriggerConfiguration) SyncEffectiveFieldsDuringRead(existingState TableUpdateTriggerConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableUpdateTriggerConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableUpdateTriggerConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "table_names": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableUpdateTriggerConfiguration +// only implements ToObjectValue() and Type(). +func (o TableUpdateTriggerConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition": o.Condition, + "min_time_between_triggers_seconds": o.MinTimeBetweenTriggersSeconds, + "table_names": o.TableNames, + "wait_after_last_change_seconds": o.WaitAfterLastChangeSeconds, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableUpdateTriggerConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition": types.StringType, + "min_time_between_triggers_seconds": types.Int64Type, + "table_names": basetypes.ListType{ + ElemType: types.StringType, + }, + "wait_after_last_change_seconds": types.Int64Type, + }, + } +} + +// GetTableNames returns the value of the TableNames field in TableUpdateTriggerConfiguration as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableUpdateTriggerConfiguration) GetTableNames(ctx context.Context) ([]types.String, bool) { + if o.TableNames.IsNull() || o.TableNames.IsUnknown() { + return nil, false + } + var v []types.String + d := o.TableNames.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTableNames sets the value of the TableNames field in TableUpdateTriggerConfiguration. +func (o *TableUpdateTriggerConfiguration) SetTableNames(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_names"] + t = t.(attr.TypeWithElementType).ElementType() + o.TableNames = types.ListValueMust(t, vs) +} + type Task struct { // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries // or notifications. - ConditionTask []ConditionTask `tfsdk:"condition_task" tf:"optional,object"` + ConditionTask types.List `tfsdk:"condition_task" tf:"optional,object"` // The task runs one or more dbt commands when the `dbt_task` field is // present. The dbt task requires both Databricks SQL and the ability to use // a serverless or a pro SQL warehouse. - DbtTask []DbtTask `tfsdk:"dbt_task" tf:"optional,object"` + DbtTask types.List `tfsdk:"dbt_task" tf:"optional,object"` // An optional array of objects specifying the dependency graph of the task. // All tasks specified in this field must complete before executing this // task. The task will run only if the `run_if` condition is true. The key // is `task_key`, and the value is the name assigned to the dependent task. - DependsOn []TaskDependency `tfsdk:"depends_on" tf:"optional"` + DependsOn types.List `tfsdk:"depends_on" tf:"optional"` // An optional description for this task. Description types.String `tfsdk:"description" tf:"optional"` // An option to disable auto optimization in serverless @@ -3274,7 +14517,7 @@ type Task struct { // An optional set of email addresses that is notified when runs of this // task begin or complete as well as when this task is deleted. The default // behavior is to not send any emails. - EmailNotifications []TaskEmailNotifications `tfsdk:"email_notifications" tf:"optional,object"` + EmailNotifications types.List `tfsdk:"email_notifications" tf:"optional,object"` // The key that references an environment spec in a job. This field is // required for Python script, Python wheel and dbt tasks when using // serverless compute. @@ -3286,15 +14529,15 @@ type Task struct { ExistingClusterId types.String `tfsdk:"existing_cluster_id" tf:"optional"` // The task executes a nested task for every input provided when the // `for_each_task` field is present. - ForEachTask []ForEachTask `tfsdk:"for_each_task" tf:"optional,object"` + ForEachTask types.List `tfsdk:"for_each_task" tf:"optional,object"` // An optional set of health rules that can be defined for this job. - Health []JobsHealthRules `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // If job_cluster_key, this task is executed reusing the cluster specified // in `job.settings.job_clusters`. JobClusterKey types.String `tfsdk:"job_cluster_key" tf:"optional"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - Libraries compute.Library `tfsdk:"library" tf:"optional"` + Libraries types.List `tfsdk:"library" tf:"optional"` // An optional maximum number of times to retry an unsuccessful run. A run // is considered to be unsuccessful if it completes with the `FAILED` // result_state or `INTERNAL_ERROR` `life_cycle_state`. The value `-1` means @@ -3306,19 +14549,19 @@ type Task struct { MinRetryIntervalMillis types.Int64 `tfsdk:"min_retry_interval_millis" tf:"optional"` // If new_cluster, a description of a new cluster that is created for each // run. - NewCluster compute.ClusterSpec `tfsdk:"new_cluster" tf:"optional,object"` + NewCluster types.List `tfsdk:"new_cluster" tf:"optional,object"` // The task runs a notebook when the `notebook_task` field is present. - NotebookTask []NotebookTask `tfsdk:"notebook_task" tf:"optional,object"` + NotebookTask types.List `tfsdk:"notebook_task" tf:"optional,object"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // task. - NotificationSettings []TaskNotificationSettings `tfsdk:"notification_settings" tf:"optional,object"` + NotificationSettings types.List `tfsdk:"notification_settings" tf:"optional,object"` // The task triggers a pipeline update when the `pipeline_task` field is // present. Only pipelines configured to use triggered more are supported. - PipelineTask []PipelineTask `tfsdk:"pipeline_task" tf:"optional,object"` + PipelineTask types.List `tfsdk:"pipeline_task" tf:"optional,object"` // The task runs a Python wheel when the `python_wheel_task` field is // present. - PythonWheelTask []PythonWheelTask `tfsdk:"python_wheel_task" tf:"optional,object"` + PythonWheelTask types.List `tfsdk:"python_wheel_task" tf:"optional,object"` // An optional policy to specify whether to retry a job when it times out. // The default behavior is to not retry on timeout. RetryOnTimeout types.Bool `tfsdk:"retry_on_timeout" tf:"optional"` @@ -3333,12 +14576,12 @@ type Task struct { // dependencies have failed RunIf types.String `tfsdk:"run_if" tf:"optional"` // The task triggers another job when the `run_job_task` field is present. - RunJobTask []RunJobTask `tfsdk:"run_job_task" tf:"optional,object"` + RunJobTask types.List `tfsdk:"run_job_task" tf:"optional,object"` // The task runs a JAR when the `spark_jar_task` field is present. - SparkJarTask []SparkJarTask `tfsdk:"spark_jar_task" tf:"optional,object"` + SparkJarTask types.List `tfsdk:"spark_jar_task" tf:"optional,object"` // The task runs a Python file when the `spark_python_task` field is // present. - SparkPythonTask []SparkPythonTask `tfsdk:"spark_python_task" tf:"optional,object"` + SparkPythonTask types.List `tfsdk:"spark_python_task" tf:"optional,object"` // (Legacy) The task runs the spark-submit script when the // `spark_submit_task` field is present. This task can run only on new // clusters and is not compatible with serverless compute. @@ -3357,10 +14600,10 @@ type Task struct { // // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 // paths. - SparkSubmitTask []SparkSubmitTask `tfsdk:"spark_submit_task" tf:"optional,object"` + SparkSubmitTask types.List `tfsdk:"spark_submit_task" tf:"optional,object"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. - SqlTask []SqlTask `tfsdk:"sql_task" tf:"optional,object"` + SqlTask types.List `tfsdk:"sql_task" tf:"optional,object"` // A unique name for the task. This field is used to refer to this task from // other tasks. This field is required and must be unique within its parent // job. On Update or Reset, this field is used to reference the tasks to be @@ -3372,7 +14615,7 @@ type Task struct { // A collection of system notification IDs to notify when runs of this task // begin or complete. The default behavior is to not send any system // notifications. - WebhookNotifications []WebhookNotifications `tfsdk:"webhook_notifications" tf:"optional,object"` + WebhookNotifications types.List `tfsdk:"webhook_notifications" tf:"optional,object"` } func (newState *Task) SyncEffectiveFieldsDuringCreateOrUpdate(plan Task) { @@ -3381,6 +14624,616 @@ func (newState *Task) SyncEffectiveFieldsDuringCreateOrUpdate(plan Task) { func (newState *Task) SyncEffectiveFieldsDuringRead(existingState Task) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Task. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Task) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition_task": reflect.TypeOf(ConditionTask{}), + "dbt_task": reflect.TypeOf(DbtTask{}), + "depends_on": reflect.TypeOf(TaskDependency{}), + "email_notifications": reflect.TypeOf(TaskEmailNotifications{}), + "for_each_task": reflect.TypeOf(ForEachTask{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + "notebook_task": reflect.TypeOf(NotebookTask{}), + "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), + "pipeline_task": reflect.TypeOf(PipelineTask{}), + "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), + "run_job_task": reflect.TypeOf(RunJobTask{}), + "spark_jar_task": reflect.TypeOf(SparkJarTask{}), + "spark_python_task": reflect.TypeOf(SparkPythonTask{}), + "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), + "sql_task": reflect.TypeOf(SqlTask{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Task +// only implements ToObjectValue() and Type(). +func (o Task) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition_task": o.ConditionTask, + "dbt_task": o.DbtTask, + "depends_on": o.DependsOn, + "description": o.Description, + "disable_auto_optimization": o.DisableAutoOptimization, + "email_notifications": o.EmailNotifications, + "environment_key": o.EnvironmentKey, + "existing_cluster_id": o.ExistingClusterId, + "for_each_task": o.ForEachTask, + "health": o.Health, + "job_cluster_key": o.JobClusterKey, + "library": o.Libraries, + "max_retries": o.MaxRetries, + "min_retry_interval_millis": o.MinRetryIntervalMillis, + "new_cluster": o.NewCluster, + "notebook_task": o.NotebookTask, + "notification_settings": o.NotificationSettings, + "pipeline_task": o.PipelineTask, + "python_wheel_task": o.PythonWheelTask, + "retry_on_timeout": o.RetryOnTimeout, + "run_if": o.RunIf, + "run_job_task": o.RunJobTask, + "spark_jar_task": o.SparkJarTask, + "spark_python_task": o.SparkPythonTask, + "spark_submit_task": o.SparkSubmitTask, + "sql_task": o.SqlTask, + "task_key": o.TaskKey, + "timeout_seconds": o.TimeoutSeconds, + "webhook_notifications": o.WebhookNotifications, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Task) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition_task": basetypes.ListType{ + ElemType: ConditionTask{}.Type(ctx), + }, + "dbt_task": basetypes.ListType{ + ElemType: DbtTask{}.Type(ctx), + }, + "depends_on": basetypes.ListType{ + ElemType: TaskDependency{}.Type(ctx), + }, + "description": types.StringType, + "disable_auto_optimization": types.BoolType, + "email_notifications": basetypes.ListType{ + ElemType: TaskEmailNotifications{}.Type(ctx), + }, + "environment_key": types.StringType, + "existing_cluster_id": types.StringType, + "for_each_task": basetypes.ListType{ + ElemType: ForEachTask{}.Type(ctx), + }, + "health": basetypes.ListType{ + ElemType: JobsHealthRules{}.Type(ctx), + }, + "job_cluster_key": types.StringType, + "library": basetypes.ListType{ + ElemType: compute_tf.Library{}.Type(ctx), + }, + "max_retries": types.Int64Type, + "min_retry_interval_millis": types.Int64Type, + "new_cluster": basetypes.ListType{ + ElemType: compute_tf.ClusterSpec{}.Type(ctx), + }, + "notebook_task": basetypes.ListType{ + ElemType: NotebookTask{}.Type(ctx), + }, + "notification_settings": basetypes.ListType{ + ElemType: TaskNotificationSettings{}.Type(ctx), + }, + "pipeline_task": basetypes.ListType{ + ElemType: PipelineTask{}.Type(ctx), + }, + "python_wheel_task": basetypes.ListType{ + ElemType: PythonWheelTask{}.Type(ctx), + }, + "retry_on_timeout": types.BoolType, + "run_if": types.StringType, + "run_job_task": basetypes.ListType{ + ElemType: RunJobTask{}.Type(ctx), + }, + "spark_jar_task": basetypes.ListType{ + ElemType: SparkJarTask{}.Type(ctx), + }, + "spark_python_task": basetypes.ListType{ + ElemType: SparkPythonTask{}.Type(ctx), + }, + "spark_submit_task": basetypes.ListType{ + ElemType: SparkSubmitTask{}.Type(ctx), + }, + "sql_task": basetypes.ListType{ + ElemType: SqlTask{}.Type(ctx), + }, + "task_key": types.StringType, + "timeout_seconds": types.Int64Type, + "webhook_notifications": basetypes.ListType{ + ElemType: WebhookNotifications{}.Type(ctx), + }, + }, + } +} + +// GetConditionTask returns the value of the ConditionTask field in Task as +// a ConditionTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetConditionTask(ctx context.Context) (ConditionTask, bool) { + var e ConditionTask + if o.ConditionTask.IsNull() || o.ConditionTask.IsUnknown() { + return e, false + } + var v []ConditionTask + d := o.ConditionTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConditionTask sets the value of the ConditionTask field in Task. +func (o *Task) SetConditionTask(ctx context.Context, v ConditionTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition_task"] + o.ConditionTask = types.ListValueMust(t, vs) +} + +// GetDbtTask returns the value of the DbtTask field in Task as +// a DbtTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetDbtTask(ctx context.Context) (DbtTask, bool) { + var e DbtTask + if o.DbtTask.IsNull() || o.DbtTask.IsUnknown() { + return e, false + } + var v []DbtTask + d := o.DbtTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDbtTask sets the value of the DbtTask field in Task. +func (o *Task) SetDbtTask(ctx context.Context, v DbtTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dbt_task"] + o.DbtTask = types.ListValueMust(t, vs) +} + +// GetDependsOn returns the value of the DependsOn field in Task as +// a slice of TaskDependency values. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetDependsOn(ctx context.Context) ([]TaskDependency, bool) { + if o.DependsOn.IsNull() || o.DependsOn.IsUnknown() { + return nil, false + } + var v []TaskDependency + d := o.DependsOn.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDependsOn sets the value of the DependsOn field in Task. +func (o *Task) SetDependsOn(ctx context.Context, v []TaskDependency) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["depends_on"] + t = t.(attr.TypeWithElementType).ElementType() + o.DependsOn = types.ListValueMust(t, vs) +} + +// GetEmailNotifications returns the value of the EmailNotifications field in Task as +// a TaskEmailNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetEmailNotifications(ctx context.Context) (TaskEmailNotifications, bool) { + var e TaskEmailNotifications + if o.EmailNotifications.IsNull() || o.EmailNotifications.IsUnknown() { + return e, false + } + var v []TaskEmailNotifications + d := o.EmailNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmailNotifications sets the value of the EmailNotifications field in Task. +func (o *Task) SetEmailNotifications(ctx context.Context, v TaskEmailNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_notifications"] + o.EmailNotifications = types.ListValueMust(t, vs) +} + +// GetForEachTask returns the value of the ForEachTask field in Task as +// a ForEachTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetForEachTask(ctx context.Context) (ForEachTask, bool) { + var e ForEachTask + if o.ForEachTask.IsNull() || o.ForEachTask.IsUnknown() { + return e, false + } + var v []ForEachTask + d := o.ForEachTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetForEachTask sets the value of the ForEachTask field in Task. +func (o *Task) SetForEachTask(ctx context.Context, v ForEachTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["for_each_task"] + o.ForEachTask = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in Task as +// a JobsHealthRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetHealth(ctx context.Context) (JobsHealthRules, bool) { + var e JobsHealthRules + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []JobsHealthRules + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in Task. +func (o *Task) SetHealth(ctx context.Context, v JobsHealthRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetLibraries returns the value of the Libraries field in Task as +// a slice of compute_tf.Library values. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetLibraries(ctx context.Context) ([]compute_tf.Library, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []compute_tf.Library + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in Task. +func (o *Task) SetLibraries(ctx context.Context, v []compute_tf.Library) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["library"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNewCluster returns the value of the NewCluster field in Task as +// a compute_tf.ClusterSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetNewCluster(ctx context.Context) (compute_tf.ClusterSpec, bool) { + var e compute_tf.ClusterSpec + if o.NewCluster.IsNull() || o.NewCluster.IsUnknown() { + return e, false + } + var v []compute_tf.ClusterSpec + d := o.NewCluster.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewCluster sets the value of the NewCluster field in Task. +func (o *Task) SetNewCluster(ctx context.Context, v compute_tf.ClusterSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_cluster"] + o.NewCluster = types.ListValueMust(t, vs) +} + +// GetNotebookTask returns the value of the NotebookTask field in Task as +// a NotebookTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetNotebookTask(ctx context.Context) (NotebookTask, bool) { + var e NotebookTask + if o.NotebookTask.IsNull() || o.NotebookTask.IsUnknown() { + return e, false + } + var v []NotebookTask + d := o.NotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebookTask sets the value of the NotebookTask field in Task. +func (o *Task) SetNotebookTask(ctx context.Context, v NotebookTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_task"] + o.NotebookTask = types.ListValueMust(t, vs) +} + +// GetNotificationSettings returns the value of the NotificationSettings field in Task as +// a TaskNotificationSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetNotificationSettings(ctx context.Context) (TaskNotificationSettings, bool) { + var e TaskNotificationSettings + if o.NotificationSettings.IsNull() || o.NotificationSettings.IsUnknown() { + return e, false + } + var v []TaskNotificationSettings + d := o.NotificationSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotificationSettings sets the value of the NotificationSettings field in Task. +func (o *Task) SetNotificationSettings(ctx context.Context, v TaskNotificationSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notification_settings"] + o.NotificationSettings = types.ListValueMust(t, vs) +} + +// GetPipelineTask returns the value of the PipelineTask field in Task as +// a PipelineTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetPipelineTask(ctx context.Context) (PipelineTask, bool) { + var e PipelineTask + if o.PipelineTask.IsNull() || o.PipelineTask.IsUnknown() { + return e, false + } + var v []PipelineTask + d := o.PipelineTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPipelineTask sets the value of the PipelineTask field in Task. +func (o *Task) SetPipelineTask(ctx context.Context, v PipelineTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pipeline_task"] + o.PipelineTask = types.ListValueMust(t, vs) +} + +// GetPythonWheelTask returns the value of the PythonWheelTask field in Task as +// a PythonWheelTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetPythonWheelTask(ctx context.Context) (PythonWheelTask, bool) { + var e PythonWheelTask + if o.PythonWheelTask.IsNull() || o.PythonWheelTask.IsUnknown() { + return e, false + } + var v []PythonWheelTask + d := o.PythonWheelTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPythonWheelTask sets the value of the PythonWheelTask field in Task. +func (o *Task) SetPythonWheelTask(ctx context.Context, v PythonWheelTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["python_wheel_task"] + o.PythonWheelTask = types.ListValueMust(t, vs) +} + +// GetRunJobTask returns the value of the RunJobTask field in Task as +// a RunJobTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetRunJobTask(ctx context.Context) (RunJobTask, bool) { + var e RunJobTask + if o.RunJobTask.IsNull() || o.RunJobTask.IsUnknown() { + return e, false + } + var v []RunJobTask + d := o.RunJobTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunJobTask sets the value of the RunJobTask field in Task. +func (o *Task) SetRunJobTask(ctx context.Context, v RunJobTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_job_task"] + o.RunJobTask = types.ListValueMust(t, vs) +} + +// GetSparkJarTask returns the value of the SparkJarTask field in Task as +// a SparkJarTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetSparkJarTask(ctx context.Context) (SparkJarTask, bool) { + var e SparkJarTask + if o.SparkJarTask.IsNull() || o.SparkJarTask.IsUnknown() { + return e, false + } + var v []SparkJarTask + d := o.SparkJarTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkJarTask sets the value of the SparkJarTask field in Task. +func (o *Task) SetSparkJarTask(ctx context.Context, v SparkJarTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_jar_task"] + o.SparkJarTask = types.ListValueMust(t, vs) +} + +// GetSparkPythonTask returns the value of the SparkPythonTask field in Task as +// a SparkPythonTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetSparkPythonTask(ctx context.Context) (SparkPythonTask, bool) { + var e SparkPythonTask + if o.SparkPythonTask.IsNull() || o.SparkPythonTask.IsUnknown() { + return e, false + } + var v []SparkPythonTask + d := o.SparkPythonTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkPythonTask sets the value of the SparkPythonTask field in Task. +func (o *Task) SetSparkPythonTask(ctx context.Context, v SparkPythonTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_python_task"] + o.SparkPythonTask = types.ListValueMust(t, vs) +} + +// GetSparkSubmitTask returns the value of the SparkSubmitTask field in Task as +// a SparkSubmitTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetSparkSubmitTask(ctx context.Context) (SparkSubmitTask, bool) { + var e SparkSubmitTask + if o.SparkSubmitTask.IsNull() || o.SparkSubmitTask.IsUnknown() { + return e, false + } + var v []SparkSubmitTask + d := o.SparkSubmitTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparkSubmitTask sets the value of the SparkSubmitTask field in Task. +func (o *Task) SetSparkSubmitTask(ctx context.Context, v SparkSubmitTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_submit_task"] + o.SparkSubmitTask = types.ListValueMust(t, vs) +} + +// GetSqlTask returns the value of the SqlTask field in Task as +// a SqlTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetSqlTask(ctx context.Context) (SqlTask, bool) { + var e SqlTask + if o.SqlTask.IsNull() || o.SqlTask.IsUnknown() { + return e, false + } + var v []SqlTask + d := o.SqlTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlTask sets the value of the SqlTask field in Task. +func (o *Task) SetSqlTask(ctx context.Context, v SqlTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_task"] + o.SqlTask = types.ListValueMust(t, vs) +} + +// GetWebhookNotifications returns the value of the WebhookNotifications field in Task as +// a WebhookNotifications value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetWebhookNotifications(ctx context.Context) (WebhookNotifications, bool) { + var e WebhookNotifications + if o.WebhookNotifications.IsNull() || o.WebhookNotifications.IsUnknown() { + return e, false + } + var v []WebhookNotifications + d := o.WebhookNotifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhookNotifications sets the value of the WebhookNotifications field in Task. +func (o *Task) SetWebhookNotifications(ctx context.Context, v WebhookNotifications) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook_notifications"] + o.WebhookNotifications = types.ListValueMust(t, vs) +} + type TaskDependency struct { // Can only be specified on condition task dependencies. The outcome of the // dependent task that must be met for this task to run. @@ -3395,6 +15248,39 @@ func (newState *TaskDependency) SyncEffectiveFieldsDuringCreateOrUpdate(plan Tas func (newState *TaskDependency) SyncEffectiveFieldsDuringRead(existingState TaskDependency) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TaskDependency. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TaskDependency) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TaskDependency +// only implements ToObjectValue() and Type(). +func (o TaskDependency) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "outcome": o.Outcome, + "task_key": o.TaskKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TaskDependency) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "outcome": types.StringType, + "task_key": types.StringType, + }, + } +} + type TaskEmailNotifications struct { // If true, do not send email to recipients specified in `on_failure` if the // run is skipped. This field is `deprecated`. Please use the @@ -3404,17 +15290,17 @@ type TaskEmailNotifications struct { // exceeds the threshold specified for the `RUN_DURATION_SECONDS` metric in // the `health` field. If no rule for the `RUN_DURATION_SECONDS` metric is // specified in the `health` field for the job, notifications are not sent. - OnDurationWarningThresholdExceeded []types.String `tfsdk:"on_duration_warning_threshold_exceeded" tf:"optional"` + OnDurationWarningThresholdExceeded types.List `tfsdk:"on_duration_warning_threshold_exceeded" tf:"optional"` // A list of email addresses to be notified when a run unsuccessfully // completes. A run is considered to have completed unsuccessfully if it // ends with an `INTERNAL_ERROR` `life_cycle_state` or a `FAILED`, or // `TIMED_OUT` result_state. If this is not specified on job creation, // reset, or update the list is empty, and notifications are not sent. - OnFailure []types.String `tfsdk:"on_failure" tf:"optional"` + OnFailure types.List `tfsdk:"on_failure" tf:"optional"` // A list of email addresses to be notified when a run begins. If not // specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - OnStart []types.String `tfsdk:"on_start" tf:"optional"` + OnStart types.List `tfsdk:"on_start" tf:"optional"` // A list of email addresses to notify when any streaming backlog thresholds // are exceeded for any stream. Streaming backlog thresholds can be set in // the `health` field using the following metrics: @@ -3422,13 +15308,13 @@ type TaskEmailNotifications struct { // `STREAMING_BACKLOG_SECONDS`, or `STREAMING_BACKLOG_FILES`. Alerting is // based on the 10-minute average of these metrics. If the issue persists, // notifications are resent every 30 minutes. - OnStreamingBacklogExceeded []types.String `tfsdk:"on_streaming_backlog_exceeded" tf:"optional"` + OnStreamingBacklogExceeded types.List `tfsdk:"on_streaming_backlog_exceeded" tf:"optional"` // A list of email addresses to be notified when a run successfully // completes. A run is considered to have completed successfully if it ends // with a `TERMINATED` `life_cycle_state` and a `SUCCESS` result_state. If // not specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - OnSuccess []types.String `tfsdk:"on_success" tf:"optional"` + OnSuccess types.List `tfsdk:"on_success" tf:"optional"` } func (newState *TaskEmailNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(plan TaskEmailNotifications) { @@ -3437,6 +15323,193 @@ func (newState *TaskEmailNotifications) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *TaskEmailNotifications) SyncEffectiveFieldsDuringRead(existingState TaskEmailNotifications) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TaskEmailNotifications. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TaskEmailNotifications) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "on_duration_warning_threshold_exceeded": reflect.TypeOf(types.String{}), + "on_failure": reflect.TypeOf(types.String{}), + "on_start": reflect.TypeOf(types.String{}), + "on_streaming_backlog_exceeded": reflect.TypeOf(types.String{}), + "on_success": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TaskEmailNotifications +// only implements ToObjectValue() and Type(). +func (o TaskEmailNotifications) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "no_alert_for_skipped_runs": o.NoAlertForSkippedRuns, + "on_duration_warning_threshold_exceeded": o.OnDurationWarningThresholdExceeded, + "on_failure": o.OnFailure, + "on_start": o.OnStart, + "on_streaming_backlog_exceeded": o.OnStreamingBacklogExceeded, + "on_success": o.OnSuccess, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TaskEmailNotifications) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "no_alert_for_skipped_runs": types.BoolType, + "on_duration_warning_threshold_exceeded": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_failure": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_start": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_streaming_backlog_exceeded": basetypes.ListType{ + ElemType: types.StringType, + }, + "on_success": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetOnDurationWarningThresholdExceeded returns the value of the OnDurationWarningThresholdExceeded field in TaskEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TaskEmailNotifications) GetOnDurationWarningThresholdExceeded(ctx context.Context) ([]types.String, bool) { + if o.OnDurationWarningThresholdExceeded.IsNull() || o.OnDurationWarningThresholdExceeded.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnDurationWarningThresholdExceeded.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnDurationWarningThresholdExceeded sets the value of the OnDurationWarningThresholdExceeded field in TaskEmailNotifications. +func (o *TaskEmailNotifications) SetOnDurationWarningThresholdExceeded(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_duration_warning_threshold_exceeded"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnDurationWarningThresholdExceeded = types.ListValueMust(t, vs) +} + +// GetOnFailure returns the value of the OnFailure field in TaskEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TaskEmailNotifications) GetOnFailure(ctx context.Context) ([]types.String, bool) { + if o.OnFailure.IsNull() || o.OnFailure.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnFailure.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnFailure sets the value of the OnFailure field in TaskEmailNotifications. +func (o *TaskEmailNotifications) SetOnFailure(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_failure"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnFailure = types.ListValueMust(t, vs) +} + +// GetOnStart returns the value of the OnStart field in TaskEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TaskEmailNotifications) GetOnStart(ctx context.Context) ([]types.String, bool) { + if o.OnStart.IsNull() || o.OnStart.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnStart.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnStart sets the value of the OnStart field in TaskEmailNotifications. +func (o *TaskEmailNotifications) SetOnStart(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_start"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnStart = types.ListValueMust(t, vs) +} + +// GetOnStreamingBacklogExceeded returns the value of the OnStreamingBacklogExceeded field in TaskEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TaskEmailNotifications) GetOnStreamingBacklogExceeded(ctx context.Context) ([]types.String, bool) { + if o.OnStreamingBacklogExceeded.IsNull() || o.OnStreamingBacklogExceeded.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnStreamingBacklogExceeded.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnStreamingBacklogExceeded sets the value of the OnStreamingBacklogExceeded field in TaskEmailNotifications. +func (o *TaskEmailNotifications) SetOnStreamingBacklogExceeded(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_streaming_backlog_exceeded"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnStreamingBacklogExceeded = types.ListValueMust(t, vs) +} + +// GetOnSuccess returns the value of the OnSuccess field in TaskEmailNotifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TaskEmailNotifications) GetOnSuccess(ctx context.Context) ([]types.String, bool) { + if o.OnSuccess.IsNull() || o.OnSuccess.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OnSuccess.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnSuccess sets the value of the OnSuccess field in TaskEmailNotifications. +func (o *TaskEmailNotifications) SetOnSuccess(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_success"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnSuccess = types.ListValueMust(t, vs) +} + type TaskNotificationSettings struct { // If true, do not send notifications to recipients specified in `on_start` // for the retried runs and do not send notifications to recipients @@ -3456,6 +15529,41 @@ func (newState *TaskNotificationSettings) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *TaskNotificationSettings) SyncEffectiveFieldsDuringRead(existingState TaskNotificationSettings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TaskNotificationSettings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TaskNotificationSettings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TaskNotificationSettings +// only implements ToObjectValue() and Type(). +func (o TaskNotificationSettings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_on_last_attempt": o.AlertOnLastAttempt, + "no_alert_for_canceled_runs": o.NoAlertForCanceledRuns, + "no_alert_for_skipped_runs": o.NoAlertForSkippedRuns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TaskNotificationSettings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_on_last_attempt": types.BoolType, + "no_alert_for_canceled_runs": types.BoolType, + "no_alert_for_skipped_runs": types.BoolType, + }, + } +} + type TerminationDetails struct { // The code indicates why the run was terminated. Additional codes might be // introduced in future releases. * `SUCCESS`: The run was completed @@ -3514,7 +15622,7 @@ type TerminationDetails struct { // issue with your cloud provider. // // [status page]: https://status.databricks.com/ - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *TerminationDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan TerminationDetails) { @@ -3523,6 +15631,41 @@ func (newState *TerminationDetails) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TerminationDetails) SyncEffectiveFieldsDuringRead(existingState TerminationDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TerminationDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TerminationDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TerminationDetails +// only implements ToObjectValue() and Type(). +func (o TerminationDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "code": o.Code, + "message": o.Message, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TerminationDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "code": types.StringType, + "message": types.StringType, + "type": types.StringType, + }, + } +} + // Additional details about what triggered the run type TriggerInfo struct { // The run id of the Run Job task run @@ -3535,17 +15678,48 @@ func (newState *TriggerInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Trigge func (newState *TriggerInfo) SyncEffectiveFieldsDuringRead(existingState TriggerInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TriggerInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TriggerInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TriggerInfo +// only implements ToObjectValue() and Type(). +func (o TriggerInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TriggerInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.Int64Type, + }, + } +} + type TriggerSettings struct { // File arrival trigger settings. - FileArrival []FileArrivalTriggerConfiguration `tfsdk:"file_arrival" tf:"optional,object"` + FileArrival types.List `tfsdk:"file_arrival" tf:"optional,object"` // Whether this trigger is paused or not. PauseStatus types.String `tfsdk:"pause_status" tf:"optional"` // Periodic trigger settings. - Periodic []PeriodicTriggerConfiguration `tfsdk:"periodic" tf:"optional,object"` + Periodic types.List `tfsdk:"periodic" tf:"optional,object"` // Old table trigger settings name. Deprecated in favor of `table_update`. - Table []TableUpdateTriggerConfiguration `tfsdk:"table" tf:"optional,object"` + Table types.List `tfsdk:"table" tf:"optional,object"` - TableUpdate []TableUpdateTriggerConfiguration `tfsdk:"table_update" tf:"optional,object"` + TableUpdate types.List `tfsdk:"table_update" tf:"optional,object"` } func (newState *TriggerSettings) SyncEffectiveFieldsDuringCreateOrUpdate(plan TriggerSettings) { @@ -3554,11 +15728,167 @@ func (newState *TriggerSettings) SyncEffectiveFieldsDuringCreateOrUpdate(plan Tr func (newState *TriggerSettings) SyncEffectiveFieldsDuringRead(existingState TriggerSettings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TriggerSettings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TriggerSettings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_arrival": reflect.TypeOf(FileArrivalTriggerConfiguration{}), + "periodic": reflect.TypeOf(PeriodicTriggerConfiguration{}), + "table": reflect.TypeOf(TableUpdateTriggerConfiguration{}), + "table_update": reflect.TypeOf(TableUpdateTriggerConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TriggerSettings +// only implements ToObjectValue() and Type(). +func (o TriggerSettings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_arrival": o.FileArrival, + "pause_status": o.PauseStatus, + "periodic": o.Periodic, + "table": o.Table, + "table_update": o.TableUpdate, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TriggerSettings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_arrival": basetypes.ListType{ + ElemType: FileArrivalTriggerConfiguration{}.Type(ctx), + }, + "pause_status": types.StringType, + "periodic": basetypes.ListType{ + ElemType: PeriodicTriggerConfiguration{}.Type(ctx), + }, + "table": basetypes.ListType{ + ElemType: TableUpdateTriggerConfiguration{}.Type(ctx), + }, + "table_update": basetypes.ListType{ + ElemType: TableUpdateTriggerConfiguration{}.Type(ctx), + }, + }, + } +} + +// GetFileArrival returns the value of the FileArrival field in TriggerSettings as +// a FileArrivalTriggerConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *TriggerSettings) GetFileArrival(ctx context.Context) (FileArrivalTriggerConfiguration, bool) { + var e FileArrivalTriggerConfiguration + if o.FileArrival.IsNull() || o.FileArrival.IsUnknown() { + return e, false + } + var v []FileArrivalTriggerConfiguration + d := o.FileArrival.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFileArrival sets the value of the FileArrival field in TriggerSettings. +func (o *TriggerSettings) SetFileArrival(ctx context.Context, v FileArrivalTriggerConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_arrival"] + o.FileArrival = types.ListValueMust(t, vs) +} + +// GetPeriodic returns the value of the Periodic field in TriggerSettings as +// a PeriodicTriggerConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *TriggerSettings) GetPeriodic(ctx context.Context) (PeriodicTriggerConfiguration, bool) { + var e PeriodicTriggerConfiguration + if o.Periodic.IsNull() || o.Periodic.IsUnknown() { + return e, false + } + var v []PeriodicTriggerConfiguration + d := o.Periodic.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPeriodic sets the value of the Periodic field in TriggerSettings. +func (o *TriggerSettings) SetPeriodic(ctx context.Context, v PeriodicTriggerConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["periodic"] + o.Periodic = types.ListValueMust(t, vs) +} + +// GetTable returns the value of the Table field in TriggerSettings as +// a TableUpdateTriggerConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *TriggerSettings) GetTable(ctx context.Context) (TableUpdateTriggerConfiguration, bool) { + var e TableUpdateTriggerConfiguration + if o.Table.IsNull() || o.Table.IsUnknown() { + return e, false + } + var v []TableUpdateTriggerConfiguration + d := o.Table.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTable sets the value of the Table field in TriggerSettings. +func (o *TriggerSettings) SetTable(ctx context.Context, v TableUpdateTriggerConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table"] + o.Table = types.ListValueMust(t, vs) +} + +// GetTableUpdate returns the value of the TableUpdate field in TriggerSettings as +// a TableUpdateTriggerConfiguration value. +// If the field is unknown or null, the boolean return value is false. +func (o *TriggerSettings) GetTableUpdate(ctx context.Context) (TableUpdateTriggerConfiguration, bool) { + var e TableUpdateTriggerConfiguration + if o.TableUpdate.IsNull() || o.TableUpdate.IsUnknown() { + return e, false + } + var v []TableUpdateTriggerConfiguration + d := o.TableUpdate.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTableUpdate sets the value of the TableUpdate field in TriggerSettings. +func (o *TriggerSettings) SetTableUpdate(ctx context.Context, v TableUpdateTriggerConfiguration) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_update"] + o.TableUpdate = types.ListValueMust(t, vs) +} + type UpdateJob struct { // Remove top-level fields in the job settings. Removing nested fields is // not supported, except for tasks and job clusters (`tasks/task_1`). This // field is optional. - FieldsToRemove []types.String `tfsdk:"fields_to_remove" tf:"optional"` + FieldsToRemove types.List `tfsdk:"fields_to_remove" tf:"optional"` // The canonical identifier of the job to update. This field is required. JobId types.Int64 `tfsdk:"job_id" tf:""` // The new settings for the job. @@ -3572,7 +15902,7 @@ type UpdateJob struct { // // Changes to the field `JobSettings.timeout_seconds` are applied to active // runs. Changes to other fields are applied to future runs only. - NewSettings []JobSettings `tfsdk:"new_settings" tf:"optional,object"` + NewSettings types.List `tfsdk:"new_settings" tf:"optional,object"` } func (newState *UpdateJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateJob) { @@ -3581,6 +15911,100 @@ func (newState *UpdateJob) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateJo func (newState *UpdateJob) SyncEffectiveFieldsDuringRead(existingState UpdateJob) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateJob. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateJob) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "fields_to_remove": reflect.TypeOf(types.String{}), + "new_settings": reflect.TypeOf(JobSettings{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateJob +// only implements ToObjectValue() and Type(). +func (o UpdateJob) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "fields_to_remove": o.FieldsToRemove, + "job_id": o.JobId, + "new_settings": o.NewSettings, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateJob) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "fields_to_remove": basetypes.ListType{ + ElemType: types.StringType, + }, + "job_id": types.Int64Type, + "new_settings": basetypes.ListType{ + ElemType: JobSettings{}.Type(ctx), + }, + }, + } +} + +// GetFieldsToRemove returns the value of the FieldsToRemove field in UpdateJob as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateJob) GetFieldsToRemove(ctx context.Context) ([]types.String, bool) { + if o.FieldsToRemove.IsNull() || o.FieldsToRemove.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FieldsToRemove.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFieldsToRemove sets the value of the FieldsToRemove field in UpdateJob. +func (o *UpdateJob) SetFieldsToRemove(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["fields_to_remove"] + t = t.(attr.TypeWithElementType).ElementType() + o.FieldsToRemove = types.ListValueMust(t, vs) +} + +// GetNewSettings returns the value of the NewSettings field in UpdateJob as +// a JobSettings value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateJob) GetNewSettings(ctx context.Context) (JobSettings, bool) { + var e JobSettings + if o.NewSettings.IsNull() || o.NewSettings.IsUnknown() { + return e, false + } + var v []JobSettings + d := o.NewSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNewSettings sets the value of the NewSettings field in UpdateJob. +func (o *UpdateJob) SetNewSettings(ctx context.Context, v JobSettings) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["new_settings"] + o.NewSettings = types.ListValueMust(t, vs) +} + type UpdateResponse struct { } @@ -3590,6 +16014,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ViewItem struct { // Content of the view. Content types.String `tfsdk:"content" tf:"optional"` @@ -3598,7 +16049,7 @@ type ViewItem struct { // dashboard’s name. Name types.String `tfsdk:"name" tf:"optional"` // Type of the view item. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *ViewItem) SyncEffectiveFieldsDuringCreateOrUpdate(plan ViewItem) { @@ -3607,6 +16058,41 @@ func (newState *ViewItem) SyncEffectiveFieldsDuringCreateOrUpdate(plan ViewItem) func (newState *ViewItem) SyncEffectiveFieldsDuringRead(existingState ViewItem) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ViewItem. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ViewItem) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ViewItem +// only implements ToObjectValue() and Type(). +func (o ViewItem) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "name": o.Name, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ViewItem) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "name": types.StringType, + "type": types.StringType, + }, + } +} + type Webhook struct { Id types.String `tfsdk:"id" tf:""` } @@ -3617,18 +16103,49 @@ func (newState *Webhook) SyncEffectiveFieldsDuringCreateOrUpdate(plan Webhook) { func (newState *Webhook) SyncEffectiveFieldsDuringRead(existingState Webhook) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Webhook. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Webhook) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Webhook +// only implements ToObjectValue() and Type(). +func (o Webhook) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Webhook) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type WebhookNotifications struct { // An optional list of system notification IDs to call when the duration of // a run exceeds the threshold specified for the `RUN_DURATION_SECONDS` // metric in the `health` field. A maximum of 3 destinations can be // specified for the `on_duration_warning_threshold_exceeded` property. - OnDurationWarningThresholdExceeded []Webhook `tfsdk:"on_duration_warning_threshold_exceeded" tf:"optional"` + OnDurationWarningThresholdExceeded types.List `tfsdk:"on_duration_warning_threshold_exceeded" tf:"optional"` // An optional list of system notification IDs to call when the run fails. A // maximum of 3 destinations can be specified for the `on_failure` property. - OnFailure []Webhook `tfsdk:"on_failure" tf:"optional"` + OnFailure types.List `tfsdk:"on_failure" tf:"optional"` // An optional list of system notification IDs to call when the run starts. // A maximum of 3 destinations can be specified for the `on_start` property. - OnStart []Webhook `tfsdk:"on_start" tf:"optional"` + OnStart types.List `tfsdk:"on_start" tf:"optional"` // An optional list of system notification IDs to call when any streaming // backlog thresholds are exceeded for any stream. Streaming backlog // thresholds can be set in the `health` field using the following metrics: @@ -3637,11 +16154,11 @@ type WebhookNotifications struct { // based on the 10-minute average of these metrics. If the issue persists, // notifications are resent every 30 minutes. A maximum of 3 destinations // can be specified for the `on_streaming_backlog_exceeded` property. - OnStreamingBacklogExceeded []Webhook `tfsdk:"on_streaming_backlog_exceeded" tf:"optional"` + OnStreamingBacklogExceeded types.List `tfsdk:"on_streaming_backlog_exceeded" tf:"optional"` // An optional list of system notification IDs to call when the run // completes successfully. A maximum of 3 destinations can be specified for // the `on_success` property. - OnSuccess []Webhook `tfsdk:"on_success" tf:"optional"` + OnSuccess types.List `tfsdk:"on_success" tf:"optional"` } func (newState *WebhookNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(plan WebhookNotifications) { @@ -3649,3 +16166,188 @@ func (newState *WebhookNotifications) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *WebhookNotifications) SyncEffectiveFieldsDuringRead(existingState WebhookNotifications) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WebhookNotifications. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WebhookNotifications) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "on_duration_warning_threshold_exceeded": reflect.TypeOf(Webhook{}), + "on_failure": reflect.TypeOf(Webhook{}), + "on_start": reflect.TypeOf(Webhook{}), + "on_streaming_backlog_exceeded": reflect.TypeOf(Webhook{}), + "on_success": reflect.TypeOf(Webhook{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WebhookNotifications +// only implements ToObjectValue() and Type(). +func (o WebhookNotifications) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "on_duration_warning_threshold_exceeded": o.OnDurationWarningThresholdExceeded, + "on_failure": o.OnFailure, + "on_start": o.OnStart, + "on_streaming_backlog_exceeded": o.OnStreamingBacklogExceeded, + "on_success": o.OnSuccess, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WebhookNotifications) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "on_duration_warning_threshold_exceeded": basetypes.ListType{ + ElemType: Webhook{}.Type(ctx), + }, + "on_failure": basetypes.ListType{ + ElemType: Webhook{}.Type(ctx), + }, + "on_start": basetypes.ListType{ + ElemType: Webhook{}.Type(ctx), + }, + "on_streaming_backlog_exceeded": basetypes.ListType{ + ElemType: Webhook{}.Type(ctx), + }, + "on_success": basetypes.ListType{ + ElemType: Webhook{}.Type(ctx), + }, + }, + } +} + +// GetOnDurationWarningThresholdExceeded returns the value of the OnDurationWarningThresholdExceeded field in WebhookNotifications as +// a slice of Webhook values. +// If the field is unknown or null, the boolean return value is false. +func (o *WebhookNotifications) GetOnDurationWarningThresholdExceeded(ctx context.Context) ([]Webhook, bool) { + if o.OnDurationWarningThresholdExceeded.IsNull() || o.OnDurationWarningThresholdExceeded.IsUnknown() { + return nil, false + } + var v []Webhook + d := o.OnDurationWarningThresholdExceeded.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnDurationWarningThresholdExceeded sets the value of the OnDurationWarningThresholdExceeded field in WebhookNotifications. +func (o *WebhookNotifications) SetOnDurationWarningThresholdExceeded(ctx context.Context, v []Webhook) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_duration_warning_threshold_exceeded"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnDurationWarningThresholdExceeded = types.ListValueMust(t, vs) +} + +// GetOnFailure returns the value of the OnFailure field in WebhookNotifications as +// a slice of Webhook values. +// If the field is unknown or null, the boolean return value is false. +func (o *WebhookNotifications) GetOnFailure(ctx context.Context) ([]Webhook, bool) { + if o.OnFailure.IsNull() || o.OnFailure.IsUnknown() { + return nil, false + } + var v []Webhook + d := o.OnFailure.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnFailure sets the value of the OnFailure field in WebhookNotifications. +func (o *WebhookNotifications) SetOnFailure(ctx context.Context, v []Webhook) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_failure"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnFailure = types.ListValueMust(t, vs) +} + +// GetOnStart returns the value of the OnStart field in WebhookNotifications as +// a slice of Webhook values. +// If the field is unknown or null, the boolean return value is false. +func (o *WebhookNotifications) GetOnStart(ctx context.Context) ([]Webhook, bool) { + if o.OnStart.IsNull() || o.OnStart.IsUnknown() { + return nil, false + } + var v []Webhook + d := o.OnStart.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnStart sets the value of the OnStart field in WebhookNotifications. +func (o *WebhookNotifications) SetOnStart(ctx context.Context, v []Webhook) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_start"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnStart = types.ListValueMust(t, vs) +} + +// GetOnStreamingBacklogExceeded returns the value of the OnStreamingBacklogExceeded field in WebhookNotifications as +// a slice of Webhook values. +// If the field is unknown or null, the boolean return value is false. +func (o *WebhookNotifications) GetOnStreamingBacklogExceeded(ctx context.Context) ([]Webhook, bool) { + if o.OnStreamingBacklogExceeded.IsNull() || o.OnStreamingBacklogExceeded.IsUnknown() { + return nil, false + } + var v []Webhook + d := o.OnStreamingBacklogExceeded.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnStreamingBacklogExceeded sets the value of the OnStreamingBacklogExceeded field in WebhookNotifications. +func (o *WebhookNotifications) SetOnStreamingBacklogExceeded(ctx context.Context, v []Webhook) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_streaming_backlog_exceeded"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnStreamingBacklogExceeded = types.ListValueMust(t, vs) +} + +// GetOnSuccess returns the value of the OnSuccess field in WebhookNotifications as +// a slice of Webhook values. +// If the field is unknown or null, the boolean return value is false. +func (o *WebhookNotifications) GetOnSuccess(ctx context.Context) ([]Webhook, bool) { + if o.OnSuccess.IsNull() || o.OnSuccess.IsUnknown() { + return nil, false + } + var v []Webhook + d := o.OnSuccess.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOnSuccess sets the value of the OnSuccess field in WebhookNotifications. +func (o *WebhookNotifications) SetOnSuccess(ctx context.Context, v []Webhook) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["on_success"] + t = t.(attr.TypeWithElementType).ElementType() + o.OnSuccess = types.ListValueMust(t, vs) +} diff --git a/internal/service/marketplace_tf/model.go b/internal/service/marketplace_tf/model.go index 125335b59..8d04b4a04 100755 --- a/internal/service/marketplace_tf/model.go +++ b/internal/service/marketplace_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package marketplace_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AddExchangeForListingRequest struct { @@ -26,8 +33,41 @@ func (newState *AddExchangeForListingRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *AddExchangeForListingRequest) SyncEffectiveFieldsDuringRead(existingState AddExchangeForListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AddExchangeForListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AddExchangeForListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AddExchangeForListingRequest +// only implements ToObjectValue() and Type(). +func (o AddExchangeForListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_id": o.ExchangeId, + "listing_id": o.ListingId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AddExchangeForListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_id": types.StringType, + "listing_id": types.StringType, + }, + } +} + type AddExchangeForListingResponse struct { - ExchangeForListing []ExchangeListing `tfsdk:"exchange_for_listing" tf:"optional,object"` + ExchangeForListing types.List `tfsdk:"exchange_for_listing" tf:"optional,object"` } func (newState *AddExchangeForListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan AddExchangeForListingResponse) { @@ -36,9 +76,70 @@ func (newState *AddExchangeForListingResponse) SyncEffectiveFieldsDuringCreateOr func (newState *AddExchangeForListingResponse) SyncEffectiveFieldsDuringRead(existingState AddExchangeForListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AddExchangeForListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AddExchangeForListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange_for_listing": reflect.TypeOf(ExchangeListing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AddExchangeForListingResponse +// only implements ToObjectValue() and Type(). +func (o AddExchangeForListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_for_listing": o.ExchangeForListing, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AddExchangeForListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_for_listing": basetypes.ListType{ + ElemType: ExchangeListing{}.Type(ctx), + }, + }, + } +} + +// GetExchangeForListing returns the value of the ExchangeForListing field in AddExchangeForListingResponse as +// a ExchangeListing value. +// If the field is unknown or null, the boolean return value is false. +func (o *AddExchangeForListingResponse) GetExchangeForListing(ctx context.Context) (ExchangeListing, bool) { + var e ExchangeListing + if o.ExchangeForListing.IsNull() || o.ExchangeForListing.IsUnknown() { + return e, false + } + var v []ExchangeListing + d := o.ExchangeForListing.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExchangeForListing sets the value of the ExchangeForListing field in AddExchangeForListingResponse. +func (o *AddExchangeForListingResponse) SetExchangeForListing(ctx context.Context, v ExchangeListing) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange_for_listing"] + o.ExchangeForListing = types.ListValueMust(t, vs) +} + // Get one batch of listings. One may specify up to 50 IDs per request. type BatchGetListingsRequest struct { - Ids []types.String `tfsdk:"-"` + Ids types.List `tfsdk:"-"` } func (newState *BatchGetListingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan BatchGetListingsRequest) { @@ -47,8 +148,69 @@ func (newState *BatchGetListingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *BatchGetListingsRequest) SyncEffectiveFieldsDuringRead(existingState BatchGetListingsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BatchGetListingsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BatchGetListingsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ids": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BatchGetListingsRequest +// only implements ToObjectValue() and Type(). +func (o BatchGetListingsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ids": o.Ids, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BatchGetListingsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ids": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetIds returns the value of the Ids field in BatchGetListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *BatchGetListingsRequest) GetIds(ctx context.Context) ([]types.String, bool) { + if o.Ids.IsNull() || o.Ids.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Ids.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIds sets the value of the Ids field in BatchGetListingsRequest. +func (o *BatchGetListingsRequest) SetIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.Ids = types.ListValueMust(t, vs) +} + type BatchGetListingsResponse struct { - Listings []Listing `tfsdk:"listings" tf:"optional"` + Listings types.List `tfsdk:"listings" tf:"optional"` } func (newState *BatchGetListingsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan BatchGetListingsResponse) { @@ -57,9 +219,70 @@ func (newState *BatchGetListingsResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *BatchGetListingsResponse) SyncEffectiveFieldsDuringRead(existingState BatchGetListingsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BatchGetListingsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BatchGetListingsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listings": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BatchGetListingsResponse +// only implements ToObjectValue() and Type(). +func (o BatchGetListingsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listings": o.Listings, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BatchGetListingsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listings": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + }, + } +} + +// GetListings returns the value of the Listings field in BatchGetListingsResponse as +// a slice of Listing values. +// If the field is unknown or null, the boolean return value is false. +func (o *BatchGetListingsResponse) GetListings(ctx context.Context) ([]Listing, bool) { + if o.Listings.IsNull() || o.Listings.IsUnknown() { + return nil, false + } + var v []Listing + d := o.Listings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetListings sets the value of the Listings field in BatchGetListingsResponse. +func (o *BatchGetListingsResponse) SetListings(ctx context.Context, v []Listing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listings"] + t = t.(attr.TypeWithElementType).ElementType() + o.Listings = types.ListValueMust(t, vs) +} + // Get one batch of providers. One may specify up to 50 IDs per request. type BatchGetProvidersRequest struct { - Ids []types.String `tfsdk:"-"` + Ids types.List `tfsdk:"-"` } func (newState *BatchGetProvidersRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan BatchGetProvidersRequest) { @@ -68,8 +291,69 @@ func (newState *BatchGetProvidersRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *BatchGetProvidersRequest) SyncEffectiveFieldsDuringRead(existingState BatchGetProvidersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BatchGetProvidersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BatchGetProvidersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ids": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BatchGetProvidersRequest +// only implements ToObjectValue() and Type(). +func (o BatchGetProvidersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ids": o.Ids, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BatchGetProvidersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ids": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetIds returns the value of the Ids field in BatchGetProvidersRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *BatchGetProvidersRequest) GetIds(ctx context.Context) ([]types.String, bool) { + if o.Ids.IsNull() || o.Ids.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Ids.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIds sets the value of the Ids field in BatchGetProvidersRequest. +func (o *BatchGetProvidersRequest) SetIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.Ids = types.ListValueMust(t, vs) +} + type BatchGetProvidersResponse struct { - Providers []ProviderInfo `tfsdk:"providers" tf:"optional"` + Providers types.List `tfsdk:"providers" tf:"optional"` } func (newState *BatchGetProvidersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan BatchGetProvidersResponse) { @@ -78,6 +362,67 @@ func (newState *BatchGetProvidersResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *BatchGetProvidersResponse) SyncEffectiveFieldsDuringRead(existingState BatchGetProvidersResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BatchGetProvidersResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BatchGetProvidersResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "providers": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BatchGetProvidersResponse +// only implements ToObjectValue() and Type(). +func (o BatchGetProvidersResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "providers": o.Providers, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BatchGetProvidersResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "providers": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProviders returns the value of the Providers field in BatchGetProvidersResponse as +// a slice of ProviderInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *BatchGetProvidersResponse) GetProviders(ctx context.Context) ([]ProviderInfo, bool) { + if o.Providers.IsNull() || o.Providers.IsUnknown() { + return nil, false + } + var v []ProviderInfo + d := o.Providers.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProviders sets the value of the Providers field in BatchGetProvidersResponse. +func (o *BatchGetProvidersResponse) SetProviders(ctx context.Context, v []ProviderInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["providers"] + t = t.(attr.TypeWithElementType).ElementType() + o.Providers = types.ListValueMust(t, vs) +} + type ConsumerTerms struct { Version types.String `tfsdk:"version" tf:""` } @@ -88,6 +433,37 @@ func (newState *ConsumerTerms) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cons func (newState *ConsumerTerms) SyncEffectiveFieldsDuringRead(existingState ConsumerTerms) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ConsumerTerms. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ConsumerTerms) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ConsumerTerms +// only implements ToObjectValue() and Type(). +func (o ConsumerTerms) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ConsumerTerms) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "version": types.StringType, + }, + } +} + // contact info for the consumer requesting data or performing a listing // installation type ContactInfo struct { @@ -106,8 +482,45 @@ func (newState *ContactInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Contac func (newState *ContactInfo) SyncEffectiveFieldsDuringRead(existingState ContactInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ContactInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ContactInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ContactInfo +// only implements ToObjectValue() and Type(). +func (o ContactInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "company": o.Company, + "email": o.Email, + "first_name": o.FirstName, + "last_name": o.LastName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ContactInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "company": types.StringType, + "email": types.StringType, + "first_name": types.StringType, + "last_name": types.StringType, + }, + } +} + type CreateExchangeFilterRequest struct { - Filter []ExchangeFilter `tfsdk:"filter" tf:"object"` + Filter types.List `tfsdk:"filter" tf:"object"` } func (newState *CreateExchangeFilterRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateExchangeFilterRequest) { @@ -116,6 +529,67 @@ func (newState *CreateExchangeFilterRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *CreateExchangeFilterRequest) SyncEffectiveFieldsDuringRead(existingState CreateExchangeFilterRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExchangeFilterRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExchangeFilterRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filter": reflect.TypeOf(ExchangeFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExchangeFilterRequest +// only implements ToObjectValue() and Type(). +func (o CreateExchangeFilterRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExchangeFilterRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": basetypes.ListType{ + ElemType: ExchangeFilter{}.Type(ctx), + }, + }, + } +} + +// GetFilter returns the value of the Filter field in CreateExchangeFilterRequest as +// a ExchangeFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateExchangeFilterRequest) GetFilter(ctx context.Context) (ExchangeFilter, bool) { + var e ExchangeFilter + if o.Filter.IsNull() || o.Filter.IsUnknown() { + return e, false + } + var v []ExchangeFilter + d := o.Filter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilter sets the value of the Filter field in CreateExchangeFilterRequest. +func (o *CreateExchangeFilterRequest) SetFilter(ctx context.Context, v ExchangeFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter"] + o.Filter = types.ListValueMust(t, vs) +} + type CreateExchangeFilterResponse struct { FilterId types.String `tfsdk:"filter_id" tf:"optional"` } @@ -126,8 +600,39 @@ func (newState *CreateExchangeFilterResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *CreateExchangeFilterResponse) SyncEffectiveFieldsDuringRead(existingState CreateExchangeFilterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExchangeFilterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExchangeFilterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExchangeFilterResponse +// only implements ToObjectValue() and Type(). +func (o CreateExchangeFilterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter_id": o.FilterId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExchangeFilterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter_id": types.StringType, + }, + } +} + type CreateExchangeRequest struct { - Exchange []Exchange `tfsdk:"exchange" tf:"object"` + Exchange types.List `tfsdk:"exchange" tf:"object"` } func (newState *CreateExchangeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateExchangeRequest) { @@ -136,6 +641,67 @@ func (newState *CreateExchangeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateExchangeRequest) SyncEffectiveFieldsDuringRead(existingState CreateExchangeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExchangeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExchangeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange": reflect.TypeOf(Exchange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExchangeRequest +// only implements ToObjectValue() and Type(). +func (o CreateExchangeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange": o.Exchange, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExchangeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange": basetypes.ListType{ + ElemType: Exchange{}.Type(ctx), + }, + }, + } +} + +// GetExchange returns the value of the Exchange field in CreateExchangeRequest as +// a Exchange value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateExchangeRequest) GetExchange(ctx context.Context) (Exchange, bool) { + var e Exchange + if o.Exchange.IsNull() || o.Exchange.IsUnknown() { + return e, false + } + var v []Exchange + d := o.Exchange.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExchange sets the value of the Exchange field in CreateExchangeRequest. +func (o *CreateExchangeRequest) SetExchange(ctx context.Context, v Exchange) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange"] + o.Exchange = types.ListValueMust(t, vs) +} + type CreateExchangeResponse struct { ExchangeId types.String `tfsdk:"exchange_id" tf:"optional"` } @@ -146,10 +712,41 @@ func (newState *CreateExchangeResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateExchangeResponse) SyncEffectiveFieldsDuringRead(existingState CreateExchangeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExchangeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExchangeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExchangeResponse +// only implements ToObjectValue() and Type(). +func (o CreateExchangeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_id": o.ExchangeId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExchangeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_id": types.StringType, + }, + } +} + type CreateFileRequest struct { DisplayName types.String `tfsdk:"display_name" tf:"optional"` - FileParent []FileParent `tfsdk:"file_parent" tf:"object"` + FileParent types.List `tfsdk:"file_parent" tf:"object"` MarketplaceFileType types.String `tfsdk:"marketplace_file_type" tf:""` @@ -162,8 +759,75 @@ func (newState *CreateFileRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateFileRequest) SyncEffectiveFieldsDuringRead(existingState CreateFileRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateFileRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateFileRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_parent": reflect.TypeOf(FileParent{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateFileRequest +// only implements ToObjectValue() and Type(). +func (o CreateFileRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display_name": o.DisplayName, + "file_parent": o.FileParent, + "marketplace_file_type": o.MarketplaceFileType, + "mime_type": o.MimeType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateFileRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display_name": types.StringType, + "file_parent": basetypes.ListType{ + ElemType: FileParent{}.Type(ctx), + }, + "marketplace_file_type": types.StringType, + "mime_type": types.StringType, + }, + } +} + +// GetFileParent returns the value of the FileParent field in CreateFileRequest as +// a FileParent value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateFileRequest) GetFileParent(ctx context.Context) (FileParent, bool) { + var e FileParent + if o.FileParent.IsNull() || o.FileParent.IsUnknown() { + return e, false + } + var v []FileParent + d := o.FileParent.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFileParent sets the value of the FileParent field in CreateFileRequest. +func (o *CreateFileRequest) SetFileParent(ctx context.Context, v FileParent) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_parent"] + o.FileParent = types.ListValueMust(t, vs) +} + type CreateFileResponse struct { - FileInfo []FileInfo `tfsdk:"file_info" tf:"optional,object"` + FileInfo types.List `tfsdk:"file_info" tf:"optional,object"` // Pre-signed POST URL to blob storage UploadUrl types.String `tfsdk:"upload_url" tf:"optional"` } @@ -174,8 +838,71 @@ func (newState *CreateFileResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateFileResponse) SyncEffectiveFieldsDuringRead(existingState CreateFileResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateFileResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateFileResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_info": reflect.TypeOf(FileInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateFileResponse +// only implements ToObjectValue() and Type(). +func (o CreateFileResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_info": o.FileInfo, + "upload_url": o.UploadUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateFileResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_info": basetypes.ListType{ + ElemType: FileInfo{}.Type(ctx), + }, + "upload_url": types.StringType, + }, + } +} + +// GetFileInfo returns the value of the FileInfo field in CreateFileResponse as +// a FileInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateFileResponse) GetFileInfo(ctx context.Context) (FileInfo, bool) { + var e FileInfo + if o.FileInfo.IsNull() || o.FileInfo.IsUnknown() { + return e, false + } + var v []FileInfo + d := o.FileInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFileInfo sets the value of the FileInfo field in CreateFileResponse. +func (o *CreateFileResponse) SetFileInfo(ctx context.Context, v FileInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_info"] + o.FileInfo = types.ListValueMust(t, vs) +} + type CreateInstallationRequest struct { - AcceptedConsumerTerms []ConsumerTerms `tfsdk:"accepted_consumer_terms" tf:"optional,object"` + AcceptedConsumerTerms types.List `tfsdk:"accepted_consumer_terms" tf:"optional,object"` CatalogName types.String `tfsdk:"catalog_name" tf:"optional"` @@ -183,7 +910,7 @@ type CreateInstallationRequest struct { RecipientType types.String `tfsdk:"recipient_type" tf:"optional"` // for git repo installations - RepoDetail []RepoInstallation `tfsdk:"repo_detail" tf:"optional,object"` + RepoDetail types.List `tfsdk:"repo_detail" tf:"optional,object"` ShareName types.String `tfsdk:"share_name" tf:"optional"` } @@ -194,8 +921,108 @@ func (newState *CreateInstallationRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *CreateInstallationRequest) SyncEffectiveFieldsDuringRead(existingState CreateInstallationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateInstallationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateInstallationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "accepted_consumer_terms": reflect.TypeOf(ConsumerTerms{}), + "repo_detail": reflect.TypeOf(RepoInstallation{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateInstallationRequest +// only implements ToObjectValue() and Type(). +func (o CreateInstallationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "accepted_consumer_terms": o.AcceptedConsumerTerms, + "catalog_name": o.CatalogName, + "listing_id": o.ListingId, + "recipient_type": o.RecipientType, + "repo_detail": o.RepoDetail, + "share_name": o.ShareName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateInstallationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "accepted_consumer_terms": basetypes.ListType{ + ElemType: ConsumerTerms{}.Type(ctx), + }, + "catalog_name": types.StringType, + "listing_id": types.StringType, + "recipient_type": types.StringType, + "repo_detail": basetypes.ListType{ + ElemType: RepoInstallation{}.Type(ctx), + }, + "share_name": types.StringType, + }, + } +} + +// GetAcceptedConsumerTerms returns the value of the AcceptedConsumerTerms field in CreateInstallationRequest as +// a ConsumerTerms value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstallationRequest) GetAcceptedConsumerTerms(ctx context.Context) (ConsumerTerms, bool) { + var e ConsumerTerms + if o.AcceptedConsumerTerms.IsNull() || o.AcceptedConsumerTerms.IsUnknown() { + return e, false + } + var v []ConsumerTerms + d := o.AcceptedConsumerTerms.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAcceptedConsumerTerms sets the value of the AcceptedConsumerTerms field in CreateInstallationRequest. +func (o *CreateInstallationRequest) SetAcceptedConsumerTerms(ctx context.Context, v ConsumerTerms) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["accepted_consumer_terms"] + o.AcceptedConsumerTerms = types.ListValueMust(t, vs) +} + +// GetRepoDetail returns the value of the RepoDetail field in CreateInstallationRequest as +// a RepoInstallation value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateInstallationRequest) GetRepoDetail(ctx context.Context) (RepoInstallation, bool) { + var e RepoInstallation + if o.RepoDetail.IsNull() || o.RepoDetail.IsUnknown() { + return e, false + } + var v []RepoInstallation + d := o.RepoDetail.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRepoDetail sets the value of the RepoDetail field in CreateInstallationRequest. +func (o *CreateInstallationRequest) SetRepoDetail(ctx context.Context, v RepoInstallation) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["repo_detail"] + o.RepoDetail = types.ListValueMust(t, vs) +} + type CreateListingRequest struct { - Listing []Listing `tfsdk:"listing" tf:"object"` + Listing types.List `tfsdk:"listing" tf:"object"` } func (newState *CreateListingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateListingRequest) { @@ -204,6 +1031,67 @@ func (newState *CreateListingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *CreateListingRequest) SyncEffectiveFieldsDuringRead(existingState CreateListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listing": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateListingRequest +// only implements ToObjectValue() and Type(). +func (o CreateListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing": o.Listing, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + }, + } +} + +// GetListing returns the value of the Listing field in CreateListingRequest as +// a Listing value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateListingRequest) GetListing(ctx context.Context) (Listing, bool) { + var e Listing + if o.Listing.IsNull() || o.Listing.IsUnknown() { + return e, false + } + var v []Listing + d := o.Listing.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetListing sets the value of the Listing field in CreateListingRequest. +func (o *CreateListingRequest) SetListing(ctx context.Context, v Listing) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listing"] + o.Listing = types.ListValueMust(t, vs) +} + type CreateListingResponse struct { ListingId types.String `tfsdk:"listing_id" tf:"optional"` } @@ -214,9 +1102,40 @@ func (newState *CreateListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateListingResponse) SyncEffectiveFieldsDuringRead(existingState CreateListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateListingResponse +// only implements ToObjectValue() and Type(). +func (o CreateListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + }, + } +} + // Data request messages also creates a lead (maybe) type CreatePersonalizationRequest struct { - AcceptedConsumerTerms []ConsumerTerms `tfsdk:"accepted_consumer_terms" tf:"object"` + AcceptedConsumerTerms types.List `tfsdk:"accepted_consumer_terms" tf:"object"` Comment types.String `tfsdk:"comment" tf:"optional"` @@ -241,6 +1160,83 @@ func (newState *CreatePersonalizationRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *CreatePersonalizationRequest) SyncEffectiveFieldsDuringRead(existingState CreatePersonalizationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePersonalizationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePersonalizationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "accepted_consumer_terms": reflect.TypeOf(ConsumerTerms{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePersonalizationRequest +// only implements ToObjectValue() and Type(). +func (o CreatePersonalizationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "accepted_consumer_terms": o.AcceptedConsumerTerms, + "comment": o.Comment, + "company": o.Company, + "first_name": o.FirstName, + "intended_use": o.IntendedUse, + "is_from_lighthouse": o.IsFromLighthouse, + "last_name": o.LastName, + "listing_id": o.ListingId, + "recipient_type": o.RecipientType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePersonalizationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "accepted_consumer_terms": basetypes.ListType{ + ElemType: ConsumerTerms{}.Type(ctx), + }, + "comment": types.StringType, + "company": types.StringType, + "first_name": types.StringType, + "intended_use": types.StringType, + "is_from_lighthouse": types.BoolType, + "last_name": types.StringType, + "listing_id": types.StringType, + "recipient_type": types.StringType, + }, + } +} + +// GetAcceptedConsumerTerms returns the value of the AcceptedConsumerTerms field in CreatePersonalizationRequest as +// a ConsumerTerms value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePersonalizationRequest) GetAcceptedConsumerTerms(ctx context.Context) (ConsumerTerms, bool) { + var e ConsumerTerms + if o.AcceptedConsumerTerms.IsNull() || o.AcceptedConsumerTerms.IsUnknown() { + return e, false + } + var v []ConsumerTerms + d := o.AcceptedConsumerTerms.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAcceptedConsumerTerms sets the value of the AcceptedConsumerTerms field in CreatePersonalizationRequest. +func (o *CreatePersonalizationRequest) SetAcceptedConsumerTerms(ctx context.Context, v ConsumerTerms) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["accepted_consumer_terms"] + o.AcceptedConsumerTerms = types.ListValueMust(t, vs) +} + type CreatePersonalizationRequestResponse struct { Id types.String `tfsdk:"id" tf:"optional"` } @@ -251,8 +1247,39 @@ func (newState *CreatePersonalizationRequestResponse) SyncEffectiveFieldsDuringC func (newState *CreatePersonalizationRequestResponse) SyncEffectiveFieldsDuringRead(existingState CreatePersonalizationRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePersonalizationRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePersonalizationRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePersonalizationRequestResponse +// only implements ToObjectValue() and Type(). +func (o CreatePersonalizationRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePersonalizationRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type CreateProviderRequest struct { - Provider []ProviderInfo `tfsdk:"provider" tf:"object"` + Provider types.List `tfsdk:"provider" tf:"object"` } func (newState *CreateProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateProviderRequest) { @@ -261,6 +1288,67 @@ func (newState *CreateProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateProviderRequest) SyncEffectiveFieldsDuringRead(existingState CreateProviderRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateProviderRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateProviderRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "provider": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateProviderRequest +// only implements ToObjectValue() and Type(). +func (o CreateProviderRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "provider": o.Provider, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateProviderRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "provider": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProvider returns the value of the Provider field in CreateProviderRequest as +// a ProviderInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateProviderRequest) GetProvider(ctx context.Context) (ProviderInfo, bool) { + var e ProviderInfo + if o.Provider.IsNull() || o.Provider.IsUnknown() { + return e, false + } + var v []ProviderInfo + d := o.Provider.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvider sets the value of the Provider field in CreateProviderRequest. +func (o *CreateProviderRequest) SetProvider(ctx context.Context, v ProviderInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider"] + o.Provider = types.ListValueMust(t, vs) +} + type CreateProviderResponse struct { Id types.String `tfsdk:"id" tf:"optional"` } @@ -271,6 +1359,37 @@ func (newState *CreateProviderResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateProviderResponse) SyncEffectiveFieldsDuringRead(existingState CreateProviderResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateProviderResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateProviderResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateProviderResponse +// only implements ToObjectValue() and Type(). +func (o CreateProviderResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateProviderResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DataRefreshInfo struct { Interval types.Int64 `tfsdk:"interval" tf:""` @@ -283,6 +1402,39 @@ func (newState *DataRefreshInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Da func (newState *DataRefreshInfo) SyncEffectiveFieldsDuringRead(existingState DataRefreshInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DataRefreshInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DataRefreshInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DataRefreshInfo +// only implements ToObjectValue() and Type(). +func (o DataRefreshInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "interval": o.Interval, + "unit": o.Unit, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DataRefreshInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "interval": types.Int64Type, + "unit": types.StringType, + }, + } +} + // Delete an exchange filter type DeleteExchangeFilterRequest struct { Id types.String `tfsdk:"-"` @@ -294,6 +1446,37 @@ func (newState *DeleteExchangeFilterRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *DeleteExchangeFilterRequest) SyncEffectiveFieldsDuringRead(existingState DeleteExchangeFilterRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExchangeFilterRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExchangeFilterRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExchangeFilterRequest +// only implements ToObjectValue() and Type(). +func (o DeleteExchangeFilterRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExchangeFilterRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteExchangeFilterResponse struct { } @@ -303,6 +1486,33 @@ func (newState *DeleteExchangeFilterResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteExchangeFilterResponse) SyncEffectiveFieldsDuringRead(existingState DeleteExchangeFilterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExchangeFilterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExchangeFilterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExchangeFilterResponse +// only implements ToObjectValue() and Type(). +func (o DeleteExchangeFilterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExchangeFilterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete an exchange type DeleteExchangeRequest struct { Id types.String `tfsdk:"-"` @@ -314,6 +1524,37 @@ func (newState *DeleteExchangeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteExchangeRequest) SyncEffectiveFieldsDuringRead(existingState DeleteExchangeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExchangeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExchangeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExchangeRequest +// only implements ToObjectValue() and Type(). +func (o DeleteExchangeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExchangeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteExchangeResponse struct { } @@ -323,6 +1564,33 @@ func (newState *DeleteExchangeResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteExchangeResponse) SyncEffectiveFieldsDuringRead(existingState DeleteExchangeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExchangeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExchangeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExchangeResponse +// only implements ToObjectValue() and Type(). +func (o DeleteExchangeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExchangeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a file type DeleteFileRequest struct { FileId types.String `tfsdk:"-"` @@ -334,6 +1602,37 @@ func (newState *DeleteFileRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteFileRequest) SyncEffectiveFieldsDuringRead(existingState DeleteFileRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteFileRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteFileRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteFileRequest +// only implements ToObjectValue() and Type(). +func (o DeleteFileRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_id": o.FileId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteFileRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_id": types.StringType, + }, + } +} + type DeleteFileResponse struct { } @@ -343,6 +1642,33 @@ func (newState *DeleteFileResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteFileResponse) SyncEffectiveFieldsDuringRead(existingState DeleteFileResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteFileResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteFileResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteFileResponse +// only implements ToObjectValue() and Type(). +func (o DeleteFileResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteFileResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Uninstall from a listing type DeleteInstallationRequest struct { InstallationId types.String `tfsdk:"-"` @@ -356,6 +1682,39 @@ func (newState *DeleteInstallationRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteInstallationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteInstallationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteInstallationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteInstallationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteInstallationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteInstallationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "installation_id": o.InstallationId, + "listing_id": o.ListingId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteInstallationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "installation_id": types.StringType, + "listing_id": types.StringType, + }, + } +} + type DeleteInstallationResponse struct { } @@ -365,6 +1724,33 @@ func (newState *DeleteInstallationResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteInstallationResponse) SyncEffectiveFieldsDuringRead(existingState DeleteInstallationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteInstallationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteInstallationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteInstallationResponse +// only implements ToObjectValue() and Type(). +func (o DeleteInstallationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteInstallationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a listing type DeleteListingRequest struct { Id types.String `tfsdk:"-"` @@ -376,6 +1762,37 @@ func (newState *DeleteListingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteListingRequest) SyncEffectiveFieldsDuringRead(existingState DeleteListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteListingRequest +// only implements ToObjectValue() and Type(). +func (o DeleteListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteListingResponse struct { } @@ -385,6 +1802,33 @@ func (newState *DeleteListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteListingResponse) SyncEffectiveFieldsDuringRead(existingState DeleteListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteListingResponse +// only implements ToObjectValue() and Type(). +func (o DeleteListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete provider type DeleteProviderRequest struct { Id types.String `tfsdk:"-"` @@ -396,6 +1840,37 @@ func (newState *DeleteProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteProviderRequest) SyncEffectiveFieldsDuringRead(existingState DeleteProviderRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteProviderRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteProviderRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteProviderRequest +// only implements ToObjectValue() and Type(). +func (o DeleteProviderRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteProviderRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteProviderResponse struct { } @@ -405,6 +1880,33 @@ func (newState *DeleteProviderResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteProviderResponse) SyncEffectiveFieldsDuringRead(existingState DeleteProviderResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteProviderResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteProviderResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteProviderResponse +// only implements ToObjectValue() and Type(). +func (o DeleteProviderResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteProviderResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Exchange struct { Comment types.String `tfsdk:"comment" tf:"optional"` @@ -412,11 +1914,11 @@ type Exchange struct { CreatedBy types.String `tfsdk:"created_by" tf:"optional"` - Filters []ExchangeFilter `tfsdk:"filters" tf:"optional"` + Filters types.List `tfsdk:"filters" tf:"optional"` Id types.String `tfsdk:"id" tf:"optional"` - LinkedListings []ExchangeListing `tfsdk:"linked_listings" tf:"optional"` + LinkedListings types.List `tfsdk:"linked_listings" tf:"optional"` Name types.String `tfsdk:"name" tf:""` @@ -431,6 +1933,112 @@ func (newState *Exchange) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exchange) func (newState *Exchange) SyncEffectiveFieldsDuringRead(existingState Exchange) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Exchange. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Exchange) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filters": reflect.TypeOf(ExchangeFilter{}), + "linked_listings": reflect.TypeOf(ExchangeListing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Exchange +// only implements ToObjectValue() and Type(). +func (o Exchange) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "filters": o.Filters, + "id": o.Id, + "linked_listings": o.LinkedListings, + "name": o.Name, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Exchange) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "filters": basetypes.ListType{ + ElemType: ExchangeFilter{}.Type(ctx), + }, + "id": types.StringType, + "linked_listings": basetypes.ListType{ + ElemType: ExchangeListing{}.Type(ctx), + }, + "name": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetFilters returns the value of the Filters field in Exchange as +// a slice of ExchangeFilter values. +// If the field is unknown or null, the boolean return value is false. +func (o *Exchange) GetFilters(ctx context.Context) ([]ExchangeFilter, bool) { + if o.Filters.IsNull() || o.Filters.IsUnknown() { + return nil, false + } + var v []ExchangeFilter + d := o.Filters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFilters sets the value of the Filters field in Exchange. +func (o *Exchange) SetFilters(ctx context.Context, v []ExchangeFilter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Filters = types.ListValueMust(t, vs) +} + +// GetLinkedListings returns the value of the LinkedListings field in Exchange as +// a slice of ExchangeListing values. +// If the field is unknown or null, the boolean return value is false. +func (o *Exchange) GetLinkedListings(ctx context.Context) ([]ExchangeListing, bool) { + if o.LinkedListings.IsNull() || o.LinkedListings.IsUnknown() { + return nil, false + } + var v []ExchangeListing + d := o.LinkedListings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLinkedListings sets the value of the LinkedListings field in Exchange. +func (o *Exchange) SetLinkedListings(ctx context.Context, v []ExchangeListing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["linked_listings"] + t = t.(attr.TypeWithElementType).ElementType() + o.LinkedListings = types.ListValueMust(t, vs) +} + type ExchangeFilter struct { CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` @@ -457,6 +2065,53 @@ func (newState *ExchangeFilter) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exc func (newState *ExchangeFilter) SyncEffectiveFieldsDuringRead(existingState ExchangeFilter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExchangeFilter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExchangeFilter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExchangeFilter +// only implements ToObjectValue() and Type(). +func (o ExchangeFilter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "exchange_id": o.ExchangeId, + "filter_type": o.FilterType, + "filter_value": o.FilterValue, + "id": o.Id, + "name": o.Name, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExchangeFilter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.Int64Type, + "created_by": types.StringType, + "exchange_id": types.StringType, + "filter_type": types.StringType, + "filter_value": types.StringType, + "id": types.StringType, + "name": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + type ExchangeListing struct { CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` @@ -479,6 +2134,49 @@ func (newState *ExchangeListing) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ex func (newState *ExchangeListing) SyncEffectiveFieldsDuringRead(existingState ExchangeListing) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExchangeListing. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExchangeListing) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExchangeListing +// only implements ToObjectValue() and Type(). +func (o ExchangeListing) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "exchange_id": o.ExchangeId, + "exchange_name": o.ExchangeName, + "id": o.Id, + "listing_id": o.ListingId, + "listing_name": o.ListingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExchangeListing) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.Int64Type, + "created_by": types.StringType, + "exchange_id": types.StringType, + "exchange_name": types.StringType, + "id": types.StringType, + "listing_id": types.StringType, + "listing_name": types.StringType, + }, + } +} + type FileInfo struct { CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` // Name displayed to users for applicable files, e.g. embedded notebooks @@ -486,7 +2184,7 @@ type FileInfo struct { DownloadLink types.String `tfsdk:"download_link" tf:"optional"` - FileParent []FileParent `tfsdk:"file_parent" tf:"optional,object"` + FileParent types.List `tfsdk:"file_parent" tf:"optional,object"` Id types.String `tfsdk:"id" tf:"optional"` @@ -508,6 +2206,85 @@ func (newState *FileInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan FileInfo) func (newState *FileInfo) SyncEffectiveFieldsDuringRead(existingState FileInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FileInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FileInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_parent": reflect.TypeOf(FileParent{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FileInfo +// only implements ToObjectValue() and Type(). +func (o FileInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "display_name": o.DisplayName, + "download_link": o.DownloadLink, + "file_parent": o.FileParent, + "id": o.Id, + "marketplace_file_type": o.MarketplaceFileType, + "mime_type": o.MimeType, + "status": o.Status, + "status_message": o.StatusMessage, + "updated_at": o.UpdatedAt, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FileInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.Int64Type, + "display_name": types.StringType, + "download_link": types.StringType, + "file_parent": basetypes.ListType{ + ElemType: FileParent{}.Type(ctx), + }, + "id": types.StringType, + "marketplace_file_type": types.StringType, + "mime_type": types.StringType, + "status": types.StringType, + "status_message": types.StringType, + "updated_at": types.Int64Type, + }, + } +} + +// GetFileParent returns the value of the FileParent field in FileInfo as +// a FileParent value. +// If the field is unknown or null, the boolean return value is false. +func (o *FileInfo) GetFileParent(ctx context.Context) (FileParent, bool) { + var e FileParent + if o.FileParent.IsNull() || o.FileParent.IsUnknown() { + return e, false + } + var v []FileParent + d := o.FileParent.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFileParent sets the value of the FileParent field in FileInfo. +func (o *FileInfo) SetFileParent(ctx context.Context, v FileParent) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_parent"] + o.FileParent = types.ListValueMust(t, vs) +} + type FileParent struct { FileParentType types.String `tfsdk:"file_parent_type" tf:"optional"` // TODO make the following fields required @@ -520,6 +2297,39 @@ func (newState *FileParent) SyncEffectiveFieldsDuringCreateOrUpdate(plan FilePar func (newState *FileParent) SyncEffectiveFieldsDuringRead(existingState FileParent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FileParent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FileParent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FileParent +// only implements ToObjectValue() and Type(). +func (o FileParent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_parent_type": o.FileParentType, + "parent_id": o.ParentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FileParent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_parent_type": types.StringType, + "parent_id": types.StringType, + }, + } +} + // Get an exchange type GetExchangeRequest struct { Id types.String `tfsdk:"-"` @@ -531,8 +2341,39 @@ func (newState *GetExchangeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetExchangeRequest) SyncEffectiveFieldsDuringRead(existingState GetExchangeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExchangeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExchangeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExchangeRequest +// only implements ToObjectValue() and Type(). +func (o GetExchangeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExchangeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetExchangeResponse struct { - Exchange []Exchange `tfsdk:"exchange" tf:"optional,object"` + Exchange types.List `tfsdk:"exchange" tf:"optional,object"` } func (newState *GetExchangeResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetExchangeResponse) { @@ -541,6 +2382,67 @@ func (newState *GetExchangeResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetExchangeResponse) SyncEffectiveFieldsDuringRead(existingState GetExchangeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExchangeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExchangeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange": reflect.TypeOf(Exchange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExchangeResponse +// only implements ToObjectValue() and Type(). +func (o GetExchangeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange": o.Exchange, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExchangeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange": basetypes.ListType{ + ElemType: Exchange{}.Type(ctx), + }, + }, + } +} + +// GetExchange returns the value of the Exchange field in GetExchangeResponse as +// a Exchange value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetExchangeResponse) GetExchange(ctx context.Context) (Exchange, bool) { + var e Exchange + if o.Exchange.IsNull() || o.Exchange.IsUnknown() { + return e, false + } + var v []Exchange + d := o.Exchange.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExchange sets the value of the Exchange field in GetExchangeResponse. +func (o *GetExchangeResponse) SetExchange(ctx context.Context, v Exchange) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange"] + o.Exchange = types.ListValueMust(t, vs) +} + // Get a file type GetFileRequest struct { FileId types.String `tfsdk:"-"` @@ -552,8 +2454,39 @@ func (newState *GetFileRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Get func (newState *GetFileRequest) SyncEffectiveFieldsDuringRead(existingState GetFileRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetFileRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetFileRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetFileRequest +// only implements ToObjectValue() and Type(). +func (o GetFileRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_id": o.FileId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetFileRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_id": types.StringType, + }, + } +} + type GetFileResponse struct { - FileInfo []FileInfo `tfsdk:"file_info" tf:"optional,object"` + FileInfo types.List `tfsdk:"file_info" tf:"optional,object"` } func (newState *GetFileResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetFileResponse) { @@ -562,6 +2495,67 @@ func (newState *GetFileResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetFileResponse) SyncEffectiveFieldsDuringRead(existingState GetFileResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetFileResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetFileResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_info": reflect.TypeOf(FileInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetFileResponse +// only implements ToObjectValue() and Type(). +func (o GetFileResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_info": o.FileInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetFileResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_info": basetypes.ListType{ + ElemType: FileInfo{}.Type(ctx), + }, + }, + } +} + +// GetFileInfo returns the value of the FileInfo field in GetFileResponse as +// a FileInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetFileResponse) GetFileInfo(ctx context.Context) (FileInfo, bool) { + var e FileInfo + if o.FileInfo.IsNull() || o.FileInfo.IsUnknown() { + return e, false + } + var v []FileInfo + d := o.FileInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFileInfo sets the value of the FileInfo field in GetFileResponse. +func (o *GetFileResponse) SetFileInfo(ctx context.Context, v FileInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_info"] + o.FileInfo = types.ListValueMust(t, vs) +} + type GetLatestVersionProviderAnalyticsDashboardResponse struct { // version here is latest logical version of the dashboard template Version types.Int64 `tfsdk:"version" tf:"optional"` @@ -573,6 +2567,37 @@ func (newState *GetLatestVersionProviderAnalyticsDashboardResponse) SyncEffectiv func (newState *GetLatestVersionProviderAnalyticsDashboardResponse) SyncEffectiveFieldsDuringRead(existingState GetLatestVersionProviderAnalyticsDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetLatestVersionProviderAnalyticsDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetLatestVersionProviderAnalyticsDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetLatestVersionProviderAnalyticsDashboardResponse +// only implements ToObjectValue() and Type(). +func (o GetLatestVersionProviderAnalyticsDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetLatestVersionProviderAnalyticsDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "version": types.Int64Type, + }, + } +} + // Get listing content metadata type GetListingContentMetadataRequest struct { ListingId types.String `tfsdk:"-"` @@ -588,10 +2613,45 @@ func (newState *GetListingContentMetadataRequest) SyncEffectiveFieldsDuringCreat func (newState *GetListingContentMetadataRequest) SyncEffectiveFieldsDuringRead(existingState GetListingContentMetadataRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetListingContentMetadataRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetListingContentMetadataRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetListingContentMetadataRequest +// only implements ToObjectValue() and Type(). +func (o GetListingContentMetadataRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetListingContentMetadataRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type GetListingContentMetadataResponse struct { NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - SharedDataObjects []SharedDataObject `tfsdk:"shared_data_objects" tf:"optional"` + SharedDataObjects types.List `tfsdk:"shared_data_objects" tf:"optional"` } func (newState *GetListingContentMetadataResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetListingContentMetadataResponse) { @@ -600,6 +2660,69 @@ func (newState *GetListingContentMetadataResponse) SyncEffectiveFieldsDuringCrea func (newState *GetListingContentMetadataResponse) SyncEffectiveFieldsDuringRead(existingState GetListingContentMetadataResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetListingContentMetadataResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetListingContentMetadataResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "shared_data_objects": reflect.TypeOf(SharedDataObject{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetListingContentMetadataResponse +// only implements ToObjectValue() and Type(). +func (o GetListingContentMetadataResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "shared_data_objects": o.SharedDataObjects, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetListingContentMetadataResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "shared_data_objects": basetypes.ListType{ + ElemType: SharedDataObject{}.Type(ctx), + }, + }, + } +} + +// GetSharedDataObjects returns the value of the SharedDataObjects field in GetListingContentMetadataResponse as +// a slice of SharedDataObject values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetListingContentMetadataResponse) GetSharedDataObjects(ctx context.Context) ([]SharedDataObject, bool) { + if o.SharedDataObjects.IsNull() || o.SharedDataObjects.IsUnknown() { + return nil, false + } + var v []SharedDataObject + d := o.SharedDataObjects.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSharedDataObjects sets the value of the SharedDataObjects field in GetListingContentMetadataResponse. +func (o *GetListingContentMetadataResponse) SetSharedDataObjects(ctx context.Context, v []SharedDataObject) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["shared_data_objects"] + t = t.(attr.TypeWithElementType).ElementType() + o.SharedDataObjects = types.ListValueMust(t, vs) +} + // Get listing type GetListingRequest struct { Id types.String `tfsdk:"-"` @@ -611,8 +2734,39 @@ func (newState *GetListingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetListingRequest) SyncEffectiveFieldsDuringRead(existingState GetListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetListingRequest +// only implements ToObjectValue() and Type(). +func (o GetListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetListingResponse struct { - Listing []Listing `tfsdk:"listing" tf:"optional,object"` + Listing types.List `tfsdk:"listing" tf:"optional,object"` } func (newState *GetListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetListingResponse) { @@ -621,6 +2775,67 @@ func (newState *GetListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetListingResponse) SyncEffectiveFieldsDuringRead(existingState GetListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listing": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetListingResponse +// only implements ToObjectValue() and Type(). +func (o GetListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing": o.Listing, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + }, + } +} + +// GetListing returns the value of the Listing field in GetListingResponse as +// a Listing value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetListingResponse) GetListing(ctx context.Context) (Listing, bool) { + var e Listing + if o.Listing.IsNull() || o.Listing.IsUnknown() { + return e, false + } + var v []Listing + d := o.Listing.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetListing sets the value of the Listing field in GetListingResponse. +func (o *GetListingResponse) SetListing(ctx context.Context, v Listing) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listing"] + o.Listing = types.ListValueMust(t, vs) +} + // List listings type GetListingsRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -634,8 +2849,41 @@ func (newState *GetListingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetListingsRequest) SyncEffectiveFieldsDuringRead(existingState GetListingsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetListingsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetListingsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetListingsRequest +// only implements ToObjectValue() and Type(). +func (o GetListingsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetListingsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type GetListingsResponse struct { - Listings []Listing `tfsdk:"listings" tf:"optional"` + Listings types.List `tfsdk:"listings" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -646,6 +2894,69 @@ func (newState *GetListingsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetListingsResponse) SyncEffectiveFieldsDuringRead(existingState GetListingsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetListingsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetListingsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listings": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetListingsResponse +// only implements ToObjectValue() and Type(). +func (o GetListingsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listings": o.Listings, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetListingsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listings": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetListings returns the value of the Listings field in GetListingsResponse as +// a slice of Listing values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetListingsResponse) GetListings(ctx context.Context) ([]Listing, bool) { + if o.Listings.IsNull() || o.Listings.IsUnknown() { + return nil, false + } + var v []Listing + d := o.Listings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetListings sets the value of the Listings field in GetListingsResponse. +func (o *GetListingsResponse) SetListings(ctx context.Context, v []Listing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listings"] + t = t.(attr.TypeWithElementType).ElementType() + o.Listings = types.ListValueMust(t, vs) +} + // Get the personalization request for a listing type GetPersonalizationRequestRequest struct { ListingId types.String `tfsdk:"-"` @@ -657,8 +2968,39 @@ func (newState *GetPersonalizationRequestRequest) SyncEffectiveFieldsDuringCreat func (newState *GetPersonalizationRequestRequest) SyncEffectiveFieldsDuringRead(existingState GetPersonalizationRequestRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPersonalizationRequestRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPersonalizationRequestRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPersonalizationRequestRequest +// only implements ToObjectValue() and Type(). +func (o GetPersonalizationRequestRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPersonalizationRequestRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + }, + } +} + type GetPersonalizationRequestResponse struct { - PersonalizationRequests []PersonalizationRequest `tfsdk:"personalization_requests" tf:"optional"` + PersonalizationRequests types.List `tfsdk:"personalization_requests" tf:"optional"` } func (newState *GetPersonalizationRequestResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetPersonalizationRequestResponse) { @@ -667,6 +3009,67 @@ func (newState *GetPersonalizationRequestResponse) SyncEffectiveFieldsDuringCrea func (newState *GetPersonalizationRequestResponse) SyncEffectiveFieldsDuringRead(existingState GetPersonalizationRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPersonalizationRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPersonalizationRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "personalization_requests": reflect.TypeOf(PersonalizationRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPersonalizationRequestResponse +// only implements ToObjectValue() and Type(). +func (o GetPersonalizationRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "personalization_requests": o.PersonalizationRequests, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPersonalizationRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "personalization_requests": basetypes.ListType{ + ElemType: PersonalizationRequest{}.Type(ctx), + }, + }, + } +} + +// GetPersonalizationRequests returns the value of the PersonalizationRequests field in GetPersonalizationRequestResponse as +// a slice of PersonalizationRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPersonalizationRequestResponse) GetPersonalizationRequests(ctx context.Context) ([]PersonalizationRequest, bool) { + if o.PersonalizationRequests.IsNull() || o.PersonalizationRequests.IsUnknown() { + return nil, false + } + var v []PersonalizationRequest + d := o.PersonalizationRequests.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPersonalizationRequests sets the value of the PersonalizationRequests field in GetPersonalizationRequestResponse. +func (o *GetPersonalizationRequestResponse) SetPersonalizationRequests(ctx context.Context, v []PersonalizationRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["personalization_requests"] + t = t.(attr.TypeWithElementType).ElementType() + o.PersonalizationRequests = types.ListValueMust(t, vs) +} + // Get a provider type GetProviderRequest struct { Id types.String `tfsdk:"-"` @@ -678,8 +3081,39 @@ func (newState *GetProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetProviderRequest) SyncEffectiveFieldsDuringRead(existingState GetProviderRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetProviderRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetProviderRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetProviderRequest +// only implements ToObjectValue() and Type(). +func (o GetProviderRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetProviderRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetProviderResponse struct { - Provider []ProviderInfo `tfsdk:"provider" tf:"optional,object"` + Provider types.List `tfsdk:"provider" tf:"optional,object"` } func (newState *GetProviderResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetProviderResponse) { @@ -688,8 +3122,69 @@ func (newState *GetProviderResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetProviderResponse) SyncEffectiveFieldsDuringRead(existingState GetProviderResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetProviderResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetProviderResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "provider": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetProviderResponse +// only implements ToObjectValue() and Type(). +func (o GetProviderResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "provider": o.Provider, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetProviderResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "provider": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProvider returns the value of the Provider field in GetProviderResponse as +// a ProviderInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetProviderResponse) GetProvider(ctx context.Context) (ProviderInfo, bool) { + var e ProviderInfo + if o.Provider.IsNull() || o.Provider.IsUnknown() { + return e, false + } + var v []ProviderInfo + d := o.Provider.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvider sets the value of the Provider field in GetProviderResponse. +func (o *GetProviderResponse) SetProvider(ctx context.Context, v ProviderInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider"] + o.Provider = types.ListValueMust(t, vs) +} + type Installation struct { - Installation []InstallationDetail `tfsdk:"installation" tf:"optional,object"` + Installation types.List `tfsdk:"installation" tf:"optional,object"` } func (newState *Installation) SyncEffectiveFieldsDuringCreateOrUpdate(plan Installation) { @@ -698,6 +3193,67 @@ func (newState *Installation) SyncEffectiveFieldsDuringCreateOrUpdate(plan Insta func (newState *Installation) SyncEffectiveFieldsDuringRead(existingState Installation) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Installation. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Installation) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "installation": reflect.TypeOf(InstallationDetail{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Installation +// only implements ToObjectValue() and Type(). +func (o Installation) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "installation": o.Installation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Installation) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "installation": basetypes.ListType{ + ElemType: InstallationDetail{}.Type(ctx), + }, + }, + } +} + +// GetInstallation returns the value of the Installation field in Installation as +// a InstallationDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *Installation) GetInstallation(ctx context.Context) (InstallationDetail, bool) { + var e InstallationDetail + if o.Installation.IsNull() || o.Installation.IsUnknown() { + return e, false + } + var v []InstallationDetail + d := o.Installation.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInstallation sets the value of the Installation field in Installation. +func (o *Installation) SetInstallation(ctx context.Context, v InstallationDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["installation"] + o.Installation = types.ListValueMust(t, vs) +} + type InstallationDetail struct { CatalogName types.String `tfsdk:"catalog_name" tf:"optional"` @@ -721,9 +3277,9 @@ type InstallationDetail struct { Status types.String `tfsdk:"status" tf:"optional"` - TokenDetail []TokenDetail `tfsdk:"token_detail" tf:"optional,object"` + TokenDetail types.List `tfsdk:"token_detail" tf:"optional,object"` - Tokens []TokenInfo `tfsdk:"tokens" tf:"optional"` + Tokens types.List `tfsdk:"tokens" tf:"optional"` } func (newState *InstallationDetail) SyncEffectiveFieldsDuringCreateOrUpdate(plan InstallationDetail) { @@ -732,6 +3288,120 @@ func (newState *InstallationDetail) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *InstallationDetail) SyncEffectiveFieldsDuringRead(existingState InstallationDetail) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InstallationDetail. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InstallationDetail) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_detail": reflect.TypeOf(TokenDetail{}), + "tokens": reflect.TypeOf(TokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InstallationDetail +// only implements ToObjectValue() and Type(). +func (o InstallationDetail) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "error_message": o.ErrorMessage, + "id": o.Id, + "installed_on": o.InstalledOn, + "listing_id": o.ListingId, + "listing_name": o.ListingName, + "recipient_type": o.RecipientType, + "repo_name": o.RepoName, + "repo_path": o.RepoPath, + "share_name": o.ShareName, + "status": o.Status, + "token_detail": o.TokenDetail, + "tokens": o.Tokens, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InstallationDetail) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "error_message": types.StringType, + "id": types.StringType, + "installed_on": types.Int64Type, + "listing_id": types.StringType, + "listing_name": types.StringType, + "recipient_type": types.StringType, + "repo_name": types.StringType, + "repo_path": types.StringType, + "share_name": types.StringType, + "status": types.StringType, + "token_detail": basetypes.ListType{ + ElemType: TokenDetail{}.Type(ctx), + }, + "tokens": basetypes.ListType{ + ElemType: TokenInfo{}.Type(ctx), + }, + }, + } +} + +// GetTokenDetail returns the value of the TokenDetail field in InstallationDetail as +// a TokenDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *InstallationDetail) GetTokenDetail(ctx context.Context) (TokenDetail, bool) { + var e TokenDetail + if o.TokenDetail.IsNull() || o.TokenDetail.IsUnknown() { + return e, false + } + var v []TokenDetail + d := o.TokenDetail.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenDetail sets the value of the TokenDetail field in InstallationDetail. +func (o *InstallationDetail) SetTokenDetail(ctx context.Context, v TokenDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_detail"] + o.TokenDetail = types.ListValueMust(t, vs) +} + +// GetTokens returns the value of the Tokens field in InstallationDetail as +// a slice of TokenInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *InstallationDetail) GetTokens(ctx context.Context) ([]TokenInfo, bool) { + if o.Tokens.IsNull() || o.Tokens.IsUnknown() { + return nil, false + } + var v []TokenInfo + d := o.Tokens.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTokens sets the value of the Tokens field in InstallationDetail. +func (o *InstallationDetail) SetTokens(ctx context.Context, v []TokenInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tokens"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tokens = types.ListValueMust(t, vs) +} + // List all installations type ListAllInstallationsRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -745,8 +3415,41 @@ func (newState *ListAllInstallationsRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *ListAllInstallationsRequest) SyncEffectiveFieldsDuringRead(existingState ListAllInstallationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAllInstallationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAllInstallationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAllInstallationsRequest +// only implements ToObjectValue() and Type(). +func (o ListAllInstallationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAllInstallationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListAllInstallationsResponse struct { - Installations []InstallationDetail `tfsdk:"installations" tf:"optional"` + Installations types.List `tfsdk:"installations" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -757,6 +3460,69 @@ func (newState *ListAllInstallationsResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *ListAllInstallationsResponse) SyncEffectiveFieldsDuringRead(existingState ListAllInstallationsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAllInstallationsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAllInstallationsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "installations": reflect.TypeOf(InstallationDetail{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAllInstallationsResponse +// only implements ToObjectValue() and Type(). +func (o ListAllInstallationsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "installations": o.Installations, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAllInstallationsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "installations": basetypes.ListType{ + ElemType: InstallationDetail{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetInstallations returns the value of the Installations field in ListAllInstallationsResponse as +// a slice of InstallationDetail values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAllInstallationsResponse) GetInstallations(ctx context.Context) ([]InstallationDetail, bool) { + if o.Installations.IsNull() || o.Installations.IsUnknown() { + return nil, false + } + var v []InstallationDetail + d := o.Installations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInstallations sets the value of the Installations field in ListAllInstallationsResponse. +func (o *ListAllInstallationsResponse) SetInstallations(ctx context.Context, v []InstallationDetail) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["installations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Installations = types.ListValueMust(t, vs) +} + // List all personalization requests type ListAllPersonalizationRequestsRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -770,10 +3536,43 @@ func (newState *ListAllPersonalizationRequestsRequest) SyncEffectiveFieldsDuring func (newState *ListAllPersonalizationRequestsRequest) SyncEffectiveFieldsDuringRead(existingState ListAllPersonalizationRequestsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAllPersonalizationRequestsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAllPersonalizationRequestsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAllPersonalizationRequestsRequest +// only implements ToObjectValue() and Type(). +func (o ListAllPersonalizationRequestsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAllPersonalizationRequestsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListAllPersonalizationRequestsResponse struct { NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - PersonalizationRequests []PersonalizationRequest `tfsdk:"personalization_requests" tf:"optional"` + PersonalizationRequests types.List `tfsdk:"personalization_requests" tf:"optional"` } func (newState *ListAllPersonalizationRequestsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAllPersonalizationRequestsResponse) { @@ -782,6 +3581,69 @@ func (newState *ListAllPersonalizationRequestsResponse) SyncEffectiveFieldsDurin func (newState *ListAllPersonalizationRequestsResponse) SyncEffectiveFieldsDuringRead(existingState ListAllPersonalizationRequestsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAllPersonalizationRequestsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAllPersonalizationRequestsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "personalization_requests": reflect.TypeOf(PersonalizationRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAllPersonalizationRequestsResponse +// only implements ToObjectValue() and Type(). +func (o ListAllPersonalizationRequestsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "personalization_requests": o.PersonalizationRequests, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAllPersonalizationRequestsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "personalization_requests": basetypes.ListType{ + ElemType: PersonalizationRequest{}.Type(ctx), + }, + }, + } +} + +// GetPersonalizationRequests returns the value of the PersonalizationRequests field in ListAllPersonalizationRequestsResponse as +// a slice of PersonalizationRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAllPersonalizationRequestsResponse) GetPersonalizationRequests(ctx context.Context) ([]PersonalizationRequest, bool) { + if o.PersonalizationRequests.IsNull() || o.PersonalizationRequests.IsUnknown() { + return nil, false + } + var v []PersonalizationRequest + d := o.PersonalizationRequests.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPersonalizationRequests sets the value of the PersonalizationRequests field in ListAllPersonalizationRequestsResponse. +func (o *ListAllPersonalizationRequestsResponse) SetPersonalizationRequests(ctx context.Context, v []PersonalizationRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["personalization_requests"] + t = t.(attr.TypeWithElementType).ElementType() + o.PersonalizationRequests = types.ListValueMust(t, vs) +} + // List exchange filters type ListExchangeFiltersRequest struct { ExchangeId types.String `tfsdk:"-"` @@ -797,8 +3659,43 @@ func (newState *ListExchangeFiltersRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListExchangeFiltersRequest) SyncEffectiveFieldsDuringRead(existingState ListExchangeFiltersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExchangeFiltersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExchangeFiltersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExchangeFiltersRequest +// only implements ToObjectValue() and Type(). +func (o ListExchangeFiltersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_id": o.ExchangeId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExchangeFiltersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListExchangeFiltersResponse struct { - Filters []ExchangeFilter `tfsdk:"filters" tf:"optional"` + Filters types.List `tfsdk:"filters" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -809,6 +3706,69 @@ func (newState *ListExchangeFiltersResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *ListExchangeFiltersResponse) SyncEffectiveFieldsDuringRead(existingState ListExchangeFiltersResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExchangeFiltersResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExchangeFiltersResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filters": reflect.TypeOf(ExchangeFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExchangeFiltersResponse +// only implements ToObjectValue() and Type(). +func (o ListExchangeFiltersResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filters": o.Filters, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExchangeFiltersResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filters": basetypes.ListType{ + ElemType: ExchangeFilter{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetFilters returns the value of the Filters field in ListExchangeFiltersResponse as +// a slice of ExchangeFilter values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListExchangeFiltersResponse) GetFilters(ctx context.Context) ([]ExchangeFilter, bool) { + if o.Filters.IsNull() || o.Filters.IsUnknown() { + return nil, false + } + var v []ExchangeFilter + d := o.Filters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFilters sets the value of the Filters field in ListExchangeFiltersResponse. +func (o *ListExchangeFiltersResponse) SetFilters(ctx context.Context, v []ExchangeFilter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Filters = types.ListValueMust(t, vs) +} + // List exchanges for listing type ListExchangesForListingRequest struct { ListingId types.String `tfsdk:"-"` @@ -824,8 +3784,43 @@ func (newState *ListExchangesForListingRequest) SyncEffectiveFieldsDuringCreateO func (newState *ListExchangesForListingRequest) SyncEffectiveFieldsDuringRead(existingState ListExchangesForListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExchangesForListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExchangesForListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExchangesForListingRequest +// only implements ToObjectValue() and Type(). +func (o ListExchangesForListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExchangesForListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListExchangesForListingResponse struct { - ExchangeListing []ExchangeListing `tfsdk:"exchange_listing" tf:"optional"` + ExchangeListing types.List `tfsdk:"exchange_listing" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -836,6 +3831,69 @@ func (newState *ListExchangesForListingResponse) SyncEffectiveFieldsDuringCreate func (newState *ListExchangesForListingResponse) SyncEffectiveFieldsDuringRead(existingState ListExchangesForListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExchangesForListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExchangesForListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange_listing": reflect.TypeOf(ExchangeListing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExchangesForListingResponse +// only implements ToObjectValue() and Type(). +func (o ListExchangesForListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_listing": o.ExchangeListing, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExchangesForListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_listing": basetypes.ListType{ + ElemType: ExchangeListing{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetExchangeListing returns the value of the ExchangeListing field in ListExchangesForListingResponse as +// a slice of ExchangeListing values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListExchangesForListingResponse) GetExchangeListing(ctx context.Context) ([]ExchangeListing, bool) { + if o.ExchangeListing.IsNull() || o.ExchangeListing.IsUnknown() { + return nil, false + } + var v []ExchangeListing + d := o.ExchangeListing.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExchangeListing sets the value of the ExchangeListing field in ListExchangesForListingResponse. +func (o *ListExchangesForListingResponse) SetExchangeListing(ctx context.Context, v []ExchangeListing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange_listing"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExchangeListing = types.ListValueMust(t, vs) +} + // List exchanges type ListExchangesRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -849,8 +3907,41 @@ func (newState *ListExchangesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListExchangesRequest) SyncEffectiveFieldsDuringRead(existingState ListExchangesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExchangesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExchangesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExchangesRequest +// only implements ToObjectValue() and Type(). +func (o ListExchangesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExchangesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListExchangesResponse struct { - Exchanges []Exchange `tfsdk:"exchanges" tf:"optional"` + Exchanges types.List `tfsdk:"exchanges" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -861,9 +3952,72 @@ func (newState *ListExchangesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListExchangesResponse) SyncEffectiveFieldsDuringRead(existingState ListExchangesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExchangesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExchangesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchanges": reflect.TypeOf(Exchange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExchangesResponse +// only implements ToObjectValue() and Type(). +func (o ListExchangesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchanges": o.Exchanges, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExchangesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchanges": basetypes.ListType{ + ElemType: Exchange{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetExchanges returns the value of the Exchanges field in ListExchangesResponse as +// a slice of Exchange values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListExchangesResponse) GetExchanges(ctx context.Context) ([]Exchange, bool) { + if o.Exchanges.IsNull() || o.Exchanges.IsUnknown() { + return nil, false + } + var v []Exchange + d := o.Exchanges.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExchanges sets the value of the Exchanges field in ListExchangesResponse. +func (o *ListExchangesResponse) SetExchanges(ctx context.Context, v []Exchange) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchanges"] + t = t.(attr.TypeWithElementType).ElementType() + o.Exchanges = types.ListValueMust(t, vs) +} + // List files type ListFilesRequest struct { - FileParent []FileParent `tfsdk:"-"` + FileParent types.List `tfsdk:"-"` PageSize types.Int64 `tfsdk:"-"` @@ -876,8 +4030,73 @@ func (newState *ListFilesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListFilesRequest) SyncEffectiveFieldsDuringRead(existingState ListFilesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFilesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFilesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_parent": reflect.TypeOf(FileParent{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFilesRequest +// only implements ToObjectValue() and Type(). +func (o ListFilesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_parent": o.FileParent, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFilesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_parent": basetypes.ListType{ + ElemType: FileParent{}.Type(ctx), + }, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + +// GetFileParent returns the value of the FileParent field in ListFilesRequest as +// a FileParent value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListFilesRequest) GetFileParent(ctx context.Context) (FileParent, bool) { + var e FileParent + if o.FileParent.IsNull() || o.FileParent.IsUnknown() { + return e, false + } + var v []FileParent + d := o.FileParent.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFileParent sets the value of the FileParent field in ListFilesRequest. +func (o *ListFilesRequest) SetFileParent(ctx context.Context, v FileParent) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_parent"] + o.FileParent = types.ListValueMust(t, vs) +} + type ListFilesResponse struct { - FileInfos []FileInfo `tfsdk:"file_infos" tf:"optional"` + FileInfos types.List `tfsdk:"file_infos" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -888,6 +4107,69 @@ func (newState *ListFilesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListFilesResponse) SyncEffectiveFieldsDuringRead(existingState ListFilesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFilesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFilesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file_infos": reflect.TypeOf(FileInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFilesResponse +// only implements ToObjectValue() and Type(). +func (o ListFilesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_infos": o.FileInfos, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFilesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_infos": basetypes.ListType{ + ElemType: FileInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetFileInfos returns the value of the FileInfos field in ListFilesResponse as +// a slice of FileInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListFilesResponse) GetFileInfos(ctx context.Context) ([]FileInfo, bool) { + if o.FileInfos.IsNull() || o.FileInfos.IsUnknown() { + return nil, false + } + var v []FileInfo + d := o.FileInfos.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFileInfos sets the value of the FileInfos field in ListFilesResponse. +func (o *ListFilesResponse) SetFileInfos(ctx context.Context, v []FileInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_infos"] + t = t.(attr.TypeWithElementType).ElementType() + o.FileInfos = types.ListValueMust(t, vs) +} + // List all listing fulfillments type ListFulfillmentsRequest struct { ListingId types.String `tfsdk:"-"` @@ -903,8 +4185,43 @@ func (newState *ListFulfillmentsRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListFulfillmentsRequest) SyncEffectiveFieldsDuringRead(existingState ListFulfillmentsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFulfillmentsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFulfillmentsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFulfillmentsRequest +// only implements ToObjectValue() and Type(). +func (o ListFulfillmentsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFulfillmentsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListFulfillmentsResponse struct { - Fulfillments []ListingFulfillment `tfsdk:"fulfillments" tf:"optional"` + Fulfillments types.List `tfsdk:"fulfillments" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -915,6 +4232,69 @@ func (newState *ListFulfillmentsResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListFulfillmentsResponse) SyncEffectiveFieldsDuringRead(existingState ListFulfillmentsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFulfillmentsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFulfillmentsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "fulfillments": reflect.TypeOf(ListingFulfillment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFulfillmentsResponse +// only implements ToObjectValue() and Type(). +func (o ListFulfillmentsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "fulfillments": o.Fulfillments, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFulfillmentsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "fulfillments": basetypes.ListType{ + ElemType: ListingFulfillment{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetFulfillments returns the value of the Fulfillments field in ListFulfillmentsResponse as +// a slice of ListingFulfillment values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListFulfillmentsResponse) GetFulfillments(ctx context.Context) ([]ListingFulfillment, bool) { + if o.Fulfillments.IsNull() || o.Fulfillments.IsUnknown() { + return nil, false + } + var v []ListingFulfillment + d := o.Fulfillments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFulfillments sets the value of the Fulfillments field in ListFulfillmentsResponse. +func (o *ListFulfillmentsResponse) SetFulfillments(ctx context.Context, v []ListingFulfillment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["fulfillments"] + t = t.(attr.TypeWithElementType).ElementType() + o.Fulfillments = types.ListValueMust(t, vs) +} + // List installations for a listing type ListInstallationsRequest struct { ListingId types.String `tfsdk:"-"` @@ -930,8 +4310,43 @@ func (newState *ListInstallationsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListInstallationsRequest) SyncEffectiveFieldsDuringRead(existingState ListInstallationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListInstallationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListInstallationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListInstallationsRequest +// only implements ToObjectValue() and Type(). +func (o ListInstallationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListInstallationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListInstallationsResponse struct { - Installations []InstallationDetail `tfsdk:"installations" tf:"optional"` + Installations types.List `tfsdk:"installations" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -942,6 +4357,69 @@ func (newState *ListInstallationsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListInstallationsResponse) SyncEffectiveFieldsDuringRead(existingState ListInstallationsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListInstallationsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListInstallationsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "installations": reflect.TypeOf(InstallationDetail{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListInstallationsResponse +// only implements ToObjectValue() and Type(). +func (o ListInstallationsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "installations": o.Installations, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListInstallationsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "installations": basetypes.ListType{ + ElemType: InstallationDetail{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetInstallations returns the value of the Installations field in ListInstallationsResponse as +// a slice of InstallationDetail values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListInstallationsResponse) GetInstallations(ctx context.Context) ([]InstallationDetail, bool) { + if o.Installations.IsNull() || o.Installations.IsUnknown() { + return nil, false + } + var v []InstallationDetail + d := o.Installations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInstallations sets the value of the Installations field in ListInstallationsResponse. +func (o *ListInstallationsResponse) SetInstallations(ctx context.Context, v []InstallationDetail) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["installations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Installations = types.ListValueMust(t, vs) +} + // List listings for exchange type ListListingsForExchangeRequest struct { ExchangeId types.String `tfsdk:"-"` @@ -957,8 +4435,43 @@ func (newState *ListListingsForExchangeRequest) SyncEffectiveFieldsDuringCreateO func (newState *ListListingsForExchangeRequest) SyncEffectiveFieldsDuringRead(existingState ListListingsForExchangeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListListingsForExchangeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListListingsForExchangeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListListingsForExchangeRequest +// only implements ToObjectValue() and Type(). +func (o ListListingsForExchangeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_id": o.ExchangeId, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListListingsForExchangeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListListingsForExchangeResponse struct { - ExchangeListings []ExchangeListing `tfsdk:"exchange_listings" tf:"optional"` + ExchangeListings types.List `tfsdk:"exchange_listings" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -969,12 +4482,75 @@ func (newState *ListListingsForExchangeResponse) SyncEffectiveFieldsDuringCreate func (newState *ListListingsForExchangeResponse) SyncEffectiveFieldsDuringRead(existingState ListListingsForExchangeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListListingsForExchangeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListListingsForExchangeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange_listings": reflect.TypeOf(ExchangeListing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListListingsForExchangeResponse +// only implements ToObjectValue() and Type(). +func (o ListListingsForExchangeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange_listings": o.ExchangeListings, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListListingsForExchangeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange_listings": basetypes.ListType{ + ElemType: ExchangeListing{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetExchangeListings returns the value of the ExchangeListings field in ListListingsForExchangeResponse as +// a slice of ExchangeListing values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListListingsForExchangeResponse) GetExchangeListings(ctx context.Context) ([]ExchangeListing, bool) { + if o.ExchangeListings.IsNull() || o.ExchangeListings.IsUnknown() { + return nil, false + } + var v []ExchangeListing + d := o.ExchangeListings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExchangeListings sets the value of the ExchangeListings field in ListListingsForExchangeResponse. +func (o *ListListingsForExchangeResponse) SetExchangeListings(ctx context.Context, v []ExchangeListing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange_listings"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExchangeListings = types.ListValueMust(t, vs) +} + // List listings type ListListingsRequest struct { // Matches any of the following asset types - Assets []types.String `tfsdk:"-"` + Assets types.List `tfsdk:"-"` // Matches any of the following categories - Categories []types.String `tfsdk:"-"` + Categories types.List `tfsdk:"-"` // Filters each listing based on if it is free. IsFree types.Bool `tfsdk:"-"` // Filters each listing based on if it is a private exchange. @@ -986,9 +4562,9 @@ type ListListingsRequest struct { PageToken types.String `tfsdk:"-"` // Matches any of the following provider ids - ProviderIds []types.String `tfsdk:"-"` + ProviderIds types.List `tfsdk:"-"` // Matches any of the following tags - Tags []ListingTag `tfsdk:"-"` + Tags types.List `tfsdk:"-"` } func (newState *ListListingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListListingsRequest) { @@ -997,8 +4573,172 @@ func (newState *ListListingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListListingsRequest) SyncEffectiveFieldsDuringRead(existingState ListListingsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListListingsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListListingsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "assets": reflect.TypeOf(types.String{}), + "categories": reflect.TypeOf(types.String{}), + "provider_ids": reflect.TypeOf(types.String{}), + "tags": reflect.TypeOf(ListingTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListListingsRequest +// only implements ToObjectValue() and Type(). +func (o ListListingsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assets": o.Assets, + "categories": o.Categories, + "is_free": o.IsFree, + "is_private_exchange": o.IsPrivateExchange, + "is_staff_pick": o.IsStaffPick, + "page_size": o.PageSize, + "page_token": o.PageToken, + "provider_ids": o.ProviderIds, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListListingsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assets": basetypes.ListType{ + ElemType: types.StringType, + }, + "categories": basetypes.ListType{ + ElemType: types.StringType, + }, + "is_free": types.BoolType, + "is_private_exchange": types.BoolType, + "is_staff_pick": types.BoolType, + "page_size": types.Int64Type, + "page_token": types.StringType, + "provider_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "tags": basetypes.ListType{ + ElemType: ListingTag{}.Type(ctx), + }, + }, + } +} + +// GetAssets returns the value of the Assets field in ListListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListListingsRequest) GetAssets(ctx context.Context) ([]types.String, bool) { + if o.Assets.IsNull() || o.Assets.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Assets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAssets sets the value of the Assets field in ListListingsRequest. +func (o *ListListingsRequest) SetAssets(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["assets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Assets = types.ListValueMust(t, vs) +} + +// GetCategories returns the value of the Categories field in ListListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListListingsRequest) GetCategories(ctx context.Context) ([]types.String, bool) { + if o.Categories.IsNull() || o.Categories.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Categories.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCategories sets the value of the Categories field in ListListingsRequest. +func (o *ListListingsRequest) SetCategories(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["categories"] + t = t.(attr.TypeWithElementType).ElementType() + o.Categories = types.ListValueMust(t, vs) +} + +// GetProviderIds returns the value of the ProviderIds field in ListListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListListingsRequest) GetProviderIds(ctx context.Context) ([]types.String, bool) { + if o.ProviderIds.IsNull() || o.ProviderIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ProviderIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProviderIds sets the value of the ProviderIds field in ListListingsRequest. +func (o *ListListingsRequest) SetProviderIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.ProviderIds = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in ListListingsRequest as +// a slice of ListingTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListListingsRequest) GetTags(ctx context.Context) ([]ListingTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ListingTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ListListingsRequest. +func (o *ListListingsRequest) SetTags(ctx context.Context, v []ListingTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ListListingsResponse struct { - Listings []Listing `tfsdk:"listings" tf:"optional"` + Listings types.List `tfsdk:"listings" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -1009,6 +4749,69 @@ func (newState *ListListingsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListListingsResponse) SyncEffectiveFieldsDuringRead(existingState ListListingsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListListingsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListListingsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listings": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListListingsResponse +// only implements ToObjectValue() and Type(). +func (o ListListingsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listings": o.Listings, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListListingsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listings": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetListings returns the value of the Listings field in ListListingsResponse as +// a slice of Listing values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListListingsResponse) GetListings(ctx context.Context) ([]Listing, bool) { + if o.Listings.IsNull() || o.Listings.IsUnknown() { + return nil, false + } + var v []Listing + d := o.Listings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetListings sets the value of the Listings field in ListListingsResponse. +func (o *ListListingsResponse) SetListings(ctx context.Context, v []Listing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listings"] + t = t.(attr.TypeWithElementType).ElementType() + o.Listings = types.ListValueMust(t, vs) +} + type ListProviderAnalyticsDashboardResponse struct { // dashboard_id will be used to open Lakeview dashboard. DashboardId types.String `tfsdk:"dashboard_id" tf:""` @@ -1024,6 +4827,41 @@ func (newState *ListProviderAnalyticsDashboardResponse) SyncEffectiveFieldsDurin func (newState *ListProviderAnalyticsDashboardResponse) SyncEffectiveFieldsDuringRead(existingState ListProviderAnalyticsDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListProviderAnalyticsDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListProviderAnalyticsDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListProviderAnalyticsDashboardResponse +// only implements ToObjectValue() and Type(). +func (o ListProviderAnalyticsDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "id": o.Id, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListProviderAnalyticsDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "id": types.StringType, + "version": types.Int64Type, + }, + } +} + // List providers type ListProvidersRequest struct { IsFeatured types.Bool `tfsdk:"-"` @@ -1039,10 +4877,45 @@ func (newState *ListProvidersRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListProvidersRequest) SyncEffectiveFieldsDuringRead(existingState ListProvidersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListProvidersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListProvidersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListProvidersRequest +// only implements ToObjectValue() and Type(). +func (o ListProvidersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_featured": o.IsFeatured, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListProvidersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_featured": types.BoolType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListProvidersResponse struct { NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Providers []ProviderInfo `tfsdk:"providers" tf:"optional"` + Providers types.List `tfsdk:"providers" tf:"optional"` } func (newState *ListProvidersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListProvidersResponse) { @@ -1051,12 +4924,75 @@ func (newState *ListProvidersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListProvidersResponse) SyncEffectiveFieldsDuringRead(existingState ListProvidersResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListProvidersResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListProvidersResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "providers": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListProvidersResponse +// only implements ToObjectValue() and Type(). +func (o ListProvidersResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "providers": o.Providers, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListProvidersResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "providers": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProviders returns the value of the Providers field in ListProvidersResponse as +// a slice of ProviderInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListProvidersResponse) GetProviders(ctx context.Context) ([]ProviderInfo, bool) { + if o.Providers.IsNull() || o.Providers.IsUnknown() { + return nil, false + } + var v []ProviderInfo + d := o.Providers.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProviders sets the value of the Providers field in ListProvidersResponse. +func (o *ListProvidersResponse) SetProviders(ctx context.Context, v []ProviderInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["providers"] + t = t.(attr.TypeWithElementType).ElementType() + o.Providers = types.ListValueMust(t, vs) +} + type Listing struct { - Detail []ListingDetail `tfsdk:"detail" tf:"optional,object"` + Detail types.List `tfsdk:"detail" tf:"optional,object"` Id types.String `tfsdk:"id" tf:"optional"` // Next Number: 26 - Summary []ListingSummary `tfsdk:"summary" tf:"object"` + Summary types.List `tfsdk:"summary" tf:"object"` } func (newState *Listing) SyncEffectiveFieldsDuringCreateOrUpdate(plan Listing) { @@ -1065,16 +5001,110 @@ func (newState *Listing) SyncEffectiveFieldsDuringCreateOrUpdate(plan Listing) { func (newState *Listing) SyncEffectiveFieldsDuringRead(existingState Listing) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Listing. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Listing) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "detail": reflect.TypeOf(ListingDetail{}), + "summary": reflect.TypeOf(ListingSummary{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Listing +// only implements ToObjectValue() and Type(). +func (o Listing) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "detail": o.Detail, + "id": o.Id, + "summary": o.Summary, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Listing) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "detail": basetypes.ListType{ + ElemType: ListingDetail{}.Type(ctx), + }, + "id": types.StringType, + "summary": basetypes.ListType{ + ElemType: ListingSummary{}.Type(ctx), + }, + }, + } +} + +// GetDetail returns the value of the Detail field in Listing as +// a ListingDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *Listing) GetDetail(ctx context.Context) (ListingDetail, bool) { + var e ListingDetail + if o.Detail.IsNull() || o.Detail.IsUnknown() { + return e, false + } + var v []ListingDetail + d := o.Detail.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDetail sets the value of the Detail field in Listing. +func (o *Listing) SetDetail(ctx context.Context, v ListingDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["detail"] + o.Detail = types.ListValueMust(t, vs) +} + +// GetSummary returns the value of the Summary field in Listing as +// a ListingSummary value. +// If the field is unknown or null, the boolean return value is false. +func (o *Listing) GetSummary(ctx context.Context) (ListingSummary, bool) { + var e ListingSummary + if o.Summary.IsNull() || o.Summary.IsUnknown() { + return e, false + } + var v []ListingSummary + d := o.Summary.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSummary sets the value of the Summary field in Listing. +func (o *Listing) SetSummary(ctx context.Context, v ListingSummary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["summary"] + o.Summary = types.ListValueMust(t, vs) +} + type ListingDetail struct { // Type of assets included in the listing. eg. GIT_REPO, DATA_TABLE, MODEL, // NOTEBOOK - Assets []types.String `tfsdk:"assets" tf:"optional"` + Assets types.List `tfsdk:"assets" tf:"optional"` // The ending date timestamp for when the data spans CollectionDateEnd types.Int64 `tfsdk:"collection_date_end" tf:"optional"` // The starting date timestamp for when the data spans CollectionDateStart types.Int64 `tfsdk:"collection_date_start" tf:"optional"` // Smallest unit of time in the dataset - CollectionGranularity []DataRefreshInfo `tfsdk:"collection_granularity" tf:"optional,object"` + CollectionGranularity types.List `tfsdk:"collection_granularity" tf:"optional,object"` // Whether the dataset is free or paid Cost types.String `tfsdk:"cost" tf:"optional"` // Where/how the data is sourced @@ -1084,9 +5114,9 @@ type ListingDetail struct { DocumentationLink types.String `tfsdk:"documentation_link" tf:"optional"` - EmbeddedNotebookFileInfos []FileInfo `tfsdk:"embedded_notebook_file_infos" tf:"optional"` + EmbeddedNotebookFileInfos types.List `tfsdk:"embedded_notebook_file_infos" tf:"optional"` - FileIds []types.String `tfsdk:"file_ids" tf:"optional"` + FileIds types.List `tfsdk:"file_ids" tf:"optional"` // Which geo region the listing data is collected from GeographicalCoverage types.String `tfsdk:"geographical_coverage" tf:"optional"` // ID 20, 21 removed don't use License of the data asset - Required for @@ -1109,11 +5139,11 @@ type ListingDetail struct { // the field is optional and won't need to have NOT NULL integrity check 2. // The value is fairly fixed, static and low cardinality (eg. enums). 3. The // value won't be used in filters or joins with other tables. - Tags []ListingTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` TermsOfService types.String `tfsdk:"terms_of_service" tf:"optional"` // How often data is updated - UpdateFrequency []DataRefreshInfo `tfsdk:"update_frequency" tf:"optional,object"` + UpdateFrequency types.List `tfsdk:"update_frequency" tf:"optional,object"` } func (newState *ListingDetail) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListingDetail) { @@ -1122,6 +5152,248 @@ func (newState *ListingDetail) SyncEffectiveFieldsDuringCreateOrUpdate(plan List func (newState *ListingDetail) SyncEffectiveFieldsDuringRead(existingState ListingDetail) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListingDetail. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListingDetail) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "assets": reflect.TypeOf(types.String{}), + "collection_granularity": reflect.TypeOf(DataRefreshInfo{}), + "embedded_notebook_file_infos": reflect.TypeOf(FileInfo{}), + "file_ids": reflect.TypeOf(types.String{}), + "tags": reflect.TypeOf(ListingTag{}), + "update_frequency": reflect.TypeOf(DataRefreshInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListingDetail +// only implements ToObjectValue() and Type(). +func (o ListingDetail) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assets": o.Assets, + "collection_date_end": o.CollectionDateEnd, + "collection_date_start": o.CollectionDateStart, + "collection_granularity": o.CollectionGranularity, + "cost": o.Cost, + "data_source": o.DataSource, + "description": o.Description, + "documentation_link": o.DocumentationLink, + "embedded_notebook_file_infos": o.EmbeddedNotebookFileInfos, + "file_ids": o.FileIds, + "geographical_coverage": o.GeographicalCoverage, + "license": o.License, + "pricing_model": o.PricingModel, + "privacy_policy_link": o.PrivacyPolicyLink, + "size": o.Size, + "support_link": o.SupportLink, + "tags": o.Tags, + "terms_of_service": o.TermsOfService, + "update_frequency": o.UpdateFrequency, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListingDetail) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assets": basetypes.ListType{ + ElemType: types.StringType, + }, + "collection_date_end": types.Int64Type, + "collection_date_start": types.Int64Type, + "collection_granularity": basetypes.ListType{ + ElemType: DataRefreshInfo{}.Type(ctx), + }, + "cost": types.StringType, + "data_source": types.StringType, + "description": types.StringType, + "documentation_link": types.StringType, + "embedded_notebook_file_infos": basetypes.ListType{ + ElemType: FileInfo{}.Type(ctx), + }, + "file_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "geographical_coverage": types.StringType, + "license": types.StringType, + "pricing_model": types.StringType, + "privacy_policy_link": types.StringType, + "size": types.Float64Type, + "support_link": types.StringType, + "tags": basetypes.ListType{ + ElemType: ListingTag{}.Type(ctx), + }, + "terms_of_service": types.StringType, + "update_frequency": basetypes.ListType{ + ElemType: DataRefreshInfo{}.Type(ctx), + }, + }, + } +} + +// GetAssets returns the value of the Assets field in ListingDetail as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingDetail) GetAssets(ctx context.Context) ([]types.String, bool) { + if o.Assets.IsNull() || o.Assets.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Assets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAssets sets the value of the Assets field in ListingDetail. +func (o *ListingDetail) SetAssets(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["assets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Assets = types.ListValueMust(t, vs) +} + +// GetCollectionGranularity returns the value of the CollectionGranularity field in ListingDetail as +// a DataRefreshInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingDetail) GetCollectionGranularity(ctx context.Context) (DataRefreshInfo, bool) { + var e DataRefreshInfo + if o.CollectionGranularity.IsNull() || o.CollectionGranularity.IsUnknown() { + return e, false + } + var v []DataRefreshInfo + d := o.CollectionGranularity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCollectionGranularity sets the value of the CollectionGranularity field in ListingDetail. +func (o *ListingDetail) SetCollectionGranularity(ctx context.Context, v DataRefreshInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["collection_granularity"] + o.CollectionGranularity = types.ListValueMust(t, vs) +} + +// GetEmbeddedNotebookFileInfos returns the value of the EmbeddedNotebookFileInfos field in ListingDetail as +// a slice of FileInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingDetail) GetEmbeddedNotebookFileInfos(ctx context.Context) ([]FileInfo, bool) { + if o.EmbeddedNotebookFileInfos.IsNull() || o.EmbeddedNotebookFileInfos.IsUnknown() { + return nil, false + } + var v []FileInfo + d := o.EmbeddedNotebookFileInfos.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddedNotebookFileInfos sets the value of the EmbeddedNotebookFileInfos field in ListingDetail. +func (o *ListingDetail) SetEmbeddedNotebookFileInfos(ctx context.Context, v []FileInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedded_notebook_file_infos"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddedNotebookFileInfos = types.ListValueMust(t, vs) +} + +// GetFileIds returns the value of the FileIds field in ListingDetail as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingDetail) GetFileIds(ctx context.Context) ([]types.String, bool) { + if o.FileIds.IsNull() || o.FileIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FileIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFileIds sets the value of the FileIds field in ListingDetail. +func (o *ListingDetail) SetFileIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.FileIds = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in ListingDetail as +// a slice of ListingTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingDetail) GetTags(ctx context.Context) ([]ListingTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ListingTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ListingDetail. +func (o *ListingDetail) SetTags(ctx context.Context, v []ListingTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + +// GetUpdateFrequency returns the value of the UpdateFrequency field in ListingDetail as +// a DataRefreshInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingDetail) GetUpdateFrequency(ctx context.Context) (DataRefreshInfo, bool) { + var e DataRefreshInfo + if o.UpdateFrequency.IsNull() || o.UpdateFrequency.IsUnknown() { + return e, false + } + var v []DataRefreshInfo + d := o.UpdateFrequency.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUpdateFrequency sets the value of the UpdateFrequency field in ListingDetail. +func (o *ListingDetail) SetUpdateFrequency(ctx context.Context, v DataRefreshInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["update_frequency"] + o.UpdateFrequency = types.ListValueMust(t, vs) +} + type ListingFulfillment struct { FulfillmentType types.String `tfsdk:"fulfillment_type" tf:"optional"` @@ -1129,9 +5401,9 @@ type ListingFulfillment struct { RecipientType types.String `tfsdk:"recipient_type" tf:"optional"` - RepoInfo []RepoInfo `tfsdk:"repo_info" tf:"optional,object"` + RepoInfo types.List `tfsdk:"repo_info" tf:"optional,object"` - ShareInfo []ShareInfo `tfsdk:"share_info" tf:"optional,object"` + ShareInfo types.List `tfsdk:"share_info" tf:"optional,object"` } func (newState *ListingFulfillment) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListingFulfillment) { @@ -1140,6 +5412,104 @@ func (newState *ListingFulfillment) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListingFulfillment) SyncEffectiveFieldsDuringRead(existingState ListingFulfillment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListingFulfillment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListingFulfillment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "repo_info": reflect.TypeOf(RepoInfo{}), + "share_info": reflect.TypeOf(ShareInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListingFulfillment +// only implements ToObjectValue() and Type(). +func (o ListingFulfillment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "fulfillment_type": o.FulfillmentType, + "listing_id": o.ListingId, + "recipient_type": o.RecipientType, + "repo_info": o.RepoInfo, + "share_info": o.ShareInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListingFulfillment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "fulfillment_type": types.StringType, + "listing_id": types.StringType, + "recipient_type": types.StringType, + "repo_info": basetypes.ListType{ + ElemType: RepoInfo{}.Type(ctx), + }, + "share_info": basetypes.ListType{ + ElemType: ShareInfo{}.Type(ctx), + }, + }, + } +} + +// GetRepoInfo returns the value of the RepoInfo field in ListingFulfillment as +// a RepoInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingFulfillment) GetRepoInfo(ctx context.Context) (RepoInfo, bool) { + var e RepoInfo + if o.RepoInfo.IsNull() || o.RepoInfo.IsUnknown() { + return e, false + } + var v []RepoInfo + d := o.RepoInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRepoInfo sets the value of the RepoInfo field in ListingFulfillment. +func (o *ListingFulfillment) SetRepoInfo(ctx context.Context, v RepoInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["repo_info"] + o.RepoInfo = types.ListValueMust(t, vs) +} + +// GetShareInfo returns the value of the ShareInfo field in ListingFulfillment as +// a ShareInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingFulfillment) GetShareInfo(ctx context.Context) (ShareInfo, bool) { + var e ShareInfo + if o.ShareInfo.IsNull() || o.ShareInfo.IsUnknown() { + return e, false + } + var v []ShareInfo + d := o.ShareInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetShareInfo sets the value of the ShareInfo field in ListingFulfillment. +func (o *ListingFulfillment) SetShareInfo(ctx context.Context, v ShareInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["share_info"] + o.ShareInfo = types.ListValueMust(t, vs) +} + type ListingSetting struct { Visibility types.String `tfsdk:"visibility" tf:"optional"` } @@ -1150,9 +5520,40 @@ func (newState *ListingSetting) SyncEffectiveFieldsDuringCreateOrUpdate(plan Lis func (newState *ListingSetting) SyncEffectiveFieldsDuringRead(existingState ListingSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListingSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListingSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListingSetting +// only implements ToObjectValue() and Type(). +func (o ListingSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "visibility": o.Visibility, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListingSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "visibility": types.StringType, + }, + } +} + // Next Number: 26 type ListingSummary struct { - Categories []types.String `tfsdk:"categories" tf:"optional"` + Categories types.List `tfsdk:"categories" tf:"optional"` CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` @@ -1160,10 +5561,10 @@ type ListingSummary struct { CreatedById types.Int64 `tfsdk:"created_by_id" tf:"optional"` - ExchangeIds []types.String `tfsdk:"exchange_ids" tf:"optional"` + ExchangeIds types.List `tfsdk:"exchange_ids" tf:"optional"` // if a git repo is being created, a listing will be initialized with this // field as opposed to a share - GitRepo []RepoInfo `tfsdk:"git_repo" tf:"optional,object"` + GitRepo types.List `tfsdk:"git_repo" tf:"optional,object"` ListingType types.String `tfsdk:"listingType" tf:""` @@ -1171,15 +5572,15 @@ type ListingSummary struct { ProviderId types.String `tfsdk:"provider_id" tf:"optional"` - ProviderRegion []RegionInfo `tfsdk:"provider_region" tf:"optional,object"` + ProviderRegion types.List `tfsdk:"provider_region" tf:"optional,object"` PublishedAt types.Int64 `tfsdk:"published_at" tf:"optional"` PublishedBy types.String `tfsdk:"published_by" tf:"optional"` - Setting []ListingSetting `tfsdk:"setting" tf:"optional,object"` + Setting types.List `tfsdk:"setting" tf:"optional,object"` - Share []ShareInfo `tfsdk:"share" tf:"optional,object"` + Share types.List `tfsdk:"share" tf:"optional,object"` // Enums Status types.String `tfsdk:"status" tf:"optional"` @@ -1198,12 +5599,254 @@ func (newState *ListingSummary) SyncEffectiveFieldsDuringCreateOrUpdate(plan Lis func (newState *ListingSummary) SyncEffectiveFieldsDuringRead(existingState ListingSummary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListingSummary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListingSummary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "categories": reflect.TypeOf(types.String{}), + "exchange_ids": reflect.TypeOf(types.String{}), + "git_repo": reflect.TypeOf(RepoInfo{}), + "provider_region": reflect.TypeOf(RegionInfo{}), + "setting": reflect.TypeOf(ListingSetting{}), + "share": reflect.TypeOf(ShareInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListingSummary +// only implements ToObjectValue() and Type(). +func (o ListingSummary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "categories": o.Categories, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "created_by_id": o.CreatedById, + "exchange_ids": o.ExchangeIds, + "git_repo": o.GitRepo, + "listingType": o.ListingType, + "name": o.Name, + "provider_id": o.ProviderId, + "provider_region": o.ProviderRegion, + "published_at": o.PublishedAt, + "published_by": o.PublishedBy, + "setting": o.Setting, + "share": o.Share, + "status": o.Status, + "subtitle": o.Subtitle, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + "updated_by_id": o.UpdatedById, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListingSummary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "categories": basetypes.ListType{ + ElemType: types.StringType, + }, + "created_at": types.Int64Type, + "created_by": types.StringType, + "created_by_id": types.Int64Type, + "exchange_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "git_repo": basetypes.ListType{ + ElemType: RepoInfo{}.Type(ctx), + }, + "listingType": types.StringType, + "name": types.StringType, + "provider_id": types.StringType, + "provider_region": basetypes.ListType{ + ElemType: RegionInfo{}.Type(ctx), + }, + "published_at": types.Int64Type, + "published_by": types.StringType, + "setting": basetypes.ListType{ + ElemType: ListingSetting{}.Type(ctx), + }, + "share": basetypes.ListType{ + ElemType: ShareInfo{}.Type(ctx), + }, + "status": types.StringType, + "subtitle": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + "updated_by_id": types.Int64Type, + }, + } +} + +// GetCategories returns the value of the Categories field in ListingSummary as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingSummary) GetCategories(ctx context.Context) ([]types.String, bool) { + if o.Categories.IsNull() || o.Categories.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Categories.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCategories sets the value of the Categories field in ListingSummary. +func (o *ListingSummary) SetCategories(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["categories"] + t = t.(attr.TypeWithElementType).ElementType() + o.Categories = types.ListValueMust(t, vs) +} + +// GetExchangeIds returns the value of the ExchangeIds field in ListingSummary as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingSummary) GetExchangeIds(ctx context.Context) ([]types.String, bool) { + if o.ExchangeIds.IsNull() || o.ExchangeIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ExchangeIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExchangeIds sets the value of the ExchangeIds field in ListingSummary. +func (o *ListingSummary) SetExchangeIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExchangeIds = types.ListValueMust(t, vs) +} + +// GetGitRepo returns the value of the GitRepo field in ListingSummary as +// a RepoInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingSummary) GetGitRepo(ctx context.Context) (RepoInfo, bool) { + var e RepoInfo + if o.GitRepo.IsNull() || o.GitRepo.IsUnknown() { + return e, false + } + var v []RepoInfo + d := o.GitRepo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGitRepo sets the value of the GitRepo field in ListingSummary. +func (o *ListingSummary) SetGitRepo(ctx context.Context, v RepoInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["git_repo"] + o.GitRepo = types.ListValueMust(t, vs) +} + +// GetProviderRegion returns the value of the ProviderRegion field in ListingSummary as +// a RegionInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingSummary) GetProviderRegion(ctx context.Context) (RegionInfo, bool) { + var e RegionInfo + if o.ProviderRegion.IsNull() || o.ProviderRegion.IsUnknown() { + return e, false + } + var v []RegionInfo + d := o.ProviderRegion.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProviderRegion sets the value of the ProviderRegion field in ListingSummary. +func (o *ListingSummary) SetProviderRegion(ctx context.Context, v RegionInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider_region"] + o.ProviderRegion = types.ListValueMust(t, vs) +} + +// GetSetting returns the value of the Setting field in ListingSummary as +// a ListingSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingSummary) GetSetting(ctx context.Context) (ListingSetting, bool) { + var e ListingSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []ListingSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in ListingSummary. +func (o *ListingSummary) SetSetting(ctx context.Context, v ListingSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + +// GetShare returns the value of the Share field in ListingSummary as +// a ShareInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingSummary) GetShare(ctx context.Context) (ShareInfo, bool) { + var e ShareInfo + if o.Share.IsNull() || o.Share.IsUnknown() { + return e, false + } + var v []ShareInfo + d := o.Share.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetShare sets the value of the Share field in ListingSummary. +func (o *ListingSummary) SetShare(ctx context.Context, v ShareInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["share"] + o.Share = types.ListValueMust(t, vs) +} + type ListingTag struct { // Tag name (enum) TagName types.String `tfsdk:"tag_name" tf:"optional"` // String representation of the tag value. Values should be string literals // (no complex types) - TagValues []types.String `tfsdk:"tag_values" tf:"optional"` + TagValues types.List `tfsdk:"tag_values" tf:"optional"` } func (newState *ListingTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListingTag) { @@ -1212,13 +5855,76 @@ func (newState *ListingTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan Listing func (newState *ListingTag) SyncEffectiveFieldsDuringRead(existingState ListingTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListingTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListingTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tag_values": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListingTag +// only implements ToObjectValue() and Type(). +func (o ListingTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "tag_name": o.TagName, + "tag_values": o.TagValues, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListingTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "tag_name": types.StringType, + "tag_values": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetTagValues returns the value of the TagValues field in ListingTag as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListingTag) GetTagValues(ctx context.Context) ([]types.String, bool) { + if o.TagValues.IsNull() || o.TagValues.IsUnknown() { + return nil, false + } + var v []types.String + d := o.TagValues.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTagValues sets the value of the TagValues field in ListingTag. +func (o *ListingTag) SetTagValues(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tag_values"] + t = t.(attr.TypeWithElementType).ElementType() + o.TagValues = types.ListValueMust(t, vs) +} + type PersonalizationRequest struct { Comment types.String `tfsdk:"comment" tf:"optional"` - ConsumerRegion []RegionInfo `tfsdk:"consumer_region" tf:"object"` + ConsumerRegion types.List `tfsdk:"consumer_region" tf:"object"` // contact info for the consumer requesting data or performing a listing // installation - ContactInfo []ContactInfo `tfsdk:"contact_info" tf:"optional,object"` + ContactInfo types.List `tfsdk:"contact_info" tf:"optional,object"` CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` @@ -1238,7 +5944,7 @@ type PersonalizationRequest struct { RecipientType types.String `tfsdk:"recipient_type" tf:"optional"` - Share []ShareInfo `tfsdk:"share" tf:"optional,object"` + Share types.List `tfsdk:"share" tf:"optional,object"` Status types.String `tfsdk:"status" tf:"optional"` @@ -1253,6 +5959,155 @@ func (newState *PersonalizationRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *PersonalizationRequest) SyncEffectiveFieldsDuringRead(existingState PersonalizationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PersonalizationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PersonalizationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "consumer_region": reflect.TypeOf(RegionInfo{}), + "contact_info": reflect.TypeOf(ContactInfo{}), + "share": reflect.TypeOf(ShareInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PersonalizationRequest +// only implements ToObjectValue() and Type(). +func (o PersonalizationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "consumer_region": o.ConsumerRegion, + "contact_info": o.ContactInfo, + "created_at": o.CreatedAt, + "id": o.Id, + "intended_use": o.IntendedUse, + "is_from_lighthouse": o.IsFromLighthouse, + "listing_id": o.ListingId, + "listing_name": o.ListingName, + "metastore_id": o.MetastoreId, + "provider_id": o.ProviderId, + "recipient_type": o.RecipientType, + "share": o.Share, + "status": o.Status, + "status_message": o.StatusMessage, + "updated_at": o.UpdatedAt, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PersonalizationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "consumer_region": basetypes.ListType{ + ElemType: RegionInfo{}.Type(ctx), + }, + "contact_info": basetypes.ListType{ + ElemType: ContactInfo{}.Type(ctx), + }, + "created_at": types.Int64Type, + "id": types.StringType, + "intended_use": types.StringType, + "is_from_lighthouse": types.BoolType, + "listing_id": types.StringType, + "listing_name": types.StringType, + "metastore_id": types.StringType, + "provider_id": types.StringType, + "recipient_type": types.StringType, + "share": basetypes.ListType{ + ElemType: ShareInfo{}.Type(ctx), + }, + "status": types.StringType, + "status_message": types.StringType, + "updated_at": types.Int64Type, + }, + } +} + +// GetConsumerRegion returns the value of the ConsumerRegion field in PersonalizationRequest as +// a RegionInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *PersonalizationRequest) GetConsumerRegion(ctx context.Context) (RegionInfo, bool) { + var e RegionInfo + if o.ConsumerRegion.IsNull() || o.ConsumerRegion.IsUnknown() { + return e, false + } + var v []RegionInfo + d := o.ConsumerRegion.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConsumerRegion sets the value of the ConsumerRegion field in PersonalizationRequest. +func (o *PersonalizationRequest) SetConsumerRegion(ctx context.Context, v RegionInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["consumer_region"] + o.ConsumerRegion = types.ListValueMust(t, vs) +} + +// GetContactInfo returns the value of the ContactInfo field in PersonalizationRequest as +// a ContactInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *PersonalizationRequest) GetContactInfo(ctx context.Context) (ContactInfo, bool) { + var e ContactInfo + if o.ContactInfo.IsNull() || o.ContactInfo.IsUnknown() { + return e, false + } + var v []ContactInfo + d := o.ContactInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetContactInfo sets the value of the ContactInfo field in PersonalizationRequest. +func (o *PersonalizationRequest) SetContactInfo(ctx context.Context, v ContactInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["contact_info"] + o.ContactInfo = types.ListValueMust(t, vs) +} + +// GetShare returns the value of the Share field in PersonalizationRequest as +// a ShareInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *PersonalizationRequest) GetShare(ctx context.Context) (ShareInfo, bool) { + var e ShareInfo + if o.Share.IsNull() || o.Share.IsUnknown() { + return e, false + } + var v []ShareInfo + d := o.Share.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetShare sets the value of the Share field in PersonalizationRequest. +func (o *PersonalizationRequest) SetShare(ctx context.Context, v ShareInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["share"] + o.Share = types.ListValueMust(t, vs) +} + type ProviderAnalyticsDashboard struct { Id types.String `tfsdk:"id" tf:""` } @@ -1263,6 +6118,37 @@ func (newState *ProviderAnalyticsDashboard) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ProviderAnalyticsDashboard) SyncEffectiveFieldsDuringRead(existingState ProviderAnalyticsDashboard) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ProviderAnalyticsDashboard. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ProviderAnalyticsDashboard) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ProviderAnalyticsDashboard +// only implements ToObjectValue() and Type(). +func (o ProviderAnalyticsDashboard) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ProviderAnalyticsDashboard) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type ProviderInfo struct { BusinessContactEmail types.String `tfsdk:"business_contact_email" tf:""` @@ -1299,6 +6185,63 @@ func (newState *ProviderInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Provi func (newState *ProviderInfo) SyncEffectiveFieldsDuringRead(existingState ProviderInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ProviderInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ProviderInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ProviderInfo +// only implements ToObjectValue() and Type(). +func (o ProviderInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "business_contact_email": o.BusinessContactEmail, + "company_website_link": o.CompanyWebsiteLink, + "dark_mode_icon_file_id": o.DarkModeIconFileId, + "dark_mode_icon_file_path": o.DarkModeIconFilePath, + "description": o.Description, + "icon_file_id": o.IconFileId, + "icon_file_path": o.IconFilePath, + "id": o.Id, + "is_featured": o.IsFeatured, + "name": o.Name, + "privacy_policy_link": o.PrivacyPolicyLink, + "published_by": o.PublishedBy, + "support_contact_email": o.SupportContactEmail, + "term_of_service_link": o.TermOfServiceLink, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ProviderInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "business_contact_email": types.StringType, + "company_website_link": types.StringType, + "dark_mode_icon_file_id": types.StringType, + "dark_mode_icon_file_path": types.StringType, + "description": types.StringType, + "icon_file_id": types.StringType, + "icon_file_path": types.StringType, + "id": types.StringType, + "is_featured": types.BoolType, + "name": types.StringType, + "privacy_policy_link": types.StringType, + "published_by": types.StringType, + "support_contact_email": types.StringType, + "term_of_service_link": types.StringType, + }, + } +} + type RegionInfo struct { Cloud types.String `tfsdk:"cloud" tf:"optional"` @@ -1311,6 +6254,39 @@ func (newState *RegionInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan RegionI func (newState *RegionInfo) SyncEffectiveFieldsDuringRead(existingState RegionInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegionInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegionInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegionInfo +// only implements ToObjectValue() and Type(). +func (o RegionInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cloud": o.Cloud, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegionInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cloud": types.StringType, + "region": types.StringType, + }, + } +} + // Remove an exchange for listing type RemoveExchangeForListingRequest struct { Id types.String `tfsdk:"-"` @@ -1322,6 +6298,37 @@ func (newState *RemoveExchangeForListingRequest) SyncEffectiveFieldsDuringCreate func (newState *RemoveExchangeForListingRequest) SyncEffectiveFieldsDuringRead(existingState RemoveExchangeForListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RemoveExchangeForListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RemoveExchangeForListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RemoveExchangeForListingRequest +// only implements ToObjectValue() and Type(). +func (o RemoveExchangeForListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RemoveExchangeForListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type RemoveExchangeForListingResponse struct { } @@ -1331,6 +6338,33 @@ func (newState *RemoveExchangeForListingResponse) SyncEffectiveFieldsDuringCreat func (newState *RemoveExchangeForListingResponse) SyncEffectiveFieldsDuringRead(existingState RemoveExchangeForListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RemoveExchangeForListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RemoveExchangeForListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RemoveExchangeForListingResponse +// only implements ToObjectValue() and Type(). +func (o RemoveExchangeForListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RemoveExchangeForListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type RepoInfo struct { // the git repo url e.g. https://github.com/databrickslabs/dolly.git GitRepoUrl types.String `tfsdk:"git_repo_url" tf:""` @@ -1342,6 +6376,37 @@ func (newState *RepoInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan RepoInfo) func (newState *RepoInfo) SyncEffectiveFieldsDuringRead(existingState RepoInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoInfo +// only implements ToObjectValue() and Type(). +func (o RepoInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "git_repo_url": o.GitRepoUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "git_repo_url": types.StringType, + }, + } +} + type RepoInstallation struct { // the user-specified repo name for their installed git repo listing RepoName types.String `tfsdk:"repo_name" tf:""` @@ -1357,12 +6422,45 @@ func (newState *RepoInstallation) SyncEffectiveFieldsDuringCreateOrUpdate(plan R func (newState *RepoInstallation) SyncEffectiveFieldsDuringRead(existingState RepoInstallation) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoInstallation. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoInstallation) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoInstallation +// only implements ToObjectValue() and Type(). +func (o RepoInstallation) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "repo_name": o.RepoName, + "repo_path": o.RepoPath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoInstallation) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "repo_name": types.StringType, + "repo_path": types.StringType, + }, + } +} + // Search listings type SearchListingsRequest struct { // Matches any of the following asset types - Assets []types.String `tfsdk:"-"` + Assets types.List `tfsdk:"-"` // Matches any of the following categories - Categories []types.String `tfsdk:"-"` + Categories types.List `tfsdk:"-"` IsFree types.Bool `tfsdk:"-"` @@ -1372,7 +6470,7 @@ type SearchListingsRequest struct { PageToken types.String `tfsdk:"-"` // Matches any of the following provider ids - ProviderIds []types.String `tfsdk:"-"` + ProviderIds types.List `tfsdk:"-"` // Fuzzy matches query Query types.String `tfsdk:"-"` } @@ -1383,8 +6481,141 @@ func (newState *SearchListingsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *SearchListingsRequest) SyncEffectiveFieldsDuringRead(existingState SearchListingsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchListingsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchListingsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "assets": reflect.TypeOf(types.String{}), + "categories": reflect.TypeOf(types.String{}), + "provider_ids": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchListingsRequest +// only implements ToObjectValue() and Type(). +func (o SearchListingsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "assets": o.Assets, + "categories": o.Categories, + "is_free": o.IsFree, + "is_private_exchange": o.IsPrivateExchange, + "page_size": o.PageSize, + "page_token": o.PageToken, + "provider_ids": o.ProviderIds, + "query": o.Query, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchListingsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "assets": basetypes.ListType{ + ElemType: types.StringType, + }, + "categories": basetypes.ListType{ + ElemType: types.StringType, + }, + "is_free": types.BoolType, + "is_private_exchange": types.BoolType, + "page_size": types.Int64Type, + "page_token": types.StringType, + "provider_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "query": types.StringType, + }, + } +} + +// GetAssets returns the value of the Assets field in SearchListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchListingsRequest) GetAssets(ctx context.Context) ([]types.String, bool) { + if o.Assets.IsNull() || o.Assets.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Assets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAssets sets the value of the Assets field in SearchListingsRequest. +func (o *SearchListingsRequest) SetAssets(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["assets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Assets = types.ListValueMust(t, vs) +} + +// GetCategories returns the value of the Categories field in SearchListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchListingsRequest) GetCategories(ctx context.Context) ([]types.String, bool) { + if o.Categories.IsNull() || o.Categories.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Categories.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCategories sets the value of the Categories field in SearchListingsRequest. +func (o *SearchListingsRequest) SetCategories(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["categories"] + t = t.(attr.TypeWithElementType).ElementType() + o.Categories = types.ListValueMust(t, vs) +} + +// GetProviderIds returns the value of the ProviderIds field in SearchListingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchListingsRequest) GetProviderIds(ctx context.Context) ([]types.String, bool) { + if o.ProviderIds.IsNull() || o.ProviderIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ProviderIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProviderIds sets the value of the ProviderIds field in SearchListingsRequest. +func (o *SearchListingsRequest) SetProviderIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.ProviderIds = types.ListValueMust(t, vs) +} + type SearchListingsResponse struct { - Listings []Listing `tfsdk:"listings" tf:"optional"` + Listings types.List `tfsdk:"listings" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -1395,10 +6626,73 @@ func (newState *SearchListingsResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *SearchListingsResponse) SyncEffectiveFieldsDuringRead(existingState SearchListingsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchListingsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchListingsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listings": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchListingsResponse +// only implements ToObjectValue() and Type(). +func (o SearchListingsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listings": o.Listings, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchListingsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listings": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetListings returns the value of the Listings field in SearchListingsResponse as +// a slice of Listing values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchListingsResponse) GetListings(ctx context.Context) ([]Listing, bool) { + if o.Listings.IsNull() || o.Listings.IsUnknown() { + return nil, false + } + var v []Listing + d := o.Listings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetListings sets the value of the Listings field in SearchListingsResponse. +func (o *SearchListingsResponse) SetListings(ctx context.Context, v []Listing) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listings"] + t = t.(attr.TypeWithElementType).ElementType() + o.Listings = types.ListValueMust(t, vs) +} + type ShareInfo struct { Name types.String `tfsdk:"name" tf:""` - Type types.String `tfsdk:"type" tf:""` + Type_ types.String `tfsdk:"type" tf:""` } func (newState *ShareInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ShareInfo) { @@ -1407,6 +6701,39 @@ func (newState *ShareInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ShareInf func (newState *ShareInfo) SyncEffectiveFieldsDuringRead(existingState ShareInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ShareInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ShareInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ShareInfo +// only implements ToObjectValue() and Type(). +func (o ShareInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ShareInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "type": types.StringType, + }, + } +} + type SharedDataObject struct { // The type of the data object. Could be one of: TABLE, SCHEMA, // NOTEBOOK_FILE, MODEL, VOLUME @@ -1421,6 +6748,39 @@ func (newState *SharedDataObject) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *SharedDataObject) SyncEffectiveFieldsDuringRead(existingState SharedDataObject) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SharedDataObject. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SharedDataObject) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SharedDataObject +// only implements ToObjectValue() and Type(). +func (o SharedDataObject) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_object_type": o.DataObjectType, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SharedDataObject) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_object_type": types.StringType, + "name": types.StringType, + }, + } +} + type TokenDetail struct { BearerToken types.String `tfsdk:"bearerToken" tf:"optional"` @@ -1439,6 +6799,43 @@ func (newState *TokenDetail) SyncEffectiveFieldsDuringCreateOrUpdate(plan TokenD func (newState *TokenDetail) SyncEffectiveFieldsDuringRead(existingState TokenDetail) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenDetail. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenDetail) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenDetail +// only implements ToObjectValue() and Type(). +func (o TokenDetail) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bearerToken": o.BearerToken, + "endpoint": o.Endpoint, + "expirationTime": o.ExpirationTime, + "shareCredentialsVersion": o.ShareCredentialsVersion, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenDetail) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bearerToken": types.StringType, + "endpoint": types.StringType, + "expirationTime": types.StringType, + "shareCredentialsVersion": types.Int64Type, + }, + } +} + type TokenInfo struct { // Full activation url to retrieve the access token. It will be empty if the // token is already retrieved. @@ -1463,8 +6860,51 @@ func (newState *TokenInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan TokenInf func (newState *TokenInfo) SyncEffectiveFieldsDuringRead(existingState TokenInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenInfo +// only implements ToObjectValue() and Type(). +func (o TokenInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activation_url": o.ActivationUrl, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "expiration_time": o.ExpirationTime, + "id": o.Id, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activation_url": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "expiration_time": types.Int64Type, + "id": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + type UpdateExchangeFilterRequest struct { - Filter []ExchangeFilter `tfsdk:"filter" tf:"object"` + Filter types.List `tfsdk:"filter" tf:"object"` Id types.String `tfsdk:"-"` } @@ -1475,8 +6915,71 @@ func (newState *UpdateExchangeFilterRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *UpdateExchangeFilterRequest) SyncEffectiveFieldsDuringRead(existingState UpdateExchangeFilterRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExchangeFilterRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExchangeFilterRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filter": reflect.TypeOf(ExchangeFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExchangeFilterRequest +// only implements ToObjectValue() and Type(). +func (o UpdateExchangeFilterRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExchangeFilterRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": basetypes.ListType{ + ElemType: ExchangeFilter{}.Type(ctx), + }, + "id": types.StringType, + }, + } +} + +// GetFilter returns the value of the Filter field in UpdateExchangeFilterRequest as +// a ExchangeFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateExchangeFilterRequest) GetFilter(ctx context.Context) (ExchangeFilter, bool) { + var e ExchangeFilter + if o.Filter.IsNull() || o.Filter.IsUnknown() { + return e, false + } + var v []ExchangeFilter + d := o.Filter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilter sets the value of the Filter field in UpdateExchangeFilterRequest. +func (o *UpdateExchangeFilterRequest) SetFilter(ctx context.Context, v ExchangeFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter"] + o.Filter = types.ListValueMust(t, vs) +} + type UpdateExchangeFilterResponse struct { - Filter []ExchangeFilter `tfsdk:"filter" tf:"optional,object"` + Filter types.List `tfsdk:"filter" tf:"optional,object"` } func (newState *UpdateExchangeFilterResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateExchangeFilterResponse) { @@ -1485,8 +6988,69 @@ func (newState *UpdateExchangeFilterResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *UpdateExchangeFilterResponse) SyncEffectiveFieldsDuringRead(existingState UpdateExchangeFilterResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExchangeFilterResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExchangeFilterResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filter": reflect.TypeOf(ExchangeFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExchangeFilterResponse +// only implements ToObjectValue() and Type(). +func (o UpdateExchangeFilterResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExchangeFilterResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": basetypes.ListType{ + ElemType: ExchangeFilter{}.Type(ctx), + }, + }, + } +} + +// GetFilter returns the value of the Filter field in UpdateExchangeFilterResponse as +// a ExchangeFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateExchangeFilterResponse) GetFilter(ctx context.Context) (ExchangeFilter, bool) { + var e ExchangeFilter + if o.Filter.IsNull() || o.Filter.IsUnknown() { + return e, false + } + var v []ExchangeFilter + d := o.Filter.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilter sets the value of the Filter field in UpdateExchangeFilterResponse. +func (o *UpdateExchangeFilterResponse) SetFilter(ctx context.Context, v ExchangeFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter"] + o.Filter = types.ListValueMust(t, vs) +} + type UpdateExchangeRequest struct { - Exchange []Exchange `tfsdk:"exchange" tf:"object"` + Exchange types.List `tfsdk:"exchange" tf:"object"` Id types.String `tfsdk:"-"` } @@ -1497,8 +7061,71 @@ func (newState *UpdateExchangeRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateExchangeRequest) SyncEffectiveFieldsDuringRead(existingState UpdateExchangeRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExchangeRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExchangeRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange": reflect.TypeOf(Exchange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExchangeRequest +// only implements ToObjectValue() and Type(). +func (o UpdateExchangeRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange": o.Exchange, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExchangeRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange": basetypes.ListType{ + ElemType: Exchange{}.Type(ctx), + }, + "id": types.StringType, + }, + } +} + +// GetExchange returns the value of the Exchange field in UpdateExchangeRequest as +// a Exchange value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateExchangeRequest) GetExchange(ctx context.Context) (Exchange, bool) { + var e Exchange + if o.Exchange.IsNull() || o.Exchange.IsUnknown() { + return e, false + } + var v []Exchange + d := o.Exchange.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExchange sets the value of the Exchange field in UpdateExchangeRequest. +func (o *UpdateExchangeRequest) SetExchange(ctx context.Context, v Exchange) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange"] + o.Exchange = types.ListValueMust(t, vs) +} + type UpdateExchangeResponse struct { - Exchange []Exchange `tfsdk:"exchange" tf:"optional,object"` + Exchange types.List `tfsdk:"exchange" tf:"optional,object"` } func (newState *UpdateExchangeResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateExchangeResponse) { @@ -1507,8 +7134,69 @@ func (newState *UpdateExchangeResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateExchangeResponse) SyncEffectiveFieldsDuringRead(existingState UpdateExchangeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExchangeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExchangeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exchange": reflect.TypeOf(Exchange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExchangeResponse +// only implements ToObjectValue() and Type(). +func (o UpdateExchangeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exchange": o.Exchange, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExchangeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exchange": basetypes.ListType{ + ElemType: Exchange{}.Type(ctx), + }, + }, + } +} + +// GetExchange returns the value of the Exchange field in UpdateExchangeResponse as +// a Exchange value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateExchangeResponse) GetExchange(ctx context.Context) (Exchange, bool) { + var e Exchange + if o.Exchange.IsNull() || o.Exchange.IsUnknown() { + return e, false + } + var v []Exchange + d := o.Exchange.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExchange sets the value of the Exchange field in UpdateExchangeResponse. +func (o *UpdateExchangeResponse) SetExchange(ctx context.Context, v Exchange) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exchange"] + o.Exchange = types.ListValueMust(t, vs) +} + type UpdateInstallationRequest struct { - Installation []InstallationDetail `tfsdk:"installation" tf:"object"` + Installation types.List `tfsdk:"installation" tf:"object"` InstallationId types.String `tfsdk:"-"` @@ -1523,8 +7211,75 @@ func (newState *UpdateInstallationRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UpdateInstallationRequest) SyncEffectiveFieldsDuringRead(existingState UpdateInstallationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateInstallationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateInstallationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "installation": reflect.TypeOf(InstallationDetail{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateInstallationRequest +// only implements ToObjectValue() and Type(). +func (o UpdateInstallationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "installation": o.Installation, + "installation_id": o.InstallationId, + "listing_id": o.ListingId, + "rotate_token": o.RotateToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateInstallationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "installation": basetypes.ListType{ + ElemType: InstallationDetail{}.Type(ctx), + }, + "installation_id": types.StringType, + "listing_id": types.StringType, + "rotate_token": types.BoolType, + }, + } +} + +// GetInstallation returns the value of the Installation field in UpdateInstallationRequest as +// a InstallationDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateInstallationRequest) GetInstallation(ctx context.Context) (InstallationDetail, bool) { + var e InstallationDetail + if o.Installation.IsNull() || o.Installation.IsUnknown() { + return e, false + } + var v []InstallationDetail + d := o.Installation.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInstallation sets the value of the Installation field in UpdateInstallationRequest. +func (o *UpdateInstallationRequest) SetInstallation(ctx context.Context, v InstallationDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["installation"] + o.Installation = types.ListValueMust(t, vs) +} + type UpdateInstallationResponse struct { - Installation []InstallationDetail `tfsdk:"installation" tf:"optional,object"` + Installation types.List `tfsdk:"installation" tf:"optional,object"` } func (newState *UpdateInstallationResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateInstallationResponse) { @@ -1533,10 +7288,71 @@ func (newState *UpdateInstallationResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UpdateInstallationResponse) SyncEffectiveFieldsDuringRead(existingState UpdateInstallationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateInstallationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateInstallationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "installation": reflect.TypeOf(InstallationDetail{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateInstallationResponse +// only implements ToObjectValue() and Type(). +func (o UpdateInstallationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "installation": o.Installation, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateInstallationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "installation": basetypes.ListType{ + ElemType: InstallationDetail{}.Type(ctx), + }, + }, + } +} + +// GetInstallation returns the value of the Installation field in UpdateInstallationResponse as +// a InstallationDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateInstallationResponse) GetInstallation(ctx context.Context) (InstallationDetail, bool) { + var e InstallationDetail + if o.Installation.IsNull() || o.Installation.IsUnknown() { + return e, false + } + var v []InstallationDetail + d := o.Installation.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInstallation sets the value of the Installation field in UpdateInstallationResponse. +func (o *UpdateInstallationResponse) SetInstallation(ctx context.Context, v InstallationDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["installation"] + o.Installation = types.ListValueMust(t, vs) +} + type UpdateListingRequest struct { Id types.String `tfsdk:"-"` - Listing []Listing `tfsdk:"listing" tf:"object"` + Listing types.List `tfsdk:"listing" tf:"object"` } func (newState *UpdateListingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateListingRequest) { @@ -1545,8 +7361,71 @@ func (newState *UpdateListingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *UpdateListingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateListingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateListingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateListingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listing": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateListingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateListingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "listing": o.Listing, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateListingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "listing": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + }, + } +} + +// GetListing returns the value of the Listing field in UpdateListingRequest as +// a Listing value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateListingRequest) GetListing(ctx context.Context) (Listing, bool) { + var e Listing + if o.Listing.IsNull() || o.Listing.IsUnknown() { + return e, false + } + var v []Listing + d := o.Listing.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetListing sets the value of the Listing field in UpdateListingRequest. +func (o *UpdateListingRequest) SetListing(ctx context.Context, v Listing) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listing"] + o.Listing = types.ListValueMust(t, vs) +} + type UpdateListingResponse struct { - Listing []Listing `tfsdk:"listing" tf:"optional,object"` + Listing types.List `tfsdk:"listing" tf:"optional,object"` } func (newState *UpdateListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateListingResponse) { @@ -1555,6 +7434,67 @@ func (newState *UpdateListingResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateListingResponse) SyncEffectiveFieldsDuringRead(existingState UpdateListingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateListingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateListingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "listing": reflect.TypeOf(Listing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateListingResponse +// only implements ToObjectValue() and Type(). +func (o UpdateListingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing": o.Listing, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateListingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing": basetypes.ListType{ + ElemType: Listing{}.Type(ctx), + }, + }, + } +} + +// GetListing returns the value of the Listing field in UpdateListingResponse as +// a Listing value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateListingResponse) GetListing(ctx context.Context) (Listing, bool) { + var e Listing + if o.Listing.IsNull() || o.Listing.IsUnknown() { + return e, false + } + var v []Listing + d := o.Listing.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetListing sets the value of the Listing field in UpdateListingResponse. +func (o *UpdateListingResponse) SetListing(ctx context.Context, v Listing) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["listing"] + o.Listing = types.ListValueMust(t, vs) +} + type UpdatePersonalizationRequestRequest struct { ListingId types.String `tfsdk:"-"` @@ -1562,7 +7502,7 @@ type UpdatePersonalizationRequestRequest struct { RequestId types.String `tfsdk:"-"` - Share []ShareInfo `tfsdk:"share" tf:"optional,object"` + Share types.List `tfsdk:"share" tf:"optional,object"` Status types.String `tfsdk:"status" tf:""` } @@ -1573,8 +7513,77 @@ func (newState *UpdatePersonalizationRequestRequest) SyncEffectiveFieldsDuringCr func (newState *UpdatePersonalizationRequestRequest) SyncEffectiveFieldsDuringRead(existingState UpdatePersonalizationRequestRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePersonalizationRequestRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePersonalizationRequestRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "share": reflect.TypeOf(ShareInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePersonalizationRequestRequest +// only implements ToObjectValue() and Type(). +func (o UpdatePersonalizationRequestRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "listing_id": o.ListingId, + "reason": o.Reason, + "request_id": o.RequestId, + "share": o.Share, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePersonalizationRequestRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "listing_id": types.StringType, + "reason": types.StringType, + "request_id": types.StringType, + "share": basetypes.ListType{ + ElemType: ShareInfo{}.Type(ctx), + }, + "status": types.StringType, + }, + } +} + +// GetShare returns the value of the Share field in UpdatePersonalizationRequestRequest as +// a ShareInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdatePersonalizationRequestRequest) GetShare(ctx context.Context) (ShareInfo, bool) { + var e ShareInfo + if o.Share.IsNull() || o.Share.IsUnknown() { + return e, false + } + var v []ShareInfo + d := o.Share.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetShare sets the value of the Share field in UpdatePersonalizationRequestRequest. +func (o *UpdatePersonalizationRequestRequest) SetShare(ctx context.Context, v ShareInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["share"] + o.Share = types.ListValueMust(t, vs) +} + type UpdatePersonalizationRequestResponse struct { - Request []PersonalizationRequest `tfsdk:"request" tf:"optional,object"` + Request types.List `tfsdk:"request" tf:"optional,object"` } func (newState *UpdatePersonalizationRequestResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdatePersonalizationRequestResponse) { @@ -1583,6 +7592,67 @@ func (newState *UpdatePersonalizationRequestResponse) SyncEffectiveFieldsDuringC func (newState *UpdatePersonalizationRequestResponse) SyncEffectiveFieldsDuringRead(existingState UpdatePersonalizationRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePersonalizationRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePersonalizationRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "request": reflect.TypeOf(PersonalizationRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePersonalizationRequestResponse +// only implements ToObjectValue() and Type(). +func (o UpdatePersonalizationRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "request": o.Request, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePersonalizationRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "request": basetypes.ListType{ + ElemType: PersonalizationRequest{}.Type(ctx), + }, + }, + } +} + +// GetRequest returns the value of the Request field in UpdatePersonalizationRequestResponse as +// a PersonalizationRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdatePersonalizationRequestResponse) GetRequest(ctx context.Context) (PersonalizationRequest, bool) { + var e PersonalizationRequest + if o.Request.IsNull() || o.Request.IsUnknown() { + return e, false + } + var v []PersonalizationRequest + d := o.Request.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRequest sets the value of the Request field in UpdatePersonalizationRequestResponse. +func (o *UpdatePersonalizationRequestResponse) SetRequest(ctx context.Context, v PersonalizationRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["request"] + o.Request = types.ListValueMust(t, vs) +} + type UpdateProviderAnalyticsDashboardRequest struct { // id is immutable property and can't be updated. Id types.String `tfsdk:"-"` @@ -1598,6 +7668,39 @@ func (newState *UpdateProviderAnalyticsDashboardRequest) SyncEffectiveFieldsDuri func (newState *UpdateProviderAnalyticsDashboardRequest) SyncEffectiveFieldsDuringRead(existingState UpdateProviderAnalyticsDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateProviderAnalyticsDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateProviderAnalyticsDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateProviderAnalyticsDashboardRequest +// only implements ToObjectValue() and Type(). +func (o UpdateProviderAnalyticsDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateProviderAnalyticsDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "version": types.Int64Type, + }, + } +} + type UpdateProviderAnalyticsDashboardResponse struct { // this is newly created Lakeview dashboard for the user DashboardId types.String `tfsdk:"dashboard_id" tf:""` @@ -1613,10 +7716,45 @@ func (newState *UpdateProviderAnalyticsDashboardResponse) SyncEffectiveFieldsDur func (newState *UpdateProviderAnalyticsDashboardResponse) SyncEffectiveFieldsDuringRead(existingState UpdateProviderAnalyticsDashboardResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateProviderAnalyticsDashboardResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateProviderAnalyticsDashboardResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateProviderAnalyticsDashboardResponse +// only implements ToObjectValue() and Type(). +func (o UpdateProviderAnalyticsDashboardResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "id": o.Id, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateProviderAnalyticsDashboardResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "id": types.StringType, + "version": types.Int64Type, + }, + } +} + type UpdateProviderRequest struct { Id types.String `tfsdk:"-"` - Provider []ProviderInfo `tfsdk:"provider" tf:"object"` + Provider types.List `tfsdk:"provider" tf:"object"` } func (newState *UpdateProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateProviderRequest) { @@ -1625,8 +7763,71 @@ func (newState *UpdateProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateProviderRequest) SyncEffectiveFieldsDuringRead(existingState UpdateProviderRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateProviderRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateProviderRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "provider": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateProviderRequest +// only implements ToObjectValue() and Type(). +func (o UpdateProviderRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "provider": o.Provider, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateProviderRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "provider": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProvider returns the value of the Provider field in UpdateProviderRequest as +// a ProviderInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateProviderRequest) GetProvider(ctx context.Context) (ProviderInfo, bool) { + var e ProviderInfo + if o.Provider.IsNull() || o.Provider.IsUnknown() { + return e, false + } + var v []ProviderInfo + d := o.Provider.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvider sets the value of the Provider field in UpdateProviderRequest. +func (o *UpdateProviderRequest) SetProvider(ctx context.Context, v ProviderInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider"] + o.Provider = types.ListValueMust(t, vs) +} + type UpdateProviderResponse struct { - Provider []ProviderInfo `tfsdk:"provider" tf:"optional,object"` + Provider types.List `tfsdk:"provider" tf:"optional,object"` } func (newState *UpdateProviderResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateProviderResponse) { @@ -1634,3 +7835,64 @@ func (newState *UpdateProviderResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateProviderResponse) SyncEffectiveFieldsDuringRead(existingState UpdateProviderResponse) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateProviderResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateProviderResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "provider": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateProviderResponse +// only implements ToObjectValue() and Type(). +func (o UpdateProviderResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "provider": o.Provider, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateProviderResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "provider": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProvider returns the value of the Provider field in UpdateProviderResponse as +// a ProviderInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateProviderResponse) GetProvider(ctx context.Context) (ProviderInfo, bool) { + var e ProviderInfo + if o.Provider.IsNull() || o.Provider.IsUnknown() { + return e, false + } + var v []ProviderInfo + d := o.Provider.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetProvider sets the value of the Provider field in UpdateProviderResponse. +func (o *UpdateProviderResponse) SetProvider(ctx context.Context, v ProviderInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["provider"] + o.Provider = types.ListValueMust(t, vs) +} diff --git a/internal/service/ml_tf/model.go b/internal/service/ml_tf/model.go index c978e6a2c..c93c99fe9 100755 --- a/internal/service/ml_tf/model.go +++ b/internal/service/ml_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package ml_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) // Activity recorded for the action. @@ -76,6 +83,53 @@ func (newState *Activity) SyncEffectiveFieldsDuringCreateOrUpdate(plan Activity) func (newState *Activity) SyncEffectiveFieldsDuringRead(existingState Activity) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Activity. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Activity) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Activity +// only implements ToObjectValue() and Type(). +func (o Activity) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activity_type": o.ActivityType, + "comment": o.Comment, + "creation_timestamp": o.CreationTimestamp, + "from_stage": o.FromStage, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "system_comment": o.SystemComment, + "to_stage": o.ToStage, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Activity) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activity_type": types.StringType, + "comment": types.StringType, + "creation_timestamp": types.Int64Type, + "from_stage": types.StringType, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "system_comment": types.StringType, + "to_stage": types.StringType, + "user_id": types.StringType, + }, + } +} + type ApproveTransitionRequest struct { // Specifies whether to archive all current model versions in the target // stage. @@ -104,9 +158,48 @@ func (newState *ApproveTransitionRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ApproveTransitionRequest) SyncEffectiveFieldsDuringRead(existingState ApproveTransitionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ApproveTransitionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ApproveTransitionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ApproveTransitionRequest +// only implements ToObjectValue() and Type(). +func (o ApproveTransitionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "archive_existing_versions": o.ArchiveExistingVersions, + "comment": o.Comment, + "name": o.Name, + "stage": o.Stage, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ApproveTransitionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "archive_existing_versions": types.BoolType, + "comment": types.StringType, + "name": types.StringType, + "stage": types.StringType, + "version": types.StringType, + }, + } +} + type ApproveTransitionRequestResponse struct { // Activity recorded for the action. - Activity []Activity `tfsdk:"activity" tf:"optional,object"` + Activity types.List `tfsdk:"activity" tf:"optional,object"` } func (newState *ApproveTransitionRequestResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ApproveTransitionRequestResponse) { @@ -115,10 +208,71 @@ func (newState *ApproveTransitionRequestResponse) SyncEffectiveFieldsDuringCreat func (newState *ApproveTransitionRequestResponse) SyncEffectiveFieldsDuringRead(existingState ApproveTransitionRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ApproveTransitionRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ApproveTransitionRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "activity": reflect.TypeOf(Activity{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ApproveTransitionRequestResponse +// only implements ToObjectValue() and Type(). +func (o ApproveTransitionRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activity": o.Activity, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ApproveTransitionRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activity": basetypes.ListType{ + ElemType: Activity{}.Type(ctx), + }, + }, + } +} + +// GetActivity returns the value of the Activity field in ApproveTransitionRequestResponse as +// a Activity value. +// If the field is unknown or null, the boolean return value is false. +func (o *ApproveTransitionRequestResponse) GetActivity(ctx context.Context) (Activity, bool) { + var e Activity + if o.Activity.IsNull() || o.Activity.IsUnknown() { + return e, false + } + var v []Activity + d := o.Activity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetActivity sets the value of the Activity field in ApproveTransitionRequestResponse. +func (o *ApproveTransitionRequestResponse) SetActivity(ctx context.Context, v Activity) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["activity"] + o.Activity = types.ListValueMust(t, vs) +} + // Comment details. type CommentObject struct { // Array of actions on the activity allowed for the current viewer. - AvailableActions []types.String `tfsdk:"available_actions" tf:"optional"` + AvailableActions types.List `tfsdk:"available_actions" tf:"optional"` // User-provided comment on the action. Comment types.String `tfsdk:"comment" tf:"optional"` // Creation time of the object, as a Unix timestamp in milliseconds. @@ -137,6 +291,77 @@ func (newState *CommentObject) SyncEffectiveFieldsDuringCreateOrUpdate(plan Comm func (newState *CommentObject) SyncEffectiveFieldsDuringRead(existingState CommentObject) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CommentObject. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CommentObject) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "available_actions": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CommentObject +// only implements ToObjectValue() and Type(). +func (o CommentObject) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "available_actions": o.AvailableActions, + "comment": o.Comment, + "creation_timestamp": o.CreationTimestamp, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CommentObject) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "available_actions": basetypes.ListType{ + ElemType: types.StringType, + }, + "comment": types.StringType, + "creation_timestamp": types.Int64Type, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "user_id": types.StringType, + }, + } +} + +// GetAvailableActions returns the value of the AvailableActions field in CommentObject as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CommentObject) GetAvailableActions(ctx context.Context) ([]types.String, bool) { + if o.AvailableActions.IsNull() || o.AvailableActions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.AvailableActions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAvailableActions sets the value of the AvailableActions field in CommentObject. +func (o *CommentObject) SetAvailableActions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["available_actions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AvailableActions = types.ListValueMust(t, vs) +} + type CreateComment struct { // User-provided comment on the action. Comment types.String `tfsdk:"comment" tf:""` @@ -152,9 +377,44 @@ func (newState *CreateComment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Crea func (newState *CreateComment) SyncEffectiveFieldsDuringRead(existingState CreateComment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateComment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateComment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateComment +// only implements ToObjectValue() and Type(). +func (o CreateComment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateComment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "version": types.StringType, + }, + } +} + type CreateCommentResponse struct { // Comment details. - Comment []CommentObject `tfsdk:"comment" tf:"optional,object"` + Comment types.List `tfsdk:"comment" tf:"optional,object"` } func (newState *CreateCommentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCommentResponse) { @@ -163,6 +423,67 @@ func (newState *CreateCommentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateCommentResponse) SyncEffectiveFieldsDuringRead(existingState CreateCommentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCommentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCommentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "comment": reflect.TypeOf(CommentObject{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCommentResponse +// only implements ToObjectValue() and Type(). +func (o CreateCommentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCommentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": basetypes.ListType{ + ElemType: CommentObject{}.Type(ctx), + }, + }, + } +} + +// GetComment returns the value of the Comment field in CreateCommentResponse as +// a CommentObject value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCommentResponse) GetComment(ctx context.Context) (CommentObject, bool) { + var e CommentObject + if o.Comment.IsNull() || o.Comment.IsUnknown() { + return e, false + } + var v []CommentObject + d := o.Comment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetComment sets the value of the Comment field in CreateCommentResponse. +func (o *CreateCommentResponse) SetComment(ctx context.Context, v CommentObject) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["comment"] + o.Comment = types.ListValueMust(t, vs) +} + type CreateExperiment struct { // Location where all artifacts for the experiment are stored. If not // provided, the remote server will select an appropriate default. @@ -174,7 +495,7 @@ type CreateExperiment struct { // backends are guaranteed to support tag keys up to 250 bytes in size and // tag values up to 5000 bytes in size. All storage backends are also // guaranteed to support up to 20 tags per request. - Tags []ExperimentTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *CreateExperiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateExperiment) { @@ -183,6 +504,71 @@ func (newState *CreateExperiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan C func (newState *CreateExperiment) SyncEffectiveFieldsDuringRead(existingState CreateExperiment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExperiment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExperiment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(ExperimentTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExperiment +// only implements ToObjectValue() and Type(). +func (o CreateExperiment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_location": o.ArtifactLocation, + "name": o.Name, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExperiment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_location": types.StringType, + "name": types.StringType, + "tags": basetypes.ListType{ + ElemType: ExperimentTag{}.Type(ctx), + }, + }, + } +} + +// GetTags returns the value of the Tags field in CreateExperiment as +// a slice of ExperimentTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateExperiment) GetTags(ctx context.Context) ([]ExperimentTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ExperimentTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateExperiment. +func (o *CreateExperiment) SetTags(ctx context.Context, v []ExperimentTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type CreateExperimentResponse struct { // Unique identifier for the experiment. ExperimentId types.String `tfsdk:"experiment_id" tf:"optional"` @@ -194,13 +580,44 @@ func (newState *CreateExperimentResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CreateExperimentResponse) SyncEffectiveFieldsDuringRead(existingState CreateExperimentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateExperimentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateExperimentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateExperimentResponse +// only implements ToObjectValue() and Type(). +func (o CreateExperimentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateExperimentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + }, + } +} + type CreateModelRequest struct { // Optional description for registered model. Description types.String `tfsdk:"description" tf:"optional"` // Register models under this name Name types.String `tfsdk:"name" tf:""` // Additional metadata for registered model. - Tags []ModelTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *CreateModelRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateModelRequest) { @@ -209,8 +626,73 @@ func (newState *CreateModelRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateModelRequest) SyncEffectiveFieldsDuringRead(existingState CreateModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(ModelTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateModelRequest +// only implements ToObjectValue() and Type(). +func (o CreateModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "name": o.Name, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "name": types.StringType, + "tags": basetypes.ListType{ + ElemType: ModelTag{}.Type(ctx), + }, + }, + } +} + +// GetTags returns the value of the Tags field in CreateModelRequest as +// a slice of ModelTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateModelRequest) GetTags(ctx context.Context) ([]ModelTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ModelTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateModelRequest. +func (o *CreateModelRequest) SetTags(ctx context.Context, v []ModelTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type CreateModelResponse struct { - RegisteredModel []Model `tfsdk:"registered_model" tf:"optional,object"` + RegisteredModel types.List `tfsdk:"registered_model" tf:"optional,object"` } func (newState *CreateModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateModelResponse) { @@ -219,6 +701,67 @@ func (newState *CreateModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *CreateModelResponse) SyncEffectiveFieldsDuringRead(existingState CreateModelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateModelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateModelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "registered_model": reflect.TypeOf(Model{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateModelResponse +// only implements ToObjectValue() and Type(). +func (o CreateModelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "registered_model": o.RegisteredModel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateModelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "registered_model": basetypes.ListType{ + ElemType: Model{}.Type(ctx), + }, + }, + } +} + +// GetRegisteredModel returns the value of the RegisteredModel field in CreateModelResponse as +// a Model value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateModelResponse) GetRegisteredModel(ctx context.Context) (Model, bool) { + var e Model + if o.RegisteredModel.IsNull() || o.RegisteredModel.IsUnknown() { + return e, false + } + var v []Model + d := o.RegisteredModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRegisteredModel sets the value of the RegisteredModel field in CreateModelResponse. +func (o *CreateModelResponse) SetRegisteredModel(ctx context.Context, v Model) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["registered_model"] + o.RegisteredModel = types.ListValueMust(t, vs) +} + type CreateModelVersionRequest struct { // Optional description for model version. Description types.String `tfsdk:"description" tf:"optional"` @@ -233,7 +776,7 @@ type CreateModelVersionRequest struct { // URI indicating the location of the model artifacts. Source types.String `tfsdk:"source" tf:""` // Additional metadata for model version. - Tags []ModelVersionTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *CreateModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateModelVersionRequest) { @@ -242,9 +785,80 @@ func (newState *CreateModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *CreateModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState CreateModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(ModelVersionTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o CreateModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "name": o.Name, + "run_id": o.RunId, + "run_link": o.RunLink, + "source": o.Source, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "name": types.StringType, + "run_id": types.StringType, + "run_link": types.StringType, + "source": types.StringType, + "tags": basetypes.ListType{ + ElemType: ModelVersionTag{}.Type(ctx), + }, + }, + } +} + +// GetTags returns the value of the Tags field in CreateModelVersionRequest as +// a slice of ModelVersionTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateModelVersionRequest) GetTags(ctx context.Context) ([]ModelVersionTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ModelVersionTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateModelVersionRequest. +func (o *CreateModelVersionRequest) SetTags(ctx context.Context, v []ModelVersionTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type CreateModelVersionResponse struct { // Return new version number generated for this model in registry. - ModelVersion []ModelVersion `tfsdk:"model_version" tf:"optional,object"` + ModelVersion types.List `tfsdk:"model_version" tf:"optional,object"` } func (newState *CreateModelVersionResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateModelVersionResponse) { @@ -253,6 +867,67 @@ func (newState *CreateModelVersionResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateModelVersionResponse) SyncEffectiveFieldsDuringRead(existingState CreateModelVersionResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateModelVersionResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateModelVersionResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_version": reflect.TypeOf(ModelVersion{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateModelVersionResponse +// only implements ToObjectValue() and Type(). +func (o CreateModelVersionResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_version": o.ModelVersion, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateModelVersionResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_version": basetypes.ListType{ + ElemType: ModelVersion{}.Type(ctx), + }, + }, + } +} + +// GetModelVersion returns the value of the ModelVersion field in CreateModelVersionResponse as +// a ModelVersion value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateModelVersionResponse) GetModelVersion(ctx context.Context) (ModelVersion, bool) { + var e ModelVersion + if o.ModelVersion.IsNull() || o.ModelVersion.IsUnknown() { + return e, false + } + var v []ModelVersion + d := o.ModelVersion.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetModelVersion sets the value of the ModelVersion field in CreateModelVersionResponse. +func (o *CreateModelVersionResponse) SetModelVersion(ctx context.Context, v ModelVersion) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_version"] + o.ModelVersion = types.ListValueMust(t, vs) +} + type CreateRegistryWebhook struct { // User-specified description for the webhook. Description types.String `tfsdk:"description" tf:"optional"` @@ -289,11 +964,11 @@ type CreateRegistryWebhook struct { // // * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model // version be archived. - Events []types.String `tfsdk:"events" tf:""` + Events types.List `tfsdk:"events" tf:""` - HttpUrlSpec []HttpUrlSpec `tfsdk:"http_url_spec" tf:"optional,object"` + HttpUrlSpec types.List `tfsdk:"http_url_spec" tf:"optional,object"` - JobSpec []JobSpec `tfsdk:"job_spec" tf:"optional,object"` + JobSpec types.List `tfsdk:"job_spec" tf:"optional,object"` // Name of the model whose events would trigger this webhook. ModelName types.String `tfsdk:"model_name" tf:"optional"` // Enable or disable triggering the webhook, or put the webhook into test @@ -313,13 +988,142 @@ func (newState *CreateRegistryWebhook) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateRegistryWebhook) SyncEffectiveFieldsDuringRead(existingState CreateRegistryWebhook) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRegistryWebhook. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRegistryWebhook) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "events": reflect.TypeOf(types.String{}), + "http_url_spec": reflect.TypeOf(HttpUrlSpec{}), + "job_spec": reflect.TypeOf(JobSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRegistryWebhook +// only implements ToObjectValue() and Type(). +func (o CreateRegistryWebhook) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "events": o.Events, + "http_url_spec": o.HttpUrlSpec, + "job_spec": o.JobSpec, + "model_name": o.ModelName, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRegistryWebhook) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "events": basetypes.ListType{ + ElemType: types.StringType, + }, + "http_url_spec": basetypes.ListType{ + ElemType: HttpUrlSpec{}.Type(ctx), + }, + "job_spec": basetypes.ListType{ + ElemType: JobSpec{}.Type(ctx), + }, + "model_name": types.StringType, + "status": types.StringType, + }, + } +} + +// GetEvents returns the value of the Events field in CreateRegistryWebhook as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRegistryWebhook) GetEvents(ctx context.Context) ([]types.String, bool) { + if o.Events.IsNull() || o.Events.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Events.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEvents sets the value of the Events field in CreateRegistryWebhook. +func (o *CreateRegistryWebhook) SetEvents(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["events"] + t = t.(attr.TypeWithElementType).ElementType() + o.Events = types.ListValueMust(t, vs) +} + +// GetHttpUrlSpec returns the value of the HttpUrlSpec field in CreateRegistryWebhook as +// a HttpUrlSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRegistryWebhook) GetHttpUrlSpec(ctx context.Context) (HttpUrlSpec, bool) { + var e HttpUrlSpec + if o.HttpUrlSpec.IsNull() || o.HttpUrlSpec.IsUnknown() { + return e, false + } + var v []HttpUrlSpec + d := o.HttpUrlSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHttpUrlSpec sets the value of the HttpUrlSpec field in CreateRegistryWebhook. +func (o *CreateRegistryWebhook) SetHttpUrlSpec(ctx context.Context, v HttpUrlSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["http_url_spec"] + o.HttpUrlSpec = types.ListValueMust(t, vs) +} + +// GetJobSpec returns the value of the JobSpec field in CreateRegistryWebhook as +// a JobSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRegistryWebhook) GetJobSpec(ctx context.Context) (JobSpec, bool) { + var e JobSpec + if o.JobSpec.IsNull() || o.JobSpec.IsUnknown() { + return e, false + } + var v []JobSpec + d := o.JobSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetJobSpec sets the value of the JobSpec field in CreateRegistryWebhook. +func (o *CreateRegistryWebhook) SetJobSpec(ctx context.Context, v JobSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_spec"] + o.JobSpec = types.ListValueMust(t, vs) +} + type CreateRun struct { // ID of the associated experiment. ExperimentId types.String `tfsdk:"experiment_id" tf:"optional"` // Unix timestamp in milliseconds of when the run started. StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` // Additional metadata for run. - Tags []RunTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // ID of the user executing the run. This field is deprecated as of MLflow // 1.0, and will be removed in a future MLflow release. Use 'mlflow.user' // tag instead. @@ -332,9 +1136,76 @@ func (newState *CreateRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateRu func (newState *CreateRun) SyncEffectiveFieldsDuringRead(existingState CreateRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(RunTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRun +// only implements ToObjectValue() and Type(). +func (o CreateRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + "start_time": o.StartTime, + "tags": o.Tags, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + "start_time": types.Int64Type, + "tags": basetypes.ListType{ + ElemType: RunTag{}.Type(ctx), + }, + "user_id": types.StringType, + }, + } +} + +// GetTags returns the value of the Tags field in CreateRun as +// a slice of RunTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRun) GetTags(ctx context.Context) ([]RunTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []RunTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateRun. +func (o *CreateRun) SetTags(ctx context.Context, v []RunTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type CreateRunResponse struct { // The newly created run. - Run []Run `tfsdk:"run" tf:"optional,object"` + Run types.List `tfsdk:"run" tf:"optional,object"` } func (newState *CreateRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateRunResponse) { @@ -343,6 +1214,67 @@ func (newState *CreateRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateRunResponse) SyncEffectiveFieldsDuringRead(existingState CreateRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "run": reflect.TypeOf(Run{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRunResponse +// only implements ToObjectValue() and Type(). +func (o CreateRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run": o.Run, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run": basetypes.ListType{ + ElemType: Run{}.Type(ctx), + }, + }, + } +} + +// GetRun returns the value of the Run field in CreateRunResponse as +// a Run value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRunResponse) GetRun(ctx context.Context) (Run, bool) { + var e Run + if o.Run.IsNull() || o.Run.IsUnknown() { + return e, false + } + var v []Run + d := o.Run.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRun sets the value of the Run field in CreateRunResponse. +func (o *CreateRunResponse) SetRun(ctx context.Context, v Run) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run"] + o.Run = types.ListValueMust(t, vs) +} + type CreateTransitionRequest struct { // User-provided comment on the action. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -368,9 +1300,46 @@ func (newState *CreateTransitionRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateTransitionRequest) SyncEffectiveFieldsDuringRead(existingState CreateTransitionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateTransitionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateTransitionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateTransitionRequest +// only implements ToObjectValue() and Type(). +func (o CreateTransitionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "stage": o.Stage, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateTransitionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "stage": types.StringType, + "version": types.StringType, + }, + } +} + type CreateTransitionRequestResponse struct { // Transition request details. - Request []TransitionRequest `tfsdk:"request" tf:"optional,object"` + Request types.List `tfsdk:"request" tf:"optional,object"` } func (newState *CreateTransitionRequestResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateTransitionRequestResponse) { @@ -379,8 +1348,69 @@ func (newState *CreateTransitionRequestResponse) SyncEffectiveFieldsDuringCreate func (newState *CreateTransitionRequestResponse) SyncEffectiveFieldsDuringRead(existingState CreateTransitionRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateTransitionRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateTransitionRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "request": reflect.TypeOf(TransitionRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateTransitionRequestResponse +// only implements ToObjectValue() and Type(). +func (o CreateTransitionRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "request": o.Request, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateTransitionRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "request": basetypes.ListType{ + ElemType: TransitionRequest{}.Type(ctx), + }, + }, + } +} + +// GetRequest returns the value of the Request field in CreateTransitionRequestResponse as +// a TransitionRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateTransitionRequestResponse) GetRequest(ctx context.Context) (TransitionRequest, bool) { + var e TransitionRequest + if o.Request.IsNull() || o.Request.IsUnknown() { + return e, false + } + var v []TransitionRequest + d := o.Request.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRequest sets the value of the Request field in CreateTransitionRequestResponse. +func (o *CreateTransitionRequestResponse) SetRequest(ctx context.Context, v TransitionRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["request"] + o.Request = types.ListValueMust(t, vs) +} + type CreateWebhookResponse struct { - Webhook []RegistryWebhook `tfsdk:"webhook" tf:"optional,object"` + Webhook types.List `tfsdk:"webhook" tf:"optional,object"` } func (newState *CreateWebhookResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateWebhookResponse) { @@ -389,6 +1419,67 @@ func (newState *CreateWebhookResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateWebhookResponse) SyncEffectiveFieldsDuringRead(existingState CreateWebhookResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateWebhookResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateWebhookResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "webhook": reflect.TypeOf(RegistryWebhook{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateWebhookResponse +// only implements ToObjectValue() and Type(). +func (o CreateWebhookResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "webhook": o.Webhook, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateWebhookResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "webhook": basetypes.ListType{ + ElemType: RegistryWebhook{}.Type(ctx), + }, + }, + } +} + +// GetWebhook returns the value of the Webhook field in CreateWebhookResponse as +// a RegistryWebhook value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWebhookResponse) GetWebhook(ctx context.Context) (RegistryWebhook, bool) { + var e RegistryWebhook + if o.Webhook.IsNull() || o.Webhook.IsUnknown() { + return e, false + } + var v []RegistryWebhook + d := o.Webhook.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhook sets the value of the Webhook field in CreateWebhookResponse. +func (o *CreateWebhookResponse) SetWebhook(ctx context.Context, v RegistryWebhook) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook"] + o.Webhook = types.ListValueMust(t, vs) +} + type Dataset struct { // Dataset digest, e.g. an md5 hash of the dataset that uniquely identifies // it within datasets of the same name. @@ -418,12 +1509,53 @@ func (newState *Dataset) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dataset) { func (newState *Dataset) SyncEffectiveFieldsDuringRead(existingState Dataset) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Dataset. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Dataset) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Dataset +// only implements ToObjectValue() and Type(). +func (o Dataset) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "digest": o.Digest, + "name": o.Name, + "profile": o.Profile, + "schema": o.Schema, + "source": o.Source, + "source_type": o.SourceType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Dataset) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "digest": types.StringType, + "name": types.StringType, + "profile": types.StringType, + "schema": types.StringType, + "source": types.StringType, + "source_type": types.StringType, + }, + } +} + type DatasetInput struct { // The dataset being used as a Run input. - Dataset []Dataset `tfsdk:"dataset" tf:"optional,object"` + Dataset types.List `tfsdk:"dataset" tf:"optional,object"` // A list of tags for the dataset input, e.g. a “context” tag with value // “training” - Tags []InputTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *DatasetInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan DatasetInput) { @@ -432,6 +1564,98 @@ func (newState *DatasetInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan Datas func (newState *DatasetInput) SyncEffectiveFieldsDuringRead(existingState DatasetInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DatasetInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DatasetInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dataset": reflect.TypeOf(Dataset{}), + "tags": reflect.TypeOf(InputTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DatasetInput +// only implements ToObjectValue() and Type(). +func (o DatasetInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dataset": o.Dataset, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DatasetInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dataset": basetypes.ListType{ + ElemType: Dataset{}.Type(ctx), + }, + "tags": basetypes.ListType{ + ElemType: InputTag{}.Type(ctx), + }, + }, + } +} + +// GetDataset returns the value of the Dataset field in DatasetInput as +// a Dataset value. +// If the field is unknown or null, the boolean return value is false. +func (o *DatasetInput) GetDataset(ctx context.Context) (Dataset, bool) { + var e Dataset + if o.Dataset.IsNull() || o.Dataset.IsUnknown() { + return e, false + } + var v []Dataset + d := o.Dataset.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataset sets the value of the Dataset field in DatasetInput. +func (o *DatasetInput) SetDataset(ctx context.Context, v Dataset) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dataset"] + o.Dataset = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in DatasetInput as +// a slice of InputTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *DatasetInput) GetTags(ctx context.Context) ([]InputTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []InputTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in DatasetInput. +func (o *DatasetInput) SetTags(ctx context.Context, v []InputTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + // Delete a comment type DeleteCommentRequest struct { Id types.String `tfsdk:"-"` @@ -443,6 +1667,37 @@ func (newState *DeleteCommentRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteCommentRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCommentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCommentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCommentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCommentRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCommentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCommentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteCommentResponse struct { } @@ -452,6 +1707,33 @@ func (newState *DeleteCommentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteCommentResponse) SyncEffectiveFieldsDuringRead(existingState DeleteCommentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCommentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCommentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCommentResponse +// only implements ToObjectValue() and Type(). +func (o DeleteCommentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCommentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteExperiment struct { // ID of the associated experiment. ExperimentId types.String `tfsdk:"experiment_id" tf:""` @@ -463,6 +1745,37 @@ func (newState *DeleteExperiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan D func (newState *DeleteExperiment) SyncEffectiveFieldsDuringRead(existingState DeleteExperiment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExperiment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExperiment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExperiment +// only implements ToObjectValue() and Type(). +func (o DeleteExperiment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExperiment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + }, + } +} + type DeleteExperimentResponse struct { } @@ -472,6 +1785,33 @@ func (newState *DeleteExperimentResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *DeleteExperimentResponse) SyncEffectiveFieldsDuringRead(existingState DeleteExperimentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteExperimentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteExperimentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteExperimentResponse +// only implements ToObjectValue() and Type(). +func (o DeleteExperimentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteExperimentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a model type DeleteModelRequest struct { // Registered model unique name identifier. @@ -484,6 +1824,37 @@ func (newState *DeleteModelRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteModelRequest) SyncEffectiveFieldsDuringRead(existingState DeleteModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelRequest +// only implements ToObjectValue() and Type(). +func (o DeleteModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type DeleteModelResponse struct { } @@ -493,6 +1864,33 @@ func (newState *DeleteModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DeleteModelResponse) SyncEffectiveFieldsDuringRead(existingState DeleteModelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelResponse +// only implements ToObjectValue() and Type(). +func (o DeleteModelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a model tag type DeleteModelTagRequest struct { // Name of the tag. The name must be an exact match; wild-card deletion is @@ -508,6 +1906,39 @@ func (newState *DeleteModelTagRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteModelTagRequest) SyncEffectiveFieldsDuringRead(existingState DeleteModelTagRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelTagRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelTagRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelTagRequest +// only implements ToObjectValue() and Type(). +func (o DeleteModelTagRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelTagRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "name": types.StringType, + }, + } +} + type DeleteModelTagResponse struct { } @@ -517,6 +1948,33 @@ func (newState *DeleteModelTagResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteModelTagResponse) SyncEffectiveFieldsDuringRead(existingState DeleteModelTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelTagResponse +// only implements ToObjectValue() and Type(). +func (o DeleteModelTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a model version. type DeleteModelVersionRequest struct { // Name of the registered model @@ -531,6 +1989,39 @@ func (newState *DeleteModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState DeleteModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o DeleteModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "version": types.StringType, + }, + } +} + type DeleteModelVersionResponse struct { } @@ -540,6 +2031,33 @@ func (newState *DeleteModelVersionResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteModelVersionResponse) SyncEffectiveFieldsDuringRead(existingState DeleteModelVersionResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelVersionResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelVersionResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelVersionResponse +// only implements ToObjectValue() and Type(). +func (o DeleteModelVersionResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelVersionResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a model version tag type DeleteModelVersionTagRequest struct { // Name of the tag. The name must be an exact match; wild-card deletion is @@ -557,6 +2075,41 @@ func (newState *DeleteModelVersionTagRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteModelVersionTagRequest) SyncEffectiveFieldsDuringRead(existingState DeleteModelVersionTagRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelVersionTagRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelVersionTagRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelVersionTagRequest +// only implements ToObjectValue() and Type(). +func (o DeleteModelVersionTagRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelVersionTagRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "name": types.StringType, + "version": types.StringType, + }, + } +} + type DeleteModelVersionTagResponse struct { } @@ -566,6 +2119,33 @@ func (newState *DeleteModelVersionTagResponse) SyncEffectiveFieldsDuringCreateOr func (newState *DeleteModelVersionTagResponse) SyncEffectiveFieldsDuringRead(existingState DeleteModelVersionTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteModelVersionTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteModelVersionTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteModelVersionTagResponse +// only implements ToObjectValue() and Type(). +func (o DeleteModelVersionTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteModelVersionTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteRun struct { // ID of the run to delete. RunId types.String `tfsdk:"run_id" tf:""` @@ -577,6 +2157,37 @@ func (newState *DeleteRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteRu func (newState *DeleteRun) SyncEffectiveFieldsDuringRead(existingState DeleteRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRun +// only implements ToObjectValue() and Type(). +func (o DeleteRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.StringType, + }, + } +} + type DeleteRunResponse struct { } @@ -586,6 +2197,33 @@ func (newState *DeleteRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteRunResponse) SyncEffectiveFieldsDuringRead(existingState DeleteRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRunResponse +// only implements ToObjectValue() and Type(). +func (o DeleteRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteRuns struct { // The ID of the experiment containing the runs to delete. ExperimentId types.String `tfsdk:"experiment_id" tf:""` @@ -604,6 +2242,41 @@ func (newState *DeleteRuns) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteR func (newState *DeleteRuns) SyncEffectiveFieldsDuringRead(existingState DeleteRuns) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRuns. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRuns) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRuns +// only implements ToObjectValue() and Type(). +func (o DeleteRuns) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + "max_runs": o.MaxRuns, + "max_timestamp_millis": o.MaxTimestampMillis, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRuns) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + "max_runs": types.Int64Type, + "max_timestamp_millis": types.Int64Type, + }, + } +} + type DeleteRunsResponse struct { // The number of runs deleted. RunsDeleted types.Int64 `tfsdk:"runs_deleted" tf:"optional"` @@ -615,6 +2288,37 @@ func (newState *DeleteRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteRunsResponse) SyncEffectiveFieldsDuringRead(existingState DeleteRunsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRunsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRunsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRunsResponse +// only implements ToObjectValue() and Type(). +func (o DeleteRunsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "runs_deleted": o.RunsDeleted, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRunsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "runs_deleted": types.Int64Type, + }, + } +} + type DeleteTag struct { // Name of the tag. Maximum size is 255 bytes. Must be provided. Key types.String `tfsdk:"key" tf:""` @@ -628,6 +2332,39 @@ func (newState *DeleteTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteTa func (newState *DeleteTag) SyncEffectiveFieldsDuringRead(existingState DeleteTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTag +// only implements ToObjectValue() and Type(). +func (o DeleteTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "run_id": types.StringType, + }, + } +} + type DeleteTagResponse struct { } @@ -637,6 +2374,33 @@ func (newState *DeleteTagResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteTagResponse) SyncEffectiveFieldsDuringRead(existingState DeleteTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTagResponse +// only implements ToObjectValue() and Type(). +func (o DeleteTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a transition request type DeleteTransitionRequestRequest struct { // User-provided comment on the action. @@ -667,6 +2431,45 @@ func (newState *DeleteTransitionRequestRequest) SyncEffectiveFieldsDuringCreateO func (newState *DeleteTransitionRequestRequest) SyncEffectiveFieldsDuringRead(existingState DeleteTransitionRequestRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTransitionRequestRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTransitionRequestRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTransitionRequestRequest +// only implements ToObjectValue() and Type(). +func (o DeleteTransitionRequestRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "creator": o.Creator, + "name": o.Name, + "stage": o.Stage, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTransitionRequestRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "creator": types.StringType, + "name": types.StringType, + "stage": types.StringType, + "version": types.StringType, + }, + } +} + type DeleteTransitionRequestResponse struct { } @@ -676,6 +2479,33 @@ func (newState *DeleteTransitionRequestResponse) SyncEffectiveFieldsDuringCreate func (newState *DeleteTransitionRequestResponse) SyncEffectiveFieldsDuringRead(existingState DeleteTransitionRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTransitionRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTransitionRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTransitionRequestResponse +// only implements ToObjectValue() and Type(). +func (o DeleteTransitionRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTransitionRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a webhook type DeleteWebhookRequest struct { // Webhook ID required to delete a registry webhook. @@ -688,6 +2518,37 @@ func (newState *DeleteWebhookRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteWebhookRequest) SyncEffectiveFieldsDuringRead(existingState DeleteWebhookRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWebhookRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWebhookRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWebhookRequest +// only implements ToObjectValue() and Type(). +func (o DeleteWebhookRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWebhookRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteWebhookResponse struct { } @@ -697,6 +2558,33 @@ func (newState *DeleteWebhookResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteWebhookResponse) SyncEffectiveFieldsDuringRead(existingState DeleteWebhookResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWebhookResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWebhookResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWebhookResponse +// only implements ToObjectValue() and Type(). +func (o DeleteWebhookResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWebhookResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Experiment struct { // Location where artifacts for the experiment are stored. ArtifactLocation types.String `tfsdk:"artifact_location" tf:"optional"` @@ -712,7 +2600,7 @@ type Experiment struct { // Human readable name that identifies the experiment. Name types.String `tfsdk:"name" tf:"optional"` // Tags: Additional metadata key-value pairs. - Tags []ExperimentTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *Experiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Experiment) { @@ -721,6 +2609,79 @@ func (newState *Experiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Experim func (newState *Experiment) SyncEffectiveFieldsDuringRead(existingState Experiment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Experiment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Experiment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(ExperimentTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Experiment +// only implements ToObjectValue() and Type(). +func (o Experiment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_location": o.ArtifactLocation, + "creation_time": o.CreationTime, + "experiment_id": o.ExperimentId, + "last_update_time": o.LastUpdateTime, + "lifecycle_stage": o.LifecycleStage, + "name": o.Name, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Experiment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_location": types.StringType, + "creation_time": types.Int64Type, + "experiment_id": types.StringType, + "last_update_time": types.Int64Type, + "lifecycle_stage": types.StringType, + "name": types.StringType, + "tags": basetypes.ListType{ + ElemType: ExperimentTag{}.Type(ctx), + }, + }, + } +} + +// GetTags returns the value of the Tags field in Experiment as +// a slice of ExperimentTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *Experiment) GetTags(ctx context.Context) ([]ExperimentTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ExperimentTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in Experiment. +func (o *Experiment) SetTags(ctx context.Context, v []ExperimentTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ExperimentAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -738,9 +2699,46 @@ func (newState *ExperimentAccessControlRequest) SyncEffectiveFieldsDuringCreateO func (newState *ExperimentAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState ExperimentAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o ExperimentAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type ExperimentAccessControlResponse struct { // All permissions. - AllPermissions []ExperimentPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -757,10 +2755,79 @@ func (newState *ExperimentAccessControlResponse) SyncEffectiveFieldsDuringCreate func (newState *ExperimentAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState ExperimentAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(ExperimentPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o ExperimentAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: ExperimentPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in ExperimentAccessControlResponse as +// a slice of ExperimentPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExperimentAccessControlResponse) GetAllPermissions(ctx context.Context) ([]ExperimentPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []ExperimentPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in ExperimentAccessControlResponse. +func (o *ExperimentAccessControlResponse) SetAllPermissions(ctx context.Context, v []ExperimentPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type ExperimentPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -771,8 +2838,73 @@ func (newState *ExperimentPermission) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ExperimentPermission) SyncEffectiveFieldsDuringRead(existingState ExperimentPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentPermission +// only implements ToObjectValue() and Type(). +func (o ExperimentPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in ExperimentPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExperimentPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in ExperimentPermission. +func (o *ExperimentPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type ExperimentPermissions struct { - AccessControlList []ExperimentAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -785,6 +2917,71 @@ func (newState *ExperimentPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ExperimentPermissions) SyncEffectiveFieldsDuringRead(existingState ExperimentPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ExperimentAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentPermissions +// only implements ToObjectValue() and Type(). +func (o ExperimentPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ExperimentAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ExperimentPermissions as +// a slice of ExperimentAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExperimentPermissions) GetAccessControlList(ctx context.Context) ([]ExperimentAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ExperimentAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ExperimentPermissions. +func (o *ExperimentPermissions) SetAccessControlList(ctx context.Context, v []ExperimentAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type ExperimentPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -797,8 +2994,41 @@ func (newState *ExperimentPermissionsDescription) SyncEffectiveFieldsDuringCreat func (newState *ExperimentPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState ExperimentPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o ExperimentPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type ExperimentPermissionsRequest struct { - AccessControlList []ExperimentAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The experiment for which to get or manage permissions. ExperimentId types.String `tfsdk:"-"` } @@ -809,6 +3039,69 @@ func (newState *ExperimentPermissionsRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *ExperimentPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState ExperimentPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ExperimentAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o ExperimentPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ExperimentAccessControlRequest{}.Type(ctx), + }, + "experiment_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ExperimentPermissionsRequest as +// a slice of ExperimentAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExperimentPermissionsRequest) GetAccessControlList(ctx context.Context) ([]ExperimentAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ExperimentAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ExperimentPermissionsRequest. +func (o *ExperimentPermissionsRequest) SetAccessControlList(ctx context.Context, v []ExperimentAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type ExperimentTag struct { // The tag key. Key types.String `tfsdk:"key" tf:"optional"` @@ -822,6 +3115,39 @@ func (newState *ExperimentTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan Expe func (newState *ExperimentTag) SyncEffectiveFieldsDuringRead(existingState ExperimentTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExperimentTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExperimentTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExperimentTag +// only implements ToObjectValue() and Type(). +func (o ExperimentTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExperimentTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type FileInfo struct { // Size in bytes. Unset for directories. FileSize types.Int64 `tfsdk:"file_size" tf:"optional"` @@ -837,6 +3163,41 @@ func (newState *FileInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan FileInfo) func (newState *FileInfo) SyncEffectiveFieldsDuringRead(existingState FileInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FileInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FileInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FileInfo +// only implements ToObjectValue() and Type(). +func (o FileInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file_size": o.FileSize, + "is_dir": o.IsDir, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FileInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file_size": types.Int64Type, + "is_dir": types.BoolType, + "path": types.StringType, + }, + } +} + // Get metadata type GetByNameRequest struct { // Name of the associated experiment. @@ -849,6 +3210,37 @@ func (newState *GetByNameRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetByNameRequest) SyncEffectiveFieldsDuringRead(existingState GetByNameRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetByNameRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetByNameRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetByNameRequest +// only implements ToObjectValue() and Type(). +func (o GetByNameRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_name": o.ExperimentName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetByNameRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_name": types.StringType, + }, + } +} + // Get experiment permission levels type GetExperimentPermissionLevelsRequest struct { // The experiment for which to get or manage permissions. @@ -861,9 +3253,40 @@ func (newState *GetExperimentPermissionLevelsRequest) SyncEffectiveFieldsDuringC func (newState *GetExperimentPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetExperimentPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExperimentPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExperimentPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExperimentPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetExperimentPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExperimentPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + }, + } +} + type GetExperimentPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []ExperimentPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetExperimentPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetExperimentPermissionLevelsResponse) { @@ -872,6 +3295,67 @@ func (newState *GetExperimentPermissionLevelsResponse) SyncEffectiveFieldsDuring func (newState *GetExperimentPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetExperimentPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExperimentPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExperimentPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(ExperimentPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExperimentPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetExperimentPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExperimentPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: ExperimentPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetExperimentPermissionLevelsResponse as +// a slice of ExperimentPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetExperimentPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]ExperimentPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []ExperimentPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetExperimentPermissionLevelsResponse. +func (o *GetExperimentPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []ExperimentPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get experiment permissions type GetExperimentPermissionsRequest struct { // The experiment for which to get or manage permissions. @@ -884,6 +3368,37 @@ func (newState *GetExperimentPermissionsRequest) SyncEffectiveFieldsDuringCreate func (newState *GetExperimentPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetExperimentPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExperimentPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExperimentPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExperimentPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetExperimentPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExperimentPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + }, + } +} + // Get an experiment type GetExperimentRequest struct { // ID of the associated experiment. @@ -896,9 +3411,40 @@ func (newState *GetExperimentRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GetExperimentRequest) SyncEffectiveFieldsDuringRead(existingState GetExperimentRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExperimentRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExperimentRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExperimentRequest +// only implements ToObjectValue() and Type(). +func (o GetExperimentRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExperimentRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + }, + } +} + type GetExperimentResponse struct { // Experiment details. - Experiment []Experiment `tfsdk:"experiment" tf:"optional,object"` + Experiment types.List `tfsdk:"experiment" tf:"optional,object"` } func (newState *GetExperimentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetExperimentResponse) { @@ -907,6 +3453,67 @@ func (newState *GetExperimentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *GetExperimentResponse) SyncEffectiveFieldsDuringRead(existingState GetExperimentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetExperimentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetExperimentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "experiment": reflect.TypeOf(Experiment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetExperimentResponse +// only implements ToObjectValue() and Type(). +func (o GetExperimentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment": o.Experiment, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetExperimentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment": basetypes.ListType{ + ElemType: Experiment{}.Type(ctx), + }, + }, + } +} + +// GetExperiment returns the value of the Experiment field in GetExperimentResponse as +// a Experiment value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetExperimentResponse) GetExperiment(ctx context.Context) (Experiment, bool) { + var e Experiment + if o.Experiment.IsNull() || o.Experiment.IsUnknown() { + return e, false + } + var v []Experiment + d := o.Experiment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExperiment sets the value of the Experiment field in GetExperimentResponse. +func (o *GetExperimentResponse) SetExperiment(ctx context.Context, v Experiment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["experiment"] + o.Experiment = types.ListValueMust(t, vs) +} + // Get history of a given metric within a run type GetHistoryRequest struct { // Maximum number of Metric records to return per paginated request. Default @@ -930,11 +3537,50 @@ func (newState *GetHistoryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetHistoryRequest) SyncEffectiveFieldsDuringRead(existingState GetHistoryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetHistoryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetHistoryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetHistoryRequest +// only implements ToObjectValue() and Type(). +func (o GetHistoryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "metric_key": o.MetricKey, + "page_token": o.PageToken, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetHistoryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "metric_key": types.StringType, + "page_token": types.StringType, + "run_id": types.StringType, + "run_uuid": types.StringType, + }, + } +} + type GetLatestVersionsRequest struct { // Registered model unique name identifier. Name types.String `tfsdk:"name" tf:""` // List of stages. - Stages []types.String `tfsdk:"stages" tf:"optional"` + Stages types.List `tfsdk:"stages" tf:"optional"` } func (newState *GetLatestVersionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetLatestVersionsRequest) { @@ -943,11 +3589,74 @@ func (newState *GetLatestVersionsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetLatestVersionsRequest) SyncEffectiveFieldsDuringRead(existingState GetLatestVersionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetLatestVersionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetLatestVersionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "stages": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetLatestVersionsRequest +// only implements ToObjectValue() and Type(). +func (o GetLatestVersionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "stages": o.Stages, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetLatestVersionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "stages": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetStages returns the value of the Stages field in GetLatestVersionsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetLatestVersionsRequest) GetStages(ctx context.Context) ([]types.String, bool) { + if o.Stages.IsNull() || o.Stages.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Stages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStages sets the value of the Stages field in GetLatestVersionsRequest. +func (o *GetLatestVersionsRequest) SetStages(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["stages"] + t = t.(attr.TypeWithElementType).ElementType() + o.Stages = types.ListValueMust(t, vs) +} + type GetLatestVersionsResponse struct { // Latest version models for each requests stage. Only return models with // current `READY` status. If no `stages` provided, returns the latest // version for each stage, including `"None"`. - ModelVersions []ModelVersion `tfsdk:"model_versions" tf:"optional"` + ModelVersions types.List `tfsdk:"model_versions" tf:"optional"` } func (newState *GetLatestVersionsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetLatestVersionsResponse) { @@ -956,9 +3665,70 @@ func (newState *GetLatestVersionsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GetLatestVersionsResponse) SyncEffectiveFieldsDuringRead(existingState GetLatestVersionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetLatestVersionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetLatestVersionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_versions": reflect.TypeOf(ModelVersion{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetLatestVersionsResponse +// only implements ToObjectValue() and Type(). +func (o GetLatestVersionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_versions": o.ModelVersions, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetLatestVersionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_versions": basetypes.ListType{ + ElemType: ModelVersion{}.Type(ctx), + }, + }, + } +} + +// GetModelVersions returns the value of the ModelVersions field in GetLatestVersionsResponse as +// a slice of ModelVersion values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetLatestVersionsResponse) GetModelVersions(ctx context.Context) ([]ModelVersion, bool) { + if o.ModelVersions.IsNull() || o.ModelVersions.IsUnknown() { + return nil, false + } + var v []ModelVersion + d := o.ModelVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetModelVersions sets the value of the ModelVersions field in GetLatestVersionsResponse. +func (o *GetLatestVersionsResponse) SetModelVersions(ctx context.Context, v []ModelVersion) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.ModelVersions = types.ListValueMust(t, vs) +} + type GetMetricHistoryResponse struct { // All logged values for this metric. - Metrics []Metric `tfsdk:"metrics" tf:"optional"` + Metrics types.List `tfsdk:"metrics" tf:"optional"` // Token that can be used to retrieve the next page of metric history // results NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -970,6 +3740,69 @@ func (newState *GetMetricHistoryResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetMetricHistoryResponse) SyncEffectiveFieldsDuringRead(existingState GetMetricHistoryResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetMetricHistoryResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetMetricHistoryResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metrics": reflect.TypeOf(Metric{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetMetricHistoryResponse +// only implements ToObjectValue() and Type(). +func (o GetMetricHistoryResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metrics": o.Metrics, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetMetricHistoryResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metrics": basetypes.ListType{ + ElemType: Metric{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetMetrics returns the value of the Metrics field in GetMetricHistoryResponse as +// a slice of Metric values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetMetricHistoryResponse) GetMetrics(ctx context.Context) ([]Metric, bool) { + if o.Metrics.IsNull() || o.Metrics.IsUnknown() { + return nil, false + } + var v []Metric + d := o.Metrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMetrics sets the value of the Metrics field in GetMetricHistoryResponse. +func (o *GetMetricHistoryResponse) SetMetrics(ctx context.Context, v []Metric) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metrics"] + t = t.(attr.TypeWithElementType).ElementType() + o.Metrics = types.ListValueMust(t, vs) +} + // Get model type GetModelRequest struct { // Registered model unique name identifier. @@ -982,8 +3815,39 @@ func (newState *GetModelRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetModelRequest) SyncEffectiveFieldsDuringRead(existingState GetModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelRequest +// only implements ToObjectValue() and Type(). +func (o GetModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type GetModelResponse struct { - RegisteredModelDatabricks []ModelDatabricks `tfsdk:"registered_model_databricks" tf:"optional,object"` + RegisteredModelDatabricks types.List `tfsdk:"registered_model_databricks" tf:"optional,object"` } func (newState *GetModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetModelResponse) { @@ -992,6 +3856,67 @@ func (newState *GetModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetModelResponse) SyncEffectiveFieldsDuringRead(existingState GetModelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "registered_model_databricks": reflect.TypeOf(ModelDatabricks{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelResponse +// only implements ToObjectValue() and Type(). +func (o GetModelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "registered_model_databricks": o.RegisteredModelDatabricks, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "registered_model_databricks": basetypes.ListType{ + ElemType: ModelDatabricks{}.Type(ctx), + }, + }, + } +} + +// GetRegisteredModelDatabricks returns the value of the RegisteredModelDatabricks field in GetModelResponse as +// a ModelDatabricks value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetModelResponse) GetRegisteredModelDatabricks(ctx context.Context) (ModelDatabricks, bool) { + var e ModelDatabricks + if o.RegisteredModelDatabricks.IsNull() || o.RegisteredModelDatabricks.IsUnknown() { + return e, false + } + var v []ModelDatabricks + d := o.RegisteredModelDatabricks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRegisteredModelDatabricks sets the value of the RegisteredModelDatabricks field in GetModelResponse. +func (o *GetModelResponse) SetRegisteredModelDatabricks(ctx context.Context, v ModelDatabricks) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["registered_model_databricks"] + o.RegisteredModelDatabricks = types.ListValueMust(t, vs) +} + // Get a model version URI type GetModelVersionDownloadUriRequest struct { // Name of the registered model @@ -1006,6 +3931,39 @@ func (newState *GetModelVersionDownloadUriRequest) SyncEffectiveFieldsDuringCrea func (newState *GetModelVersionDownloadUriRequest) SyncEffectiveFieldsDuringRead(existingState GetModelVersionDownloadUriRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelVersionDownloadUriRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelVersionDownloadUriRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelVersionDownloadUriRequest +// only implements ToObjectValue() and Type(). +func (o GetModelVersionDownloadUriRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelVersionDownloadUriRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "version": types.StringType, + }, + } +} + type GetModelVersionDownloadUriResponse struct { // URI corresponding to where artifacts for this model version are stored. ArtifactUri types.String `tfsdk:"artifact_uri" tf:"optional"` @@ -1017,6 +3975,37 @@ func (newState *GetModelVersionDownloadUriResponse) SyncEffectiveFieldsDuringCre func (newState *GetModelVersionDownloadUriResponse) SyncEffectiveFieldsDuringRead(existingState GetModelVersionDownloadUriResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelVersionDownloadUriResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelVersionDownloadUriResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelVersionDownloadUriResponse +// only implements ToObjectValue() and Type(). +func (o GetModelVersionDownloadUriResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_uri": o.ArtifactUri, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelVersionDownloadUriResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_uri": types.StringType, + }, + } +} + // Get a model version type GetModelVersionRequest struct { // Name of the registered model @@ -1031,8 +4020,41 @@ func (newState *GetModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState GetModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o GetModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "version": types.StringType, + }, + } +} + type GetModelVersionResponse struct { - ModelVersion []ModelVersion `tfsdk:"model_version" tf:"optional,object"` + ModelVersion types.List `tfsdk:"model_version" tf:"optional,object"` } func (newState *GetModelVersionResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetModelVersionResponse) { @@ -1041,6 +4063,67 @@ func (newState *GetModelVersionResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GetModelVersionResponse) SyncEffectiveFieldsDuringRead(existingState GetModelVersionResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetModelVersionResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetModelVersionResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_version": reflect.TypeOf(ModelVersion{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetModelVersionResponse +// only implements ToObjectValue() and Type(). +func (o GetModelVersionResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_version": o.ModelVersion, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetModelVersionResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_version": basetypes.ListType{ + ElemType: ModelVersion{}.Type(ctx), + }, + }, + } +} + +// GetModelVersion returns the value of the ModelVersion field in GetModelVersionResponse as +// a ModelVersion value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetModelVersionResponse) GetModelVersion(ctx context.Context) (ModelVersion, bool) { + var e ModelVersion + if o.ModelVersion.IsNull() || o.ModelVersion.IsUnknown() { + return e, false + } + var v []ModelVersion + d := o.ModelVersion.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetModelVersion sets the value of the ModelVersion field in GetModelVersionResponse. +func (o *GetModelVersionResponse) SetModelVersion(ctx context.Context, v ModelVersion) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_version"] + o.ModelVersion = types.ListValueMust(t, vs) +} + // Get registered model permission levels type GetRegisteredModelPermissionLevelsRequest struct { // The registered model for which to get or manage permissions. @@ -1053,9 +4136,40 @@ func (newState *GetRegisteredModelPermissionLevelsRequest) SyncEffectiveFieldsDu func (newState *GetRegisteredModelPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetRegisteredModelPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRegisteredModelPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRegisteredModelPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRegisteredModelPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetRegisteredModelPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "registered_model_id": o.RegisteredModelId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRegisteredModelPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "registered_model_id": types.StringType, + }, + } +} + type GetRegisteredModelPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []RegisteredModelPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetRegisteredModelPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetRegisteredModelPermissionLevelsResponse) { @@ -1064,6 +4178,67 @@ func (newState *GetRegisteredModelPermissionLevelsResponse) SyncEffectiveFieldsD func (newState *GetRegisteredModelPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetRegisteredModelPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRegisteredModelPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRegisteredModelPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(RegisteredModelPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRegisteredModelPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetRegisteredModelPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRegisteredModelPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: RegisteredModelPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetRegisteredModelPermissionLevelsResponse as +// a slice of RegisteredModelPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetRegisteredModelPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]RegisteredModelPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []RegisteredModelPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetRegisteredModelPermissionLevelsResponse. +func (o *GetRegisteredModelPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []RegisteredModelPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get registered model permissions type GetRegisteredModelPermissionsRequest struct { // The registered model for which to get or manage permissions. @@ -1076,6 +4251,37 @@ func (newState *GetRegisteredModelPermissionsRequest) SyncEffectiveFieldsDuringC func (newState *GetRegisteredModelPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetRegisteredModelPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRegisteredModelPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRegisteredModelPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRegisteredModelPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetRegisteredModelPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "registered_model_id": o.RegisteredModelId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRegisteredModelPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "registered_model_id": types.StringType, + }, + } +} + // Get a run type GetRunRequest struct { // ID of the run to fetch. Must be provided. @@ -1091,10 +4297,43 @@ func (newState *GetRunRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetR func (newState *GetRunRequest) SyncEffectiveFieldsDuringRead(existingState GetRunRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRunRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRunRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRunRequest +// only implements ToObjectValue() and Type(). +func (o GetRunRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + "run_uuid": o.RunUuid, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRunRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.StringType, + "run_uuid": types.StringType, + }, + } +} + type GetRunResponse struct { // Run metadata (name, start time, etc) and data (metrics, params, and // tags). - Run []Run `tfsdk:"run" tf:"optional,object"` + Run types.List `tfsdk:"run" tf:"optional,object"` } func (newState *GetRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetRunResponse) { @@ -1103,6 +4342,67 @@ func (newState *GetRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Get func (newState *GetRunResponse) SyncEffectiveFieldsDuringRead(existingState GetRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "run": reflect.TypeOf(Run{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRunResponse +// only implements ToObjectValue() and Type(). +func (o GetRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run": o.Run, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run": basetypes.ListType{ + ElemType: Run{}.Type(ctx), + }, + }, + } +} + +// GetRun returns the value of the Run field in GetRunResponse as +// a Run value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetRunResponse) GetRun(ctx context.Context) (Run, bool) { + var e Run + if o.Run.IsNull() || o.Run.IsUnknown() { + return e, false + } + var v []Run + d := o.Run.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRun sets the value of the Run field in GetRunResponse. +func (o *GetRunResponse) SetRun(ctx context.Context, v Run) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run"] + o.Run = types.ListValueMust(t, vs) +} + type HttpUrlSpec struct { // Value of the authorization header that should be sent in the request sent // by the wehbook. It should be of the form `" "`. @@ -1131,6 +4431,43 @@ func (newState *HttpUrlSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan HttpUr func (newState *HttpUrlSpec) SyncEffectiveFieldsDuringRead(existingState HttpUrlSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in HttpUrlSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a HttpUrlSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, HttpUrlSpec +// only implements ToObjectValue() and Type(). +func (o HttpUrlSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "authorization": o.Authorization, + "enable_ssl_verification": o.EnableSslVerification, + "secret": o.Secret, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o HttpUrlSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "authorization": types.StringType, + "enable_ssl_verification": types.BoolType, + "secret": types.StringType, + "url": types.StringType, + }, + } +} + type HttpUrlSpecWithoutSecret struct { // Enable/disable SSL certificate validation. Default is true. For // self-signed certificates, this field must be false AND the destination @@ -1150,6 +4487,39 @@ func (newState *HttpUrlSpecWithoutSecret) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *HttpUrlSpecWithoutSecret) SyncEffectiveFieldsDuringRead(existingState HttpUrlSpecWithoutSecret) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in HttpUrlSpecWithoutSecret. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a HttpUrlSpecWithoutSecret) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, HttpUrlSpecWithoutSecret +// only implements ToObjectValue() and Type(). +func (o HttpUrlSpecWithoutSecret) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enable_ssl_verification": o.EnableSslVerification, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o HttpUrlSpecWithoutSecret) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enable_ssl_verification": types.BoolType, + "url": types.StringType, + }, + } +} + type InputTag struct { // The tag key. Key types.String `tfsdk:"key" tf:"optional"` @@ -1163,6 +4533,39 @@ func (newState *InputTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan InputTag) func (newState *InputTag) SyncEffectiveFieldsDuringRead(existingState InputTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in InputTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a InputTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, InputTag +// only implements ToObjectValue() and Type(). +func (o InputTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o InputTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type JobSpec struct { // The personal access token used to authorize webhook's job runs. AccessToken types.String `tfsdk:"access_token" tf:""` @@ -1180,6 +4583,41 @@ func (newState *JobSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan JobSpec) { func (newState *JobSpec) SyncEffectiveFieldsDuringRead(existingState JobSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobSpec +// only implements ToObjectValue() and Type(). +func (o JobSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_token": o.AccessToken, + "job_id": o.JobId, + "workspace_url": o.WorkspaceUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_token": types.StringType, + "job_id": types.StringType, + "workspace_url": types.StringType, + }, + } +} + type JobSpecWithoutSecret struct { // ID of the job that the webhook runs. JobId types.String `tfsdk:"job_id" tf:"optional"` @@ -1195,6 +4633,39 @@ func (newState *JobSpecWithoutSecret) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *JobSpecWithoutSecret) SyncEffectiveFieldsDuringRead(existingState JobSpecWithoutSecret) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in JobSpecWithoutSecret. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a JobSpecWithoutSecret) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, JobSpecWithoutSecret +// only implements ToObjectValue() and Type(). +func (o JobSpecWithoutSecret) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "job_id": o.JobId, + "workspace_url": o.WorkspaceUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o JobSpecWithoutSecret) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "job_id": types.StringType, + "workspace_url": types.StringType, + }, + } +} + // Get all artifacts type ListArtifactsRequest struct { // Token indicating the page of artifact results to fetch. `page_token` is @@ -1220,9 +4691,46 @@ func (newState *ListArtifactsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListArtifactsRequest) SyncEffectiveFieldsDuringRead(existingState ListArtifactsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListArtifactsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListArtifactsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListArtifactsRequest +// only implements ToObjectValue() and Type(). +func (o ListArtifactsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_token": o.PageToken, + "path": o.Path, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListArtifactsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_token": types.StringType, + "path": types.StringType, + "run_id": types.StringType, + "run_uuid": types.StringType, + }, + } +} + type ListArtifactsResponse struct { // File location and metadata for artifacts. - Files []FileInfo `tfsdk:"files" tf:"optional"` + Files types.List `tfsdk:"files" tf:"optional"` // Token that can be used to retrieve the next page of artifact results NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // Root artifact directory for the run. @@ -1235,6 +4743,71 @@ func (newState *ListArtifactsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListArtifactsResponse) SyncEffectiveFieldsDuringRead(existingState ListArtifactsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListArtifactsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListArtifactsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "files": reflect.TypeOf(FileInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListArtifactsResponse +// only implements ToObjectValue() and Type(). +func (o ListArtifactsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "files": o.Files, + "next_page_token": o.NextPageToken, + "root_uri": o.RootUri, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListArtifactsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "files": basetypes.ListType{ + ElemType: FileInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + "root_uri": types.StringType, + }, + } +} + +// GetFiles returns the value of the Files field in ListArtifactsResponse as +// a slice of FileInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListArtifactsResponse) GetFiles(ctx context.Context) ([]FileInfo, bool) { + if o.Files.IsNull() || o.Files.IsUnknown() { + return nil, false + } + var v []FileInfo + d := o.Files.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFiles sets the value of the Files field in ListArtifactsResponse. +func (o *ListArtifactsResponse) SetFiles(ctx context.Context, v []FileInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["files"] + t = t.(attr.TypeWithElementType).ElementType() + o.Files = types.ListValueMust(t, vs) +} + // List experiments type ListExperimentsRequest struct { // Maximum number of experiments desired. If `max_results` is unspecified, @@ -1256,10 +4829,45 @@ func (newState *ListExperimentsRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListExperimentsRequest) SyncEffectiveFieldsDuringRead(existingState ListExperimentsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExperimentsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExperimentsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExperimentsRequest +// only implements ToObjectValue() and Type(). +func (o ListExperimentsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + "view_type": o.ViewType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExperimentsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + "view_type": types.StringType, + }, + } +} + type ListExperimentsResponse struct { // Paginated Experiments beginning with the first item on the requested // page. - Experiments []Experiment `tfsdk:"experiments" tf:"optional"` + Experiments types.List `tfsdk:"experiments" tf:"optional"` // Token that can be used to retrieve the next page of experiments. Empty // token means no more experiment is available for retrieval. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -1271,6 +4879,69 @@ func (newState *ListExperimentsResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListExperimentsResponse) SyncEffectiveFieldsDuringRead(existingState ListExperimentsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListExperimentsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListExperimentsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "experiments": reflect.TypeOf(Experiment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListExperimentsResponse +// only implements ToObjectValue() and Type(). +func (o ListExperimentsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiments": o.Experiments, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListExperimentsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiments": basetypes.ListType{ + ElemType: Experiment{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetExperiments returns the value of the Experiments field in ListExperimentsResponse as +// a slice of Experiment values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListExperimentsResponse) GetExperiments(ctx context.Context) ([]Experiment, bool) { + if o.Experiments.IsNull() || o.Experiments.IsUnknown() { + return nil, false + } + var v []Experiment + d := o.Experiments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExperiments sets the value of the Experiments field in ListExperimentsResponse. +func (o *ListExperimentsResponse) SetExperiments(ctx context.Context, v []Experiment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["experiments"] + t = t.(attr.TypeWithElementType).ElementType() + o.Experiments = types.ListValueMust(t, vs) +} + // List models type ListModelsRequest struct { // Maximum number of registered models desired. Max threshold is 1000. @@ -1285,11 +4956,44 @@ func (newState *ListModelsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListModelsRequest) SyncEffectiveFieldsDuringRead(existingState ListModelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListModelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListModelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListModelsRequest +// only implements ToObjectValue() and Type(). +func (o ListModelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListModelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListModelsResponse struct { // Pagination token to request next page of models for the same query. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - RegisteredModels []Model `tfsdk:"registered_models" tf:"optional"` + RegisteredModels types.List `tfsdk:"registered_models" tf:"optional"` } func (newState *ListModelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListModelsResponse) { @@ -1298,11 +5002,74 @@ func (newState *ListModelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListModelsResponse) SyncEffectiveFieldsDuringRead(existingState ListModelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListModelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListModelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "registered_models": reflect.TypeOf(Model{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListModelsResponse +// only implements ToObjectValue() and Type(). +func (o ListModelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "registered_models": o.RegisteredModels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListModelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "registered_models": basetypes.ListType{ + ElemType: Model{}.Type(ctx), + }, + }, + } +} + +// GetRegisteredModels returns the value of the RegisteredModels field in ListModelsResponse as +// a slice of Model values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListModelsResponse) GetRegisteredModels(ctx context.Context) ([]Model, bool) { + if o.RegisteredModels.IsNull() || o.RegisteredModels.IsUnknown() { + return nil, false + } + var v []Model + d := o.RegisteredModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRegisteredModels sets the value of the RegisteredModels field in ListModelsResponse. +func (o *ListModelsResponse) SetRegisteredModels(ctx context.Context, v []Model) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["registered_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.RegisteredModels = types.ListValueMust(t, vs) +} + type ListRegistryWebhooks struct { // Token that can be used to retrieve the next page of artifact results NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // Array of registry webhooks. - Webhooks []RegistryWebhook `tfsdk:"webhooks" tf:"optional"` + Webhooks types.List `tfsdk:"webhooks" tf:"optional"` } func (newState *ListRegistryWebhooks) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListRegistryWebhooks) { @@ -1311,6 +5078,69 @@ func (newState *ListRegistryWebhooks) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListRegistryWebhooks) SyncEffectiveFieldsDuringRead(existingState ListRegistryWebhooks) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRegistryWebhooks. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRegistryWebhooks) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "webhooks": reflect.TypeOf(RegistryWebhook{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRegistryWebhooks +// only implements ToObjectValue() and Type(). +func (o ListRegistryWebhooks) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "webhooks": o.Webhooks, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRegistryWebhooks) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "webhooks": basetypes.ListType{ + ElemType: RegistryWebhook{}.Type(ctx), + }, + }, + } +} + +// GetWebhooks returns the value of the Webhooks field in ListRegistryWebhooks as +// a slice of RegistryWebhook values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListRegistryWebhooks) GetWebhooks(ctx context.Context) ([]RegistryWebhook, bool) { + if o.Webhooks.IsNull() || o.Webhooks.IsUnknown() { + return nil, false + } + var v []RegistryWebhook + d := o.Webhooks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWebhooks sets the value of the Webhooks field in ListRegistryWebhooks. +func (o *ListRegistryWebhooks) SetWebhooks(ctx context.Context, v []RegistryWebhook) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhooks"] + t = t.(attr.TypeWithElementType).ElementType() + o.Webhooks = types.ListValueMust(t, vs) +} + // List transition requests type ListTransitionRequestsRequest struct { // Name of the model. @@ -1325,9 +5155,42 @@ func (newState *ListTransitionRequestsRequest) SyncEffectiveFieldsDuringCreateOr func (newState *ListTransitionRequestsRequest) SyncEffectiveFieldsDuringRead(existingState ListTransitionRequestsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTransitionRequestsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTransitionRequestsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTransitionRequestsRequest +// only implements ToObjectValue() and Type(). +func (o ListTransitionRequestsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTransitionRequestsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "version": types.StringType, + }, + } +} + type ListTransitionRequestsResponse struct { // Array of open transition requests. - Requests []Activity `tfsdk:"requests" tf:"optional"` + Requests types.List `tfsdk:"requests" tf:"optional"` } func (newState *ListTransitionRequestsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListTransitionRequestsResponse) { @@ -1336,12 +5199,73 @@ func (newState *ListTransitionRequestsResponse) SyncEffectiveFieldsDuringCreateO func (newState *ListTransitionRequestsResponse) SyncEffectiveFieldsDuringRead(existingState ListTransitionRequestsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTransitionRequestsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTransitionRequestsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "requests": reflect.TypeOf(Activity{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTransitionRequestsResponse +// only implements ToObjectValue() and Type(). +func (o ListTransitionRequestsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "requests": o.Requests, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTransitionRequestsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "requests": basetypes.ListType{ + ElemType: Activity{}.Type(ctx), + }, + }, + } +} + +// GetRequests returns the value of the Requests field in ListTransitionRequestsResponse as +// a slice of Activity values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListTransitionRequestsResponse) GetRequests(ctx context.Context) ([]Activity, bool) { + if o.Requests.IsNull() || o.Requests.IsUnknown() { + return nil, false + } + var v []Activity + d := o.Requests.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRequests sets the value of the Requests field in ListTransitionRequestsResponse. +func (o *ListTransitionRequestsResponse) SetRequests(ctx context.Context, v []Activity) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["requests"] + t = t.(attr.TypeWithElementType).ElementType() + o.Requests = types.ListValueMust(t, vs) +} + // List registry webhooks type ListWebhooksRequest struct { // If `events` is specified, any webhook with one or more of the specified // trigger events is included in the output. If `events` is not specified, // webhooks of all event types are included in the output. - Events []types.String `tfsdk:"-"` + Events types.List `tfsdk:"-"` // If not specified, all webhooks associated with the specified events are // listed, regardless of their associated model. ModelName types.String `tfsdk:"-"` @@ -1355,18 +5279,83 @@ func (newState *ListWebhooksRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListWebhooksRequest) SyncEffectiveFieldsDuringRead(existingState ListWebhooksRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListWebhooksRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListWebhooksRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "events": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListWebhooksRequest +// only implements ToObjectValue() and Type(). +func (o ListWebhooksRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "events": o.Events, + "model_name": o.ModelName, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListWebhooksRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "events": basetypes.ListType{ + ElemType: types.StringType, + }, + "model_name": types.StringType, + "page_token": types.StringType, + }, + } +} + +// GetEvents returns the value of the Events field in ListWebhooksRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListWebhooksRequest) GetEvents(ctx context.Context) ([]types.String, bool) { + if o.Events.IsNull() || o.Events.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Events.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEvents sets the value of the Events field in ListWebhooksRequest. +func (o *ListWebhooksRequest) SetEvents(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["events"] + t = t.(attr.TypeWithElementType).ElementType() + o.Events = types.ListValueMust(t, vs) +} + type LogBatch struct { // Metrics to log. A single request can contain up to 1000 metrics, and up // to 1000 metrics, params, and tags in total. - Metrics []Metric `tfsdk:"metrics" tf:"optional"` + Metrics types.List `tfsdk:"metrics" tf:"optional"` // Params to log. A single request can contain up to 100 params, and up to // 1000 metrics, params, and tags in total. - Params []Param `tfsdk:"params" tf:"optional"` + Params types.List `tfsdk:"params" tf:"optional"` // ID of the run to log under RunId types.String `tfsdk:"run_id" tf:"optional"` // Tags to log. A single request can contain up to 100 tags, and up to 1000 // metrics, params, and tags in total. - Tags []RunTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *LogBatch) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogBatch) { @@ -1375,6 +5364,131 @@ func (newState *LogBatch) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogBatch) func (newState *LogBatch) SyncEffectiveFieldsDuringRead(existingState LogBatch) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogBatch. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogBatch) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metrics": reflect.TypeOf(Metric{}), + "params": reflect.TypeOf(Param{}), + "tags": reflect.TypeOf(RunTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogBatch +// only implements ToObjectValue() and Type(). +func (o LogBatch) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metrics": o.Metrics, + "params": o.Params, + "run_id": o.RunId, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogBatch) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metrics": basetypes.ListType{ + ElemType: Metric{}.Type(ctx), + }, + "params": basetypes.ListType{ + ElemType: Param{}.Type(ctx), + }, + "run_id": types.StringType, + "tags": basetypes.ListType{ + ElemType: RunTag{}.Type(ctx), + }, + }, + } +} + +// GetMetrics returns the value of the Metrics field in LogBatch as +// a slice of Metric values. +// If the field is unknown or null, the boolean return value is false. +func (o *LogBatch) GetMetrics(ctx context.Context) ([]Metric, bool) { + if o.Metrics.IsNull() || o.Metrics.IsUnknown() { + return nil, false + } + var v []Metric + d := o.Metrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMetrics sets the value of the Metrics field in LogBatch. +func (o *LogBatch) SetMetrics(ctx context.Context, v []Metric) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metrics"] + t = t.(attr.TypeWithElementType).ElementType() + o.Metrics = types.ListValueMust(t, vs) +} + +// GetParams returns the value of the Params field in LogBatch as +// a slice of Param values. +// If the field is unknown or null, the boolean return value is false. +func (o *LogBatch) GetParams(ctx context.Context) ([]Param, bool) { + if o.Params.IsNull() || o.Params.IsUnknown() { + return nil, false + } + var v []Param + d := o.Params.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParams sets the value of the Params field in LogBatch. +func (o *LogBatch) SetParams(ctx context.Context, v []Param) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["params"] + t = t.(attr.TypeWithElementType).ElementType() + o.Params = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in LogBatch as +// a slice of RunTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *LogBatch) GetTags(ctx context.Context) ([]RunTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []RunTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in LogBatch. +func (o *LogBatch) SetTags(ctx context.Context, v []RunTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type LogBatchResponse struct { } @@ -1384,9 +5498,36 @@ func (newState *LogBatchResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *LogBatchResponse) SyncEffectiveFieldsDuringRead(existingState LogBatchResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogBatchResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogBatchResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogBatchResponse +// only implements ToObjectValue() and Type(). +func (o LogBatchResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o LogBatchResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type LogInputs struct { // Dataset inputs - Datasets []DatasetInput `tfsdk:"datasets" tf:"optional"` + Datasets types.List `tfsdk:"datasets" tf:"optional"` // ID of the run to log under RunId types.String `tfsdk:"run_id" tf:"optional"` } @@ -1397,13 +5538,103 @@ func (newState *LogInputs) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogInput func (newState *LogInputs) SyncEffectiveFieldsDuringRead(existingState LogInputs) { } -type LogInputsResponse struct { +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogInputs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogInputs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "datasets": reflect.TypeOf(DatasetInput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogInputs +// only implements ToObjectValue() and Type(). +func (o LogInputs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "datasets": o.Datasets, + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogInputs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "datasets": basetypes.ListType{ + ElemType: DatasetInput{}.Type(ctx), + }, + "run_id": types.StringType, + }, + } +} + +// GetDatasets returns the value of the Datasets field in LogInputs as +// a slice of DatasetInput values. +// If the field is unknown or null, the boolean return value is false. +func (o *LogInputs) GetDatasets(ctx context.Context) ([]DatasetInput, bool) { + if o.Datasets.IsNull() || o.Datasets.IsUnknown() { + return nil, false + } + var v []DatasetInput + d := o.Datasets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDatasets sets the value of the Datasets field in LogInputs. +func (o *LogInputs) SetDatasets(ctx context.Context, v []DatasetInput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["datasets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Datasets = types.ListValueMust(t, vs) +} + +type LogInputsResponse struct { +} + +func (newState *LogInputsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogInputsResponse) { +} + +func (newState *LogInputsResponse) SyncEffectiveFieldsDuringRead(existingState LogInputsResponse) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogInputsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogInputsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} } -func (newState *LogInputsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogInputsResponse) { +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogInputsResponse +// only implements ToObjectValue() and Type(). +func (o LogInputsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) } -func (newState *LogInputsResponse) SyncEffectiveFieldsDuringRead(existingState LogInputsResponse) { +// Type implements basetypes.ObjectValuable. +func (o LogInputsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } } type LogMetric struct { @@ -1428,6 +5659,47 @@ func (newState *LogMetric) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogMetri func (newState *LogMetric) SyncEffectiveFieldsDuringRead(existingState LogMetric) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogMetric. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogMetric) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogMetric +// only implements ToObjectValue() and Type(). +func (o LogMetric) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + "step": o.Step, + "timestamp": o.Timestamp, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogMetric) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "run_id": types.StringType, + "run_uuid": types.StringType, + "step": types.Int64Type, + "timestamp": types.Int64Type, + "value": types.Float64Type, + }, + } +} + type LogMetricResponse struct { } @@ -1437,6 +5709,33 @@ func (newState *LogMetricResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *LogMetricResponse) SyncEffectiveFieldsDuringRead(existingState LogMetricResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogMetricResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogMetricResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogMetricResponse +// only implements ToObjectValue() and Type(). +func (o LogMetricResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o LogMetricResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type LogModel struct { // MLmodel file in json format. ModelJson types.String `tfsdk:"model_json" tf:"optional"` @@ -1450,6 +5749,39 @@ func (newState *LogModel) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogModel) func (newState *LogModel) SyncEffectiveFieldsDuringRead(existingState LogModel) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogModel. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogModel) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogModel +// only implements ToObjectValue() and Type(). +func (o LogModel) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_json": o.ModelJson, + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogModel) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_json": types.StringType, + "run_id": types.StringType, + }, + } +} + type LogModelResponse struct { } @@ -1459,6 +5791,33 @@ func (newState *LogModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *LogModelResponse) SyncEffectiveFieldsDuringRead(existingState LogModelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogModelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogModelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogModelResponse +// only implements ToObjectValue() and Type(). +func (o LogModelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o LogModelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type LogParam struct { // Name of the param. Maximum size is 255 bytes. Key types.String `tfsdk:"key" tf:""` @@ -1477,6 +5836,43 @@ func (newState *LogParam) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogParam) func (newState *LogParam) SyncEffectiveFieldsDuringRead(existingState LogParam) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogParam. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogParam) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogParam +// only implements ToObjectValue() and Type(). +func (o LogParam) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogParam) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "run_id": types.StringType, + "run_uuid": types.StringType, + "value": types.StringType, + }, + } +} + type LogParamResponse struct { } @@ -1486,6 +5882,33 @@ func (newState *LogParamResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *LogParamResponse) SyncEffectiveFieldsDuringRead(existingState LogParamResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogParamResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogParamResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogParamResponse +// only implements ToObjectValue() and Type(). +func (o LogParamResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o LogParamResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Metric struct { // Key identifying this metric. Key types.String `tfsdk:"key" tf:"optional"` @@ -1503,6 +5926,43 @@ func (newState *Metric) SyncEffectiveFieldsDuringCreateOrUpdate(plan Metric) { func (newState *Metric) SyncEffectiveFieldsDuringRead(existingState Metric) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Metric. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Metric) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Metric +// only implements ToObjectValue() and Type(). +func (o Metric) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "step": o.Step, + "timestamp": o.Timestamp, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Metric) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "step": types.Int64Type, + "timestamp": types.Int64Type, + "value": types.Float64Type, + }, + } +} + type Model struct { // Timestamp recorded when this `registered_model` was created. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1513,11 +5973,11 @@ type Model struct { LastUpdatedTimestamp types.Int64 `tfsdk:"last_updated_timestamp" tf:"optional"` // Collection of latest model versions for each stage. Only contains models // with current `READY` status. - LatestVersions []ModelVersion `tfsdk:"latest_versions" tf:"optional"` + LatestVersions types.List `tfsdk:"latest_versions" tf:"optional"` // Unique name for the model. Name types.String `tfsdk:"name" tf:"optional"` // Tags: Additional metadata key-value pairs for this `registered_model`. - Tags []ModelTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // User that created this `registered_model` UserId types.String `tfsdk:"user_id" tf:"optional"` } @@ -1528,6 +5988,108 @@ func (newState *Model) SyncEffectiveFieldsDuringCreateOrUpdate(plan Model) { func (newState *Model) SyncEffectiveFieldsDuringRead(existingState Model) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Model. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Model) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "latest_versions": reflect.TypeOf(ModelVersion{}), + "tags": reflect.TypeOf(ModelTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Model +// only implements ToObjectValue() and Type(). +func (o Model) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "description": o.Description, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "latest_versions": o.LatestVersions, + "name": o.Name, + "tags": o.Tags, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Model) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "description": types.StringType, + "last_updated_timestamp": types.Int64Type, + "latest_versions": basetypes.ListType{ + ElemType: ModelVersion{}.Type(ctx), + }, + "name": types.StringType, + "tags": basetypes.ListType{ + ElemType: ModelTag{}.Type(ctx), + }, + "user_id": types.StringType, + }, + } +} + +// GetLatestVersions returns the value of the LatestVersions field in Model as +// a slice of ModelVersion values. +// If the field is unknown or null, the boolean return value is false. +func (o *Model) GetLatestVersions(ctx context.Context) ([]ModelVersion, bool) { + if o.LatestVersions.IsNull() || o.LatestVersions.IsUnknown() { + return nil, false + } + var v []ModelVersion + d := o.LatestVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLatestVersions sets the value of the LatestVersions field in Model. +func (o *Model) SetLatestVersions(ctx context.Context, v []ModelVersion) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["latest_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.LatestVersions = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in Model as +// a slice of ModelTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *Model) GetTags(ctx context.Context) ([]ModelTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ModelTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in Model. +func (o *Model) SetTags(ctx context.Context, v []ModelTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ModelDatabricks struct { // Creation time of the object, as a Unix timestamp in milliseconds. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1538,14 +6100,14 @@ type ModelDatabricks struct { // Time of the object at last update, as a Unix timestamp in milliseconds. LastUpdatedTimestamp types.Int64 `tfsdk:"last_updated_timestamp" tf:"optional"` // Array of model versions, each the latest version for its stage. - LatestVersions []ModelVersion `tfsdk:"latest_versions" tf:"optional"` + LatestVersions types.List `tfsdk:"latest_versions" tf:"optional"` // Name of the model. Name types.String `tfsdk:"name" tf:"optional"` // Permission level of the requesting user on the object. For what is // allowed at each level, see [MLflow Model permissions](..). PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` // Array of tags associated with the model. - Tags []ModelTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // The username of the user that created the object. UserId types.String `tfsdk:"user_id" tf:"optional"` } @@ -1556,6 +6118,112 @@ func (newState *ModelDatabricks) SyncEffectiveFieldsDuringCreateOrUpdate(plan Mo func (newState *ModelDatabricks) SyncEffectiveFieldsDuringRead(existingState ModelDatabricks) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelDatabricks. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelDatabricks) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "latest_versions": reflect.TypeOf(ModelVersion{}), + "tags": reflect.TypeOf(ModelTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelDatabricks +// only implements ToObjectValue() and Type(). +func (o ModelDatabricks) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "description": o.Description, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "latest_versions": o.LatestVersions, + "name": o.Name, + "permission_level": o.PermissionLevel, + "tags": o.Tags, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelDatabricks) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "description": types.StringType, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "latest_versions": basetypes.ListType{ + ElemType: ModelVersion{}.Type(ctx), + }, + "name": types.StringType, + "permission_level": types.StringType, + "tags": basetypes.ListType{ + ElemType: ModelTag{}.Type(ctx), + }, + "user_id": types.StringType, + }, + } +} + +// GetLatestVersions returns the value of the LatestVersions field in ModelDatabricks as +// a slice of ModelVersion values. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelDatabricks) GetLatestVersions(ctx context.Context) ([]ModelVersion, bool) { + if o.LatestVersions.IsNull() || o.LatestVersions.IsUnknown() { + return nil, false + } + var v []ModelVersion + d := o.LatestVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLatestVersions sets the value of the LatestVersions field in ModelDatabricks. +func (o *ModelDatabricks) SetLatestVersions(ctx context.Context, v []ModelVersion) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["latest_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.LatestVersions = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in ModelDatabricks as +// a slice of ModelTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelDatabricks) GetTags(ctx context.Context) ([]ModelTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ModelTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ModelDatabricks. +func (o *ModelDatabricks) SetTags(ctx context.Context, v []ModelTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ModelTag struct { // The tag key. Key types.String `tfsdk:"key" tf:"optional"` @@ -1569,6 +6237,39 @@ func (newState *ModelTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan ModelTag) func (newState *ModelTag) SyncEffectiveFieldsDuringRead(existingState ModelTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelTag +// only implements ToObjectValue() and Type(). +func (o ModelTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type ModelVersion struct { // Timestamp recorded when this `model_version` was created. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1594,7 +6295,7 @@ type ModelVersion struct { // Details on current `status`, if it is pending or failed. StatusMessage types.String `tfsdk:"status_message" tf:"optional"` // Tags: Additional metadata key-value pairs for this `model_version`. - Tags []ModelVersionTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // User that created this `model_version`. UserId types.String `tfsdk:"user_id" tf:"optional"` // Model's version number. @@ -1607,6 +6308,91 @@ func (newState *ModelVersion) SyncEffectiveFieldsDuringCreateOrUpdate(plan Model func (newState *ModelVersion) SyncEffectiveFieldsDuringRead(existingState ModelVersion) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelVersion. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelVersion) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(ModelVersionTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelVersion +// only implements ToObjectValue() and Type(). +func (o ModelVersion) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "current_stage": o.CurrentStage, + "description": o.Description, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "name": o.Name, + "run_id": o.RunId, + "run_link": o.RunLink, + "source": o.Source, + "status": o.Status, + "status_message": o.StatusMessage, + "tags": o.Tags, + "user_id": o.UserId, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelVersion) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "current_stage": types.StringType, + "description": types.StringType, + "last_updated_timestamp": types.Int64Type, + "name": types.StringType, + "run_id": types.StringType, + "run_link": types.StringType, + "source": types.StringType, + "status": types.StringType, + "status_message": types.StringType, + "tags": basetypes.ListType{ + ElemType: ModelVersionTag{}.Type(ctx), + }, + "user_id": types.StringType, + "version": types.StringType, + }, + } +} + +// GetTags returns the value of the Tags field in ModelVersion as +// a slice of ModelVersionTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelVersion) GetTags(ctx context.Context) ([]ModelVersionTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ModelVersionTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ModelVersion. +func (o *ModelVersion) SetTags(ctx context.Context, v []ModelVersionTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ModelVersionDatabricks struct { // Creation time of the object, as a Unix timestamp in milliseconds. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1651,7 +6437,7 @@ type ModelVersionDatabricks struct { // Details on the current status, for example why registration failed. StatusMessage types.String `tfsdk:"status_message" tf:"optional"` // Array of tags that are associated with the model version. - Tags []ModelVersionTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // The username of the user that created the object. UserId types.String `tfsdk:"user_id" tf:"optional"` // Version of the model. @@ -1664,6 +6450,93 @@ func (newState *ModelVersionDatabricks) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ModelVersionDatabricks) SyncEffectiveFieldsDuringRead(existingState ModelVersionDatabricks) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelVersionDatabricks. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelVersionDatabricks) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(ModelVersionTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelVersionDatabricks +// only implements ToObjectValue() and Type(). +func (o ModelVersionDatabricks) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "current_stage": o.CurrentStage, + "description": o.Description, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "name": o.Name, + "permission_level": o.PermissionLevel, + "run_id": o.RunId, + "run_link": o.RunLink, + "source": o.Source, + "status": o.Status, + "status_message": o.StatusMessage, + "tags": o.Tags, + "user_id": o.UserId, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelVersionDatabricks) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "current_stage": types.StringType, + "description": types.StringType, + "last_updated_timestamp": types.Int64Type, + "name": types.StringType, + "permission_level": types.StringType, + "run_id": types.StringType, + "run_link": types.StringType, + "source": types.StringType, + "status": types.StringType, + "status_message": types.StringType, + "tags": basetypes.ListType{ + ElemType: ModelVersionTag{}.Type(ctx), + }, + "user_id": types.StringType, + "version": types.StringType, + }, + } +} + +// GetTags returns the value of the Tags field in ModelVersionDatabricks as +// a slice of ModelVersionTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelVersionDatabricks) GetTags(ctx context.Context) ([]ModelVersionTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []ModelVersionTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ModelVersionDatabricks. +func (o *ModelVersionDatabricks) SetTags(ctx context.Context, v []ModelVersionTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ModelVersionTag struct { // The tag key. Key types.String `tfsdk:"key" tf:"optional"` @@ -1677,6 +6550,39 @@ func (newState *ModelVersionTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan Mo func (newState *ModelVersionTag) SyncEffectiveFieldsDuringRead(existingState ModelVersionTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelVersionTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelVersionTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelVersionTag +// only implements ToObjectValue() and Type(). +func (o ModelVersionTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelVersionTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type Param struct { // Key identifying this param. Key types.String `tfsdk:"key" tf:"optional"` @@ -1690,6 +6596,39 @@ func (newState *Param) SyncEffectiveFieldsDuringCreateOrUpdate(plan Param) { func (newState *Param) SyncEffectiveFieldsDuringRead(existingState Param) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Param. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Param) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Param +// only implements ToObjectValue() and Type(). +func (o Param) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Param) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type RegisteredModelAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -1707,9 +6646,46 @@ func (newState *RegisteredModelAccessControlRequest) SyncEffectiveFieldsDuringCr func (newState *RegisteredModelAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState RegisteredModelAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o RegisteredModelAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type RegisteredModelAccessControlResponse struct { // All permissions. - AllPermissions []RegisteredModelPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -1726,10 +6702,79 @@ func (newState *RegisteredModelAccessControlResponse) SyncEffectiveFieldsDuringC func (newState *RegisteredModelAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState RegisteredModelAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(RegisteredModelPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o RegisteredModelAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: RegisteredModelPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in RegisteredModelAccessControlResponse as +// a slice of RegisteredModelPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *RegisteredModelAccessControlResponse) GetAllPermissions(ctx context.Context) ([]RegisteredModelPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []RegisteredModelPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in RegisteredModelAccessControlResponse. +func (o *RegisteredModelAccessControlResponse) SetAllPermissions(ctx context.Context, v []RegisteredModelPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type RegisteredModelPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -1740,8 +6785,73 @@ func (newState *RegisteredModelPermission) SyncEffectiveFieldsDuringCreateOrUpda func (newState *RegisteredModelPermission) SyncEffectiveFieldsDuringRead(existingState RegisteredModelPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelPermission +// only implements ToObjectValue() and Type(). +func (o RegisteredModelPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in RegisteredModelPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RegisteredModelPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in RegisteredModelPermission. +func (o *RegisteredModelPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type RegisteredModelPermissions struct { - AccessControlList []RegisteredModelAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -1754,6 +6864,71 @@ func (newState *RegisteredModelPermissions) SyncEffectiveFieldsDuringCreateOrUpd func (newState *RegisteredModelPermissions) SyncEffectiveFieldsDuringRead(existingState RegisteredModelPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(RegisteredModelAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelPermissions +// only implements ToObjectValue() and Type(). +func (o RegisteredModelPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: RegisteredModelAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in RegisteredModelPermissions as +// a slice of RegisteredModelAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *RegisteredModelPermissions) GetAccessControlList(ctx context.Context) ([]RegisteredModelAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []RegisteredModelAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in RegisteredModelPermissions. +func (o *RegisteredModelPermissions) SetAccessControlList(ctx context.Context, v []RegisteredModelAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type RegisteredModelPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -1766,8 +6941,41 @@ func (newState *RegisteredModelPermissionsDescription) SyncEffectiveFieldsDuring func (newState *RegisteredModelPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState RegisteredModelPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o RegisteredModelPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type RegisteredModelPermissionsRequest struct { - AccessControlList []RegisteredModelAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The registered model for which to get or manage permissions. RegisteredModelId types.String `tfsdk:"-"` } @@ -1778,6 +6986,69 @@ func (newState *RegisteredModelPermissionsRequest) SyncEffectiveFieldsDuringCrea func (newState *RegisteredModelPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState RegisteredModelPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegisteredModelPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegisteredModelPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(RegisteredModelAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegisteredModelPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o RegisteredModelPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "registered_model_id": o.RegisteredModelId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegisteredModelPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: RegisteredModelAccessControlRequest{}.Type(ctx), + }, + "registered_model_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in RegisteredModelPermissionsRequest as +// a slice of RegisteredModelAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *RegisteredModelPermissionsRequest) GetAccessControlList(ctx context.Context) ([]RegisteredModelAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []RegisteredModelAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in RegisteredModelPermissionsRequest. +func (o *RegisteredModelPermissionsRequest) SetAccessControlList(ctx context.Context, v []RegisteredModelAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type RegistryWebhook struct { // Creation time of the object, as a Unix timestamp in milliseconds. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1816,13 +7087,13 @@ type RegistryWebhook struct { // // * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model // version be archived. - Events []types.String `tfsdk:"events" tf:"optional"` + Events types.List `tfsdk:"events" tf:"optional"` - HttpUrlSpec []HttpUrlSpecWithoutSecret `tfsdk:"http_url_spec" tf:"optional,object"` + HttpUrlSpec types.List `tfsdk:"http_url_spec" tf:"optional,object"` // Webhook ID Id types.String `tfsdk:"id" tf:"optional"` - JobSpec []JobSpecWithoutSecret `tfsdk:"job_spec" tf:"optional,object"` + JobSpec types.List `tfsdk:"job_spec" tf:"optional,object"` // Time of the object at last update, as a Unix timestamp in milliseconds. LastUpdatedTimestamp types.Int64 `tfsdk:"last_updated_timestamp" tf:"optional"` // Name of the model whose events would trigger this webhook. @@ -1844,6 +7115,141 @@ func (newState *RegistryWebhook) SyncEffectiveFieldsDuringCreateOrUpdate(plan Re func (newState *RegistryWebhook) SyncEffectiveFieldsDuringRead(existingState RegistryWebhook) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RegistryWebhook. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RegistryWebhook) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "events": reflect.TypeOf(types.String{}), + "http_url_spec": reflect.TypeOf(HttpUrlSpecWithoutSecret{}), + "job_spec": reflect.TypeOf(JobSpecWithoutSecret{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RegistryWebhook +// only implements ToObjectValue() and Type(). +func (o RegistryWebhook) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "description": o.Description, + "events": o.Events, + "http_url_spec": o.HttpUrlSpec, + "id": o.Id, + "job_spec": o.JobSpec, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "model_name": o.ModelName, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RegistryWebhook) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "description": types.StringType, + "events": basetypes.ListType{ + ElemType: types.StringType, + }, + "http_url_spec": basetypes.ListType{ + ElemType: HttpUrlSpecWithoutSecret{}.Type(ctx), + }, + "id": types.StringType, + "job_spec": basetypes.ListType{ + ElemType: JobSpecWithoutSecret{}.Type(ctx), + }, + "last_updated_timestamp": types.Int64Type, + "model_name": types.StringType, + "status": types.StringType, + }, + } +} + +// GetEvents returns the value of the Events field in RegistryWebhook as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RegistryWebhook) GetEvents(ctx context.Context) ([]types.String, bool) { + if o.Events.IsNull() || o.Events.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Events.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEvents sets the value of the Events field in RegistryWebhook. +func (o *RegistryWebhook) SetEvents(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["events"] + t = t.(attr.TypeWithElementType).ElementType() + o.Events = types.ListValueMust(t, vs) +} + +// GetHttpUrlSpec returns the value of the HttpUrlSpec field in RegistryWebhook as +// a HttpUrlSpecWithoutSecret value. +// If the field is unknown or null, the boolean return value is false. +func (o *RegistryWebhook) GetHttpUrlSpec(ctx context.Context) (HttpUrlSpecWithoutSecret, bool) { + var e HttpUrlSpecWithoutSecret + if o.HttpUrlSpec.IsNull() || o.HttpUrlSpec.IsUnknown() { + return e, false + } + var v []HttpUrlSpecWithoutSecret + d := o.HttpUrlSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHttpUrlSpec sets the value of the HttpUrlSpec field in RegistryWebhook. +func (o *RegistryWebhook) SetHttpUrlSpec(ctx context.Context, v HttpUrlSpecWithoutSecret) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["http_url_spec"] + o.HttpUrlSpec = types.ListValueMust(t, vs) +} + +// GetJobSpec returns the value of the JobSpec field in RegistryWebhook as +// a JobSpecWithoutSecret value. +// If the field is unknown or null, the boolean return value is false. +func (o *RegistryWebhook) GetJobSpec(ctx context.Context) (JobSpecWithoutSecret, bool) { + var e JobSpecWithoutSecret + if o.JobSpec.IsNull() || o.JobSpec.IsUnknown() { + return e, false + } + var v []JobSpecWithoutSecret + d := o.JobSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetJobSpec sets the value of the JobSpec field in RegistryWebhook. +func (o *RegistryWebhook) SetJobSpec(ctx context.Context, v JobSpecWithoutSecret) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_spec"] + o.JobSpec = types.ListValueMust(t, vs) +} + type RejectTransitionRequest struct { // User-provided comment on the action. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -1869,9 +7275,46 @@ func (newState *RejectTransitionRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *RejectTransitionRequest) SyncEffectiveFieldsDuringRead(existingState RejectTransitionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RejectTransitionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RejectTransitionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RejectTransitionRequest +// only implements ToObjectValue() and Type(). +func (o RejectTransitionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "stage": o.Stage, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RejectTransitionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "stage": types.StringType, + "version": types.StringType, + }, + } +} + type RejectTransitionRequestResponse struct { // Activity recorded for the action. - Activity []Activity `tfsdk:"activity" tf:"optional,object"` + Activity types.List `tfsdk:"activity" tf:"optional,object"` } func (newState *RejectTransitionRequestResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan RejectTransitionRequestResponse) { @@ -1880,6 +7323,67 @@ func (newState *RejectTransitionRequestResponse) SyncEffectiveFieldsDuringCreate func (newState *RejectTransitionRequestResponse) SyncEffectiveFieldsDuringRead(existingState RejectTransitionRequestResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RejectTransitionRequestResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RejectTransitionRequestResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "activity": reflect.TypeOf(Activity{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RejectTransitionRequestResponse +// only implements ToObjectValue() and Type(). +func (o RejectTransitionRequestResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activity": o.Activity, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RejectTransitionRequestResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activity": basetypes.ListType{ + ElemType: Activity{}.Type(ctx), + }, + }, + } +} + +// GetActivity returns the value of the Activity field in RejectTransitionRequestResponse as +// a Activity value. +// If the field is unknown or null, the boolean return value is false. +func (o *RejectTransitionRequestResponse) GetActivity(ctx context.Context) (Activity, bool) { + var e Activity + if o.Activity.IsNull() || o.Activity.IsUnknown() { + return e, false + } + var v []Activity + d := o.Activity.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetActivity sets the value of the Activity field in RejectTransitionRequestResponse. +func (o *RejectTransitionRequestResponse) SetActivity(ctx context.Context, v Activity) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["activity"] + o.Activity = types.ListValueMust(t, vs) +} + type RenameModelRequest struct { // Registered model unique name identifier. Name types.String `tfsdk:"name" tf:""` @@ -1893,8 +7397,41 @@ func (newState *RenameModelRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RenameModelRequest) SyncEffectiveFieldsDuringRead(existingState RenameModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RenameModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RenameModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RenameModelRequest +// only implements ToObjectValue() and Type(). +func (o RenameModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "new_name": o.NewName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RenameModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "new_name": types.StringType, + }, + } +} + type RenameModelResponse struct { - RegisteredModel []Model `tfsdk:"registered_model" tf:"optional,object"` + RegisteredModel types.List `tfsdk:"registered_model" tf:"optional,object"` } func (newState *RenameModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan RenameModelResponse) { @@ -1903,6 +7440,67 @@ func (newState *RenameModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *RenameModelResponse) SyncEffectiveFieldsDuringRead(existingState RenameModelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RenameModelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RenameModelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "registered_model": reflect.TypeOf(Model{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RenameModelResponse +// only implements ToObjectValue() and Type(). +func (o RenameModelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "registered_model": o.RegisteredModel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RenameModelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "registered_model": basetypes.ListType{ + ElemType: Model{}.Type(ctx), + }, + }, + } +} + +// GetRegisteredModel returns the value of the RegisteredModel field in RenameModelResponse as +// a Model value. +// If the field is unknown or null, the boolean return value is false. +func (o *RenameModelResponse) GetRegisteredModel(ctx context.Context) (Model, bool) { + var e Model + if o.RegisteredModel.IsNull() || o.RegisteredModel.IsUnknown() { + return e, false + } + var v []Model + d := o.RegisteredModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRegisteredModel sets the value of the RegisteredModel field in RenameModelResponse. +func (o *RenameModelResponse) SetRegisteredModel(ctx context.Context, v Model) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["registered_model"] + o.RegisteredModel = types.ListValueMust(t, vs) +} + type RestoreExperiment struct { // ID of the associated experiment. ExperimentId types.String `tfsdk:"experiment_id" tf:""` @@ -1914,6 +7512,37 @@ func (newState *RestoreExperiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RestoreExperiment) SyncEffectiveFieldsDuringRead(existingState RestoreExperiment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreExperiment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreExperiment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreExperiment +// only implements ToObjectValue() and Type(). +func (o RestoreExperiment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreExperiment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + }, + } +} + type RestoreExperimentResponse struct { } @@ -1923,6 +7552,33 @@ func (newState *RestoreExperimentResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *RestoreExperimentResponse) SyncEffectiveFieldsDuringRead(existingState RestoreExperimentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreExperimentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreExperimentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreExperimentResponse +// only implements ToObjectValue() and Type(). +func (o RestoreExperimentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreExperimentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type RestoreRun struct { // ID of the run to restore. RunId types.String `tfsdk:"run_id" tf:""` @@ -1934,6 +7590,37 @@ func (newState *RestoreRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan Restore func (newState *RestoreRun) SyncEffectiveFieldsDuringRead(existingState RestoreRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreRun +// only implements ToObjectValue() and Type(). +func (o RestoreRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_id": o.RunId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_id": types.StringType, + }, + } +} + type RestoreRunResponse struct { } @@ -1943,6 +7630,33 @@ func (newState *RestoreRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RestoreRunResponse) SyncEffectiveFieldsDuringRead(existingState RestoreRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreRunResponse +// only implements ToObjectValue() and Type(). +func (o RestoreRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type RestoreRuns struct { // The ID of the experiment containing the runs to restore. ExperimentId types.String `tfsdk:"experiment_id" tf:""` @@ -1961,6 +7675,41 @@ func (newState *RestoreRuns) SyncEffectiveFieldsDuringCreateOrUpdate(plan Restor func (newState *RestoreRuns) SyncEffectiveFieldsDuringRead(existingState RestoreRuns) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreRuns. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreRuns) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreRuns +// only implements ToObjectValue() and Type(). +func (o RestoreRuns) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + "max_runs": o.MaxRuns, + "min_timestamp_millis": o.MinTimestampMillis, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreRuns) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + "max_runs": types.Int64Type, + "min_timestamp_millis": types.Int64Type, + }, + } +} + type RestoreRunsResponse struct { // The number of runs restored. RunsRestored types.Int64 `tfsdk:"runs_restored" tf:"optional"` @@ -1972,13 +7721,44 @@ func (newState *RestoreRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *RestoreRunsResponse) SyncEffectiveFieldsDuringRead(existingState RestoreRunsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreRunsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreRunsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreRunsResponse +// only implements ToObjectValue() and Type(). +func (o RestoreRunsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "runs_restored": o.RunsRestored, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreRunsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "runs_restored": types.Int64Type, + }, + } +} + type Run struct { // Run data. - Data []RunData `tfsdk:"data" tf:"optional,object"` + Data types.List `tfsdk:"data" tf:"optional,object"` // Run metadata. - Info []RunInfo `tfsdk:"info" tf:"optional,object"` + Info types.List `tfsdk:"info" tf:"optional,object"` // Run inputs. - Inputs []RunInputs `tfsdk:"inputs" tf:"optional,object"` + Inputs types.List `tfsdk:"inputs" tf:"optional,object"` } func (newState *Run) SyncEffectiveFieldsDuringCreateOrUpdate(plan Run) { @@ -1987,13 +7767,136 @@ func (newState *Run) SyncEffectiveFieldsDuringCreateOrUpdate(plan Run) { func (newState *Run) SyncEffectiveFieldsDuringRead(existingState Run) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Run. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Run) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data": reflect.TypeOf(RunData{}), + "info": reflect.TypeOf(RunInfo{}), + "inputs": reflect.TypeOf(RunInputs{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Run +// only implements ToObjectValue() and Type(). +func (o Run) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data": o.Data, + "info": o.Info, + "inputs": o.Inputs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Run) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data": basetypes.ListType{ + ElemType: RunData{}.Type(ctx), + }, + "info": basetypes.ListType{ + ElemType: RunInfo{}.Type(ctx), + }, + "inputs": basetypes.ListType{ + ElemType: RunInputs{}.Type(ctx), + }, + }, + } +} + +// GetData returns the value of the Data field in Run as +// a RunData value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetData(ctx context.Context) (RunData, bool) { + var e RunData + if o.Data.IsNull() || o.Data.IsUnknown() { + return e, false + } + var v []RunData + d := o.Data.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetData sets the value of the Data field in Run. +func (o *Run) SetData(ctx context.Context, v RunData) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data"] + o.Data = types.ListValueMust(t, vs) +} + +// GetInfo returns the value of the Info field in Run as +// a RunInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetInfo(ctx context.Context) (RunInfo, bool) { + var e RunInfo + if o.Info.IsNull() || o.Info.IsUnknown() { + return e, false + } + var v []RunInfo + d := o.Info.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInfo sets the value of the Info field in Run. +func (o *Run) SetInfo(ctx context.Context, v RunInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["info"] + o.Info = types.ListValueMust(t, vs) +} + +// GetInputs returns the value of the Inputs field in Run as +// a RunInputs value. +// If the field is unknown or null, the boolean return value is false. +func (o *Run) GetInputs(ctx context.Context) (RunInputs, bool) { + var e RunInputs + if o.Inputs.IsNull() || o.Inputs.IsUnknown() { + return e, false + } + var v []RunInputs + d := o.Inputs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInputs sets the value of the Inputs field in Run. +func (o *Run) SetInputs(ctx context.Context, v RunInputs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inputs"] + o.Inputs = types.ListValueMust(t, vs) +} + type RunData struct { // Run metrics. - Metrics []Metric `tfsdk:"metrics" tf:"optional"` + Metrics types.List `tfsdk:"metrics" tf:"optional"` // Run parameters. - Params []Param `tfsdk:"params" tf:"optional"` + Params types.List `tfsdk:"params" tf:"optional"` // Additional metadata key-value pairs. - Tags []RunTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *RunData) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunData) { @@ -2002,6 +7905,129 @@ func (newState *RunData) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunData) { func (newState *RunData) SyncEffectiveFieldsDuringRead(existingState RunData) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunData. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunData) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "metrics": reflect.TypeOf(Metric{}), + "params": reflect.TypeOf(Param{}), + "tags": reflect.TypeOf(RunTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunData +// only implements ToObjectValue() and Type(). +func (o RunData) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "metrics": o.Metrics, + "params": o.Params, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunData) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "metrics": basetypes.ListType{ + ElemType: Metric{}.Type(ctx), + }, + "params": basetypes.ListType{ + ElemType: Param{}.Type(ctx), + }, + "tags": basetypes.ListType{ + ElemType: RunTag{}.Type(ctx), + }, + }, + } +} + +// GetMetrics returns the value of the Metrics field in RunData as +// a slice of Metric values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunData) GetMetrics(ctx context.Context) ([]Metric, bool) { + if o.Metrics.IsNull() || o.Metrics.IsUnknown() { + return nil, false + } + var v []Metric + d := o.Metrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMetrics sets the value of the Metrics field in RunData. +func (o *RunData) SetMetrics(ctx context.Context, v []Metric) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metrics"] + t = t.(attr.TypeWithElementType).ElementType() + o.Metrics = types.ListValueMust(t, vs) +} + +// GetParams returns the value of the Params field in RunData as +// a slice of Param values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunData) GetParams(ctx context.Context) ([]Param, bool) { + if o.Params.IsNull() || o.Params.IsUnknown() { + return nil, false + } + var v []Param + d := o.Params.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParams sets the value of the Params field in RunData. +func (o *RunData) SetParams(ctx context.Context, v []Param) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["params"] + t = t.(attr.TypeWithElementType).ElementType() + o.Params = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in RunData as +// a slice of RunTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunData) GetTags(ctx context.Context) ([]RunTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []RunTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in RunData. +func (o *RunData) SetTags(ctx context.Context, v []RunTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type RunInfo struct { // URI of the directory where artifacts should be uploaded. This can be a // local path (starting with "/"), or a distributed file system (DFS) path, @@ -2035,9 +8061,56 @@ func (newState *RunInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunInfo) { func (newState *RunInfo) SyncEffectiveFieldsDuringRead(existingState RunInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunInfo +// only implements ToObjectValue() and Type(). +func (o RunInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "artifact_uri": o.ArtifactUri, + "end_time": o.EndTime, + "experiment_id": o.ExperimentId, + "lifecycle_stage": o.LifecycleStage, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + "start_time": o.StartTime, + "status": o.Status, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "artifact_uri": types.StringType, + "end_time": types.Int64Type, + "experiment_id": types.StringType, + "lifecycle_stage": types.StringType, + "run_id": types.StringType, + "run_uuid": types.StringType, + "start_time": types.Int64Type, + "status": types.StringType, + "user_id": types.StringType, + }, + } +} + type RunInputs struct { // Run metrics. - DatasetInputs []DatasetInput `tfsdk:"dataset_inputs" tf:"optional"` + DatasetInputs types.List `tfsdk:"dataset_inputs" tf:"optional"` } func (newState *RunInputs) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunInputs) { @@ -2046,6 +8119,67 @@ func (newState *RunInputs) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunInput func (newState *RunInputs) SyncEffectiveFieldsDuringRead(existingState RunInputs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunInputs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunInputs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dataset_inputs": reflect.TypeOf(DatasetInput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunInputs +// only implements ToObjectValue() and Type(). +func (o RunInputs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dataset_inputs": o.DatasetInputs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunInputs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dataset_inputs": basetypes.ListType{ + ElemType: DatasetInput{}.Type(ctx), + }, + }, + } +} + +// GetDatasetInputs returns the value of the DatasetInputs field in RunInputs as +// a slice of DatasetInput values. +// If the field is unknown or null, the boolean return value is false. +func (o *RunInputs) GetDatasetInputs(ctx context.Context) ([]DatasetInput, bool) { + if o.DatasetInputs.IsNull() || o.DatasetInputs.IsUnknown() { + return nil, false + } + var v []DatasetInput + d := o.DatasetInputs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDatasetInputs sets the value of the DatasetInputs field in RunInputs. +func (o *RunInputs) SetDatasetInputs(ctx context.Context, v []DatasetInput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dataset_inputs"] + t = t.(attr.TypeWithElementType).ElementType() + o.DatasetInputs = types.ListValueMust(t, vs) +} + type RunTag struct { // The tag key. Key types.String `tfsdk:"key" tf:"optional"` @@ -2059,6 +8193,39 @@ func (newState *RunTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan RunTag) { func (newState *RunTag) SyncEffectiveFieldsDuringRead(existingState RunTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RunTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RunTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RunTag +// only implements ToObjectValue() and Type(). +func (o RunTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RunTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type SearchExperiments struct { // String representing a SQL filter condition (e.g. "name ILIKE // 'my-experiment%'") @@ -2069,7 +8236,7 @@ type SearchExperiments struct { // name and last updated timestamp with an optional "DESC" or "ASC" // annotation, where "ASC" is the default. Tiebreaks are done by experiment // id DESC. - OrderBy []types.String `tfsdk:"order_by" tf:"optional"` + OrderBy types.List `tfsdk:"order_by" tf:"optional"` // Token indicating the page of experiments to fetch PageToken types.String `tfsdk:"page_token" tf:"optional"` // Qualifier for type of experiments to be returned. If unspecified, return @@ -2083,9 +8250,78 @@ func (newState *SearchExperiments) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SearchExperiments) SyncEffectiveFieldsDuringRead(existingState SearchExperiments) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchExperiments. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchExperiments) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "order_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchExperiments +// only implements ToObjectValue() and Type(). +func (o SearchExperiments) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + "max_results": o.MaxResults, + "order_by": o.OrderBy, + "page_token": o.PageToken, + "view_type": o.ViewType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchExperiments) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": types.StringType, + "max_results": types.Int64Type, + "order_by": basetypes.ListType{ + ElemType: types.StringType, + }, + "page_token": types.StringType, + "view_type": types.StringType, + }, + } +} + +// GetOrderBy returns the value of the OrderBy field in SearchExperiments as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchExperiments) GetOrderBy(ctx context.Context) ([]types.String, bool) { + if o.OrderBy.IsNull() || o.OrderBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OrderBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOrderBy sets the value of the OrderBy field in SearchExperiments. +func (o *SearchExperiments) SetOrderBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["order_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.OrderBy = types.ListValueMust(t, vs) +} + type SearchExperimentsResponse struct { // Experiments that match the search criteria - Experiments []Experiment `tfsdk:"experiments" tf:"optional"` + Experiments types.List `tfsdk:"experiments" tf:"optional"` // Token that can be used to retrieve the next page of experiments. An empty // token means that no more experiments are available for retrieval. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -2097,6 +8333,69 @@ func (newState *SearchExperimentsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *SearchExperimentsResponse) SyncEffectiveFieldsDuringRead(existingState SearchExperimentsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchExperimentsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchExperimentsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "experiments": reflect.TypeOf(Experiment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchExperimentsResponse +// only implements ToObjectValue() and Type(). +func (o SearchExperimentsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiments": o.Experiments, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchExperimentsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiments": basetypes.ListType{ + ElemType: Experiment{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetExperiments returns the value of the Experiments field in SearchExperimentsResponse as +// a slice of Experiment values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchExperimentsResponse) GetExperiments(ctx context.Context) ([]Experiment, bool) { + if o.Experiments.IsNull() || o.Experiments.IsUnknown() { + return nil, false + } + var v []Experiment + d := o.Experiments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExperiments sets the value of the Experiments field in SearchExperimentsResponse. +func (o *SearchExperimentsResponse) SetExperiments(ctx context.Context, v []Experiment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["experiments"] + t = t.(attr.TypeWithElementType).ElementType() + o.Experiments = types.ListValueMust(t, vs) +} + // Searches model versions type SearchModelVersionsRequest struct { // String filter condition, like "name='my-model-name'". Must be a single @@ -2108,7 +8407,7 @@ type SearchModelVersionsRequest struct { // with an optional "DESC" or "ASC" annotation, where "ASC" is the default. // Tiebreaks are done by latest stage transition timestamp, followed by name // ASC, followed by version DESC. - OrderBy []types.String `tfsdk:"-"` + OrderBy types.List `tfsdk:"-"` // Pagination token to go to next page based on previous search query. PageToken types.String `tfsdk:"-"` } @@ -2119,9 +8418,76 @@ func (newState *SearchModelVersionsRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *SearchModelVersionsRequest) SyncEffectiveFieldsDuringRead(existingState SearchModelVersionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchModelVersionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchModelVersionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "order_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchModelVersionsRequest +// only implements ToObjectValue() and Type(). +func (o SearchModelVersionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + "max_results": o.MaxResults, + "order_by": o.OrderBy, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchModelVersionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": types.StringType, + "max_results": types.Int64Type, + "order_by": basetypes.ListType{ + ElemType: types.StringType, + }, + "page_token": types.StringType, + }, + } +} + +// GetOrderBy returns the value of the OrderBy field in SearchModelVersionsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchModelVersionsRequest) GetOrderBy(ctx context.Context) ([]types.String, bool) { + if o.OrderBy.IsNull() || o.OrderBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OrderBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOrderBy sets the value of the OrderBy field in SearchModelVersionsRequest. +func (o *SearchModelVersionsRequest) SetOrderBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["order_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.OrderBy = types.ListValueMust(t, vs) +} + type SearchModelVersionsResponse struct { // Models that match the search criteria - ModelVersions []ModelVersion `tfsdk:"model_versions" tf:"optional"` + ModelVersions types.List `tfsdk:"model_versions" tf:"optional"` // Pagination token to request next page of models for the same search // query. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -2133,6 +8499,69 @@ func (newState *SearchModelVersionsResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *SearchModelVersionsResponse) SyncEffectiveFieldsDuringRead(existingState SearchModelVersionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchModelVersionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchModelVersionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_versions": reflect.TypeOf(ModelVersion{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchModelVersionsResponse +// only implements ToObjectValue() and Type(). +func (o SearchModelVersionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_versions": o.ModelVersions, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchModelVersionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_versions": basetypes.ListType{ + ElemType: ModelVersion{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetModelVersions returns the value of the ModelVersions field in SearchModelVersionsResponse as +// a slice of ModelVersion values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchModelVersionsResponse) GetModelVersions(ctx context.Context) ([]ModelVersion, bool) { + if o.ModelVersions.IsNull() || o.ModelVersions.IsUnknown() { + return nil, false + } + var v []ModelVersion + d := o.ModelVersions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetModelVersions sets the value of the ModelVersions field in SearchModelVersionsResponse. +func (o *SearchModelVersionsResponse) SetModelVersions(ctx context.Context, v []ModelVersion) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_versions"] + t = t.(attr.TypeWithElementType).ElementType() + o.ModelVersions = types.ListValueMust(t, vs) +} + // Search models type SearchModelsRequest struct { // String filter condition, like "name LIKE 'my-model-name'". Interpreted in @@ -2144,7 +8573,7 @@ type SearchModelsRequest struct { // List of columns for ordering search results, which can include model name // and last updated timestamp with an optional "DESC" or "ASC" annotation, // where "ASC" is the default. Tiebreaks are done by model name ASC. - OrderBy []types.String `tfsdk:"-"` + OrderBy types.List `tfsdk:"-"` // Pagination token to go to the next page based on a previous search query. PageToken types.String `tfsdk:"-"` } @@ -2155,11 +8584,78 @@ func (newState *SearchModelsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *SearchModelsRequest) SyncEffectiveFieldsDuringRead(existingState SearchModelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchModelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchModelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "order_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchModelsRequest +// only implements ToObjectValue() and Type(). +func (o SearchModelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + "max_results": o.MaxResults, + "order_by": o.OrderBy, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchModelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": types.StringType, + "max_results": types.Int64Type, + "order_by": basetypes.ListType{ + ElemType: types.StringType, + }, + "page_token": types.StringType, + }, + } +} + +// GetOrderBy returns the value of the OrderBy field in SearchModelsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchModelsRequest) GetOrderBy(ctx context.Context) ([]types.String, bool) { + if o.OrderBy.IsNull() || o.OrderBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OrderBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOrderBy sets the value of the OrderBy field in SearchModelsRequest. +func (o *SearchModelsRequest) SetOrderBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["order_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.OrderBy = types.ListValueMust(t, vs) +} + type SearchModelsResponse struct { // Pagination token to request the next page of models. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // Registered Models that match the search criteria. - RegisteredModels []Model `tfsdk:"registered_models" tf:"optional"` + RegisteredModels types.List `tfsdk:"registered_models" tf:"optional"` } func (newState *SearchModelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan SearchModelsResponse) { @@ -2168,9 +8664,72 @@ func (newState *SearchModelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *SearchModelsResponse) SyncEffectiveFieldsDuringRead(existingState SearchModelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchModelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchModelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "registered_models": reflect.TypeOf(Model{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchModelsResponse +// only implements ToObjectValue() and Type(). +func (o SearchModelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "registered_models": o.RegisteredModels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchModelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "registered_models": basetypes.ListType{ + ElemType: Model{}.Type(ctx), + }, + }, + } +} + +// GetRegisteredModels returns the value of the RegisteredModels field in SearchModelsResponse as +// a slice of Model values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchModelsResponse) GetRegisteredModels(ctx context.Context) ([]Model, bool) { + if o.RegisteredModels.IsNull() || o.RegisteredModels.IsUnknown() { + return nil, false + } + var v []Model + d := o.RegisteredModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRegisteredModels sets the value of the RegisteredModels field in SearchModelsResponse. +func (o *SearchModelsResponse) SetRegisteredModels(ctx context.Context, v []Model) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["registered_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.RegisteredModels = types.ListValueMust(t, vs) +} + type SearchRuns struct { // List of experiment IDs to search over. - ExperimentIds []types.String `tfsdk:"experiment_ids" tf:"optional"` + ExperimentIds types.List `tfsdk:"experiment_ids" tf:"optional"` // A filter expression over params, metrics, and tags, that allows returning // a subset of runs. The syntax is a subset of SQL that supports ANDing // together binary operations between a param, metric, or tag and a @@ -2192,7 +8751,7 @@ type SearchRuns struct { // "metrics.rmse"] Tiebreaks are done by start_time DESC followed by run_id // for runs with the same start time (and this is the default ordering // criterion if order_by is not provided). - OrderBy []types.String `tfsdk:"order_by" tf:"optional"` + OrderBy types.List `tfsdk:"order_by" tf:"optional"` // Token for the current page of runs. PageToken types.String `tfsdk:"page_token" tf:"optional"` // Whether to display only active, only deleted, or all runs. Defaults to @@ -2206,11 +8765,111 @@ func (newState *SearchRuns) SyncEffectiveFieldsDuringCreateOrUpdate(plan SearchR func (newState *SearchRuns) SyncEffectiveFieldsDuringRead(existingState SearchRuns) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchRuns. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchRuns) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "experiment_ids": reflect.TypeOf(types.String{}), + "order_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchRuns +// only implements ToObjectValue() and Type(). +func (o SearchRuns) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_ids": o.ExperimentIds, + "filter": o.Filter, + "max_results": o.MaxResults, + "order_by": o.OrderBy, + "page_token": o.PageToken, + "run_view_type": o.RunViewType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchRuns) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "filter": types.StringType, + "max_results": types.Int64Type, + "order_by": basetypes.ListType{ + ElemType: types.StringType, + }, + "page_token": types.StringType, + "run_view_type": types.StringType, + }, + } +} + +// GetExperimentIds returns the value of the ExperimentIds field in SearchRuns as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchRuns) GetExperimentIds(ctx context.Context) ([]types.String, bool) { + if o.ExperimentIds.IsNull() || o.ExperimentIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ExperimentIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExperimentIds sets the value of the ExperimentIds field in SearchRuns. +func (o *SearchRuns) SetExperimentIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["experiment_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExperimentIds = types.ListValueMust(t, vs) +} + +// GetOrderBy returns the value of the OrderBy field in SearchRuns as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchRuns) GetOrderBy(ctx context.Context) ([]types.String, bool) { + if o.OrderBy.IsNull() || o.OrderBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OrderBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOrderBy sets the value of the OrderBy field in SearchRuns. +func (o *SearchRuns) SetOrderBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["order_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.OrderBy = types.ListValueMust(t, vs) +} + type SearchRunsResponse struct { // Token for the next page of runs. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // Runs that match the search criteria. - Runs []Run `tfsdk:"runs" tf:"optional"` + Runs types.List `tfsdk:"runs" tf:"optional"` } func (newState *SearchRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan SearchRunsResponse) { @@ -2219,6 +8878,69 @@ func (newState *SearchRunsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SearchRunsResponse) SyncEffectiveFieldsDuringRead(existingState SearchRunsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SearchRunsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SearchRunsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "runs": reflect.TypeOf(Run{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SearchRunsResponse +// only implements ToObjectValue() and Type(). +func (o SearchRunsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "runs": o.Runs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SearchRunsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "runs": basetypes.ListType{ + ElemType: Run{}.Type(ctx), + }, + }, + } +} + +// GetRuns returns the value of the Runs field in SearchRunsResponse as +// a slice of Run values. +// If the field is unknown or null, the boolean return value is false. +func (o *SearchRunsResponse) GetRuns(ctx context.Context) ([]Run, bool) { + if o.Runs.IsNull() || o.Runs.IsUnknown() { + return nil, false + } + var v []Run + d := o.Runs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRuns sets the value of the Runs field in SearchRunsResponse. +func (o *SearchRunsResponse) SetRuns(ctx context.Context, v []Run) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["runs"] + t = t.(attr.TypeWithElementType).ElementType() + o.Runs = types.ListValueMust(t, vs) +} + type SetExperimentTag struct { // ID of the experiment under which to log the tag. Must be provided. ExperimentId types.String `tfsdk:"experiment_id" tf:""` @@ -2237,6 +8959,41 @@ func (newState *SetExperimentTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *SetExperimentTag) SyncEffectiveFieldsDuringRead(existingState SetExperimentTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetExperimentTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetExperimentTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetExperimentTag +// only implements ToObjectValue() and Type(). +func (o SetExperimentTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetExperimentTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + "key": types.StringType, + "value": types.StringType, + }, + } +} + type SetExperimentTagResponse struct { } @@ -2246,6 +9003,33 @@ func (newState *SetExperimentTagResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *SetExperimentTagResponse) SyncEffectiveFieldsDuringRead(existingState SetExperimentTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetExperimentTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetExperimentTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetExperimentTagResponse +// only implements ToObjectValue() and Type(). +func (o SetExperimentTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SetExperimentTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type SetModelTagRequest struct { // Name of the tag. Maximum size depends on storage backend. If a tag with // this name already exists, its preexisting value will be replaced by the @@ -2266,6 +9050,41 @@ func (newState *SetModelTagRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SetModelTagRequest) SyncEffectiveFieldsDuringRead(existingState SetModelTagRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetModelTagRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetModelTagRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetModelTagRequest +// only implements ToObjectValue() and Type(). +func (o SetModelTagRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "name": o.Name, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetModelTagRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "name": types.StringType, + "value": types.StringType, + }, + } +} + type SetModelTagResponse struct { } @@ -2275,6 +9094,33 @@ func (newState *SetModelTagResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *SetModelTagResponse) SyncEffectiveFieldsDuringRead(existingState SetModelTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetModelTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetModelTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetModelTagResponse +// only implements ToObjectValue() and Type(). +func (o SetModelTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SetModelTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type SetModelVersionTagRequest struct { // Name of the tag. Maximum size depends on storage backend. If a tag with // this name already exists, its preexisting value will be replaced by the @@ -2297,6 +9143,43 @@ func (newState *SetModelVersionTagRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *SetModelVersionTagRequest) SyncEffectiveFieldsDuringRead(existingState SetModelVersionTagRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetModelVersionTagRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetModelVersionTagRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetModelVersionTagRequest +// only implements ToObjectValue() and Type(). +func (o SetModelVersionTagRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "name": o.Name, + "value": o.Value, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetModelVersionTagRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "name": types.StringType, + "value": types.StringType, + "version": types.StringType, + }, + } +} + type SetModelVersionTagResponse struct { } @@ -2306,6 +9189,33 @@ func (newState *SetModelVersionTagResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *SetModelVersionTagResponse) SyncEffectiveFieldsDuringRead(existingState SetModelVersionTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetModelVersionTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetModelVersionTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetModelVersionTagResponse +// only implements ToObjectValue() and Type(). +func (o SetModelVersionTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SetModelVersionTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type SetTag struct { // Name of the tag. Maximum size depends on storage backend. All storage // backends are guaranteed to support key values up to 250 bytes in size. @@ -2327,6 +9237,43 @@ func (newState *SetTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan SetTag) { func (newState *SetTag) SyncEffectiveFieldsDuringRead(existingState SetTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetTag +// only implements ToObjectValue() and Type(). +func (o SetTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "run_id": types.StringType, + "run_uuid": types.StringType, + "value": types.StringType, + }, + } +} + type SetTagResponse struct { } @@ -2336,6 +9283,33 @@ func (newState *SetTagResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Set func (newState *SetTagResponse) SyncEffectiveFieldsDuringRead(existingState SetTagResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetTagResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetTagResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetTagResponse +// only implements ToObjectValue() and Type(). +func (o SetTagResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SetTagResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Test webhook response object. type TestRegistryWebhook struct { // Body of the response from the webhook URL @@ -2350,6 +9324,39 @@ func (newState *TestRegistryWebhook) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *TestRegistryWebhook) SyncEffectiveFieldsDuringRead(existingState TestRegistryWebhook) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TestRegistryWebhook. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TestRegistryWebhook) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TestRegistryWebhook +// only implements ToObjectValue() and Type(). +func (o TestRegistryWebhook) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "body": o.Body, + "status_code": o.StatusCode, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TestRegistryWebhook) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "body": types.StringType, + "status_code": types.Int64Type, + }, + } +} + type TestRegistryWebhookRequest struct { // If `event` is specified, the test trigger uses the specified event. If // `event` is not specified, the test trigger uses a randomly chosen event @@ -2365,9 +9372,42 @@ func (newState *TestRegistryWebhookRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *TestRegistryWebhookRequest) SyncEffectiveFieldsDuringRead(existingState TestRegistryWebhookRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TestRegistryWebhookRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TestRegistryWebhookRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TestRegistryWebhookRequest +// only implements ToObjectValue() and Type(). +func (o TestRegistryWebhookRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "event": o.Event, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TestRegistryWebhookRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "event": types.StringType, + "id": types.StringType, + }, + } +} + type TestRegistryWebhookResponse struct { // Test webhook response object. - Webhook []TestRegistryWebhook `tfsdk:"webhook" tf:"optional,object"` + Webhook types.List `tfsdk:"webhook" tf:"optional,object"` } func (newState *TestRegistryWebhookResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan TestRegistryWebhookResponse) { @@ -2376,6 +9416,67 @@ func (newState *TestRegistryWebhookResponse) SyncEffectiveFieldsDuringCreateOrUp func (newState *TestRegistryWebhookResponse) SyncEffectiveFieldsDuringRead(existingState TestRegistryWebhookResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TestRegistryWebhookResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TestRegistryWebhookResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "webhook": reflect.TypeOf(TestRegistryWebhook{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TestRegistryWebhookResponse +// only implements ToObjectValue() and Type(). +func (o TestRegistryWebhookResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "webhook": o.Webhook, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TestRegistryWebhookResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "webhook": basetypes.ListType{ + ElemType: TestRegistryWebhook{}.Type(ctx), + }, + }, + } +} + +// GetWebhook returns the value of the Webhook field in TestRegistryWebhookResponse as +// a TestRegistryWebhook value. +// If the field is unknown or null, the boolean return value is false. +func (o *TestRegistryWebhookResponse) GetWebhook(ctx context.Context) (TestRegistryWebhook, bool) { + var e TestRegistryWebhook + if o.Webhook.IsNull() || o.Webhook.IsUnknown() { + return e, false + } + var v []TestRegistryWebhook + d := o.Webhook.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWebhook sets the value of the Webhook field in TestRegistryWebhookResponse. +func (o *TestRegistryWebhookResponse) SetWebhook(ctx context.Context, v TestRegistryWebhook) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["webhook"] + o.Webhook = types.ListValueMust(t, vs) +} + type TransitionModelVersionStageDatabricks struct { // Specifies whether to archive all current model versions in the target // stage. @@ -2404,10 +9505,49 @@ func (newState *TransitionModelVersionStageDatabricks) SyncEffectiveFieldsDuring func (newState *TransitionModelVersionStageDatabricks) SyncEffectiveFieldsDuringRead(existingState TransitionModelVersionStageDatabricks) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TransitionModelVersionStageDatabricks. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TransitionModelVersionStageDatabricks) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TransitionModelVersionStageDatabricks +// only implements ToObjectValue() and Type(). +func (o TransitionModelVersionStageDatabricks) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "archive_existing_versions": o.ArchiveExistingVersions, + "comment": o.Comment, + "name": o.Name, + "stage": o.Stage, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TransitionModelVersionStageDatabricks) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "archive_existing_versions": types.BoolType, + "comment": types.StringType, + "name": types.StringType, + "stage": types.StringType, + "version": types.StringType, + }, + } +} + // Transition request details. type TransitionRequest struct { // Array of actions on the activity allowed for the current viewer. - AvailableActions []types.String `tfsdk:"available_actions" tf:"optional"` + AvailableActions types.List `tfsdk:"available_actions" tf:"optional"` // User-provided comment associated with the transition request. Comment types.String `tfsdk:"comment" tf:"optional"` // Creation time of the object, as a Unix timestamp in milliseconds. @@ -2433,8 +9573,77 @@ func (newState *TransitionRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TransitionRequest) SyncEffectiveFieldsDuringRead(existingState TransitionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TransitionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TransitionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "available_actions": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TransitionRequest +// only implements ToObjectValue() and Type(). +func (o TransitionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "available_actions": o.AvailableActions, + "comment": o.Comment, + "creation_timestamp": o.CreationTimestamp, + "to_stage": o.ToStage, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TransitionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "available_actions": basetypes.ListType{ + ElemType: types.StringType, + }, + "comment": types.StringType, + "creation_timestamp": types.Int64Type, + "to_stage": types.StringType, + "user_id": types.StringType, + }, + } +} + +// GetAvailableActions returns the value of the AvailableActions field in TransitionRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TransitionRequest) GetAvailableActions(ctx context.Context) ([]types.String, bool) { + if o.AvailableActions.IsNull() || o.AvailableActions.IsUnknown() { + return nil, false + } + var v []types.String + d := o.AvailableActions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAvailableActions sets the value of the AvailableActions field in TransitionRequest. +func (o *TransitionRequest) SetAvailableActions(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["available_actions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AvailableActions = types.ListValueMust(t, vs) +} + type TransitionStageResponse struct { - ModelVersion []ModelVersionDatabricks `tfsdk:"model_version" tf:"optional,object"` + ModelVersion types.List `tfsdk:"model_version" tf:"optional,object"` } func (newState *TransitionStageResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan TransitionStageResponse) { @@ -2443,6 +9652,67 @@ func (newState *TransitionStageResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *TransitionStageResponse) SyncEffectiveFieldsDuringRead(existingState TransitionStageResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TransitionStageResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TransitionStageResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "model_version": reflect.TypeOf(ModelVersionDatabricks{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TransitionStageResponse +// only implements ToObjectValue() and Type(). +func (o TransitionStageResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_version": o.ModelVersion, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TransitionStageResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_version": basetypes.ListType{ + ElemType: ModelVersionDatabricks{}.Type(ctx), + }, + }, + } +} + +// GetModelVersion returns the value of the ModelVersion field in TransitionStageResponse as +// a ModelVersionDatabricks value. +// If the field is unknown or null, the boolean return value is false. +func (o *TransitionStageResponse) GetModelVersion(ctx context.Context) (ModelVersionDatabricks, bool) { + var e ModelVersionDatabricks + if o.ModelVersion.IsNull() || o.ModelVersion.IsUnknown() { + return e, false + } + var v []ModelVersionDatabricks + d := o.ModelVersion.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetModelVersion sets the value of the ModelVersion field in TransitionStageResponse. +func (o *TransitionStageResponse) SetModelVersion(ctx context.Context, v ModelVersionDatabricks) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["model_version"] + o.ModelVersion = types.ListValueMust(t, vs) +} + type UpdateComment struct { // User-provided comment on the action. Comment types.String `tfsdk:"comment" tf:""` @@ -2456,9 +9726,42 @@ func (newState *UpdateComment) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upda func (newState *UpdateComment) SyncEffectiveFieldsDuringRead(existingState UpdateComment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateComment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateComment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateComment +// only implements ToObjectValue() and Type(). +func (o UpdateComment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateComment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "id": types.StringType, + }, + } +} + type UpdateCommentResponse struct { // Comment details. - Comment []CommentObject `tfsdk:"comment" tf:"optional,object"` + Comment types.List `tfsdk:"comment" tf:"optional,object"` } func (newState *UpdateCommentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateCommentResponse) { @@ -2467,6 +9770,67 @@ func (newState *UpdateCommentResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateCommentResponse) SyncEffectiveFieldsDuringRead(existingState UpdateCommentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCommentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCommentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "comment": reflect.TypeOf(CommentObject{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCommentResponse +// only implements ToObjectValue() and Type(). +func (o UpdateCommentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCommentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": basetypes.ListType{ + ElemType: CommentObject{}.Type(ctx), + }, + }, + } +} + +// GetComment returns the value of the Comment field in UpdateCommentResponse as +// a CommentObject value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCommentResponse) GetComment(ctx context.Context) (CommentObject, bool) { + var e CommentObject + if o.Comment.IsNull() || o.Comment.IsUnknown() { + return e, false + } + var v []CommentObject + d := o.Comment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetComment sets the value of the Comment field in UpdateCommentResponse. +func (o *UpdateCommentResponse) SetComment(ctx context.Context, v CommentObject) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["comment"] + o.Comment = types.ListValueMust(t, vs) +} + type UpdateExperiment struct { // ID of the associated experiment. ExperimentId types.String `tfsdk:"experiment_id" tf:""` @@ -2481,6 +9845,39 @@ func (newState *UpdateExperiment) SyncEffectiveFieldsDuringCreateOrUpdate(plan U func (newState *UpdateExperiment) SyncEffectiveFieldsDuringRead(existingState UpdateExperiment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExperiment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExperiment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExperiment +// only implements ToObjectValue() and Type(). +func (o UpdateExperiment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "experiment_id": o.ExperimentId, + "new_name": o.NewName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExperiment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "experiment_id": types.StringType, + "new_name": types.StringType, + }, + } +} + type UpdateExperimentResponse struct { } @@ -2490,6 +9887,33 @@ func (newState *UpdateExperimentResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *UpdateExperimentResponse) SyncEffectiveFieldsDuringRead(existingState UpdateExperimentResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateExperimentResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateExperimentResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateExperimentResponse +// only implements ToObjectValue() and Type(). +func (o UpdateExperimentResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateExperimentResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateModelRequest struct { // If provided, updates the description for this `registered_model`. Description types.String `tfsdk:"description" tf:"optional"` @@ -2503,6 +9927,39 @@ func (newState *UpdateModelRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateModelRequest) SyncEffectiveFieldsDuringRead(existingState UpdateModelRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateModelRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateModelRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateModelRequest +// only implements ToObjectValue() and Type(). +func (o UpdateModelRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateModelRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "name": types.StringType, + }, + } +} + type UpdateModelResponse struct { } @@ -2512,6 +9969,33 @@ func (newState *UpdateModelResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *UpdateModelResponse) SyncEffectiveFieldsDuringRead(existingState UpdateModelResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateModelResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateModelResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateModelResponse +// only implements ToObjectValue() and Type(). +func (o UpdateModelResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateModelResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateModelVersionRequest struct { // If provided, updates the description for this `registered_model`. Description types.String `tfsdk:"description" tf:"optional"` @@ -2527,6 +10011,41 @@ func (newState *UpdateModelVersionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UpdateModelVersionRequest) SyncEffectiveFieldsDuringRead(existingState UpdateModelVersionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateModelVersionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateModelVersionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateModelVersionRequest +// only implements ToObjectValue() and Type(). +func (o UpdateModelVersionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "name": o.Name, + "version": o.Version, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateModelVersionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "name": types.StringType, + "version": types.StringType, + }, + } +} + type UpdateModelVersionResponse struct { } @@ -2536,6 +10055,33 @@ func (newState *UpdateModelVersionResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UpdateModelVersionResponse) SyncEffectiveFieldsDuringRead(existingState UpdateModelVersionResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateModelVersionResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateModelVersionResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateModelVersionResponse +// only implements ToObjectValue() and Type(). +func (o UpdateModelVersionResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateModelVersionResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateRegistryWebhook struct { // User-specified description for the webhook. Description types.String `tfsdk:"description" tf:"optional"` @@ -2572,13 +10118,13 @@ type UpdateRegistryWebhook struct { // // * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model // version be archived. - Events []types.String `tfsdk:"events" tf:"optional"` + Events types.List `tfsdk:"events" tf:"optional"` - HttpUrlSpec []HttpUrlSpec `tfsdk:"http_url_spec" tf:"optional,object"` + HttpUrlSpec types.List `tfsdk:"http_url_spec" tf:"optional,object"` // Webhook ID Id types.String `tfsdk:"id" tf:""` - JobSpec []JobSpec `tfsdk:"job_spec" tf:"optional,object"` + JobSpec types.List `tfsdk:"job_spec" tf:"optional,object"` // Enable or disable triggering the webhook, or put the webhook into test // mode. The default is `ACTIVE`: * `ACTIVE`: Webhook is triggered when an // associated event happens. @@ -2596,6 +10142,135 @@ func (newState *UpdateRegistryWebhook) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateRegistryWebhook) SyncEffectiveFieldsDuringRead(existingState UpdateRegistryWebhook) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRegistryWebhook. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRegistryWebhook) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "events": reflect.TypeOf(types.String{}), + "http_url_spec": reflect.TypeOf(HttpUrlSpec{}), + "job_spec": reflect.TypeOf(JobSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRegistryWebhook +// only implements ToObjectValue() and Type(). +func (o UpdateRegistryWebhook) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "events": o.Events, + "http_url_spec": o.HttpUrlSpec, + "id": o.Id, + "job_spec": o.JobSpec, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRegistryWebhook) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "events": basetypes.ListType{ + ElemType: types.StringType, + }, + "http_url_spec": basetypes.ListType{ + ElemType: HttpUrlSpec{}.Type(ctx), + }, + "id": types.StringType, + "job_spec": basetypes.ListType{ + ElemType: JobSpec{}.Type(ctx), + }, + "status": types.StringType, + }, + } +} + +// GetEvents returns the value of the Events field in UpdateRegistryWebhook as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRegistryWebhook) GetEvents(ctx context.Context) ([]types.String, bool) { + if o.Events.IsNull() || o.Events.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Events.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEvents sets the value of the Events field in UpdateRegistryWebhook. +func (o *UpdateRegistryWebhook) SetEvents(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["events"] + t = t.(attr.TypeWithElementType).ElementType() + o.Events = types.ListValueMust(t, vs) +} + +// GetHttpUrlSpec returns the value of the HttpUrlSpec field in UpdateRegistryWebhook as +// a HttpUrlSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRegistryWebhook) GetHttpUrlSpec(ctx context.Context) (HttpUrlSpec, bool) { + var e HttpUrlSpec + if o.HttpUrlSpec.IsNull() || o.HttpUrlSpec.IsUnknown() { + return e, false + } + var v []HttpUrlSpec + d := o.HttpUrlSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHttpUrlSpec sets the value of the HttpUrlSpec field in UpdateRegistryWebhook. +func (o *UpdateRegistryWebhook) SetHttpUrlSpec(ctx context.Context, v HttpUrlSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["http_url_spec"] + o.HttpUrlSpec = types.ListValueMust(t, vs) +} + +// GetJobSpec returns the value of the JobSpec field in UpdateRegistryWebhook as +// a JobSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRegistryWebhook) GetJobSpec(ctx context.Context) (JobSpec, bool) { + var e JobSpec + if o.JobSpec.IsNull() || o.JobSpec.IsUnknown() { + return e, false + } + var v []JobSpec + d := o.JobSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetJobSpec sets the value of the JobSpec field in UpdateRegistryWebhook. +func (o *UpdateRegistryWebhook) SetJobSpec(ctx context.Context, v JobSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["job_spec"] + o.JobSpec = types.ListValueMust(t, vs) +} + type UpdateRun struct { // Unix timestamp in milliseconds of when the run ended. EndTime types.Int64 `tfsdk:"end_time" tf:"optional"` @@ -2614,9 +10289,46 @@ func (newState *UpdateRun) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateRu func (newState *UpdateRun) SyncEffectiveFieldsDuringRead(existingState UpdateRun) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRun. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRun) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRun +// only implements ToObjectValue() and Type(). +func (o UpdateRun) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end_time": o.EndTime, + "run_id": o.RunId, + "run_uuid": o.RunUuid, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRun) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end_time": types.Int64Type, + "run_id": types.StringType, + "run_uuid": types.StringType, + "status": types.StringType, + }, + } +} + type UpdateRunResponse struct { // Updated metadata of the run. - RunInfo []RunInfo `tfsdk:"run_info" tf:"optional,object"` + RunInfo types.List `tfsdk:"run_info" tf:"optional,object"` } func (newState *UpdateRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateRunResponse) { @@ -2625,6 +10337,67 @@ func (newState *UpdateRunResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateRunResponse) SyncEffectiveFieldsDuringRead(existingState UpdateRunResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRunResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRunResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "run_info": reflect.TypeOf(RunInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRunResponse +// only implements ToObjectValue() and Type(). +func (o UpdateRunResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_info": o.RunInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRunResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_info": basetypes.ListType{ + ElemType: RunInfo{}.Type(ctx), + }, + }, + } +} + +// GetRunInfo returns the value of the RunInfo field in UpdateRunResponse as +// a RunInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRunResponse) GetRunInfo(ctx context.Context) (RunInfo, bool) { + var e RunInfo + if o.RunInfo.IsNull() || o.RunInfo.IsUnknown() { + return e, false + } + var v []RunInfo + d := o.RunInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRunInfo sets the value of the RunInfo field in UpdateRunResponse. +func (o *UpdateRunResponse) SetRunInfo(ctx context.Context, v RunInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["run_info"] + o.RunInfo = types.ListValueMust(t, vs) +} + type UpdateWebhookResponse struct { } @@ -2633,3 +10406,30 @@ func (newState *UpdateWebhookResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *UpdateWebhookResponse) SyncEffectiveFieldsDuringRead(existingState UpdateWebhookResponse) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateWebhookResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateWebhookResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateWebhookResponse +// only implements ToObjectValue() and Type(). +func (o UpdateWebhookResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateWebhookResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} diff --git a/internal/service/oauth2_tf/model.go b/internal/service/oauth2_tf/model.go index 537a30b38..e2e8defbd 100755 --- a/internal/service/oauth2_tf/model.go +++ b/internal/service/oauth2_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package oauth2_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type CreateCustomAppIntegration struct { @@ -21,12 +28,12 @@ type CreateCustomAppIntegration struct { // Name of the custom OAuth app Name types.String `tfsdk:"name" tf:"optional"` // List of OAuth redirect urls - RedirectUrls []types.String `tfsdk:"redirect_urls" tf:"optional"` + RedirectUrls types.List `tfsdk:"redirect_urls" tf:"optional"` // OAuth scopes granted to the application. Supported scopes: all-apis, sql, // offline_access, openid, profile, email. - Scopes []types.String `tfsdk:"scopes" tf:"optional"` + Scopes types.List `tfsdk:"scopes" tf:"optional"` // Token access policy - TokenAccessPolicy []TokenAccessPolicy `tfsdk:"token_access_policy" tf:"optional,object"` + TokenAccessPolicy types.List `tfsdk:"token_access_policy" tf:"optional,object"` } func (newState *CreateCustomAppIntegration) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCustomAppIntegration) { @@ -35,6 +42,133 @@ func (newState *CreateCustomAppIntegration) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateCustomAppIntegration) SyncEffectiveFieldsDuringRead(existingState CreateCustomAppIntegration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCustomAppIntegration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCustomAppIntegration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "redirect_urls": reflect.TypeOf(types.String{}), + "scopes": reflect.TypeOf(types.String{}), + "token_access_policy": reflect.TypeOf(TokenAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCustomAppIntegration +// only implements ToObjectValue() and Type(). +func (o CreateCustomAppIntegration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "confidential": o.Confidential, + "name": o.Name, + "redirect_urls": o.RedirectUrls, + "scopes": o.Scopes, + "token_access_policy": o.TokenAccessPolicy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCustomAppIntegration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "confidential": types.BoolType, + "name": types.StringType, + "redirect_urls": basetypes.ListType{ + ElemType: types.StringType, + }, + "scopes": basetypes.ListType{ + ElemType: types.StringType, + }, + "token_access_policy": basetypes.ListType{ + ElemType: TokenAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetRedirectUrls returns the value of the RedirectUrls field in CreateCustomAppIntegration as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCustomAppIntegration) GetRedirectUrls(ctx context.Context) ([]types.String, bool) { + if o.RedirectUrls.IsNull() || o.RedirectUrls.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RedirectUrls.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRedirectUrls sets the value of the RedirectUrls field in CreateCustomAppIntegration. +func (o *CreateCustomAppIntegration) SetRedirectUrls(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["redirect_urls"] + t = t.(attr.TypeWithElementType).ElementType() + o.RedirectUrls = types.ListValueMust(t, vs) +} + +// GetScopes returns the value of the Scopes field in CreateCustomAppIntegration as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCustomAppIntegration) GetScopes(ctx context.Context) ([]types.String, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in CreateCustomAppIntegration. +func (o *CreateCustomAppIntegration) SetScopes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + +// GetTokenAccessPolicy returns the value of the TokenAccessPolicy field in CreateCustomAppIntegration as +// a TokenAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCustomAppIntegration) GetTokenAccessPolicy(ctx context.Context) (TokenAccessPolicy, bool) { + var e TokenAccessPolicy + if o.TokenAccessPolicy.IsNull() || o.TokenAccessPolicy.IsUnknown() { + return e, false + } + var v []TokenAccessPolicy + d := o.TokenAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenAccessPolicy sets the value of the TokenAccessPolicy field in CreateCustomAppIntegration. +func (o *CreateCustomAppIntegration) SetTokenAccessPolicy(ctx context.Context, v TokenAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_access_policy"] + o.TokenAccessPolicy = types.ListValueMust(t, vs) +} + type CreateCustomAppIntegrationOutput struct { // OAuth client-id generated by the Databricks ClientId types.String `tfsdk:"client_id" tf:"optional"` @@ -51,12 +185,47 @@ func (newState *CreateCustomAppIntegrationOutput) SyncEffectiveFieldsDuringCreat func (newState *CreateCustomAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState CreateCustomAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCustomAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCustomAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCustomAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o CreateCustomAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "client_id": o.ClientId, + "client_secret": o.ClientSecret, + "integration_id": o.IntegrationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCustomAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "client_id": types.StringType, + "client_secret": types.StringType, + "integration_id": types.StringType, + }, + } +} + type CreatePublishedAppIntegration struct { // App id of the OAuth published app integration. For example power-bi, // tableau-deskop AppId types.String `tfsdk:"app_id" tf:"optional"` // Token access policy - TokenAccessPolicy []TokenAccessPolicy `tfsdk:"token_access_policy" tf:"optional,object"` + TokenAccessPolicy types.List `tfsdk:"token_access_policy" tf:"optional,object"` } func (newState *CreatePublishedAppIntegration) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreatePublishedAppIntegration) { @@ -65,6 +234,69 @@ func (newState *CreatePublishedAppIntegration) SyncEffectiveFieldsDuringCreateOr func (newState *CreatePublishedAppIntegration) SyncEffectiveFieldsDuringRead(existingState CreatePublishedAppIntegration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePublishedAppIntegration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePublishedAppIntegration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_access_policy": reflect.TypeOf(TokenAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePublishedAppIntegration +// only implements ToObjectValue() and Type(). +func (o CreatePublishedAppIntegration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_id": o.AppId, + "token_access_policy": o.TokenAccessPolicy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePublishedAppIntegration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_id": types.StringType, + "token_access_policy": basetypes.ListType{ + ElemType: TokenAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetTokenAccessPolicy returns the value of the TokenAccessPolicy field in CreatePublishedAppIntegration as +// a TokenAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePublishedAppIntegration) GetTokenAccessPolicy(ctx context.Context) (TokenAccessPolicy, bool) { + var e TokenAccessPolicy + if o.TokenAccessPolicy.IsNull() || o.TokenAccessPolicy.IsUnknown() { + return e, false + } + var v []TokenAccessPolicy + d := o.TokenAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenAccessPolicy sets the value of the TokenAccessPolicy field in CreatePublishedAppIntegration. +func (o *CreatePublishedAppIntegration) SetTokenAccessPolicy(ctx context.Context, v TokenAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_access_policy"] + o.TokenAccessPolicy = types.ListValueMust(t, vs) +} + type CreatePublishedAppIntegrationOutput struct { // Unique integration id for the published OAuth app IntegrationId types.String `tfsdk:"integration_id" tf:"optional"` @@ -76,6 +308,37 @@ func (newState *CreatePublishedAppIntegrationOutput) SyncEffectiveFieldsDuringCr func (newState *CreatePublishedAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState CreatePublishedAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePublishedAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePublishedAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePublishedAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o CreatePublishedAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePublishedAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + }, + } +} + // Create service principal secret type CreateServicePrincipalSecretRequest struct { // The service principal ID. @@ -88,6 +351,37 @@ func (newState *CreateServicePrincipalSecretRequest) SyncEffectiveFieldsDuringCr func (newState *CreateServicePrincipalSecretRequest) SyncEffectiveFieldsDuringRead(existingState CreateServicePrincipalSecretRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateServicePrincipalSecretRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateServicePrincipalSecretRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateServicePrincipalSecretRequest +// only implements ToObjectValue() and Type(). +func (o CreateServicePrincipalSecretRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "service_principal_id": o.ServicePrincipalId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateServicePrincipalSecretRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "service_principal_id": types.Int64Type, + }, + } +} + type CreateServicePrincipalSecretResponse struct { // UTC time when the secret was created CreateTime types.String `tfsdk:"create_time" tf:"optional"` @@ -109,6 +403,47 @@ func (newState *CreateServicePrincipalSecretResponse) SyncEffectiveFieldsDuringC func (newState *CreateServicePrincipalSecretResponse) SyncEffectiveFieldsDuringRead(existingState CreateServicePrincipalSecretResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateServicePrincipalSecretResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateServicePrincipalSecretResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateServicePrincipalSecretResponse +// only implements ToObjectValue() and Type(). +func (o CreateServicePrincipalSecretResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "id": o.Id, + "secret": o.Secret, + "secret_hash": o.SecretHash, + "status": o.Status, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateServicePrincipalSecretResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "id": types.StringType, + "secret": types.StringType, + "secret_hash": types.StringType, + "status": types.StringType, + "update_time": types.StringType, + }, + } +} + type DataPlaneInfo struct { // Authorization details as a string. AuthorizationDetails types.String `tfsdk:"authorization_details" tf:"optional"` @@ -122,6 +457,39 @@ func (newState *DataPlaneInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Data func (newState *DataPlaneInfo) SyncEffectiveFieldsDuringRead(existingState DataPlaneInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DataPlaneInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DataPlaneInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DataPlaneInfo +// only implements ToObjectValue() and Type(). +func (o DataPlaneInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "authorization_details": o.AuthorizationDetails, + "endpoint_url": o.EndpointUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DataPlaneInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "authorization_details": types.StringType, + "endpoint_url": types.StringType, + }, + } +} + type DeleteCustomAppIntegrationOutput struct { } @@ -131,6 +499,33 @@ func (newState *DeleteCustomAppIntegrationOutput) SyncEffectiveFieldsDuringCreat func (newState *DeleteCustomAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState DeleteCustomAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCustomAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCustomAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCustomAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o DeleteCustomAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCustomAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete Custom OAuth App Integration type DeleteCustomAppIntegrationRequest struct { IntegrationId types.String `tfsdk:"-"` @@ -142,6 +537,37 @@ func (newState *DeleteCustomAppIntegrationRequest) SyncEffectiveFieldsDuringCrea func (newState *DeleteCustomAppIntegrationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCustomAppIntegrationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCustomAppIntegrationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCustomAppIntegrationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCustomAppIntegrationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCustomAppIntegrationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCustomAppIntegrationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + }, + } +} + type DeletePublishedAppIntegrationOutput struct { } @@ -151,6 +577,33 @@ func (newState *DeletePublishedAppIntegrationOutput) SyncEffectiveFieldsDuringCr func (newState *DeletePublishedAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState DeletePublishedAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePublishedAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePublishedAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePublishedAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o DeletePublishedAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePublishedAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete Published OAuth App Integration type DeletePublishedAppIntegrationRequest struct { IntegrationId types.String `tfsdk:"-"` @@ -162,6 +615,37 @@ func (newState *DeletePublishedAppIntegrationRequest) SyncEffectiveFieldsDuringC func (newState *DeletePublishedAppIntegrationRequest) SyncEffectiveFieldsDuringRead(existingState DeletePublishedAppIntegrationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePublishedAppIntegrationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePublishedAppIntegrationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePublishedAppIntegrationRequest +// only implements ToObjectValue() and Type(). +func (o DeletePublishedAppIntegrationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePublishedAppIntegrationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -171,6 +655,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete service principal secret type DeleteServicePrincipalSecretRequest struct { // The secret ID. @@ -185,6 +696,39 @@ func (newState *DeleteServicePrincipalSecretRequest) SyncEffectiveFieldsDuringCr func (newState *DeleteServicePrincipalSecretRequest) SyncEffectiveFieldsDuringRead(existingState DeleteServicePrincipalSecretRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteServicePrincipalSecretRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteServicePrincipalSecretRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteServicePrincipalSecretRequest +// only implements ToObjectValue() and Type(). +func (o DeleteServicePrincipalSecretRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "secret_id": o.SecretId, + "service_principal_id": o.ServicePrincipalId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteServicePrincipalSecretRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "secret_id": types.StringType, + "service_principal_id": types.Int64Type, + }, + } +} + type GetCustomAppIntegrationOutput struct { // The client id of the custom OAuth app ClientId types.String `tfsdk:"client_id" tf:"optional"` @@ -202,11 +746,11 @@ type GetCustomAppIntegrationOutput struct { // The display name of the custom OAuth app Name types.String `tfsdk:"name" tf:"optional"` // List of OAuth redirect urls - RedirectUrls []types.String `tfsdk:"redirect_urls" tf:"optional"` + RedirectUrls types.List `tfsdk:"redirect_urls" tf:"optional"` - Scopes []types.String `tfsdk:"scopes" tf:"optional"` + Scopes types.List `tfsdk:"scopes" tf:"optional"` // Token access policy - TokenAccessPolicy []TokenAccessPolicy `tfsdk:"token_access_policy" tf:"optional,object"` + TokenAccessPolicy types.List `tfsdk:"token_access_policy" tf:"optional,object"` } func (newState *GetCustomAppIntegrationOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetCustomAppIntegrationOutput) { @@ -215,6 +759,143 @@ func (newState *GetCustomAppIntegrationOutput) SyncEffectiveFieldsDuringCreateOr func (newState *GetCustomAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState GetCustomAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCustomAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCustomAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "redirect_urls": reflect.TypeOf(types.String{}), + "scopes": reflect.TypeOf(types.String{}), + "token_access_policy": reflect.TypeOf(TokenAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCustomAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o GetCustomAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "client_id": o.ClientId, + "confidential": o.Confidential, + "create_time": o.CreateTime, + "created_by": o.CreatedBy, + "creator_username": o.CreatorUsername, + "integration_id": o.IntegrationId, + "name": o.Name, + "redirect_urls": o.RedirectUrls, + "scopes": o.Scopes, + "token_access_policy": o.TokenAccessPolicy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCustomAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "client_id": types.StringType, + "confidential": types.BoolType, + "create_time": types.StringType, + "created_by": types.Int64Type, + "creator_username": types.StringType, + "integration_id": types.StringType, + "name": types.StringType, + "redirect_urls": basetypes.ListType{ + ElemType: types.StringType, + }, + "scopes": basetypes.ListType{ + ElemType: types.StringType, + }, + "token_access_policy": basetypes.ListType{ + ElemType: TokenAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetRedirectUrls returns the value of the RedirectUrls field in GetCustomAppIntegrationOutput as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetCustomAppIntegrationOutput) GetRedirectUrls(ctx context.Context) ([]types.String, bool) { + if o.RedirectUrls.IsNull() || o.RedirectUrls.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RedirectUrls.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRedirectUrls sets the value of the RedirectUrls field in GetCustomAppIntegrationOutput. +func (o *GetCustomAppIntegrationOutput) SetRedirectUrls(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["redirect_urls"] + t = t.(attr.TypeWithElementType).ElementType() + o.RedirectUrls = types.ListValueMust(t, vs) +} + +// GetScopes returns the value of the Scopes field in GetCustomAppIntegrationOutput as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetCustomAppIntegrationOutput) GetScopes(ctx context.Context) ([]types.String, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in GetCustomAppIntegrationOutput. +func (o *GetCustomAppIntegrationOutput) SetScopes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + +// GetTokenAccessPolicy returns the value of the TokenAccessPolicy field in GetCustomAppIntegrationOutput as +// a TokenAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetCustomAppIntegrationOutput) GetTokenAccessPolicy(ctx context.Context) (TokenAccessPolicy, bool) { + var e TokenAccessPolicy + if o.TokenAccessPolicy.IsNull() || o.TokenAccessPolicy.IsUnknown() { + return e, false + } + var v []TokenAccessPolicy + d := o.TokenAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenAccessPolicy sets the value of the TokenAccessPolicy field in GetCustomAppIntegrationOutput. +func (o *GetCustomAppIntegrationOutput) SetTokenAccessPolicy(ctx context.Context, v TokenAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_access_policy"] + o.TokenAccessPolicy = types.ListValueMust(t, vs) +} + // Get OAuth Custom App Integration type GetCustomAppIntegrationRequest struct { // The OAuth app integration ID. @@ -227,9 +908,40 @@ func (newState *GetCustomAppIntegrationRequest) SyncEffectiveFieldsDuringCreateO func (newState *GetCustomAppIntegrationRequest) SyncEffectiveFieldsDuringRead(existingState GetCustomAppIntegrationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCustomAppIntegrationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCustomAppIntegrationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCustomAppIntegrationRequest +// only implements ToObjectValue() and Type(). +func (o GetCustomAppIntegrationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCustomAppIntegrationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + }, + } +} + type GetCustomAppIntegrationsOutput struct { // List of Custom OAuth App Integrations defined for the account. - Apps []GetCustomAppIntegrationOutput `tfsdk:"apps" tf:"optional"` + Apps types.List `tfsdk:"apps" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -240,6 +952,69 @@ func (newState *GetCustomAppIntegrationsOutput) SyncEffectiveFieldsDuringCreateO func (newState *GetCustomAppIntegrationsOutput) SyncEffectiveFieldsDuringRead(existingState GetCustomAppIntegrationsOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCustomAppIntegrationsOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCustomAppIntegrationsOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "apps": reflect.TypeOf(GetCustomAppIntegrationOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCustomAppIntegrationsOutput +// only implements ToObjectValue() and Type(). +func (o GetCustomAppIntegrationsOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apps": o.Apps, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCustomAppIntegrationsOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apps": basetypes.ListType{ + ElemType: GetCustomAppIntegrationOutput{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetApps returns the value of the Apps field in GetCustomAppIntegrationsOutput as +// a slice of GetCustomAppIntegrationOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetCustomAppIntegrationsOutput) GetApps(ctx context.Context) ([]GetCustomAppIntegrationOutput, bool) { + if o.Apps.IsNull() || o.Apps.IsUnknown() { + return nil, false + } + var v []GetCustomAppIntegrationOutput + d := o.Apps.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetApps sets the value of the Apps field in GetCustomAppIntegrationsOutput. +func (o *GetCustomAppIntegrationsOutput) SetApps(ctx context.Context, v []GetCustomAppIntegrationOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["apps"] + t = t.(attr.TypeWithElementType).ElementType() + o.Apps = types.ListValueMust(t, vs) +} + type GetPublishedAppIntegrationOutput struct { // App-id of the published app integration AppId types.String `tfsdk:"app_id" tf:"optional"` @@ -252,7 +1027,7 @@ type GetPublishedAppIntegrationOutput struct { // Display name of the published OAuth app Name types.String `tfsdk:"name" tf:"optional"` // Token access policy - TokenAccessPolicy []TokenAccessPolicy `tfsdk:"token_access_policy" tf:"optional,object"` + TokenAccessPolicy types.List `tfsdk:"token_access_policy" tf:"optional,object"` } func (newState *GetPublishedAppIntegrationOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetPublishedAppIntegrationOutput) { @@ -261,6 +1036,77 @@ func (newState *GetPublishedAppIntegrationOutput) SyncEffectiveFieldsDuringCreat func (newState *GetPublishedAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState GetPublishedAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPublishedAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPublishedAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_access_policy": reflect.TypeOf(TokenAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPublishedAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o GetPublishedAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_id": o.AppId, + "create_time": o.CreateTime, + "created_by": o.CreatedBy, + "integration_id": o.IntegrationId, + "name": o.Name, + "token_access_policy": o.TokenAccessPolicy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPublishedAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_id": types.StringType, + "create_time": types.StringType, + "created_by": types.Int64Type, + "integration_id": types.StringType, + "name": types.StringType, + "token_access_policy": basetypes.ListType{ + ElemType: TokenAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetTokenAccessPolicy returns the value of the TokenAccessPolicy field in GetPublishedAppIntegrationOutput as +// a TokenAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPublishedAppIntegrationOutput) GetTokenAccessPolicy(ctx context.Context) (TokenAccessPolicy, bool) { + var e TokenAccessPolicy + if o.TokenAccessPolicy.IsNull() || o.TokenAccessPolicy.IsUnknown() { + return e, false + } + var v []TokenAccessPolicy + d := o.TokenAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenAccessPolicy sets the value of the TokenAccessPolicy field in GetPublishedAppIntegrationOutput. +func (o *GetPublishedAppIntegrationOutput) SetTokenAccessPolicy(ctx context.Context, v TokenAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_access_policy"] + o.TokenAccessPolicy = types.ListValueMust(t, vs) +} + // Get OAuth Published App Integration type GetPublishedAppIntegrationRequest struct { IntegrationId types.String `tfsdk:"-"` @@ -272,9 +1118,40 @@ func (newState *GetPublishedAppIntegrationRequest) SyncEffectiveFieldsDuringCrea func (newState *GetPublishedAppIntegrationRequest) SyncEffectiveFieldsDuringRead(existingState GetPublishedAppIntegrationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPublishedAppIntegrationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPublishedAppIntegrationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPublishedAppIntegrationRequest +// only implements ToObjectValue() and Type(). +func (o GetPublishedAppIntegrationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPublishedAppIntegrationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + }, + } +} + type GetPublishedAppIntegrationsOutput struct { // List of Published OAuth App Integrations defined for the account. - Apps []GetPublishedAppIntegrationOutput `tfsdk:"apps" tf:"optional"` + Apps types.List `tfsdk:"apps" tf:"optional"` NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` } @@ -285,9 +1162,72 @@ func (newState *GetPublishedAppIntegrationsOutput) SyncEffectiveFieldsDuringCrea func (newState *GetPublishedAppIntegrationsOutput) SyncEffectiveFieldsDuringRead(existingState GetPublishedAppIntegrationsOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPublishedAppIntegrationsOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPublishedAppIntegrationsOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "apps": reflect.TypeOf(GetPublishedAppIntegrationOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPublishedAppIntegrationsOutput +// only implements ToObjectValue() and Type(). +func (o GetPublishedAppIntegrationsOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apps": o.Apps, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPublishedAppIntegrationsOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apps": basetypes.ListType{ + ElemType: GetPublishedAppIntegrationOutput{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetApps returns the value of the Apps field in GetPublishedAppIntegrationsOutput as +// a slice of GetPublishedAppIntegrationOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPublishedAppIntegrationsOutput) GetApps(ctx context.Context) ([]GetPublishedAppIntegrationOutput, bool) { + if o.Apps.IsNull() || o.Apps.IsUnknown() { + return nil, false + } + var v []GetPublishedAppIntegrationOutput + d := o.Apps.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetApps sets the value of the Apps field in GetPublishedAppIntegrationsOutput. +func (o *GetPublishedAppIntegrationsOutput) SetApps(ctx context.Context, v []GetPublishedAppIntegrationOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["apps"] + t = t.(attr.TypeWithElementType).ElementType() + o.Apps = types.ListValueMust(t, vs) +} + type GetPublishedAppsOutput struct { // List of Published OAuth Apps. - Apps []PublishedAppOutput `tfsdk:"apps" tf:"optional"` + Apps types.List `tfsdk:"apps" tf:"optional"` // A token that can be used to get the next page of results. If not present, // there are no more results to show. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -299,6 +1239,69 @@ func (newState *GetPublishedAppsOutput) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetPublishedAppsOutput) SyncEffectiveFieldsDuringRead(existingState GetPublishedAppsOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPublishedAppsOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPublishedAppsOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "apps": reflect.TypeOf(PublishedAppOutput{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPublishedAppsOutput +// only implements ToObjectValue() and Type(). +func (o GetPublishedAppsOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apps": o.Apps, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPublishedAppsOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apps": basetypes.ListType{ + ElemType: PublishedAppOutput{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetApps returns the value of the Apps field in GetPublishedAppsOutput as +// a slice of PublishedAppOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPublishedAppsOutput) GetApps(ctx context.Context) ([]PublishedAppOutput, bool) { + if o.Apps.IsNull() || o.Apps.IsUnknown() { + return nil, false + } + var v []PublishedAppOutput + d := o.Apps.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetApps sets the value of the Apps field in GetPublishedAppsOutput. +func (o *GetPublishedAppsOutput) SetApps(ctx context.Context, v []PublishedAppOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["apps"] + t = t.(attr.TypeWithElementType).ElementType() + o.Apps = types.ListValueMust(t, vs) +} + // Get custom oauth app integrations type ListCustomAppIntegrationsRequest struct { IncludeCreatorUsername types.Bool `tfsdk:"-"` @@ -314,6 +1317,41 @@ func (newState *ListCustomAppIntegrationsRequest) SyncEffectiveFieldsDuringCreat func (newState *ListCustomAppIntegrationsRequest) SyncEffectiveFieldsDuringRead(existingState ListCustomAppIntegrationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCustomAppIntegrationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCustomAppIntegrationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCustomAppIntegrationsRequest +// only implements ToObjectValue() and Type(). +func (o ListCustomAppIntegrationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_creator_username": o.IncludeCreatorUsername, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCustomAppIntegrationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_creator_username": types.BoolType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + // Get all the published OAuth apps type ListOAuthPublishedAppsRequest struct { // The max number of OAuth published apps to return in one page. @@ -328,6 +1366,39 @@ func (newState *ListOAuthPublishedAppsRequest) SyncEffectiveFieldsDuringCreateOr func (newState *ListOAuthPublishedAppsRequest) SyncEffectiveFieldsDuringRead(existingState ListOAuthPublishedAppsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListOAuthPublishedAppsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListOAuthPublishedAppsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListOAuthPublishedAppsRequest +// only implements ToObjectValue() and Type(). +func (o ListOAuthPublishedAppsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListOAuthPublishedAppsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + // Get published oauth app integrations type ListPublishedAppIntegrationsRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -341,6 +1412,39 @@ func (newState *ListPublishedAppIntegrationsRequest) SyncEffectiveFieldsDuringCr func (newState *ListPublishedAppIntegrationsRequest) SyncEffectiveFieldsDuringRead(existingState ListPublishedAppIntegrationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPublishedAppIntegrationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPublishedAppIntegrationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPublishedAppIntegrationsRequest +// only implements ToObjectValue() and Type(). +func (o ListPublishedAppIntegrationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPublishedAppIntegrationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + // List service principal secrets type ListServicePrincipalSecretsRequest struct { // An opaque page token which was the `next_page_token` in the response of @@ -363,11 +1467,44 @@ func (newState *ListServicePrincipalSecretsRequest) SyncEffectiveFieldsDuringCre func (newState *ListServicePrincipalSecretsRequest) SyncEffectiveFieldsDuringRead(existingState ListServicePrincipalSecretsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListServicePrincipalSecretsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListServicePrincipalSecretsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListServicePrincipalSecretsRequest +// only implements ToObjectValue() and Type(). +func (o ListServicePrincipalSecretsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_token": o.PageToken, + "service_principal_id": o.ServicePrincipalId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListServicePrincipalSecretsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_token": types.StringType, + "service_principal_id": types.Int64Type, + }, + } +} + type ListServicePrincipalSecretsResponse struct { // A token, which can be sent as `page_token` to retrieve the next page. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // List of the secrets - Secrets []SecretInfo `tfsdk:"secrets" tf:"optional"` + Secrets types.List `tfsdk:"secrets" tf:"optional"` } func (newState *ListServicePrincipalSecretsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListServicePrincipalSecretsResponse) { @@ -376,6 +1513,69 @@ func (newState *ListServicePrincipalSecretsResponse) SyncEffectiveFieldsDuringCr func (newState *ListServicePrincipalSecretsResponse) SyncEffectiveFieldsDuringRead(existingState ListServicePrincipalSecretsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListServicePrincipalSecretsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListServicePrincipalSecretsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "secrets": reflect.TypeOf(SecretInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListServicePrincipalSecretsResponse +// only implements ToObjectValue() and Type(). +func (o ListServicePrincipalSecretsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "secrets": o.Secrets, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListServicePrincipalSecretsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "secrets": basetypes.ListType{ + ElemType: SecretInfo{}.Type(ctx), + }, + }, + } +} + +// GetSecrets returns the value of the Secrets field in ListServicePrincipalSecretsResponse as +// a slice of SecretInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListServicePrincipalSecretsResponse) GetSecrets(ctx context.Context) ([]SecretInfo, bool) { + if o.Secrets.IsNull() || o.Secrets.IsUnknown() { + return nil, false + } + var v []SecretInfo + d := o.Secrets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSecrets sets the value of the Secrets field in ListServicePrincipalSecretsResponse. +func (o *ListServicePrincipalSecretsResponse) SetSecrets(ctx context.Context, v []SecretInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["secrets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Secrets = types.ListValueMust(t, vs) +} + type PublishedAppOutput struct { // Unique ID of the published OAuth app. AppId types.String `tfsdk:"app_id" tf:"optional"` @@ -390,9 +1590,9 @@ type PublishedAppOutput struct { // The display name of the published OAuth app. Name types.String `tfsdk:"name" tf:"optional"` // Redirect URLs of the published OAuth app. - RedirectUrls []types.String `tfsdk:"redirect_urls" tf:"optional"` + RedirectUrls types.List `tfsdk:"redirect_urls" tf:"optional"` // Required scopes for the published OAuth app. - Scopes []types.String `tfsdk:"scopes" tf:"optional"` + Scopes types.List `tfsdk:"scopes" tf:"optional"` } func (newState *PublishedAppOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan PublishedAppOutput) { @@ -401,6 +1601,108 @@ func (newState *PublishedAppOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PublishedAppOutput) SyncEffectiveFieldsDuringRead(existingState PublishedAppOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PublishedAppOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PublishedAppOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "redirect_urls": reflect.TypeOf(types.String{}), + "scopes": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PublishedAppOutput +// only implements ToObjectValue() and Type(). +func (o PublishedAppOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "app_id": o.AppId, + "client_id": o.ClientId, + "description": o.Description, + "is_confidential_client": o.IsConfidentialClient, + "name": o.Name, + "redirect_urls": o.RedirectUrls, + "scopes": o.Scopes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PublishedAppOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "app_id": types.StringType, + "client_id": types.StringType, + "description": types.StringType, + "is_confidential_client": types.BoolType, + "name": types.StringType, + "redirect_urls": basetypes.ListType{ + ElemType: types.StringType, + }, + "scopes": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetRedirectUrls returns the value of the RedirectUrls field in PublishedAppOutput as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PublishedAppOutput) GetRedirectUrls(ctx context.Context) ([]types.String, bool) { + if o.RedirectUrls.IsNull() || o.RedirectUrls.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RedirectUrls.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRedirectUrls sets the value of the RedirectUrls field in PublishedAppOutput. +func (o *PublishedAppOutput) SetRedirectUrls(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["redirect_urls"] + t = t.(attr.TypeWithElementType).ElementType() + o.RedirectUrls = types.ListValueMust(t, vs) +} + +// GetScopes returns the value of the Scopes field in PublishedAppOutput as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PublishedAppOutput) GetScopes(ctx context.Context) ([]types.String, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in PublishedAppOutput. +func (o *PublishedAppOutput) SetScopes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + type SecretInfo struct { // UTC time when the secret was created CreateTime types.String `tfsdk:"create_time" tf:"optional"` @@ -420,6 +1722,45 @@ func (newState *SecretInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan SecretI func (newState *SecretInfo) SyncEffectiveFieldsDuringRead(existingState SecretInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SecretInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SecretInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SecretInfo +// only implements ToObjectValue() and Type(). +func (o SecretInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "id": o.Id, + "secret_hash": o.SecretHash, + "status": o.Status, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SecretInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "id": types.StringType, + "secret_hash": types.StringType, + "status": types.StringType, + "update_time": types.StringType, + }, + } +} + type TokenAccessPolicy struct { // access token time to live in minutes AccessTokenTtlInMinutes types.Int64 `tfsdk:"access_token_ttl_in_minutes" tf:"optional"` @@ -433,13 +1774,46 @@ func (newState *TokenAccessPolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TokenAccessPolicy) SyncEffectiveFieldsDuringRead(existingState TokenAccessPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenAccessPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenAccessPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenAccessPolicy +// only implements ToObjectValue() and Type(). +func (o TokenAccessPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_token_ttl_in_minutes": o.AccessTokenTtlInMinutes, + "refresh_token_ttl_in_minutes": o.RefreshTokenTtlInMinutes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenAccessPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_token_ttl_in_minutes": types.Int64Type, + "refresh_token_ttl_in_minutes": types.Int64Type, + }, + } +} + type UpdateCustomAppIntegration struct { IntegrationId types.String `tfsdk:"-"` // List of OAuth redirect urls to be updated in the custom OAuth app // integration - RedirectUrls []types.String `tfsdk:"redirect_urls" tf:"optional"` + RedirectUrls types.List `tfsdk:"redirect_urls" tf:"optional"` // Token access policy to be updated in the custom OAuth app integration - TokenAccessPolicy []TokenAccessPolicy `tfsdk:"token_access_policy" tf:"optional,object"` + TokenAccessPolicy types.List `tfsdk:"token_access_policy" tf:"optional,object"` } func (newState *UpdateCustomAppIntegration) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateCustomAppIntegration) { @@ -448,6 +1822,100 @@ func (newState *UpdateCustomAppIntegration) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UpdateCustomAppIntegration) SyncEffectiveFieldsDuringRead(existingState UpdateCustomAppIntegration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCustomAppIntegration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCustomAppIntegration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "redirect_urls": reflect.TypeOf(types.String{}), + "token_access_policy": reflect.TypeOf(TokenAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCustomAppIntegration +// only implements ToObjectValue() and Type(). +func (o UpdateCustomAppIntegration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + "redirect_urls": o.RedirectUrls, + "token_access_policy": o.TokenAccessPolicy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCustomAppIntegration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + "redirect_urls": basetypes.ListType{ + ElemType: types.StringType, + }, + "token_access_policy": basetypes.ListType{ + ElemType: TokenAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetRedirectUrls returns the value of the RedirectUrls field in UpdateCustomAppIntegration as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCustomAppIntegration) GetRedirectUrls(ctx context.Context) ([]types.String, bool) { + if o.RedirectUrls.IsNull() || o.RedirectUrls.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RedirectUrls.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRedirectUrls sets the value of the RedirectUrls field in UpdateCustomAppIntegration. +func (o *UpdateCustomAppIntegration) SetRedirectUrls(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["redirect_urls"] + t = t.(attr.TypeWithElementType).ElementType() + o.RedirectUrls = types.ListValueMust(t, vs) +} + +// GetTokenAccessPolicy returns the value of the TokenAccessPolicy field in UpdateCustomAppIntegration as +// a TokenAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCustomAppIntegration) GetTokenAccessPolicy(ctx context.Context) (TokenAccessPolicy, bool) { + var e TokenAccessPolicy + if o.TokenAccessPolicy.IsNull() || o.TokenAccessPolicy.IsUnknown() { + return e, false + } + var v []TokenAccessPolicy + d := o.TokenAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenAccessPolicy sets the value of the TokenAccessPolicy field in UpdateCustomAppIntegration. +func (o *UpdateCustomAppIntegration) SetTokenAccessPolicy(ctx context.Context, v TokenAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_access_policy"] + o.TokenAccessPolicy = types.ListValueMust(t, vs) +} + type UpdateCustomAppIntegrationOutput struct { } @@ -457,10 +1925,37 @@ func (newState *UpdateCustomAppIntegrationOutput) SyncEffectiveFieldsDuringCreat func (newState *UpdateCustomAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState UpdateCustomAppIntegrationOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCustomAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCustomAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCustomAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o UpdateCustomAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCustomAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdatePublishedAppIntegration struct { IntegrationId types.String `tfsdk:"-"` // Token access policy to be updated in the published OAuth app integration - TokenAccessPolicy []TokenAccessPolicy `tfsdk:"token_access_policy" tf:"optional,object"` + TokenAccessPolicy types.List `tfsdk:"token_access_policy" tf:"optional,object"` } func (newState *UpdatePublishedAppIntegration) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdatePublishedAppIntegration) { @@ -469,6 +1964,69 @@ func (newState *UpdatePublishedAppIntegration) SyncEffectiveFieldsDuringCreateOr func (newState *UpdatePublishedAppIntegration) SyncEffectiveFieldsDuringRead(existingState UpdatePublishedAppIntegration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePublishedAppIntegration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePublishedAppIntegration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_access_policy": reflect.TypeOf(TokenAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePublishedAppIntegration +// only implements ToObjectValue() and Type(). +func (o UpdatePublishedAppIntegration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_id": o.IntegrationId, + "token_access_policy": o.TokenAccessPolicy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePublishedAppIntegration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_id": types.StringType, + "token_access_policy": basetypes.ListType{ + ElemType: TokenAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetTokenAccessPolicy returns the value of the TokenAccessPolicy field in UpdatePublishedAppIntegration as +// a TokenAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdatePublishedAppIntegration) GetTokenAccessPolicy(ctx context.Context) (TokenAccessPolicy, bool) { + var e TokenAccessPolicy + if o.TokenAccessPolicy.IsNull() || o.TokenAccessPolicy.IsUnknown() { + return e, false + } + var v []TokenAccessPolicy + d := o.TokenAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenAccessPolicy sets the value of the TokenAccessPolicy field in UpdatePublishedAppIntegration. +func (o *UpdatePublishedAppIntegration) SetTokenAccessPolicy(ctx context.Context, v TokenAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_access_policy"] + o.TokenAccessPolicy = types.ListValueMust(t, vs) +} + type UpdatePublishedAppIntegrationOutput struct { } @@ -477,3 +2035,30 @@ func (newState *UpdatePublishedAppIntegrationOutput) SyncEffectiveFieldsDuringCr func (newState *UpdatePublishedAppIntegrationOutput) SyncEffectiveFieldsDuringRead(existingState UpdatePublishedAppIntegrationOutput) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePublishedAppIntegrationOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePublishedAppIntegrationOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePublishedAppIntegrationOutput +// only implements ToObjectValue() and Type(). +func (o UpdatePublishedAppIntegrationOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePublishedAppIntegrationOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} diff --git a/internal/service/pipelines_tf/model.go b/internal/service/pipelines_tf/model.go index 56f0b9d19..311cb5ccb 100755 --- a/internal/service/pipelines_tf/model.go +++ b/internal/service/pipelines_tf/model.go @@ -11,8 +11,15 @@ We use go-native types for lists and maps intentionally for the ease for convert package pipelines_tf import ( - "github.com/databricks/databricks-sdk-go/service/compute" + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/databricks/terraform-provider-databricks/internal/service/compute_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type CreatePipeline struct { @@ -30,13 +37,13 @@ type CreatePipeline struct { // DLT Release Channel that specifies which version to use. Channel types.String `tfsdk:"channel" tf:"optional"` // Cluster settings for this pipeline deployment. - Clusters []PipelineCluster `tfsdk:"clusters" tf:"optional"` + Clusters types.List `tfsdk:"clusters" tf:"optional"` // String-String configuration for this pipeline execution. - Configuration map[string]types.String `tfsdk:"configuration" tf:"optional"` + Configuration types.Map `tfsdk:"configuration" tf:"optional"` // Whether the pipeline is continuous or triggered. This replaces `trigger`. Continuous types.Bool `tfsdk:"continuous" tf:"optional"` // Deployment type of this pipeline. - Deployment []PipelineDeployment `tfsdk:"deployment" tf:"optional,object"` + Deployment types.List `tfsdk:"deployment" tf:"optional,object"` // Whether the pipeline is in Development mode. Defaults to false. Development types.Bool `tfsdk:"development" tf:"optional"` @@ -44,24 +51,24 @@ type CreatePipeline struct { // Pipeline product edition. Edition types.String `tfsdk:"edition" tf:"optional"` // Filters on which Pipeline packages to include in the deployed graph. - Filters []Filters `tfsdk:"filters" tf:"optional,object"` + Filters types.List `tfsdk:"filters" tf:"optional,object"` // The definition of a gateway pipeline to support change data capture. - GatewayDefinition []IngestionGatewayPipelineDefinition `tfsdk:"gateway_definition" tf:"optional,object"` + GatewayDefinition types.List `tfsdk:"gateway_definition" tf:"optional,object"` // Unique identifier for this pipeline. Id types.String `tfsdk:"id" tf:"optional"` // The configuration for a managed ingestion pipeline. These settings cannot // be used with the 'libraries', 'target' or 'catalog' settings. - IngestionDefinition []IngestionPipelineDefinition `tfsdk:"ingestion_definition" tf:"optional,object"` + IngestionDefinition types.List `tfsdk:"ingestion_definition" tf:"optional,object"` // Libraries or code needed by this deployment. - Libraries []PipelineLibrary `tfsdk:"libraries" tf:"optional"` + Libraries types.List `tfsdk:"libraries" tf:"optional"` // Friendly identifier for this pipeline. Name types.String `tfsdk:"name" tf:"optional"` // List of notification settings for this pipeline. - Notifications []Notifications `tfsdk:"notifications" tf:"optional"` + Notifications types.List `tfsdk:"notifications" tf:"optional"` // Whether Photon is enabled for this pipeline. Photon types.Bool `tfsdk:"photon" tf:"optional"` // Restart window of this pipeline. - RestartWindow []RestartWindow `tfsdk:"restart_window" tf:"optional,object"` + RestartWindow types.List `tfsdk:"restart_window" tf:"optional,object"` // The default schema (database) where tables are read from or published to. // The presence of this field implies that the pipeline is in direct // publishing mode. @@ -75,7 +82,7 @@ type CreatePipeline struct { // To publish to Unity Catalog, also specify `catalog`. Target types.String `tfsdk:"target" tf:"optional"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. - Trigger []PipelineTrigger `tfsdk:"trigger" tf:"optional,object"` + Trigger types.List `tfsdk:"trigger" tf:"optional,object"` } func (newState *CreatePipeline) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreatePipeline) { @@ -84,9 +91,379 @@ func (newState *CreatePipeline) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreatePipeline) SyncEffectiveFieldsDuringRead(existingState CreatePipeline) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePipeline. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePipeline) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clusters": reflect.TypeOf(PipelineCluster{}), + "configuration": reflect.TypeOf(types.String{}), + "deployment": reflect.TypeOf(PipelineDeployment{}), + "filters": reflect.TypeOf(Filters{}), + "gateway_definition": reflect.TypeOf(IngestionGatewayPipelineDefinition{}), + "ingestion_definition": reflect.TypeOf(IngestionPipelineDefinition{}), + "libraries": reflect.TypeOf(PipelineLibrary{}), + "notifications": reflect.TypeOf(Notifications{}), + "restart_window": reflect.TypeOf(RestartWindow{}), + "trigger": reflect.TypeOf(PipelineTrigger{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePipeline +// only implements ToObjectValue() and Type(). +func (o CreatePipeline) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_duplicate_names": o.AllowDuplicateNames, + "budget_policy_id": o.BudgetPolicyId, + "catalog": o.Catalog, + "channel": o.Channel, + "clusters": o.Clusters, + "configuration": o.Configuration, + "continuous": o.Continuous, + "deployment": o.Deployment, + "development": o.Development, + "dry_run": o.DryRun, + "edition": o.Edition, + "filters": o.Filters, + "gateway_definition": o.GatewayDefinition, + "id": o.Id, + "ingestion_definition": o.IngestionDefinition, + "libraries": o.Libraries, + "name": o.Name, + "notifications": o.Notifications, + "photon": o.Photon, + "restart_window": o.RestartWindow, + "schema": o.Schema, + "serverless": o.Serverless, + "storage": o.Storage, + "target": o.Target, + "trigger": o.Trigger, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePipeline) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_duplicate_names": types.BoolType, + "budget_policy_id": types.StringType, + "catalog": types.StringType, + "channel": types.StringType, + "clusters": basetypes.ListType{ + ElemType: PipelineCluster{}.Type(ctx), + }, + "configuration": basetypes.MapType{ + ElemType: types.StringType, + }, + "continuous": types.BoolType, + "deployment": basetypes.ListType{ + ElemType: PipelineDeployment{}.Type(ctx), + }, + "development": types.BoolType, + "dry_run": types.BoolType, + "edition": types.StringType, + "filters": basetypes.ListType{ + ElemType: Filters{}.Type(ctx), + }, + "gateway_definition": basetypes.ListType{ + ElemType: IngestionGatewayPipelineDefinition{}.Type(ctx), + }, + "id": types.StringType, + "ingestion_definition": basetypes.ListType{ + ElemType: IngestionPipelineDefinition{}.Type(ctx), + }, + "libraries": basetypes.ListType{ + ElemType: PipelineLibrary{}.Type(ctx), + }, + "name": types.StringType, + "notifications": basetypes.ListType{ + ElemType: Notifications{}.Type(ctx), + }, + "photon": types.BoolType, + "restart_window": basetypes.ListType{ + ElemType: RestartWindow{}.Type(ctx), + }, + "schema": types.StringType, + "serverless": types.BoolType, + "storage": types.StringType, + "target": types.StringType, + "trigger": basetypes.ListType{ + ElemType: PipelineTrigger{}.Type(ctx), + }, + }, + } +} + +// GetClusters returns the value of the Clusters field in CreatePipeline as +// a slice of PipelineCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetClusters(ctx context.Context) ([]PipelineCluster, bool) { + if o.Clusters.IsNull() || o.Clusters.IsUnknown() { + return nil, false + } + var v []PipelineCluster + d := o.Clusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusters sets the value of the Clusters field in CreatePipeline. +func (o *CreatePipeline) SetClusters(ctx context.Context, v []PipelineCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Clusters = types.ListValueMust(t, vs) +} + +// GetConfiguration returns the value of the Configuration field in CreatePipeline as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetConfiguration(ctx context.Context) (map[string]types.String, bool) { + if o.Configuration.IsNull() || o.Configuration.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Configuration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetConfiguration sets the value of the Configuration field in CreatePipeline. +func (o *CreatePipeline) SetConfiguration(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["configuration"] + t = t.(attr.TypeWithElementType).ElementType() + o.Configuration = types.MapValueMust(t, vs) +} + +// GetDeployment returns the value of the Deployment field in CreatePipeline as +// a PipelineDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetDeployment(ctx context.Context) (PipelineDeployment, bool) { + var e PipelineDeployment + if o.Deployment.IsNull() || o.Deployment.IsUnknown() { + return e, false + } + var v []PipelineDeployment + d := o.Deployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeployment sets the value of the Deployment field in CreatePipeline. +func (o *CreatePipeline) SetDeployment(ctx context.Context, v PipelineDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["deployment"] + o.Deployment = types.ListValueMust(t, vs) +} + +// GetFilters returns the value of the Filters field in CreatePipeline as +// a Filters value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetFilters(ctx context.Context) (Filters, bool) { + var e Filters + if o.Filters.IsNull() || o.Filters.IsUnknown() { + return e, false + } + var v []Filters + d := o.Filters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilters sets the value of the Filters field in CreatePipeline. +func (o *CreatePipeline) SetFilters(ctx context.Context, v Filters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filters"] + o.Filters = types.ListValueMust(t, vs) +} + +// GetGatewayDefinition returns the value of the GatewayDefinition field in CreatePipeline as +// a IngestionGatewayPipelineDefinition value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetGatewayDefinition(ctx context.Context) (IngestionGatewayPipelineDefinition, bool) { + var e IngestionGatewayPipelineDefinition + if o.GatewayDefinition.IsNull() || o.GatewayDefinition.IsUnknown() { + return e, false + } + var v []IngestionGatewayPipelineDefinition + d := o.GatewayDefinition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGatewayDefinition sets the value of the GatewayDefinition field in CreatePipeline. +func (o *CreatePipeline) SetGatewayDefinition(ctx context.Context, v IngestionGatewayPipelineDefinition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gateway_definition"] + o.GatewayDefinition = types.ListValueMust(t, vs) +} + +// GetIngestionDefinition returns the value of the IngestionDefinition field in CreatePipeline as +// a IngestionPipelineDefinition value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetIngestionDefinition(ctx context.Context) (IngestionPipelineDefinition, bool) { + var e IngestionPipelineDefinition + if o.IngestionDefinition.IsNull() || o.IngestionDefinition.IsUnknown() { + return e, false + } + var v []IngestionPipelineDefinition + d := o.IngestionDefinition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIngestionDefinition sets the value of the IngestionDefinition field in CreatePipeline. +func (o *CreatePipeline) SetIngestionDefinition(ctx context.Context, v IngestionPipelineDefinition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ingestion_definition"] + o.IngestionDefinition = types.ListValueMust(t, vs) +} + +// GetLibraries returns the value of the Libraries field in CreatePipeline as +// a slice of PipelineLibrary values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetLibraries(ctx context.Context) ([]PipelineLibrary, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []PipelineLibrary + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in CreatePipeline. +func (o *CreatePipeline) SetLibraries(ctx context.Context, v []PipelineLibrary) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNotifications returns the value of the Notifications field in CreatePipeline as +// a slice of Notifications values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetNotifications(ctx context.Context) ([]Notifications, bool) { + if o.Notifications.IsNull() || o.Notifications.IsUnknown() { + return nil, false + } + var v []Notifications + d := o.Notifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotifications sets the value of the Notifications field in CreatePipeline. +func (o *CreatePipeline) SetNotifications(ctx context.Context, v []Notifications) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notifications"] + t = t.(attr.TypeWithElementType).ElementType() + o.Notifications = types.ListValueMust(t, vs) +} + +// GetRestartWindow returns the value of the RestartWindow field in CreatePipeline as +// a RestartWindow value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetRestartWindow(ctx context.Context) (RestartWindow, bool) { + var e RestartWindow + if o.RestartWindow.IsNull() || o.RestartWindow.IsUnknown() { + return e, false + } + var v []RestartWindow + d := o.RestartWindow.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRestartWindow sets the value of the RestartWindow field in CreatePipeline. +func (o *CreatePipeline) SetRestartWindow(ctx context.Context, v RestartWindow) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["restart_window"] + o.RestartWindow = types.ListValueMust(t, vs) +} + +// GetTrigger returns the value of the Trigger field in CreatePipeline as +// a PipelineTrigger value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipeline) GetTrigger(ctx context.Context) (PipelineTrigger, bool) { + var e PipelineTrigger + if o.Trigger.IsNull() || o.Trigger.IsUnknown() { + return e, false + } + var v []PipelineTrigger + d := o.Trigger.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrigger sets the value of the Trigger field in CreatePipeline. +func (o *CreatePipeline) SetTrigger(ctx context.Context, v PipelineTrigger) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger"] + o.Trigger = types.ListValueMust(t, vs) +} + type CreatePipelineResponse struct { // Only returned when dry_run is true. - EffectiveSettings []PipelineSpec `tfsdk:"effective_settings" tf:"optional,object"` + EffectiveSettings types.List `tfsdk:"effective_settings" tf:"optional,object"` // The unique identifier for the newly created pipeline. Only returned when // dry_run is false. PipelineId types.String `tfsdk:"pipeline_id" tf:"optional"` @@ -98,6 +475,69 @@ func (newState *CreatePipelineResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreatePipelineResponse) SyncEffectiveFieldsDuringRead(existingState CreatePipelineResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePipelineResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePipelineResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "effective_settings": reflect.TypeOf(PipelineSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePipelineResponse +// only implements ToObjectValue() and Type(). +func (o CreatePipelineResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "effective_settings": o.EffectiveSettings, + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePipelineResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "effective_settings": basetypes.ListType{ + ElemType: PipelineSpec{}.Type(ctx), + }, + "pipeline_id": types.StringType, + }, + } +} + +// GetEffectiveSettings returns the value of the EffectiveSettings field in CreatePipelineResponse as +// a PipelineSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreatePipelineResponse) GetEffectiveSettings(ctx context.Context) (PipelineSpec, bool) { + var e PipelineSpec + if o.EffectiveSettings.IsNull() || o.EffectiveSettings.IsUnknown() { + return e, false + } + var v []PipelineSpec + d := o.EffectiveSettings.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEffectiveSettings sets the value of the EffectiveSettings field in CreatePipelineResponse. +func (o *CreatePipelineResponse) SetEffectiveSettings(ctx context.Context, v PipelineSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["effective_settings"] + o.EffectiveSettings = types.ListValueMust(t, vs) +} + type CronTrigger struct { QuartzCronSchedule types.String `tfsdk:"quartz_cron_schedule" tf:"optional"` @@ -110,6 +550,39 @@ func (newState *CronTrigger) SyncEffectiveFieldsDuringCreateOrUpdate(plan CronTr func (newState *CronTrigger) SyncEffectiveFieldsDuringRead(existingState CronTrigger) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CronTrigger. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CronTrigger) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CronTrigger +// only implements ToObjectValue() and Type(). +func (o CronTrigger) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "quartz_cron_schedule": o.QuartzCronSchedule, + "timezone_id": o.TimezoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CronTrigger) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "quartz_cron_schedule": types.StringType, + "timezone_id": types.StringType, + }, + } +} + type DataPlaneId struct { // The instance name of the data plane emitting an event. Instance types.String `tfsdk:"instance" tf:"optional"` @@ -123,6 +596,39 @@ func (newState *DataPlaneId) SyncEffectiveFieldsDuringCreateOrUpdate(plan DataPl func (newState *DataPlaneId) SyncEffectiveFieldsDuringRead(existingState DataPlaneId) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DataPlaneId. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DataPlaneId) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DataPlaneId +// only implements ToObjectValue() and Type(). +func (o DataPlaneId) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "instance": o.Instance, + "seq_no": o.SeqNo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DataPlaneId) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "instance": types.StringType, + "seq_no": types.Int64Type, + }, + } +} + // Delete a pipeline type DeletePipelineRequest struct { PipelineId types.String `tfsdk:"-"` @@ -134,6 +640,37 @@ func (newState *DeletePipelineRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeletePipelineRequest) SyncEffectiveFieldsDuringRead(existingState DeletePipelineRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePipelineRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePipelineRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePipelineRequest +// only implements ToObjectValue() and Type(). +func (o DeletePipelineRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePipelineRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pipeline_id": types.StringType, + }, + } +} + type DeletePipelineResponse struct { } @@ -143,6 +680,33 @@ func (newState *DeletePipelineResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeletePipelineResponse) SyncEffectiveFieldsDuringRead(existingState DeletePipelineResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePipelineResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePipelineResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePipelineResponse +// only implements ToObjectValue() and Type(). +func (o DeletePipelineResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePipelineResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EditPipeline struct { // If false, deployment will fail if name has changed and conflicts the name // of another pipeline. @@ -158,13 +722,13 @@ type EditPipeline struct { // DLT Release Channel that specifies which version to use. Channel types.String `tfsdk:"channel" tf:"optional"` // Cluster settings for this pipeline deployment. - Clusters []PipelineCluster `tfsdk:"clusters" tf:"optional"` + Clusters types.List `tfsdk:"clusters" tf:"optional"` // String-String configuration for this pipeline execution. - Configuration map[string]types.String `tfsdk:"configuration" tf:"optional"` + Configuration types.Map `tfsdk:"configuration" tf:"optional"` // Whether the pipeline is continuous or triggered. This replaces `trigger`. Continuous types.Bool `tfsdk:"continuous" tf:"optional"` // Deployment type of this pipeline. - Deployment []PipelineDeployment `tfsdk:"deployment" tf:"optional,object"` + Deployment types.List `tfsdk:"deployment" tf:"optional,object"` // Whether the pipeline is in Development mode. Defaults to false. Development types.Bool `tfsdk:"development" tf:"optional"` // Pipeline product edition. @@ -174,26 +738,26 @@ type EditPipeline struct { // will fail with a conflict. ExpectedLastModified types.Int64 `tfsdk:"expected_last_modified" tf:"optional"` // Filters on which Pipeline packages to include in the deployed graph. - Filters []Filters `tfsdk:"filters" tf:"optional,object"` + Filters types.List `tfsdk:"filters" tf:"optional,object"` // The definition of a gateway pipeline to support change data capture. - GatewayDefinition []IngestionGatewayPipelineDefinition `tfsdk:"gateway_definition" tf:"optional,object"` + GatewayDefinition types.List `tfsdk:"gateway_definition" tf:"optional,object"` // Unique identifier for this pipeline. Id types.String `tfsdk:"id" tf:"optional"` // The configuration for a managed ingestion pipeline. These settings cannot // be used with the 'libraries', 'target' or 'catalog' settings. - IngestionDefinition []IngestionPipelineDefinition `tfsdk:"ingestion_definition" tf:"optional,object"` + IngestionDefinition types.List `tfsdk:"ingestion_definition" tf:"optional,object"` // Libraries or code needed by this deployment. - Libraries []PipelineLibrary `tfsdk:"libraries" tf:"optional"` + Libraries types.List `tfsdk:"libraries" tf:"optional"` // Friendly identifier for this pipeline. Name types.String `tfsdk:"name" tf:"optional"` // List of notification settings for this pipeline. - Notifications []Notifications `tfsdk:"notifications" tf:"optional"` + Notifications types.List `tfsdk:"notifications" tf:"optional"` // Whether Photon is enabled for this pipeline. Photon types.Bool `tfsdk:"photon" tf:"optional"` // Unique identifier for this pipeline. PipelineId types.String `tfsdk:"pipeline_id" tf:"optional"` // Restart window of this pipeline. - RestartWindow []RestartWindow `tfsdk:"restart_window" tf:"optional,object"` + RestartWindow types.List `tfsdk:"restart_window" tf:"optional,object"` // The default schema (database) where tables are read from or published to. // The presence of this field implies that the pipeline is in direct // publishing mode. @@ -207,7 +771,7 @@ type EditPipeline struct { // To publish to Unity Catalog, also specify `catalog`. Target types.String `tfsdk:"target" tf:"optional"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. - Trigger []PipelineTrigger `tfsdk:"trigger" tf:"optional,object"` + Trigger types.List `tfsdk:"trigger" tf:"optional,object"` } func (newState *EditPipeline) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditPipeline) { @@ -216,6 +780,378 @@ func (newState *EditPipeline) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditP func (newState *EditPipeline) SyncEffectiveFieldsDuringRead(existingState EditPipeline) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditPipeline. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditPipeline) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clusters": reflect.TypeOf(PipelineCluster{}), + "configuration": reflect.TypeOf(types.String{}), + "deployment": reflect.TypeOf(PipelineDeployment{}), + "filters": reflect.TypeOf(Filters{}), + "gateway_definition": reflect.TypeOf(IngestionGatewayPipelineDefinition{}), + "ingestion_definition": reflect.TypeOf(IngestionPipelineDefinition{}), + "libraries": reflect.TypeOf(PipelineLibrary{}), + "notifications": reflect.TypeOf(Notifications{}), + "restart_window": reflect.TypeOf(RestartWindow{}), + "trigger": reflect.TypeOf(PipelineTrigger{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditPipeline +// only implements ToObjectValue() and Type(). +func (o EditPipeline) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_duplicate_names": o.AllowDuplicateNames, + "budget_policy_id": o.BudgetPolicyId, + "catalog": o.Catalog, + "channel": o.Channel, + "clusters": o.Clusters, + "configuration": o.Configuration, + "continuous": o.Continuous, + "deployment": o.Deployment, + "development": o.Development, + "edition": o.Edition, + "expected_last_modified": o.ExpectedLastModified, + "filters": o.Filters, + "gateway_definition": o.GatewayDefinition, + "id": o.Id, + "ingestion_definition": o.IngestionDefinition, + "libraries": o.Libraries, + "name": o.Name, + "notifications": o.Notifications, + "photon": o.Photon, + "pipeline_id": o.PipelineId, + "restart_window": o.RestartWindow, + "schema": o.Schema, + "serverless": o.Serverless, + "storage": o.Storage, + "target": o.Target, + "trigger": o.Trigger, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EditPipeline) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_duplicate_names": types.BoolType, + "budget_policy_id": types.StringType, + "catalog": types.StringType, + "channel": types.StringType, + "clusters": basetypes.ListType{ + ElemType: PipelineCluster{}.Type(ctx), + }, + "configuration": basetypes.MapType{ + ElemType: types.StringType, + }, + "continuous": types.BoolType, + "deployment": basetypes.ListType{ + ElemType: PipelineDeployment{}.Type(ctx), + }, + "development": types.BoolType, + "edition": types.StringType, + "expected_last_modified": types.Int64Type, + "filters": basetypes.ListType{ + ElemType: Filters{}.Type(ctx), + }, + "gateway_definition": basetypes.ListType{ + ElemType: IngestionGatewayPipelineDefinition{}.Type(ctx), + }, + "id": types.StringType, + "ingestion_definition": basetypes.ListType{ + ElemType: IngestionPipelineDefinition{}.Type(ctx), + }, + "libraries": basetypes.ListType{ + ElemType: PipelineLibrary{}.Type(ctx), + }, + "name": types.StringType, + "notifications": basetypes.ListType{ + ElemType: Notifications{}.Type(ctx), + }, + "photon": types.BoolType, + "pipeline_id": types.StringType, + "restart_window": basetypes.ListType{ + ElemType: RestartWindow{}.Type(ctx), + }, + "schema": types.StringType, + "serverless": types.BoolType, + "storage": types.StringType, + "target": types.StringType, + "trigger": basetypes.ListType{ + ElemType: PipelineTrigger{}.Type(ctx), + }, + }, + } +} + +// GetClusters returns the value of the Clusters field in EditPipeline as +// a slice of PipelineCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetClusters(ctx context.Context) ([]PipelineCluster, bool) { + if o.Clusters.IsNull() || o.Clusters.IsUnknown() { + return nil, false + } + var v []PipelineCluster + d := o.Clusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusters sets the value of the Clusters field in EditPipeline. +func (o *EditPipeline) SetClusters(ctx context.Context, v []PipelineCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Clusters = types.ListValueMust(t, vs) +} + +// GetConfiguration returns the value of the Configuration field in EditPipeline as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetConfiguration(ctx context.Context) (map[string]types.String, bool) { + if o.Configuration.IsNull() || o.Configuration.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Configuration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetConfiguration sets the value of the Configuration field in EditPipeline. +func (o *EditPipeline) SetConfiguration(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["configuration"] + t = t.(attr.TypeWithElementType).ElementType() + o.Configuration = types.MapValueMust(t, vs) +} + +// GetDeployment returns the value of the Deployment field in EditPipeline as +// a PipelineDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetDeployment(ctx context.Context) (PipelineDeployment, bool) { + var e PipelineDeployment + if o.Deployment.IsNull() || o.Deployment.IsUnknown() { + return e, false + } + var v []PipelineDeployment + d := o.Deployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeployment sets the value of the Deployment field in EditPipeline. +func (o *EditPipeline) SetDeployment(ctx context.Context, v PipelineDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["deployment"] + o.Deployment = types.ListValueMust(t, vs) +} + +// GetFilters returns the value of the Filters field in EditPipeline as +// a Filters value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetFilters(ctx context.Context) (Filters, bool) { + var e Filters + if o.Filters.IsNull() || o.Filters.IsUnknown() { + return e, false + } + var v []Filters + d := o.Filters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilters sets the value of the Filters field in EditPipeline. +func (o *EditPipeline) SetFilters(ctx context.Context, v Filters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filters"] + o.Filters = types.ListValueMust(t, vs) +} + +// GetGatewayDefinition returns the value of the GatewayDefinition field in EditPipeline as +// a IngestionGatewayPipelineDefinition value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetGatewayDefinition(ctx context.Context) (IngestionGatewayPipelineDefinition, bool) { + var e IngestionGatewayPipelineDefinition + if o.GatewayDefinition.IsNull() || o.GatewayDefinition.IsUnknown() { + return e, false + } + var v []IngestionGatewayPipelineDefinition + d := o.GatewayDefinition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGatewayDefinition sets the value of the GatewayDefinition field in EditPipeline. +func (o *EditPipeline) SetGatewayDefinition(ctx context.Context, v IngestionGatewayPipelineDefinition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gateway_definition"] + o.GatewayDefinition = types.ListValueMust(t, vs) +} + +// GetIngestionDefinition returns the value of the IngestionDefinition field in EditPipeline as +// a IngestionPipelineDefinition value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetIngestionDefinition(ctx context.Context) (IngestionPipelineDefinition, bool) { + var e IngestionPipelineDefinition + if o.IngestionDefinition.IsNull() || o.IngestionDefinition.IsUnknown() { + return e, false + } + var v []IngestionPipelineDefinition + d := o.IngestionDefinition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIngestionDefinition sets the value of the IngestionDefinition field in EditPipeline. +func (o *EditPipeline) SetIngestionDefinition(ctx context.Context, v IngestionPipelineDefinition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ingestion_definition"] + o.IngestionDefinition = types.ListValueMust(t, vs) +} + +// GetLibraries returns the value of the Libraries field in EditPipeline as +// a slice of PipelineLibrary values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetLibraries(ctx context.Context) ([]PipelineLibrary, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []PipelineLibrary + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in EditPipeline. +func (o *EditPipeline) SetLibraries(ctx context.Context, v []PipelineLibrary) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNotifications returns the value of the Notifications field in EditPipeline as +// a slice of Notifications values. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetNotifications(ctx context.Context) ([]Notifications, bool) { + if o.Notifications.IsNull() || o.Notifications.IsUnknown() { + return nil, false + } + var v []Notifications + d := o.Notifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotifications sets the value of the Notifications field in EditPipeline. +func (o *EditPipeline) SetNotifications(ctx context.Context, v []Notifications) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notifications"] + t = t.(attr.TypeWithElementType).ElementType() + o.Notifications = types.ListValueMust(t, vs) +} + +// GetRestartWindow returns the value of the RestartWindow field in EditPipeline as +// a RestartWindow value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetRestartWindow(ctx context.Context) (RestartWindow, bool) { + var e RestartWindow + if o.RestartWindow.IsNull() || o.RestartWindow.IsUnknown() { + return e, false + } + var v []RestartWindow + d := o.RestartWindow.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRestartWindow sets the value of the RestartWindow field in EditPipeline. +func (o *EditPipeline) SetRestartWindow(ctx context.Context, v RestartWindow) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["restart_window"] + o.RestartWindow = types.ListValueMust(t, vs) +} + +// GetTrigger returns the value of the Trigger field in EditPipeline as +// a PipelineTrigger value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditPipeline) GetTrigger(ctx context.Context) (PipelineTrigger, bool) { + var e PipelineTrigger + if o.Trigger.IsNull() || o.Trigger.IsUnknown() { + return e, false + } + var v []PipelineTrigger + d := o.Trigger.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrigger sets the value of the Trigger field in EditPipeline. +func (o *EditPipeline) SetTrigger(ctx context.Context, v PipelineTrigger) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger"] + o.Trigger = types.ListValueMust(t, vs) +} + type EditPipelineResponse struct { } @@ -225,9 +1161,36 @@ func (newState *EditPipelineResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *EditPipelineResponse) SyncEffectiveFieldsDuringRead(existingState EditPipelineResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditPipelineResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditPipelineResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditPipelineResponse +// only implements ToObjectValue() and Type(). +func (o EditPipelineResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EditPipelineResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ErrorDetail struct { // The exception thrown for this error, with its chain of cause. - Exceptions []SerializedException `tfsdk:"exceptions" tf:"optional"` + Exceptions types.List `tfsdk:"exceptions" tf:"optional"` // Whether this error is considered fatal, that is, unrecoverable. Fatal types.Bool `tfsdk:"fatal" tf:"optional"` } @@ -238,6 +1201,69 @@ func (newState *ErrorDetail) SyncEffectiveFieldsDuringCreateOrUpdate(plan ErrorD func (newState *ErrorDetail) SyncEffectiveFieldsDuringRead(existingState ErrorDetail) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ErrorDetail. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ErrorDetail) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exceptions": reflect.TypeOf(SerializedException{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ErrorDetail +// only implements ToObjectValue() and Type(). +func (o ErrorDetail) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exceptions": o.Exceptions, + "fatal": o.Fatal, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ErrorDetail) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exceptions": basetypes.ListType{ + ElemType: SerializedException{}.Type(ctx), + }, + "fatal": types.BoolType, + }, + } +} + +// GetExceptions returns the value of the Exceptions field in ErrorDetail as +// a slice of SerializedException values. +// If the field is unknown or null, the boolean return value is false. +func (o *ErrorDetail) GetExceptions(ctx context.Context) ([]SerializedException, bool) { + if o.Exceptions.IsNull() || o.Exceptions.IsUnknown() { + return nil, false + } + var v []SerializedException + d := o.Exceptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExceptions sets the value of the Exceptions field in ErrorDetail. +func (o *ErrorDetail) SetExceptions(ctx context.Context, v []SerializedException) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exceptions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Exceptions = types.ListValueMust(t, vs) +} + type FileLibrary struct { // The absolute path of the file. Path types.String `tfsdk:"path" tf:"optional"` @@ -249,11 +1275,42 @@ func (newState *FileLibrary) SyncEffectiveFieldsDuringCreateOrUpdate(plan FileLi func (newState *FileLibrary) SyncEffectiveFieldsDuringRead(existingState FileLibrary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FileLibrary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FileLibrary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FileLibrary +// only implements ToObjectValue() and Type(). +func (o FileLibrary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FileLibrary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + type Filters struct { // Paths to exclude. - Exclude []types.String `tfsdk:"exclude" tf:"optional"` + Exclude types.List `tfsdk:"exclude" tf:"optional"` // Paths to include. - Include []types.String `tfsdk:"include" tf:"optional"` + Include types.List `tfsdk:"include" tf:"optional"` } func (newState *Filters) SyncEffectiveFieldsDuringCreateOrUpdate(plan Filters) { @@ -262,6 +1319,98 @@ func (newState *Filters) SyncEffectiveFieldsDuringCreateOrUpdate(plan Filters) { func (newState *Filters) SyncEffectiveFieldsDuringRead(existingState Filters) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Filters. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Filters) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "exclude": reflect.TypeOf(types.String{}), + "include": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Filters +// only implements ToObjectValue() and Type(). +func (o Filters) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "exclude": o.Exclude, + "include": o.Include, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Filters) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "exclude": basetypes.ListType{ + ElemType: types.StringType, + }, + "include": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetExclude returns the value of the Exclude field in Filters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Filters) GetExclude(ctx context.Context) ([]types.String, bool) { + if o.Exclude.IsNull() || o.Exclude.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Exclude.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExclude sets the value of the Exclude field in Filters. +func (o *Filters) SetExclude(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["exclude"] + t = t.(attr.TypeWithElementType).ElementType() + o.Exclude = types.ListValueMust(t, vs) +} + +// GetInclude returns the value of the Include field in Filters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Filters) GetInclude(ctx context.Context) ([]types.String, bool) { + if o.Include.IsNull() || o.Include.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Include.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInclude sets the value of the Include field in Filters. +func (o *Filters) SetInclude(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["include"] + t = t.(attr.TypeWithElementType).ElementType() + o.Include = types.ListValueMust(t, vs) +} + // Get pipeline permission levels type GetPipelinePermissionLevelsRequest struct { // The pipeline for which to get or manage permissions. @@ -274,9 +1423,40 @@ func (newState *GetPipelinePermissionLevelsRequest) SyncEffectiveFieldsDuringCre func (newState *GetPipelinePermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetPipelinePermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPipelinePermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPipelinePermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPipelinePermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetPipelinePermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPipelinePermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pipeline_id": types.StringType, + }, + } +} + type GetPipelinePermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []PipelinePermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetPipelinePermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetPipelinePermissionLevelsResponse) { @@ -285,6 +1465,67 @@ func (newState *GetPipelinePermissionLevelsResponse) SyncEffectiveFieldsDuringCr func (newState *GetPipelinePermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetPipelinePermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPipelinePermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPipelinePermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(PipelinePermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPipelinePermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetPipelinePermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPipelinePermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: PipelinePermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetPipelinePermissionLevelsResponse as +// a slice of PipelinePermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPipelinePermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]PipelinePermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []PipelinePermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetPipelinePermissionLevelsResponse. +func (o *GetPipelinePermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []PipelinePermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get pipeline permissions type GetPipelinePermissionsRequest struct { // The pipeline for which to get or manage permissions. @@ -297,6 +1538,37 @@ func (newState *GetPipelinePermissionsRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetPipelinePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetPipelinePermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPipelinePermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPipelinePermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPipelinePermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetPipelinePermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPipelinePermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pipeline_id": types.StringType, + }, + } +} + // Get a pipeline type GetPipelineRequest struct { PipelineId types.String `tfsdk:"-"` @@ -308,6 +1580,37 @@ func (newState *GetPipelineRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetPipelineRequest) SyncEffectiveFieldsDuringRead(existingState GetPipelineRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPipelineRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPipelineRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPipelineRequest +// only implements ToObjectValue() and Type(). +func (o GetPipelineRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPipelineRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pipeline_id": types.StringType, + }, + } +} + type GetPipelineResponse struct { // An optional message detailing the cause of the pipeline state. Cause types.String `tfsdk:"cause" tf:"optional"` @@ -323,7 +1626,7 @@ type GetPipelineResponse struct { LastModified types.Int64 `tfsdk:"last_modified" tf:"optional"` // Status of the latest updates for the pipeline. Ordered with the newest // update first. - LatestUpdates []UpdateStateInfo `tfsdk:"latest_updates" tf:"optional"` + LatestUpdates types.List `tfsdk:"latest_updates" tf:"optional"` // A human friendly identifier for the pipeline, taken from the `spec`. Name types.String `tfsdk:"name" tf:"optional"` // The ID of the pipeline. @@ -332,7 +1635,7 @@ type GetPipelineResponse struct { RunAsUserName types.String `tfsdk:"run_as_user_name" tf:"optional"` // The pipeline specification. This field is not returned when called by // `ListPipelines`. - Spec []PipelineSpec `tfsdk:"spec" tf:"optional,object"` + Spec types.List `tfsdk:"spec" tf:"optional,object"` // The pipeline state. State types.String `tfsdk:"state" tf:"optional"` } @@ -343,6 +1646,118 @@ func (newState *GetPipelineResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetPipelineResponse) SyncEffectiveFieldsDuringRead(existingState GetPipelineResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPipelineResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPipelineResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "latest_updates": reflect.TypeOf(UpdateStateInfo{}), + "spec": reflect.TypeOf(PipelineSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPipelineResponse +// only implements ToObjectValue() and Type(). +func (o GetPipelineResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cause": o.Cause, + "cluster_id": o.ClusterId, + "creator_user_name": o.CreatorUserName, + "effective_budget_policy_id": o.EffectiveBudgetPolicyId, + "health": o.Health, + "last_modified": o.LastModified, + "latest_updates": o.LatestUpdates, + "name": o.Name, + "pipeline_id": o.PipelineId, + "run_as_user_name": o.RunAsUserName, + "spec": o.Spec, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPipelineResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cause": types.StringType, + "cluster_id": types.StringType, + "creator_user_name": types.StringType, + "effective_budget_policy_id": types.StringType, + "health": types.StringType, + "last_modified": types.Int64Type, + "latest_updates": basetypes.ListType{ + ElemType: UpdateStateInfo{}.Type(ctx), + }, + "name": types.StringType, + "pipeline_id": types.StringType, + "run_as_user_name": types.StringType, + "spec": basetypes.ListType{ + ElemType: PipelineSpec{}.Type(ctx), + }, + "state": types.StringType, + }, + } +} + +// GetLatestUpdates returns the value of the LatestUpdates field in GetPipelineResponse as +// a slice of UpdateStateInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPipelineResponse) GetLatestUpdates(ctx context.Context) ([]UpdateStateInfo, bool) { + if o.LatestUpdates.IsNull() || o.LatestUpdates.IsUnknown() { + return nil, false + } + var v []UpdateStateInfo + d := o.LatestUpdates.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLatestUpdates sets the value of the LatestUpdates field in GetPipelineResponse. +func (o *GetPipelineResponse) SetLatestUpdates(ctx context.Context, v []UpdateStateInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["latest_updates"] + t = t.(attr.TypeWithElementType).ElementType() + o.LatestUpdates = types.ListValueMust(t, vs) +} + +// GetSpec returns the value of the Spec field in GetPipelineResponse as +// a PipelineSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetPipelineResponse) GetSpec(ctx context.Context) (PipelineSpec, bool) { + var e PipelineSpec + if o.Spec.IsNull() || o.Spec.IsUnknown() { + return e, false + } + var v []PipelineSpec + d := o.Spec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSpec sets the value of the Spec field in GetPipelineResponse. +func (o *GetPipelineResponse) SetSpec(ctx context.Context, v PipelineSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spec"] + o.Spec = types.ListValueMust(t, vs) +} + // Get a pipeline update type GetUpdateRequest struct { // The ID of the pipeline. @@ -357,9 +1772,42 @@ func (newState *GetUpdateRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetUpdateRequest) SyncEffectiveFieldsDuringRead(existingState GetUpdateRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetUpdateRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetUpdateRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetUpdateRequest +// only implements ToObjectValue() and Type(). +func (o GetUpdateRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pipeline_id": o.PipelineId, + "update_id": o.UpdateId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetUpdateRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pipeline_id": types.StringType, + "update_id": types.StringType, + }, + } +} + type GetUpdateResponse struct { // The current update info. - Update []UpdateInfo `tfsdk:"update" tf:"optional,object"` + Update types.List `tfsdk:"update" tf:"optional,object"` } func (newState *GetUpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetUpdateResponse) { @@ -368,13 +1816,74 @@ func (newState *GetUpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetUpdateResponse) SyncEffectiveFieldsDuringRead(existingState GetUpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetUpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetUpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "update": reflect.TypeOf(UpdateInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetUpdateResponse +// only implements ToObjectValue() and Type(). +func (o GetUpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "update": o.Update, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetUpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "update": basetypes.ListType{ + ElemType: UpdateInfo{}.Type(ctx), + }, + }, + } +} + +// GetUpdate returns the value of the Update field in GetUpdateResponse as +// a UpdateInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetUpdateResponse) GetUpdate(ctx context.Context) (UpdateInfo, bool) { + var e UpdateInfo + if o.Update.IsNull() || o.Update.IsUnknown() { + return e, false + } + var v []UpdateInfo + d := o.Update.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUpdate sets the value of the Update field in GetUpdateResponse. +func (o *GetUpdateResponse) SetUpdate(ctx context.Context, v UpdateInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["update"] + o.Update = types.ListValueMust(t, vs) +} + type IngestionConfig struct { // Select a specific source report. - Report []ReportSpec `tfsdk:"report" tf:"optional,object"` + Report types.List `tfsdk:"report" tf:"optional,object"` // Select all tables from a specific source schema. - Schema []SchemaSpec `tfsdk:"schema" tf:"optional,object"` + Schema types.List `tfsdk:"schema" tf:"optional,object"` // Select a specific source table. - Table []TableSpec `tfsdk:"table" tf:"optional,object"` + Table types.List `tfsdk:"table" tf:"optional,object"` } func (newState *IngestionConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan IngestionConfig) { @@ -383,6 +1892,129 @@ func (newState *IngestionConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan In func (newState *IngestionConfig) SyncEffectiveFieldsDuringRead(existingState IngestionConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in IngestionConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a IngestionConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "report": reflect.TypeOf(ReportSpec{}), + "schema": reflect.TypeOf(SchemaSpec{}), + "table": reflect.TypeOf(TableSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, IngestionConfig +// only implements ToObjectValue() and Type(). +func (o IngestionConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "report": o.Report, + "schema": o.Schema, + "table": o.Table, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o IngestionConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "report": basetypes.ListType{ + ElemType: ReportSpec{}.Type(ctx), + }, + "schema": basetypes.ListType{ + ElemType: SchemaSpec{}.Type(ctx), + }, + "table": basetypes.ListType{ + ElemType: TableSpec{}.Type(ctx), + }, + }, + } +} + +// GetReport returns the value of the Report field in IngestionConfig as +// a ReportSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *IngestionConfig) GetReport(ctx context.Context) (ReportSpec, bool) { + var e ReportSpec + if o.Report.IsNull() || o.Report.IsUnknown() { + return e, false + } + var v []ReportSpec + d := o.Report.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetReport sets the value of the Report field in IngestionConfig. +func (o *IngestionConfig) SetReport(ctx context.Context, v ReportSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["report"] + o.Report = types.ListValueMust(t, vs) +} + +// GetSchema returns the value of the Schema field in IngestionConfig as +// a SchemaSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *IngestionConfig) GetSchema(ctx context.Context) (SchemaSpec, bool) { + var e SchemaSpec + if o.Schema.IsNull() || o.Schema.IsUnknown() { + return e, false + } + var v []SchemaSpec + d := o.Schema.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchema sets the value of the Schema field in IngestionConfig. +func (o *IngestionConfig) SetSchema(ctx context.Context, v SchemaSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schema"] + o.Schema = types.ListValueMust(t, vs) +} + +// GetTable returns the value of the Table field in IngestionConfig as +// a TableSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *IngestionConfig) GetTable(ctx context.Context) (TableSpec, bool) { + var e TableSpec + if o.Table.IsNull() || o.Table.IsUnknown() { + return e, false + } + var v []TableSpec + d := o.Table.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTable sets the value of the Table field in IngestionConfig. +func (o *IngestionConfig) SetTable(ctx context.Context, v TableSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table"] + o.Table = types.ListValueMust(t, vs) +} + type IngestionGatewayPipelineDefinition struct { // [Deprecated, use connection_name instead] Immutable. The Unity Catalog // connection that this gateway pipeline uses to communicate with the @@ -410,6 +2042,45 @@ func (newState *IngestionGatewayPipelineDefinition) SyncEffectiveFieldsDuringCre func (newState *IngestionGatewayPipelineDefinition) SyncEffectiveFieldsDuringRead(existingState IngestionGatewayPipelineDefinition) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in IngestionGatewayPipelineDefinition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a IngestionGatewayPipelineDefinition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, IngestionGatewayPipelineDefinition +// only implements ToObjectValue() and Type(). +func (o IngestionGatewayPipelineDefinition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "connection_id": o.ConnectionId, + "connection_name": o.ConnectionName, + "gateway_storage_catalog": o.GatewayStorageCatalog, + "gateway_storage_name": o.GatewayStorageName, + "gateway_storage_schema": o.GatewayStorageSchema, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o IngestionGatewayPipelineDefinition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "connection_id": types.StringType, + "connection_name": types.StringType, + "gateway_storage_catalog": types.StringType, + "gateway_storage_name": types.StringType, + "gateway_storage_schema": types.StringType, + }, + } +} + type IngestionPipelineDefinition struct { // Immutable. The Unity Catalog connection that this ingestion pipeline uses // to communicate with the source. This is used with connectors for @@ -421,10 +2092,10 @@ type IngestionPipelineDefinition struct { IngestionGatewayId types.String `tfsdk:"ingestion_gateway_id" tf:"optional"` // Required. Settings specifying tables to replicate and the destination for // the replicated tables. - Objects []IngestionConfig `tfsdk:"objects" tf:"optional"` + Objects types.List `tfsdk:"objects" tf:"optional"` // Configuration settings to control the ingestion of tables. These settings // are applied to all tables in the pipeline. - TableConfiguration []TableSpecificConfig `tfsdk:"table_configuration" tf:"optional,object"` + TableConfiguration types.List `tfsdk:"table_configuration" tf:"optional,object"` } func (newState *IngestionPipelineDefinition) SyncEffectiveFieldsDuringCreateOrUpdate(plan IngestionPipelineDefinition) { @@ -433,6 +2104,102 @@ func (newState *IngestionPipelineDefinition) SyncEffectiveFieldsDuringCreateOrUp func (newState *IngestionPipelineDefinition) SyncEffectiveFieldsDuringRead(existingState IngestionPipelineDefinition) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in IngestionPipelineDefinition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a IngestionPipelineDefinition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "objects": reflect.TypeOf(IngestionConfig{}), + "table_configuration": reflect.TypeOf(TableSpecificConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, IngestionPipelineDefinition +// only implements ToObjectValue() and Type(). +func (o IngestionPipelineDefinition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "connection_name": o.ConnectionName, + "ingestion_gateway_id": o.IngestionGatewayId, + "objects": o.Objects, + "table_configuration": o.TableConfiguration, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o IngestionPipelineDefinition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "connection_name": types.StringType, + "ingestion_gateway_id": types.StringType, + "objects": basetypes.ListType{ + ElemType: IngestionConfig{}.Type(ctx), + }, + "table_configuration": basetypes.ListType{ + ElemType: TableSpecificConfig{}.Type(ctx), + }, + }, + } +} + +// GetObjects returns the value of the Objects field in IngestionPipelineDefinition as +// a slice of IngestionConfig values. +// If the field is unknown or null, the boolean return value is false. +func (o *IngestionPipelineDefinition) GetObjects(ctx context.Context) ([]IngestionConfig, bool) { + if o.Objects.IsNull() || o.Objects.IsUnknown() { + return nil, false + } + var v []IngestionConfig + d := o.Objects.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetObjects sets the value of the Objects field in IngestionPipelineDefinition. +func (o *IngestionPipelineDefinition) SetObjects(ctx context.Context, v []IngestionConfig) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["objects"] + t = t.(attr.TypeWithElementType).ElementType() + o.Objects = types.ListValueMust(t, vs) +} + +// GetTableConfiguration returns the value of the TableConfiguration field in IngestionPipelineDefinition as +// a TableSpecificConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *IngestionPipelineDefinition) GetTableConfiguration(ctx context.Context) (TableSpecificConfig, bool) { + var e TableSpecificConfig + if o.TableConfiguration.IsNull() || o.TableConfiguration.IsUnknown() { + return e, false + } + var v []TableSpecificConfig + d := o.TableConfiguration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTableConfiguration sets the value of the TableConfiguration field in IngestionPipelineDefinition. +func (o *IngestionPipelineDefinition) SetTableConfiguration(ctx context.Context, v TableSpecificConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_configuration"] + o.TableConfiguration = types.ListValueMust(t, vs) +} + // List pipeline events type ListPipelineEventsRequest struct { // Criteria to select a subset of results, expressed using a SQL-like @@ -451,7 +2218,7 @@ type ListPipelineEventsRequest struct { // example, ["timestamp asc"]. The sort order can be ascending or // descending. By default, events are returned in descending order by // timestamp. - OrderBy []types.String `tfsdk:"-"` + OrderBy types.List `tfsdk:"-"` // Page token returned by previous call. This field is mutually exclusive // with all fields in this request except max_results. An error is returned // if any fields other than max_results are set when this field is set. @@ -466,9 +2233,78 @@ func (newState *ListPipelineEventsRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListPipelineEventsRequest) SyncEffectiveFieldsDuringRead(existingState ListPipelineEventsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPipelineEventsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPipelineEventsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "order_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPipelineEventsRequest +// only implements ToObjectValue() and Type(). +func (o ListPipelineEventsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + "max_results": o.MaxResults, + "order_by": o.OrderBy, + "page_token": o.PageToken, + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPipelineEventsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": types.StringType, + "max_results": types.Int64Type, + "order_by": basetypes.ListType{ + ElemType: types.StringType, + }, + "page_token": types.StringType, + "pipeline_id": types.StringType, + }, + } +} + +// GetOrderBy returns the value of the OrderBy field in ListPipelineEventsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPipelineEventsRequest) GetOrderBy(ctx context.Context) ([]types.String, bool) { + if o.OrderBy.IsNull() || o.OrderBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OrderBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOrderBy sets the value of the OrderBy field in ListPipelineEventsRequest. +func (o *ListPipelineEventsRequest) SetOrderBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["order_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.OrderBy = types.ListValueMust(t, vs) +} + type ListPipelineEventsResponse struct { // The list of events matching the request criteria. - Events []PipelineEvent `tfsdk:"events" tf:"optional"` + Events types.List `tfsdk:"events" tf:"optional"` // If present, a token to fetch the next page of events. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // If present, a token to fetch the previous page of events. @@ -481,6 +2317,71 @@ func (newState *ListPipelineEventsResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListPipelineEventsResponse) SyncEffectiveFieldsDuringRead(existingState ListPipelineEventsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPipelineEventsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPipelineEventsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "events": reflect.TypeOf(PipelineEvent{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPipelineEventsResponse +// only implements ToObjectValue() and Type(). +func (o ListPipelineEventsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "events": o.Events, + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPipelineEventsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "events": basetypes.ListType{ + ElemType: PipelineEvent{}.Type(ctx), + }, + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + }, + } +} + +// GetEvents returns the value of the Events field in ListPipelineEventsResponse as +// a slice of PipelineEvent values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPipelineEventsResponse) GetEvents(ctx context.Context) ([]PipelineEvent, bool) { + if o.Events.IsNull() || o.Events.IsUnknown() { + return nil, false + } + var v []PipelineEvent + d := o.Events.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEvents sets the value of the Events field in ListPipelineEventsResponse. +func (o *ListPipelineEventsResponse) SetEvents(ctx context.Context, v []PipelineEvent) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["events"] + t = t.(attr.TypeWithElementType).ElementType() + o.Events = types.ListValueMust(t, vs) +} + // List pipelines type ListPipelinesRequest struct { // Select a subset of results based on the specified criteria. The supported @@ -501,7 +2402,7 @@ type ListPipelinesRequest struct { MaxResults types.Int64 `tfsdk:"-"` // A list of strings specifying the order of results. Supported order_by // fields are id and name. The default is id asc. This field is optional. - OrderBy []types.String `tfsdk:"-"` + OrderBy types.List `tfsdk:"-"` // Page token returned by previous call PageToken types.String `tfsdk:"-"` } @@ -512,11 +2413,78 @@ func (newState *ListPipelinesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListPipelinesRequest) SyncEffectiveFieldsDuringRead(existingState ListPipelinesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPipelinesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPipelinesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "order_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPipelinesRequest +// only implements ToObjectValue() and Type(). +func (o ListPipelinesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter": o.Filter, + "max_results": o.MaxResults, + "order_by": o.OrderBy, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPipelinesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter": types.StringType, + "max_results": types.Int64Type, + "order_by": basetypes.ListType{ + ElemType: types.StringType, + }, + "page_token": types.StringType, + }, + } +} + +// GetOrderBy returns the value of the OrderBy field in ListPipelinesRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPipelinesRequest) GetOrderBy(ctx context.Context) ([]types.String, bool) { + if o.OrderBy.IsNull() || o.OrderBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.OrderBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetOrderBy sets the value of the OrderBy field in ListPipelinesRequest. +func (o *ListPipelinesRequest) SetOrderBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["order_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.OrderBy = types.ListValueMust(t, vs) +} + type ListPipelinesResponse struct { // If present, a token to fetch the next page of events. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // The list of events matching the request criteria. - Statuses []PipelineStateInfo `tfsdk:"statuses" tf:"optional"` + Statuses types.List `tfsdk:"statuses" tf:"optional"` } func (newState *ListPipelinesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListPipelinesResponse) { @@ -525,6 +2493,69 @@ func (newState *ListPipelinesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListPipelinesResponse) SyncEffectiveFieldsDuringRead(existingState ListPipelinesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPipelinesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPipelinesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "statuses": reflect.TypeOf(PipelineStateInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPipelinesResponse +// only implements ToObjectValue() and Type(). +func (o ListPipelinesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "statuses": o.Statuses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPipelinesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "statuses": basetypes.ListType{ + ElemType: PipelineStateInfo{}.Type(ctx), + }, + }, + } +} + +// GetStatuses returns the value of the Statuses field in ListPipelinesResponse as +// a slice of PipelineStateInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPipelinesResponse) GetStatuses(ctx context.Context) ([]PipelineStateInfo, bool) { + if o.Statuses.IsNull() || o.Statuses.IsUnknown() { + return nil, false + } + var v []PipelineStateInfo + d := o.Statuses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStatuses sets the value of the Statuses field in ListPipelinesResponse. +func (o *ListPipelinesResponse) SetStatuses(ctx context.Context, v []PipelineStateInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["statuses"] + t = t.(attr.TypeWithElementType).ElementType() + o.Statuses = types.ListValueMust(t, vs) +} + // List pipeline updates type ListUpdatesRequest struct { // Max number of entries to return in a single page. @@ -543,6 +2574,43 @@ func (newState *ListUpdatesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListUpdatesRequest) SyncEffectiveFieldsDuringRead(existingState ListUpdatesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListUpdatesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListUpdatesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListUpdatesRequest +// only implements ToObjectValue() and Type(). +func (o ListUpdatesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "page_token": o.PageToken, + "pipeline_id": o.PipelineId, + "until_update_id": o.UntilUpdateId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListUpdatesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "page_token": types.StringType, + "pipeline_id": types.StringType, + "until_update_id": types.StringType, + }, + } +} + type ListUpdatesResponse struct { // If present, then there are more results, and this a token to be used in a // subsequent request to fetch the next page. @@ -551,7 +2619,7 @@ type ListUpdatesResponse struct { // the previous page. PrevPageToken types.String `tfsdk:"prev_page_token" tf:"optional"` - Updates []UpdateInfo `tfsdk:"updates" tf:"optional"` + Updates types.List `tfsdk:"updates" tf:"optional"` } func (newState *ListUpdatesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListUpdatesResponse) { @@ -560,6 +2628,71 @@ func (newState *ListUpdatesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListUpdatesResponse) SyncEffectiveFieldsDuringRead(existingState ListUpdatesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListUpdatesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListUpdatesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "updates": reflect.TypeOf(UpdateInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListUpdatesResponse +// only implements ToObjectValue() and Type(). +func (o ListUpdatesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "prev_page_token": o.PrevPageToken, + "updates": o.Updates, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListUpdatesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "prev_page_token": types.StringType, + "updates": basetypes.ListType{ + ElemType: UpdateInfo{}.Type(ctx), + }, + }, + } +} + +// GetUpdates returns the value of the Updates field in ListUpdatesResponse as +// a slice of UpdateInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListUpdatesResponse) GetUpdates(ctx context.Context) ([]UpdateInfo, bool) { + if o.Updates.IsNull() || o.Updates.IsUnknown() { + return nil, false + } + var v []UpdateInfo + d := o.Updates.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUpdates sets the value of the Updates field in ListUpdatesResponse. +func (o *ListUpdatesResponse) SetUpdates(ctx context.Context, v []UpdateInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["updates"] + t = t.(attr.TypeWithElementType).ElementType() + o.Updates = types.ListValueMust(t, vs) +} + type ManualTrigger struct { } @@ -569,6 +2702,33 @@ func (newState *ManualTrigger) SyncEffectiveFieldsDuringCreateOrUpdate(plan Manu func (newState *ManualTrigger) SyncEffectiveFieldsDuringRead(existingState ManualTrigger) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ManualTrigger. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ManualTrigger) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ManualTrigger +// only implements ToObjectValue() and Type(). +func (o ManualTrigger) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ManualTrigger) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type NotebookLibrary struct { // The absolute path of the notebook. Path types.String `tfsdk:"path" tf:"optional"` @@ -580,6 +2740,37 @@ func (newState *NotebookLibrary) SyncEffectiveFieldsDuringCreateOrUpdate(plan No func (newState *NotebookLibrary) SyncEffectiveFieldsDuringRead(existingState NotebookLibrary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NotebookLibrary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NotebookLibrary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NotebookLibrary +// only implements ToObjectValue() and Type(). +func (o NotebookLibrary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NotebookLibrary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + type Notifications struct { // A list of alerts that trigger the sending of notifications to the // configured destinations. The supported alerts are: @@ -588,9 +2779,9 @@ type Notifications struct { // `on-update-failure`: Each time a pipeline update fails. * // `on-update-fatal-failure`: A pipeline update fails with a non-retryable // (fatal) error. * `on-flow-failure`: A single data flow fails. - Alerts []types.String `tfsdk:"alerts" tf:"optional"` + Alerts types.List `tfsdk:"alerts" tf:"optional"` // A list of email addresses notified when a configured alert is triggered. - EmailRecipients []types.String `tfsdk:"email_recipients" tf:"optional"` + EmailRecipients types.List `tfsdk:"email_recipients" tf:"optional"` } func (newState *Notifications) SyncEffectiveFieldsDuringCreateOrUpdate(plan Notifications) { @@ -599,6 +2790,98 @@ func (newState *Notifications) SyncEffectiveFieldsDuringCreateOrUpdate(plan Noti func (newState *Notifications) SyncEffectiveFieldsDuringRead(existingState Notifications) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Notifications. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Notifications) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alerts": reflect.TypeOf(types.String{}), + "email_recipients": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Notifications +// only implements ToObjectValue() and Type(). +func (o Notifications) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alerts": o.Alerts, + "email_recipients": o.EmailRecipients, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Notifications) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alerts": basetypes.ListType{ + ElemType: types.StringType, + }, + "email_recipients": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAlerts returns the value of the Alerts field in Notifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Notifications) GetAlerts(ctx context.Context) ([]types.String, bool) { + if o.Alerts.IsNull() || o.Alerts.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Alerts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAlerts sets the value of the Alerts field in Notifications. +func (o *Notifications) SetAlerts(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alerts"] + t = t.(attr.TypeWithElementType).ElementType() + o.Alerts = types.ListValueMust(t, vs) +} + +// GetEmailRecipients returns the value of the EmailRecipients field in Notifications as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Notifications) GetEmailRecipients(ctx context.Context) ([]types.String, bool) { + if o.EmailRecipients.IsNull() || o.EmailRecipients.IsUnknown() { + return nil, false + } + var v []types.String + d := o.EmailRecipients.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmailRecipients sets the value of the EmailRecipients field in Notifications. +func (o *Notifications) SetEmailRecipients(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email_recipients"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmailRecipients = types.ListValueMust(t, vs) +} + type Origin struct { // The id of a batch. Unique within a flow. BatchId types.Int64 `tfsdk:"batch_id" tf:"optional"` @@ -643,6 +2926,69 @@ func (newState *Origin) SyncEffectiveFieldsDuringCreateOrUpdate(plan Origin) { func (newState *Origin) SyncEffectiveFieldsDuringRead(existingState Origin) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Origin. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Origin) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Origin +// only implements ToObjectValue() and Type(). +func (o Origin) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "batch_id": o.BatchId, + "cloud": o.Cloud, + "cluster_id": o.ClusterId, + "dataset_name": o.DatasetName, + "flow_id": o.FlowId, + "flow_name": o.FlowName, + "host": o.Host, + "maintenance_id": o.MaintenanceId, + "materialization_name": o.MaterializationName, + "org_id": o.OrgId, + "pipeline_id": o.PipelineId, + "pipeline_name": o.PipelineName, + "region": o.Region, + "request_id": o.RequestId, + "table_id": o.TableId, + "uc_resource_id": o.UcResourceId, + "update_id": o.UpdateId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Origin) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "batch_id": types.Int64Type, + "cloud": types.StringType, + "cluster_id": types.StringType, + "dataset_name": types.StringType, + "flow_id": types.StringType, + "flow_name": types.StringType, + "host": types.StringType, + "maintenance_id": types.StringType, + "materialization_name": types.StringType, + "org_id": types.Int64Type, + "pipeline_id": types.StringType, + "pipeline_name": types.StringType, + "region": types.StringType, + "request_id": types.StringType, + "table_id": types.StringType, + "uc_resource_id": types.StringType, + "update_id": types.StringType, + }, + } +} + type PipelineAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -660,9 +3006,46 @@ func (newState *PipelineAccessControlRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *PipelineAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState PipelineAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o PipelineAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type PipelineAccessControlResponse struct { // All permissions. - AllPermissions []PipelinePermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -679,6 +3062,75 @@ func (newState *PipelineAccessControlResponse) SyncEffectiveFieldsDuringCreateOr func (newState *PipelineAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState PipelineAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(PipelinePermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o PipelineAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: PipelinePermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in PipelineAccessControlResponse as +// a slice of PipelinePermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineAccessControlResponse) GetAllPermissions(ctx context.Context) ([]PipelinePermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []PipelinePermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in PipelineAccessControlResponse. +func (o *PipelineAccessControlResponse) SetAllPermissions(ctx context.Context, v []PipelinePermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type PipelineCluster struct { // Note: This field won't be persisted. Only API users will check this // field. @@ -686,20 +3138,20 @@ type PipelineCluster struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - Autoscale []PipelineClusterAutoscale `tfsdk:"autoscale" tf:"optional,object"` + Autoscale types.List `tfsdk:"autoscale" tf:"optional,object"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - AwsAttributes compute.AwsAttributes `tfsdk:"aws_attributes" tf:"optional,object"` + AwsAttributes types.List `tfsdk:"aws_attributes" tf:"optional,object"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - AzureAttributes compute.AzureAttributes `tfsdk:"azure_attributes" tf:"optional,object"` + AzureAttributes types.List `tfsdk:"azure_attributes" tf:"optional,object"` // The configuration for delivering spark logs to a long-term storage // destination. Only dbfs destinations are supported. Only one destination // can be specified for one cluster. If the conf is given, the logs will be // delivered to the destination every `5 mins`. The destination of driver // logs is `$destination/$clusterId/driver`, while the destination of // executor logs is `$destination/$clusterId/executor`. - ClusterLogConf compute.ClusterLogConf `tfsdk:"cluster_log_conf" tf:"optional,object"` + ClusterLogConf types.List `tfsdk:"cluster_log_conf" tf:"optional,object"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: @@ -708,7 +3160,7 @@ type PipelineCluster struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. @@ -721,12 +3173,12 @@ type PipelineCluster struct { EnableLocalDiskEncryption types.Bool `tfsdk:"enable_local_disk_encryption" tf:"optional"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - GcpAttributes compute.GcpAttributes `tfsdk:"gcp_attributes" tf:"optional,object"` + GcpAttributes types.List `tfsdk:"gcp_attributes" tf:"optional,object"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - InitScripts compute.InitScriptInfo `tfsdk:"init_scripts" tf:"optional"` + InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` // A label for the cluster specification, either `default` to configure the @@ -755,7 +3207,7 @@ type PipelineCluster struct { // An object containing a set of optional, user-specified Spark // configuration key-value pairs. See :method:clusters/create for more // details. - SparkConf map[string]types.String `tfsdk:"spark_conf" tf:"optional"` + SparkConf types.Map `tfsdk:"spark_conf" tf:"optional"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form // (X,Y) will be exported as is (i.e., `export X='Y'`) while launching the @@ -769,11 +3221,11 @@ type PipelineCluster struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - SparkEnvVars map[string]types.String `tfsdk:"spark_env_vars" tf:"optional"` + SparkEnvVars types.Map `tfsdk:"spark_env_vars" tf:"optional"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - SshPublicKeys []types.String `tfsdk:"ssh_public_keys" tf:"optional"` + SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` } func (newState *PipelineCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan PipelineCluster) { @@ -782,6 +3234,364 @@ func (newState *PipelineCluster) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pi func (newState *PipelineCluster) SyncEffectiveFieldsDuringRead(existingState PipelineCluster) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineCluster. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineCluster) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "autoscale": reflect.TypeOf(PipelineClusterAutoscale{}), + "aws_attributes": reflect.TypeOf(compute_tf.AwsAttributes{}), + "azure_attributes": reflect.TypeOf(compute_tf.AzureAttributes{}), + "cluster_log_conf": reflect.TypeOf(compute_tf.ClusterLogConf{}), + "custom_tags": reflect.TypeOf(types.String{}), + "gcp_attributes": reflect.TypeOf(compute_tf.GcpAttributes{}), + "init_scripts": reflect.TypeOf(compute_tf.InitScriptInfo{}), + "spark_conf": reflect.TypeOf(types.String{}), + "spark_env_vars": reflect.TypeOf(types.String{}), + "ssh_public_keys": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineCluster +// only implements ToObjectValue() and Type(). +func (o PipelineCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_policy_default_values": o.ApplyPolicyDefaultValues, + "autoscale": o.Autoscale, + "aws_attributes": o.AwsAttributes, + "azure_attributes": o.AzureAttributes, + "cluster_log_conf": o.ClusterLogConf, + "custom_tags": o.CustomTags, + "driver_instance_pool_id": o.DriverInstancePoolId, + "driver_node_type_id": o.DriverNodeTypeId, + "enable_local_disk_encryption": o.EnableLocalDiskEncryption, + "gcp_attributes": o.GcpAttributes, + "init_scripts": o.InitScripts, + "instance_pool_id": o.InstancePoolId, + "label": o.Label, + "node_type_id": o.NodeTypeId, + "num_workers": o.NumWorkers, + "policy_id": o.PolicyId, + "spark_conf": o.SparkConf, + "spark_env_vars": o.SparkEnvVars, + "ssh_public_keys": o.SshPublicKeys, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineCluster) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_policy_default_values": types.BoolType, + "autoscale": basetypes.ListType{ + ElemType: PipelineClusterAutoscale{}.Type(ctx), + }, + "aws_attributes": basetypes.ListType{ + ElemType: compute_tf.AwsAttributes{}.Type(ctx), + }, + "azure_attributes": basetypes.ListType{ + ElemType: compute_tf.AzureAttributes{}.Type(ctx), + }, + "cluster_log_conf": basetypes.ListType{ + ElemType: compute_tf.ClusterLogConf{}.Type(ctx), + }, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "driver_instance_pool_id": types.StringType, + "driver_node_type_id": types.StringType, + "enable_local_disk_encryption": types.BoolType, + "gcp_attributes": basetypes.ListType{ + ElemType: compute_tf.GcpAttributes{}.Type(ctx), + }, + "init_scripts": basetypes.ListType{ + ElemType: compute_tf.InitScriptInfo{}.Type(ctx), + }, + "instance_pool_id": types.StringType, + "label": types.StringType, + "node_type_id": types.StringType, + "num_workers": types.Int64Type, + "policy_id": types.StringType, + "spark_conf": basetypes.MapType{ + ElemType: types.StringType, + }, + "spark_env_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "ssh_public_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAutoscale returns the value of the Autoscale field in PipelineCluster as +// a PipelineClusterAutoscale value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetAutoscale(ctx context.Context) (PipelineClusterAutoscale, bool) { + var e PipelineClusterAutoscale + if o.Autoscale.IsNull() || o.Autoscale.IsUnknown() { + return e, false + } + var v []PipelineClusterAutoscale + d := o.Autoscale.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoscale sets the value of the Autoscale field in PipelineCluster. +func (o *PipelineCluster) SetAutoscale(ctx context.Context, v PipelineClusterAutoscale) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["autoscale"] + o.Autoscale = types.ListValueMust(t, vs) +} + +// GetAwsAttributes returns the value of the AwsAttributes field in PipelineCluster as +// a compute_tf.AwsAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetAwsAttributes(ctx context.Context) (compute_tf.AwsAttributes, bool) { + var e compute_tf.AwsAttributes + if o.AwsAttributes.IsNull() || o.AwsAttributes.IsUnknown() { + return e, false + } + var v []compute_tf.AwsAttributes + d := o.AwsAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsAttributes sets the value of the AwsAttributes field in PipelineCluster. +func (o *PipelineCluster) SetAwsAttributes(ctx context.Context, v compute_tf.AwsAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_attributes"] + o.AwsAttributes = types.ListValueMust(t, vs) +} + +// GetAzureAttributes returns the value of the AzureAttributes field in PipelineCluster as +// a compute_tf.AzureAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetAzureAttributes(ctx context.Context) (compute_tf.AzureAttributes, bool) { + var e compute_tf.AzureAttributes + if o.AzureAttributes.IsNull() || o.AzureAttributes.IsUnknown() { + return e, false + } + var v []compute_tf.AzureAttributes + d := o.AzureAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureAttributes sets the value of the AzureAttributes field in PipelineCluster. +func (o *PipelineCluster) SetAzureAttributes(ctx context.Context, v compute_tf.AzureAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_attributes"] + o.AzureAttributes = types.ListValueMust(t, vs) +} + +// GetClusterLogConf returns the value of the ClusterLogConf field in PipelineCluster as +// a compute_tf.ClusterLogConf value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetClusterLogConf(ctx context.Context) (compute_tf.ClusterLogConf, bool) { + var e compute_tf.ClusterLogConf + if o.ClusterLogConf.IsNull() || o.ClusterLogConf.IsUnknown() { + return e, false + } + var v []compute_tf.ClusterLogConf + d := o.ClusterLogConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetClusterLogConf sets the value of the ClusterLogConf field in PipelineCluster. +func (o *PipelineCluster) SetClusterLogConf(ctx context.Context, v compute_tf.ClusterLogConf) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cluster_log_conf"] + o.ClusterLogConf = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in PipelineCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in PipelineCluster. +func (o *PipelineCluster) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetGcpAttributes returns the value of the GcpAttributes field in PipelineCluster as +// a compute_tf.GcpAttributes value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetGcpAttributes(ctx context.Context) (compute_tf.GcpAttributes, bool) { + var e compute_tf.GcpAttributes + if o.GcpAttributes.IsNull() || o.GcpAttributes.IsUnknown() { + return e, false + } + var v []compute_tf.GcpAttributes + d := o.GcpAttributes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpAttributes sets the value of the GcpAttributes field in PipelineCluster. +func (o *PipelineCluster) SetGcpAttributes(ctx context.Context, v compute_tf.GcpAttributes) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_attributes"] + o.GcpAttributes = types.ListValueMust(t, vs) +} + +// GetInitScripts returns the value of the InitScripts field in PipelineCluster as +// a slice of compute_tf.InitScriptInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetInitScripts(ctx context.Context) ([]compute_tf.InitScriptInfo, bool) { + if o.InitScripts.IsNull() || o.InitScripts.IsUnknown() { + return nil, false + } + var v []compute_tf.InitScriptInfo + d := o.InitScripts.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInitScripts sets the value of the InitScripts field in PipelineCluster. +func (o *PipelineCluster) SetInitScripts(ctx context.Context, v []compute_tf.InitScriptInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["init_scripts"] + t = t.(attr.TypeWithElementType).ElementType() + o.InitScripts = types.ListValueMust(t, vs) +} + +// GetSparkConf returns the value of the SparkConf field in PipelineCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetSparkConf(ctx context.Context) (map[string]types.String, bool) { + if o.SparkConf.IsNull() || o.SparkConf.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkConf.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkConf sets the value of the SparkConf field in PipelineCluster. +func (o *PipelineCluster) SetSparkConf(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_conf"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkConf = types.MapValueMust(t, vs) +} + +// GetSparkEnvVars returns the value of the SparkEnvVars field in PipelineCluster as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetSparkEnvVars(ctx context.Context) (map[string]types.String, bool) { + if o.SparkEnvVars.IsNull() || o.SparkEnvVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.SparkEnvVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSparkEnvVars sets the value of the SparkEnvVars field in PipelineCluster. +func (o *PipelineCluster) SetSparkEnvVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["spark_env_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.SparkEnvVars = types.MapValueMust(t, vs) +} + +// GetSshPublicKeys returns the value of the SshPublicKeys field in PipelineCluster as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineCluster) GetSshPublicKeys(ctx context.Context) ([]types.String, bool) { + if o.SshPublicKeys.IsNull() || o.SshPublicKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SshPublicKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSshPublicKeys sets the value of the SshPublicKeys field in PipelineCluster. +func (o *PipelineCluster) SetSshPublicKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ssh_public_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.SshPublicKeys = types.ListValueMust(t, vs) +} + type PipelineClusterAutoscale struct { // The maximum number of workers to which the cluster can scale up when // overloaded. `max_workers` must be strictly greater than `min_workers`. @@ -804,6 +3614,41 @@ func (newState *PipelineClusterAutoscale) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *PipelineClusterAutoscale) SyncEffectiveFieldsDuringRead(existingState PipelineClusterAutoscale) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineClusterAutoscale. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineClusterAutoscale) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineClusterAutoscale +// only implements ToObjectValue() and Type(). +func (o PipelineClusterAutoscale) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_workers": o.MaxWorkers, + "min_workers": o.MinWorkers, + "mode": o.Mode, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineClusterAutoscale) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_workers": types.Int64Type, + "min_workers": types.Int64Type, + "mode": types.StringType, + }, + } +} + type PipelineDeployment struct { // The deployment method that manages the pipeline. Kind types.String `tfsdk:"kind" tf:"optional"` @@ -817,9 +3662,42 @@ func (newState *PipelineDeployment) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PipelineDeployment) SyncEffectiveFieldsDuringRead(existingState PipelineDeployment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineDeployment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineDeployment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineDeployment +// only implements ToObjectValue() and Type(). +func (o PipelineDeployment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "kind": o.Kind, + "metadata_file_path": o.MetadataFilePath, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineDeployment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "kind": types.StringType, + "metadata_file_path": types.StringType, + }, + } +} + type PipelineEvent struct { // Information about an error captured by the event. - Error []ErrorDetail `tfsdk:"error" tf:"optional,object"` + Error types.List `tfsdk:"error" tf:"optional,object"` // The event type. Should always correspond to the details EventType types.String `tfsdk:"event_type" tf:"optional"` // A time-based, globally unique id. @@ -831,9 +3709,9 @@ type PipelineEvent struct { // The display message associated with the event. Message types.String `tfsdk:"message" tf:"optional"` // Describes where the event originates from. - Origin []Origin `tfsdk:"origin" tf:"optional,object"` + Origin types.List `tfsdk:"origin" tf:"optional,object"` // A sequencing object to identify and order events. - Sequence []Sequencing `tfsdk:"sequence" tf:"optional,object"` + Sequence types.List `tfsdk:"sequence" tf:"optional,object"` // The time of the event. Timestamp types.String `tfsdk:"timestamp" tf:"optional"` } @@ -844,17 +3722,152 @@ func (newState *PipelineEvent) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pipe func (newState *PipelineEvent) SyncEffectiveFieldsDuringRead(existingState PipelineEvent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineEvent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineEvent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "error": reflect.TypeOf(ErrorDetail{}), + "origin": reflect.TypeOf(Origin{}), + "sequence": reflect.TypeOf(Sequencing{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineEvent +// only implements ToObjectValue() and Type(). +func (o PipelineEvent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error": o.Error, + "event_type": o.EventType, + "id": o.Id, + "level": o.Level, + "maturity_level": o.MaturityLevel, + "message": o.Message, + "origin": o.Origin, + "sequence": o.Sequence, + "timestamp": o.Timestamp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineEvent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error": basetypes.ListType{ + ElemType: ErrorDetail{}.Type(ctx), + }, + "event_type": types.StringType, + "id": types.StringType, + "level": types.StringType, + "maturity_level": types.StringType, + "message": types.StringType, + "origin": basetypes.ListType{ + ElemType: Origin{}.Type(ctx), + }, + "sequence": basetypes.ListType{ + ElemType: Sequencing{}.Type(ctx), + }, + "timestamp": types.StringType, + }, + } +} + +// GetError returns the value of the Error field in PipelineEvent as +// a ErrorDetail value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineEvent) GetError(ctx context.Context) (ErrorDetail, bool) { + var e ErrorDetail + if o.Error.IsNull() || o.Error.IsUnknown() { + return e, false + } + var v []ErrorDetail + d := o.Error.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetError sets the value of the Error field in PipelineEvent. +func (o *PipelineEvent) SetError(ctx context.Context, v ErrorDetail) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["error"] + o.Error = types.ListValueMust(t, vs) +} + +// GetOrigin returns the value of the Origin field in PipelineEvent as +// a Origin value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineEvent) GetOrigin(ctx context.Context) (Origin, bool) { + var e Origin + if o.Origin.IsNull() || o.Origin.IsUnknown() { + return e, false + } + var v []Origin + d := o.Origin.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOrigin sets the value of the Origin field in PipelineEvent. +func (o *PipelineEvent) SetOrigin(ctx context.Context, v Origin) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["origin"] + o.Origin = types.ListValueMust(t, vs) +} + +// GetSequence returns the value of the Sequence field in PipelineEvent as +// a Sequencing value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineEvent) GetSequence(ctx context.Context) (Sequencing, bool) { + var e Sequencing + if o.Sequence.IsNull() || o.Sequence.IsUnknown() { + return e, false + } + var v []Sequencing + d := o.Sequence.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSequence sets the value of the Sequence field in PipelineEvent. +func (o *PipelineEvent) SetSequence(ctx context.Context, v Sequencing) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sequence"] + o.Sequence = types.ListValueMust(t, vs) +} + type PipelineLibrary struct { // The path to a file that defines a pipeline and is stored in the // Databricks Repos. - File []FileLibrary `tfsdk:"file" tf:"optional,object"` + File types.List `tfsdk:"file" tf:"optional,object"` // URI of the jar to be installed. Currently only DBFS is supported. Jar types.String `tfsdk:"jar" tf:"optional"` // Specification of a maven library to be installed. - Maven compute.MavenLibrary `tfsdk:"maven" tf:"optional,object"` + Maven types.List `tfsdk:"maven" tf:"optional,object"` // The path to a notebook that defines a pipeline and is stored in the // Databricks workspace. - Notebook []NotebookLibrary `tfsdk:"notebook" tf:"optional,object"` + Notebook types.List `tfsdk:"notebook" tf:"optional,object"` // URI of the whl to be installed. Whl types.String `tfsdk:"whl" tf:"optional"` } @@ -865,10 +3878,137 @@ func (newState *PipelineLibrary) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pi func (newState *PipelineLibrary) SyncEffectiveFieldsDuringRead(existingState PipelineLibrary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineLibrary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineLibrary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "file": reflect.TypeOf(FileLibrary{}), + "maven": reflect.TypeOf(compute_tf.MavenLibrary{}), + "notebook": reflect.TypeOf(NotebookLibrary{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineLibrary +// only implements ToObjectValue() and Type(). +func (o PipelineLibrary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "file": o.File, + "jar": o.Jar, + "maven": o.Maven, + "notebook": o.Notebook, + "whl": o.Whl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineLibrary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "file": basetypes.ListType{ + ElemType: FileLibrary{}.Type(ctx), + }, + "jar": types.StringType, + "maven": basetypes.ListType{ + ElemType: compute_tf.MavenLibrary{}.Type(ctx), + }, + "notebook": basetypes.ListType{ + ElemType: NotebookLibrary{}.Type(ctx), + }, + "whl": types.StringType, + }, + } +} + +// GetFile returns the value of the File field in PipelineLibrary as +// a FileLibrary value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineLibrary) GetFile(ctx context.Context) (FileLibrary, bool) { + var e FileLibrary + if o.File.IsNull() || o.File.IsUnknown() { + return e, false + } + var v []FileLibrary + d := o.File.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFile sets the value of the File field in PipelineLibrary. +func (o *PipelineLibrary) SetFile(ctx context.Context, v FileLibrary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["file"] + o.File = types.ListValueMust(t, vs) +} + +// GetMaven returns the value of the Maven field in PipelineLibrary as +// a compute_tf.MavenLibrary value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineLibrary) GetMaven(ctx context.Context) (compute_tf.MavenLibrary, bool) { + var e compute_tf.MavenLibrary + if o.Maven.IsNull() || o.Maven.IsUnknown() { + return e, false + } + var v []compute_tf.MavenLibrary + d := o.Maven.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMaven sets the value of the Maven field in PipelineLibrary. +func (o *PipelineLibrary) SetMaven(ctx context.Context, v compute_tf.MavenLibrary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["maven"] + o.Maven = types.ListValueMust(t, vs) +} + +// GetNotebook returns the value of the Notebook field in PipelineLibrary as +// a NotebookLibrary value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineLibrary) GetNotebook(ctx context.Context) (NotebookLibrary, bool) { + var e NotebookLibrary + if o.Notebook.IsNull() || o.Notebook.IsUnknown() { + return e, false + } + var v []NotebookLibrary + d := o.Notebook.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNotebook sets the value of the Notebook field in PipelineLibrary. +func (o *PipelineLibrary) SetNotebook(ctx context.Context, v NotebookLibrary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook"] + o.Notebook = types.ListValueMust(t, vs) +} + type PipelinePermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -879,8 +4019,73 @@ func (newState *PipelinePermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PipelinePermission) SyncEffectiveFieldsDuringRead(existingState PipelinePermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelinePermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelinePermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelinePermission +// only implements ToObjectValue() and Type(). +func (o PipelinePermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelinePermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in PipelinePermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelinePermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in PipelinePermission. +func (o *PipelinePermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type PipelinePermissions struct { - AccessControlList []PipelineAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -893,6 +4098,71 @@ func (newState *PipelinePermissions) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *PipelinePermissions) SyncEffectiveFieldsDuringRead(existingState PipelinePermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelinePermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelinePermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(PipelineAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelinePermissions +// only implements ToObjectValue() and Type(). +func (o PipelinePermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelinePermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: PipelineAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in PipelinePermissions as +// a slice of PipelineAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelinePermissions) GetAccessControlList(ctx context.Context) ([]PipelineAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []PipelineAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in PipelinePermissions. +func (o *PipelinePermissions) SetAccessControlList(ctx context.Context, v []PipelineAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type PipelinePermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -905,8 +4175,41 @@ func (newState *PipelinePermissionsDescription) SyncEffectiveFieldsDuringCreateO func (newState *PipelinePermissionsDescription) SyncEffectiveFieldsDuringRead(existingState PipelinePermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelinePermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelinePermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelinePermissionsDescription +// only implements ToObjectValue() and Type(). +func (o PipelinePermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelinePermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type PipelinePermissionsRequest struct { - AccessControlList []PipelineAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The pipeline for which to get or manage permissions. PipelineId types.String `tfsdk:"-"` } @@ -917,6 +4220,69 @@ func (newState *PipelinePermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *PipelinePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState PipelinePermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelinePermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelinePermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(PipelineAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelinePermissionsRequest +// only implements ToObjectValue() and Type(). +func (o PipelinePermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelinePermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: PipelineAccessControlRequest{}.Type(ctx), + }, + "pipeline_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in PipelinePermissionsRequest as +// a slice of PipelineAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelinePermissionsRequest) GetAccessControlList(ctx context.Context) ([]PipelineAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []PipelineAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in PipelinePermissionsRequest. +func (o *PipelinePermissionsRequest) SetAccessControlList(ctx context.Context, v []PipelineAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type PipelineSpec struct { // Budget policy of this pipeline. BudgetPolicyId types.String `tfsdk:"budget_policy_id" tf:"optional"` @@ -929,36 +4295,36 @@ type PipelineSpec struct { // DLT Release Channel that specifies which version to use. Channel types.String `tfsdk:"channel" tf:"optional"` // Cluster settings for this pipeline deployment. - Clusters []PipelineCluster `tfsdk:"clusters" tf:"optional"` + Clusters types.List `tfsdk:"clusters" tf:"optional"` // String-String configuration for this pipeline execution. - Configuration map[string]types.String `tfsdk:"configuration" tf:"optional"` + Configuration types.Map `tfsdk:"configuration" tf:"optional"` // Whether the pipeline is continuous or triggered. This replaces `trigger`. Continuous types.Bool `tfsdk:"continuous" tf:"optional"` // Deployment type of this pipeline. - Deployment []PipelineDeployment `tfsdk:"deployment" tf:"optional,object"` + Deployment types.List `tfsdk:"deployment" tf:"optional,object"` // Whether the pipeline is in Development mode. Defaults to false. Development types.Bool `tfsdk:"development" tf:"optional"` // Pipeline product edition. Edition types.String `tfsdk:"edition" tf:"optional"` // Filters on which Pipeline packages to include in the deployed graph. - Filters []Filters `tfsdk:"filters" tf:"optional,object"` + Filters types.List `tfsdk:"filters" tf:"optional,object"` // The definition of a gateway pipeline to support change data capture. - GatewayDefinition []IngestionGatewayPipelineDefinition `tfsdk:"gateway_definition" tf:"optional,object"` + GatewayDefinition types.List `tfsdk:"gateway_definition" tf:"optional,object"` // Unique identifier for this pipeline. Id types.String `tfsdk:"id" tf:"optional"` // The configuration for a managed ingestion pipeline. These settings cannot // be used with the 'libraries', 'target' or 'catalog' settings. - IngestionDefinition []IngestionPipelineDefinition `tfsdk:"ingestion_definition" tf:"optional,object"` + IngestionDefinition types.List `tfsdk:"ingestion_definition" tf:"optional,object"` // Libraries or code needed by this deployment. - Libraries []PipelineLibrary `tfsdk:"libraries" tf:"optional"` + Libraries types.List `tfsdk:"libraries" tf:"optional"` // Friendly identifier for this pipeline. Name types.String `tfsdk:"name" tf:"optional"` // List of notification settings for this pipeline. - Notifications []Notifications `tfsdk:"notifications" tf:"optional"` + Notifications types.List `tfsdk:"notifications" tf:"optional"` // Whether Photon is enabled for this pipeline. Photon types.Bool `tfsdk:"photon" tf:"optional"` // Restart window of this pipeline. - RestartWindow []RestartWindow `tfsdk:"restart_window" tf:"optional,object"` + RestartWindow types.List `tfsdk:"restart_window" tf:"optional,object"` // The default schema (database) where tables are read from or published to. // The presence of this field implies that the pipeline is in direct // publishing mode. @@ -972,7 +4338,7 @@ type PipelineSpec struct { // To publish to Unity Catalog, also specify `catalog`. Target types.String `tfsdk:"target" tf:"optional"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. - Trigger []PipelineTrigger `tfsdk:"trigger" tf:"optional,object"` + Trigger types.List `tfsdk:"trigger" tf:"optional,object"` } func (newState *PipelineSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan PipelineSpec) { @@ -981,6 +4347,372 @@ func (newState *PipelineSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pipel func (newState *PipelineSpec) SyncEffectiveFieldsDuringRead(existingState PipelineSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "clusters": reflect.TypeOf(PipelineCluster{}), + "configuration": reflect.TypeOf(types.String{}), + "deployment": reflect.TypeOf(PipelineDeployment{}), + "filters": reflect.TypeOf(Filters{}), + "gateway_definition": reflect.TypeOf(IngestionGatewayPipelineDefinition{}), + "ingestion_definition": reflect.TypeOf(IngestionPipelineDefinition{}), + "libraries": reflect.TypeOf(PipelineLibrary{}), + "notifications": reflect.TypeOf(Notifications{}), + "restart_window": reflect.TypeOf(RestartWindow{}), + "trigger": reflect.TypeOf(PipelineTrigger{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineSpec +// only implements ToObjectValue() and Type(). +func (o PipelineSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "budget_policy_id": o.BudgetPolicyId, + "catalog": o.Catalog, + "channel": o.Channel, + "clusters": o.Clusters, + "configuration": o.Configuration, + "continuous": o.Continuous, + "deployment": o.Deployment, + "development": o.Development, + "edition": o.Edition, + "filters": o.Filters, + "gateway_definition": o.GatewayDefinition, + "id": o.Id, + "ingestion_definition": o.IngestionDefinition, + "libraries": o.Libraries, + "name": o.Name, + "notifications": o.Notifications, + "photon": o.Photon, + "restart_window": o.RestartWindow, + "schema": o.Schema, + "serverless": o.Serverless, + "storage": o.Storage, + "target": o.Target, + "trigger": o.Trigger, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "budget_policy_id": types.StringType, + "catalog": types.StringType, + "channel": types.StringType, + "clusters": basetypes.ListType{ + ElemType: PipelineCluster{}.Type(ctx), + }, + "configuration": basetypes.MapType{ + ElemType: types.StringType, + }, + "continuous": types.BoolType, + "deployment": basetypes.ListType{ + ElemType: PipelineDeployment{}.Type(ctx), + }, + "development": types.BoolType, + "edition": types.StringType, + "filters": basetypes.ListType{ + ElemType: Filters{}.Type(ctx), + }, + "gateway_definition": basetypes.ListType{ + ElemType: IngestionGatewayPipelineDefinition{}.Type(ctx), + }, + "id": types.StringType, + "ingestion_definition": basetypes.ListType{ + ElemType: IngestionPipelineDefinition{}.Type(ctx), + }, + "libraries": basetypes.ListType{ + ElemType: PipelineLibrary{}.Type(ctx), + }, + "name": types.StringType, + "notifications": basetypes.ListType{ + ElemType: Notifications{}.Type(ctx), + }, + "photon": types.BoolType, + "restart_window": basetypes.ListType{ + ElemType: RestartWindow{}.Type(ctx), + }, + "schema": types.StringType, + "serverless": types.BoolType, + "storage": types.StringType, + "target": types.StringType, + "trigger": basetypes.ListType{ + ElemType: PipelineTrigger{}.Type(ctx), + }, + }, + } +} + +// GetClusters returns the value of the Clusters field in PipelineSpec as +// a slice of PipelineCluster values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetClusters(ctx context.Context) ([]PipelineCluster, bool) { + if o.Clusters.IsNull() || o.Clusters.IsUnknown() { + return nil, false + } + var v []PipelineCluster + d := o.Clusters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetClusters sets the value of the Clusters field in PipelineSpec. +func (o *PipelineSpec) SetClusters(ctx context.Context, v []PipelineCluster) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clusters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Clusters = types.ListValueMust(t, vs) +} + +// GetConfiguration returns the value of the Configuration field in PipelineSpec as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetConfiguration(ctx context.Context) (map[string]types.String, bool) { + if o.Configuration.IsNull() || o.Configuration.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Configuration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetConfiguration sets the value of the Configuration field in PipelineSpec. +func (o *PipelineSpec) SetConfiguration(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["configuration"] + t = t.(attr.TypeWithElementType).ElementType() + o.Configuration = types.MapValueMust(t, vs) +} + +// GetDeployment returns the value of the Deployment field in PipelineSpec as +// a PipelineDeployment value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetDeployment(ctx context.Context) (PipelineDeployment, bool) { + var e PipelineDeployment + if o.Deployment.IsNull() || o.Deployment.IsUnknown() { + return e, false + } + var v []PipelineDeployment + d := o.Deployment.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeployment sets the value of the Deployment field in PipelineSpec. +func (o *PipelineSpec) SetDeployment(ctx context.Context, v PipelineDeployment) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["deployment"] + o.Deployment = types.ListValueMust(t, vs) +} + +// GetFilters returns the value of the Filters field in PipelineSpec as +// a Filters value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetFilters(ctx context.Context) (Filters, bool) { + var e Filters + if o.Filters.IsNull() || o.Filters.IsUnknown() { + return e, false + } + var v []Filters + d := o.Filters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilters sets the value of the Filters field in PipelineSpec. +func (o *PipelineSpec) SetFilters(ctx context.Context, v Filters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filters"] + o.Filters = types.ListValueMust(t, vs) +} + +// GetGatewayDefinition returns the value of the GatewayDefinition field in PipelineSpec as +// a IngestionGatewayPipelineDefinition value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetGatewayDefinition(ctx context.Context) (IngestionGatewayPipelineDefinition, bool) { + var e IngestionGatewayPipelineDefinition + if o.GatewayDefinition.IsNull() || o.GatewayDefinition.IsUnknown() { + return e, false + } + var v []IngestionGatewayPipelineDefinition + d := o.GatewayDefinition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGatewayDefinition sets the value of the GatewayDefinition field in PipelineSpec. +func (o *PipelineSpec) SetGatewayDefinition(ctx context.Context, v IngestionGatewayPipelineDefinition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gateway_definition"] + o.GatewayDefinition = types.ListValueMust(t, vs) +} + +// GetIngestionDefinition returns the value of the IngestionDefinition field in PipelineSpec as +// a IngestionPipelineDefinition value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetIngestionDefinition(ctx context.Context) (IngestionPipelineDefinition, bool) { + var e IngestionPipelineDefinition + if o.IngestionDefinition.IsNull() || o.IngestionDefinition.IsUnknown() { + return e, false + } + var v []IngestionPipelineDefinition + d := o.IngestionDefinition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIngestionDefinition sets the value of the IngestionDefinition field in PipelineSpec. +func (o *PipelineSpec) SetIngestionDefinition(ctx context.Context, v IngestionPipelineDefinition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ingestion_definition"] + o.IngestionDefinition = types.ListValueMust(t, vs) +} + +// GetLibraries returns the value of the Libraries field in PipelineSpec as +// a slice of PipelineLibrary values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetLibraries(ctx context.Context) ([]PipelineLibrary, bool) { + if o.Libraries.IsNull() || o.Libraries.IsUnknown() { + return nil, false + } + var v []PipelineLibrary + d := o.Libraries.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLibraries sets the value of the Libraries field in PipelineSpec. +func (o *PipelineSpec) SetLibraries(ctx context.Context, v []PipelineLibrary) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["libraries"] + t = t.(attr.TypeWithElementType).ElementType() + o.Libraries = types.ListValueMust(t, vs) +} + +// GetNotifications returns the value of the Notifications field in PipelineSpec as +// a slice of Notifications values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetNotifications(ctx context.Context) ([]Notifications, bool) { + if o.Notifications.IsNull() || o.Notifications.IsUnknown() { + return nil, false + } + var v []Notifications + d := o.Notifications.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotifications sets the value of the Notifications field in PipelineSpec. +func (o *PipelineSpec) SetNotifications(ctx context.Context, v []Notifications) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notifications"] + t = t.(attr.TypeWithElementType).ElementType() + o.Notifications = types.ListValueMust(t, vs) +} + +// GetRestartWindow returns the value of the RestartWindow field in PipelineSpec as +// a RestartWindow value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetRestartWindow(ctx context.Context) (RestartWindow, bool) { + var e RestartWindow + if o.RestartWindow.IsNull() || o.RestartWindow.IsUnknown() { + return e, false + } + var v []RestartWindow + d := o.RestartWindow.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRestartWindow sets the value of the RestartWindow field in PipelineSpec. +func (o *PipelineSpec) SetRestartWindow(ctx context.Context, v RestartWindow) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["restart_window"] + o.RestartWindow = types.ListValueMust(t, vs) +} + +// GetTrigger returns the value of the Trigger field in PipelineSpec as +// a PipelineTrigger value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineSpec) GetTrigger(ctx context.Context) (PipelineTrigger, bool) { + var e PipelineTrigger + if o.Trigger.IsNull() || o.Trigger.IsUnknown() { + return e, false + } + var v []PipelineTrigger + d := o.Trigger.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrigger sets the value of the Trigger field in PipelineSpec. +func (o *PipelineSpec) SetTrigger(ctx context.Context, v PipelineTrigger) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["trigger"] + o.Trigger = types.ListValueMust(t, vs) +} + type PipelineStateInfo struct { // The unique identifier of the cluster running the pipeline. ClusterId types.String `tfsdk:"cluster_id" tf:"optional"` @@ -990,7 +4722,7 @@ type PipelineStateInfo struct { Health types.String `tfsdk:"health" tf:"optional"` // Status of the latest updates for the pipeline. Ordered with the newest // update first. - LatestUpdates []UpdateStateInfo `tfsdk:"latest_updates" tf:"optional"` + LatestUpdates types.List `tfsdk:"latest_updates" tf:"optional"` // The user-friendly name of the pipeline. Name types.String `tfsdk:"name" tf:"optional"` // The unique identifier of the pipeline. @@ -1008,10 +4740,85 @@ func (newState *PipelineStateInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PipelineStateInfo) SyncEffectiveFieldsDuringRead(existingState PipelineStateInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineStateInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineStateInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "latest_updates": reflect.TypeOf(UpdateStateInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineStateInfo +// only implements ToObjectValue() and Type(). +func (o PipelineStateInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cluster_id": o.ClusterId, + "creator_user_name": o.CreatorUserName, + "health": o.Health, + "latest_updates": o.LatestUpdates, + "name": o.Name, + "pipeline_id": o.PipelineId, + "run_as_user_name": o.RunAsUserName, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineStateInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cluster_id": types.StringType, + "creator_user_name": types.StringType, + "health": types.StringType, + "latest_updates": basetypes.ListType{ + ElemType: UpdateStateInfo{}.Type(ctx), + }, + "name": types.StringType, + "pipeline_id": types.StringType, + "run_as_user_name": types.StringType, + "state": types.StringType, + }, + } +} + +// GetLatestUpdates returns the value of the LatestUpdates field in PipelineStateInfo as +// a slice of UpdateStateInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineStateInfo) GetLatestUpdates(ctx context.Context) ([]UpdateStateInfo, bool) { + if o.LatestUpdates.IsNull() || o.LatestUpdates.IsUnknown() { + return nil, false + } + var v []UpdateStateInfo + d := o.LatestUpdates.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetLatestUpdates sets the value of the LatestUpdates field in PipelineStateInfo. +func (o *PipelineStateInfo) SetLatestUpdates(ctx context.Context, v []UpdateStateInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["latest_updates"] + t = t.(attr.TypeWithElementType).ElementType() + o.LatestUpdates = types.ListValueMust(t, vs) +} + type PipelineTrigger struct { - Cron []CronTrigger `tfsdk:"cron" tf:"optional,object"` + Cron types.List `tfsdk:"cron" tf:"optional,object"` - Manual []ManualTrigger `tfsdk:"manual" tf:"optional,object"` + Manual types.List `tfsdk:"manual" tf:"optional,object"` } func (newState *PipelineTrigger) SyncEffectiveFieldsDuringCreateOrUpdate(plan PipelineTrigger) { @@ -1020,6 +4827,98 @@ func (newState *PipelineTrigger) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pi func (newState *PipelineTrigger) SyncEffectiveFieldsDuringRead(existingState PipelineTrigger) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PipelineTrigger. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PipelineTrigger) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cron": reflect.TypeOf(CronTrigger{}), + "manual": reflect.TypeOf(ManualTrigger{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PipelineTrigger +// only implements ToObjectValue() and Type(). +func (o PipelineTrigger) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cron": o.Cron, + "manual": o.Manual, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PipelineTrigger) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cron": basetypes.ListType{ + ElemType: CronTrigger{}.Type(ctx), + }, + "manual": basetypes.ListType{ + ElemType: ManualTrigger{}.Type(ctx), + }, + }, + } +} + +// GetCron returns the value of the Cron field in PipelineTrigger as +// a CronTrigger value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineTrigger) GetCron(ctx context.Context) (CronTrigger, bool) { + var e CronTrigger + if o.Cron.IsNull() || o.Cron.IsUnknown() { + return e, false + } + var v []CronTrigger + d := o.Cron.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCron sets the value of the Cron field in PipelineTrigger. +func (o *PipelineTrigger) SetCron(ctx context.Context, v CronTrigger) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cron"] + o.Cron = types.ListValueMust(t, vs) +} + +// GetManual returns the value of the Manual field in PipelineTrigger as +// a ManualTrigger value. +// If the field is unknown or null, the boolean return value is false. +func (o *PipelineTrigger) GetManual(ctx context.Context) (ManualTrigger, bool) { + var e ManualTrigger + if o.Manual.IsNull() || o.Manual.IsUnknown() { + return e, false + } + var v []ManualTrigger + d := o.Manual.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetManual sets the value of the Manual field in PipelineTrigger. +func (o *PipelineTrigger) SetManual(ctx context.Context, v ManualTrigger) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["manual"] + o.Manual = types.ListValueMust(t, vs) +} + type ReportSpec struct { // Required. Destination catalog to store table. DestinationCatalog types.String `tfsdk:"destination_catalog" tf:"optional"` @@ -1033,7 +4932,7 @@ type ReportSpec struct { // Configuration settings to control the ingestion of tables. These settings // override the table_configuration defined in the // IngestionPipelineDefinition object. - TableConfiguration []TableSpecificConfig `tfsdk:"table_configuration" tf:"optional,object"` + TableConfiguration types.List `tfsdk:"table_configuration" tf:"optional,object"` } func (newState *ReportSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan ReportSpec) { @@ -1042,6 +4941,75 @@ func (newState *ReportSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan ReportS func (newState *ReportSpec) SyncEffectiveFieldsDuringRead(existingState ReportSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReportSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReportSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "table_configuration": reflect.TypeOf(TableSpecificConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReportSpec +// only implements ToObjectValue() and Type(). +func (o ReportSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_catalog": o.DestinationCatalog, + "destination_schema": o.DestinationSchema, + "destination_table": o.DestinationTable, + "source_url": o.SourceUrl, + "table_configuration": o.TableConfiguration, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ReportSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_catalog": types.StringType, + "destination_schema": types.StringType, + "destination_table": types.StringType, + "source_url": types.StringType, + "table_configuration": basetypes.ListType{ + ElemType: TableSpecificConfig{}.Type(ctx), + }, + }, + } +} + +// GetTableConfiguration returns the value of the TableConfiguration field in ReportSpec as +// a TableSpecificConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ReportSpec) GetTableConfiguration(ctx context.Context) (TableSpecificConfig, bool) { + var e TableSpecificConfig + if o.TableConfiguration.IsNull() || o.TableConfiguration.IsUnknown() { + return e, false + } + var v []TableSpecificConfig + d := o.TableConfiguration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTableConfiguration sets the value of the TableConfiguration field in ReportSpec. +func (o *ReportSpec) SetTableConfiguration(ctx context.Context, v TableSpecificConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_configuration"] + o.TableConfiguration = types.ListValueMust(t, vs) +} + type RestartWindow struct { // Days of week in which the restart is allowed to happen (within a // five-hour window starting at start_hour). If not specified all days of @@ -1063,6 +5031,41 @@ func (newState *RestartWindow) SyncEffectiveFieldsDuringCreateOrUpdate(plan Rest func (newState *RestartWindow) SyncEffectiveFieldsDuringRead(existingState RestartWindow) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestartWindow. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestartWindow) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestartWindow +// only implements ToObjectValue() and Type(). +func (o RestartWindow) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "days_of_week": o.DaysOfWeek, + "start_hour": o.StartHour, + "time_zone_id": o.TimeZoneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestartWindow) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "days_of_week": types.StringType, + "start_hour": types.Int64Type, + "time_zone_id": types.StringType, + }, + } +} + type SchemaSpec struct { // Required. Destination catalog to store tables. DestinationCatalog types.String `tfsdk:"destination_catalog" tf:"optional"` @@ -1078,7 +5081,7 @@ type SchemaSpec struct { // Configuration settings to control the ingestion of tables. These settings // are applied to all tables in this schema and override the // table_configuration defined in the IngestionPipelineDefinition object. - TableConfiguration []TableSpecificConfig `tfsdk:"table_configuration" tf:"optional,object"` + TableConfiguration types.List `tfsdk:"table_configuration" tf:"optional,object"` } func (newState *SchemaSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan SchemaSpec) { @@ -1087,11 +5090,80 @@ func (newState *SchemaSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan SchemaS func (newState *SchemaSpec) SyncEffectiveFieldsDuringRead(existingState SchemaSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SchemaSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SchemaSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "table_configuration": reflect.TypeOf(TableSpecificConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SchemaSpec +// only implements ToObjectValue() and Type(). +func (o SchemaSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_catalog": o.DestinationCatalog, + "destination_schema": o.DestinationSchema, + "source_catalog": o.SourceCatalog, + "source_schema": o.SourceSchema, + "table_configuration": o.TableConfiguration, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SchemaSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_catalog": types.StringType, + "destination_schema": types.StringType, + "source_catalog": types.StringType, + "source_schema": types.StringType, + "table_configuration": basetypes.ListType{ + ElemType: TableSpecificConfig{}.Type(ctx), + }, + }, + } +} + +// GetTableConfiguration returns the value of the TableConfiguration field in SchemaSpec as +// a TableSpecificConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *SchemaSpec) GetTableConfiguration(ctx context.Context) (TableSpecificConfig, bool) { + var e TableSpecificConfig + if o.TableConfiguration.IsNull() || o.TableConfiguration.IsUnknown() { + return e, false + } + var v []TableSpecificConfig + d := o.TableConfiguration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTableConfiguration sets the value of the TableConfiguration field in SchemaSpec. +func (o *SchemaSpec) SetTableConfiguration(ctx context.Context, v TableSpecificConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_configuration"] + o.TableConfiguration = types.ListValueMust(t, vs) +} + type Sequencing struct { // A sequence number, unique and increasing within the control plane. ControlPlaneSeqNo types.Int64 `tfsdk:"control_plane_seq_no" tf:"optional"` // the ID assigned by the data plane. - DataPlaneId []DataPlaneId `tfsdk:"data_plane_id" tf:"optional,object"` + DataPlaneId types.List `tfsdk:"data_plane_id" tf:"optional,object"` } func (newState *Sequencing) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sequencing) { @@ -1100,13 +5172,76 @@ func (newState *Sequencing) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sequenc func (newState *Sequencing) SyncEffectiveFieldsDuringRead(existingState Sequencing) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Sequencing. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Sequencing) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data_plane_id": reflect.TypeOf(DataPlaneId{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Sequencing +// only implements ToObjectValue() and Type(). +func (o Sequencing) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "control_plane_seq_no": o.ControlPlaneSeqNo, + "data_plane_id": o.DataPlaneId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Sequencing) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "control_plane_seq_no": types.Int64Type, + "data_plane_id": basetypes.ListType{ + ElemType: DataPlaneId{}.Type(ctx), + }, + }, + } +} + +// GetDataPlaneId returns the value of the DataPlaneId field in Sequencing as +// a DataPlaneId value. +// If the field is unknown or null, the boolean return value is false. +func (o *Sequencing) GetDataPlaneId(ctx context.Context) (DataPlaneId, bool) { + var e DataPlaneId + if o.DataPlaneId.IsNull() || o.DataPlaneId.IsUnknown() { + return e, false + } + var v []DataPlaneId + d := o.DataPlaneId.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataPlaneId sets the value of the DataPlaneId field in Sequencing. +func (o *Sequencing) SetDataPlaneId(ctx context.Context, v DataPlaneId) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_plane_id"] + o.DataPlaneId = types.ListValueMust(t, vs) +} + type SerializedException struct { // Runtime class of the exception ClassName types.String `tfsdk:"class_name" tf:"optional"` // Exception message Message types.String `tfsdk:"message" tf:"optional"` // Stack trace consisting of a list of stack frames - Stack []StackFrame `tfsdk:"stack" tf:"optional"` + Stack types.List `tfsdk:"stack" tf:"optional"` } func (newState *SerializedException) SyncEffectiveFieldsDuringCreateOrUpdate(plan SerializedException) { @@ -1115,6 +5250,71 @@ func (newState *SerializedException) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *SerializedException) SyncEffectiveFieldsDuringRead(existingState SerializedException) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SerializedException. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SerializedException) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "stack": reflect.TypeOf(StackFrame{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SerializedException +// only implements ToObjectValue() and Type(). +func (o SerializedException) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "class_name": o.ClassName, + "message": o.Message, + "stack": o.Stack, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SerializedException) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "class_name": types.StringType, + "message": types.StringType, + "stack": basetypes.ListType{ + ElemType: StackFrame{}.Type(ctx), + }, + }, + } +} + +// GetStack returns the value of the Stack field in SerializedException as +// a slice of StackFrame values. +// If the field is unknown or null, the boolean return value is false. +func (o *SerializedException) GetStack(ctx context.Context) ([]StackFrame, bool) { + if o.Stack.IsNull() || o.Stack.IsUnknown() { + return nil, false + } + var v []StackFrame + d := o.Stack.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStack sets the value of the Stack field in SerializedException. +func (o *SerializedException) SetStack(ctx context.Context, v []StackFrame) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["stack"] + t = t.(attr.TypeWithElementType).ElementType() + o.Stack = types.ListValueMust(t, vs) +} + type StackFrame struct { // Class from which the method call originated DeclaringClass types.String `tfsdk:"declaring_class" tf:"optional"` @@ -1132,6 +5332,43 @@ func (newState *StackFrame) SyncEffectiveFieldsDuringCreateOrUpdate(plan StackFr func (newState *StackFrame) SyncEffectiveFieldsDuringRead(existingState StackFrame) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StackFrame. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StackFrame) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StackFrame +// only implements ToObjectValue() and Type(). +func (o StackFrame) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "declaring_class": o.DeclaringClass, + "file_name": o.FileName, + "line_number": o.LineNumber, + "method_name": o.MethodName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StackFrame) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "declaring_class": types.StringType, + "file_name": types.StringType, + "line_number": types.Int64Type, + "method_name": types.StringType, + }, + } +} + type StartUpdate struct { Cause types.String `tfsdk:"cause" tf:"optional"` // If true, this update will reset all tables before running. @@ -1140,14 +5377,14 @@ type StartUpdate struct { // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - FullRefreshSelection []types.String `tfsdk:"full_refresh_selection" tf:"optional"` + FullRefreshSelection types.List `tfsdk:"full_refresh_selection" tf:"optional"` PipelineId types.String `tfsdk:"-"` // A list of tables to update without fullRefresh. If both refresh_selection // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - RefreshSelection []types.String `tfsdk:"refresh_selection" tf:"optional"` + RefreshSelection types.List `tfsdk:"refresh_selection" tf:"optional"` // If true, this update only validates the correctness of pipeline source // code but does not materialize or publish any datasets. ValidateOnly types.Bool `tfsdk:"validate_only" tf:"optional"` @@ -1159,6 +5396,106 @@ func (newState *StartUpdate) SyncEffectiveFieldsDuringCreateOrUpdate(plan StartU func (newState *StartUpdate) SyncEffectiveFieldsDuringRead(existingState StartUpdate) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartUpdate. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartUpdate) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "full_refresh_selection": reflect.TypeOf(types.String{}), + "refresh_selection": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartUpdate +// only implements ToObjectValue() and Type(). +func (o StartUpdate) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cause": o.Cause, + "full_refresh": o.FullRefresh, + "full_refresh_selection": o.FullRefreshSelection, + "pipeline_id": o.PipelineId, + "refresh_selection": o.RefreshSelection, + "validate_only": o.ValidateOnly, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StartUpdate) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cause": types.StringType, + "full_refresh": types.BoolType, + "full_refresh_selection": basetypes.ListType{ + ElemType: types.StringType, + }, + "pipeline_id": types.StringType, + "refresh_selection": basetypes.ListType{ + ElemType: types.StringType, + }, + "validate_only": types.BoolType, + }, + } +} + +// GetFullRefreshSelection returns the value of the FullRefreshSelection field in StartUpdate as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *StartUpdate) GetFullRefreshSelection(ctx context.Context) ([]types.String, bool) { + if o.FullRefreshSelection.IsNull() || o.FullRefreshSelection.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FullRefreshSelection.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFullRefreshSelection sets the value of the FullRefreshSelection field in StartUpdate. +func (o *StartUpdate) SetFullRefreshSelection(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["full_refresh_selection"] + t = t.(attr.TypeWithElementType).ElementType() + o.FullRefreshSelection = types.ListValueMust(t, vs) +} + +// GetRefreshSelection returns the value of the RefreshSelection field in StartUpdate as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *StartUpdate) GetRefreshSelection(ctx context.Context) ([]types.String, bool) { + if o.RefreshSelection.IsNull() || o.RefreshSelection.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RefreshSelection.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRefreshSelection sets the value of the RefreshSelection field in StartUpdate. +func (o *StartUpdate) SetRefreshSelection(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["refresh_selection"] + t = t.(attr.TypeWithElementType).ElementType() + o.RefreshSelection = types.ListValueMust(t, vs) +} + type StartUpdateResponse struct { UpdateId types.String `tfsdk:"update_id" tf:"optional"` } @@ -1169,6 +5506,37 @@ func (newState *StartUpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *StartUpdateResponse) SyncEffectiveFieldsDuringRead(existingState StartUpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartUpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartUpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartUpdateResponse +// only implements ToObjectValue() and Type(). +func (o StartUpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "update_id": o.UpdateId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StartUpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "update_id": types.StringType, + }, + } +} + type StopPipelineResponse struct { } @@ -1178,6 +5546,33 @@ func (newState *StopPipelineResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *StopPipelineResponse) SyncEffectiveFieldsDuringRead(existingState StopPipelineResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StopPipelineResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StopPipelineResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StopPipelineResponse +// only implements ToObjectValue() and Type(). +func (o StopPipelineResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o StopPipelineResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Stop a pipeline type StopRequest struct { PipelineId types.String `tfsdk:"-"` @@ -1189,6 +5584,37 @@ func (newState *StopRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan StopRe func (newState *StopRequest) SyncEffectiveFieldsDuringRead(existingState StopRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StopRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StopRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StopRequest +// only implements ToObjectValue() and Type(). +func (o StopRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "pipeline_id": o.PipelineId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StopRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "pipeline_id": types.StringType, + }, + } +} + type TableSpec struct { // Required. Destination catalog to store table. DestinationCatalog types.String `tfsdk:"destination_catalog" tf:"optional"` @@ -1207,7 +5633,7 @@ type TableSpec struct { // Configuration settings to control the ingestion of tables. These settings // override the table_configuration defined in the // IngestionPipelineDefinition object and the SchemaSpec. - TableConfiguration []TableSpecificConfig `tfsdk:"table_configuration" tf:"optional,object"` + TableConfiguration types.List `tfsdk:"table_configuration" tf:"optional,object"` } func (newState *TableSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableSpec) { @@ -1216,9 +5642,82 @@ func (newState *TableSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableSpe func (newState *TableSpec) SyncEffectiveFieldsDuringRead(existingState TableSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "table_configuration": reflect.TypeOf(TableSpecificConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableSpec +// only implements ToObjectValue() and Type(). +func (o TableSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_catalog": o.DestinationCatalog, + "destination_schema": o.DestinationSchema, + "destination_table": o.DestinationTable, + "source_catalog": o.SourceCatalog, + "source_schema": o.SourceSchema, + "source_table": o.SourceTable, + "table_configuration": o.TableConfiguration, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_catalog": types.StringType, + "destination_schema": types.StringType, + "destination_table": types.StringType, + "source_catalog": types.StringType, + "source_schema": types.StringType, + "source_table": types.StringType, + "table_configuration": basetypes.ListType{ + ElemType: TableSpecificConfig{}.Type(ctx), + }, + }, + } +} + +// GetTableConfiguration returns the value of the TableConfiguration field in TableSpec as +// a TableSpecificConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *TableSpec) GetTableConfiguration(ctx context.Context) (TableSpecificConfig, bool) { + var e TableSpecificConfig + if o.TableConfiguration.IsNull() || o.TableConfiguration.IsUnknown() { + return e, false + } + var v []TableSpecificConfig + d := o.TableConfiguration.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTableConfiguration sets the value of the TableConfiguration field in TableSpec. +func (o *TableSpec) SetTableConfiguration(ctx context.Context, v TableSpecificConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["table_configuration"] + o.TableConfiguration = types.ListValueMust(t, vs) +} + type TableSpecificConfig struct { // The primary key of the table used to apply changes. - PrimaryKeys []types.String `tfsdk:"primary_keys" tf:"optional"` + PrimaryKeys types.List `tfsdk:"primary_keys" tf:"optional"` // If true, formula fields defined in the table are included in the // ingestion. This setting is only valid for the Salesforce connector SalesforceIncludeFormulaFields types.Bool `tfsdk:"salesforce_include_formula_fields" tf:"optional"` @@ -1227,7 +5726,7 @@ type TableSpecificConfig struct { // The column names specifying the logical order of events in the source // data. Delta Live Tables uses this sequencing to handle change events that // arrive out of order. - SequenceBy []types.String `tfsdk:"sequence_by" tf:"optional"` + SequenceBy types.List `tfsdk:"sequence_by" tf:"optional"` } func (newState *TableSpecificConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan TableSpecificConfig) { @@ -1236,6 +5735,102 @@ func (newState *TableSpecificConfig) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *TableSpecificConfig) SyncEffectiveFieldsDuringRead(existingState TableSpecificConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TableSpecificConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TableSpecificConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "primary_keys": reflect.TypeOf(types.String{}), + "sequence_by": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TableSpecificConfig +// only implements ToObjectValue() and Type(). +func (o TableSpecificConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "primary_keys": o.PrimaryKeys, + "salesforce_include_formula_fields": o.SalesforceIncludeFormulaFields, + "scd_type": o.ScdType, + "sequence_by": o.SequenceBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TableSpecificConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "primary_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "salesforce_include_formula_fields": types.BoolType, + "scd_type": types.StringType, + "sequence_by": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPrimaryKeys returns the value of the PrimaryKeys field in TableSpecificConfig as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableSpecificConfig) GetPrimaryKeys(ctx context.Context) ([]types.String, bool) { + if o.PrimaryKeys.IsNull() || o.PrimaryKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PrimaryKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrimaryKeys sets the value of the PrimaryKeys field in TableSpecificConfig. +func (o *TableSpecificConfig) SetPrimaryKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["primary_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.PrimaryKeys = types.ListValueMust(t, vs) +} + +// GetSequenceBy returns the value of the SequenceBy field in TableSpecificConfig as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TableSpecificConfig) GetSequenceBy(ctx context.Context) ([]types.String, bool) { + if o.SequenceBy.IsNull() || o.SequenceBy.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SequenceBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSequenceBy sets the value of the SequenceBy field in TableSpecificConfig. +func (o *TableSpecificConfig) SetSequenceBy(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sequence_by"] + t = t.(attr.TypeWithElementType).ElementType() + o.SequenceBy = types.ListValueMust(t, vs) +} + type UpdateInfo struct { // What triggered this update. Cause types.String `tfsdk:"cause" tf:"optional"` @@ -1243,7 +5838,7 @@ type UpdateInfo struct { ClusterId types.String `tfsdk:"cluster_id" tf:"optional"` // The pipeline configuration with system defaults applied where unspecified // by the user. Not returned by ListUpdates. - Config []PipelineSpec `tfsdk:"config" tf:"optional,object"` + Config types.List `tfsdk:"config" tf:"optional,object"` // The time when this update was created. CreationTime types.Int64 `tfsdk:"creation_time" tf:"optional"` // If true, this update will reset all tables before running. @@ -1252,14 +5847,14 @@ type UpdateInfo struct { // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - FullRefreshSelection []types.String `tfsdk:"full_refresh_selection" tf:"optional"` + FullRefreshSelection types.List `tfsdk:"full_refresh_selection" tf:"optional"` // The ID of the pipeline. PipelineId types.String `tfsdk:"pipeline_id" tf:"optional"` // A list of tables to update without fullRefresh. If both refresh_selection // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - RefreshSelection []types.String `tfsdk:"refresh_selection" tf:"optional"` + RefreshSelection types.List `tfsdk:"refresh_selection" tf:"optional"` // The update state. State types.String `tfsdk:"state" tf:"optional"` // The ID of this update. @@ -1275,6 +5870,145 @@ func (newState *UpdateInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateI func (newState *UpdateInfo) SyncEffectiveFieldsDuringRead(existingState UpdateInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "config": reflect.TypeOf(PipelineSpec{}), + "full_refresh_selection": reflect.TypeOf(types.String{}), + "refresh_selection": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateInfo +// only implements ToObjectValue() and Type(). +func (o UpdateInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cause": o.Cause, + "cluster_id": o.ClusterId, + "config": o.Config, + "creation_time": o.CreationTime, + "full_refresh": o.FullRefresh, + "full_refresh_selection": o.FullRefreshSelection, + "pipeline_id": o.PipelineId, + "refresh_selection": o.RefreshSelection, + "state": o.State, + "update_id": o.UpdateId, + "validate_only": o.ValidateOnly, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cause": types.StringType, + "cluster_id": types.StringType, + "config": basetypes.ListType{ + ElemType: PipelineSpec{}.Type(ctx), + }, + "creation_time": types.Int64Type, + "full_refresh": types.BoolType, + "full_refresh_selection": basetypes.ListType{ + ElemType: types.StringType, + }, + "pipeline_id": types.StringType, + "refresh_selection": basetypes.ListType{ + ElemType: types.StringType, + }, + "state": types.StringType, + "update_id": types.StringType, + "validate_only": types.BoolType, + }, + } +} + +// GetConfig returns the value of the Config field in UpdateInfo as +// a PipelineSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateInfo) GetConfig(ctx context.Context) (PipelineSpec, bool) { + var e PipelineSpec + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []PipelineSpec + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in UpdateInfo. +func (o *UpdateInfo) SetConfig(ctx context.Context, v PipelineSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + +// GetFullRefreshSelection returns the value of the FullRefreshSelection field in UpdateInfo as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateInfo) GetFullRefreshSelection(ctx context.Context) ([]types.String, bool) { + if o.FullRefreshSelection.IsNull() || o.FullRefreshSelection.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FullRefreshSelection.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFullRefreshSelection sets the value of the FullRefreshSelection field in UpdateInfo. +func (o *UpdateInfo) SetFullRefreshSelection(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["full_refresh_selection"] + t = t.(attr.TypeWithElementType).ElementType() + o.FullRefreshSelection = types.ListValueMust(t, vs) +} + +// GetRefreshSelection returns the value of the RefreshSelection field in UpdateInfo as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateInfo) GetRefreshSelection(ctx context.Context) ([]types.String, bool) { + if o.RefreshSelection.IsNull() || o.RefreshSelection.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RefreshSelection.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRefreshSelection sets the value of the RefreshSelection field in UpdateInfo. +func (o *UpdateInfo) SetRefreshSelection(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["refresh_selection"] + t = t.(attr.TypeWithElementType).ElementType() + o.RefreshSelection = types.ListValueMust(t, vs) +} + type UpdateStateInfo struct { CreationTime types.String `tfsdk:"creation_time" tf:"optional"` @@ -1288,3 +6022,38 @@ func (newState *UpdateStateInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Up func (newState *UpdateStateInfo) SyncEffectiveFieldsDuringRead(existingState UpdateStateInfo) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateStateInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateStateInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateStateInfo +// only implements ToObjectValue() and Type(). +func (o UpdateStateInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_time": o.CreationTime, + "state": o.State, + "update_id": o.UpdateId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateStateInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_time": types.StringType, + "state": types.StringType, + "update_id": types.StringType, + }, + } +} diff --git a/internal/service/provisioning_tf/model.go b/internal/service/provisioning_tf/model.go index 5ccfa54fb..14101d476 100755 --- a/internal/service/provisioning_tf/model.go +++ b/internal/service/provisioning_tf/model.go @@ -11,11 +11,18 @@ We use go-native types for lists and maps intentionally for the ease for convert package provisioning_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AwsCredentials struct { - StsRole []StsRole `tfsdk:"sts_role" tf:"optional,object"` + StsRole types.List `tfsdk:"sts_role" tf:"optional,object"` } func (newState *AwsCredentials) SyncEffectiveFieldsDuringCreateOrUpdate(plan AwsCredentials) { @@ -24,6 +31,67 @@ func (newState *AwsCredentials) SyncEffectiveFieldsDuringCreateOrUpdate(plan Aws func (newState *AwsCredentials) SyncEffectiveFieldsDuringRead(existingState AwsCredentials) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsCredentials. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsCredentials) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sts_role": reflect.TypeOf(StsRole{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsCredentials +// only implements ToObjectValue() and Type(). +func (o AwsCredentials) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "sts_role": o.StsRole, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsCredentials) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "sts_role": basetypes.ListType{ + ElemType: StsRole{}.Type(ctx), + }, + }, + } +} + +// GetStsRole returns the value of the StsRole field in AwsCredentials as +// a StsRole value. +// If the field is unknown or null, the boolean return value is false. +func (o *AwsCredentials) GetStsRole(ctx context.Context) (StsRole, bool) { + var e StsRole + if o.StsRole.IsNull() || o.StsRole.IsUnknown() { + return e, false + } + var v []StsRole + d := o.StsRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStsRole sets the value of the StsRole field in AwsCredentials. +func (o *AwsCredentials) SetStsRole(ctx context.Context, v StsRole) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sts_role"] + o.StsRole = types.ListValueMust(t, vs) +} + type AwsKeyInfo struct { // The AWS KMS key alias. KeyAlias types.String `tfsdk:"key_alias" tf:"optional"` @@ -44,6 +112,43 @@ func (newState *AwsKeyInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan AwsKeyI func (newState *AwsKeyInfo) SyncEffectiveFieldsDuringRead(existingState AwsKeyInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AwsKeyInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AwsKeyInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AwsKeyInfo +// only implements ToObjectValue() and Type(). +func (o AwsKeyInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key_alias": o.KeyAlias, + "key_arn": o.KeyArn, + "key_region": o.KeyRegion, + "reuse_key_for_cluster_volumes": o.ReuseKeyForClusterVolumes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AwsKeyInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key_alias": types.StringType, + "key_arn": types.StringType, + "key_region": types.StringType, + "reuse_key_for_cluster_volumes": types.BoolType, + }, + } +} + type AzureWorkspaceInfo struct { // Azure Resource Group name ResourceGroup types.String `tfsdk:"resource_group" tf:"optional"` @@ -57,10 +162,43 @@ func (newState *AzureWorkspaceInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AzureWorkspaceInfo) SyncEffectiveFieldsDuringRead(existingState AzureWorkspaceInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureWorkspaceInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureWorkspaceInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureWorkspaceInfo +// only implements ToObjectValue() and Type(). +func (o AzureWorkspaceInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "resource_group": o.ResourceGroup, + "subscription_id": o.SubscriptionId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureWorkspaceInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "resource_group": types.StringType, + "subscription_id": types.StringType, + }, + } +} + // The general workspace configurations that are specific to cloud providers. type CloudResourceContainer struct { // The general workspace configurations that are specific to Google Cloud. - Gcp []CustomerFacingGcpCloudResourceContainer `tfsdk:"gcp" tf:"optional,object"` + Gcp types.List `tfsdk:"gcp" tf:"optional,object"` } func (newState *CloudResourceContainer) SyncEffectiveFieldsDuringCreateOrUpdate(plan CloudResourceContainer) { @@ -69,6 +207,67 @@ func (newState *CloudResourceContainer) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CloudResourceContainer) SyncEffectiveFieldsDuringRead(existingState CloudResourceContainer) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CloudResourceContainer. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CloudResourceContainer) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "gcp": reflect.TypeOf(CustomerFacingGcpCloudResourceContainer{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CloudResourceContainer +// only implements ToObjectValue() and Type(). +func (o CloudResourceContainer) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "gcp": o.Gcp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CloudResourceContainer) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "gcp": basetypes.ListType{ + ElemType: CustomerFacingGcpCloudResourceContainer{}.Type(ctx), + }, + }, + } +} + +// GetGcp returns the value of the Gcp field in CloudResourceContainer as +// a CustomerFacingGcpCloudResourceContainer value. +// If the field is unknown or null, the boolean return value is false. +func (o *CloudResourceContainer) GetGcp(ctx context.Context) (CustomerFacingGcpCloudResourceContainer, bool) { + var e CustomerFacingGcpCloudResourceContainer + if o.Gcp.IsNull() || o.Gcp.IsUnknown() { + return e, false + } + var v []CustomerFacingGcpCloudResourceContainer + d := o.Gcp.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcp sets the value of the Gcp field in CloudResourceContainer. +func (o *CloudResourceContainer) SetGcp(ctx context.Context, v CustomerFacingGcpCloudResourceContainer) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp"] + o.Gcp = types.ListValueMust(t, vs) +} + type CreateAwsKeyInfo struct { // The AWS KMS key alias. KeyAlias types.String `tfsdk:"key_alias" tf:"optional"` @@ -88,8 +287,43 @@ func (newState *CreateAwsKeyInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan C func (newState *CreateAwsKeyInfo) SyncEffectiveFieldsDuringRead(existingState CreateAwsKeyInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAwsKeyInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAwsKeyInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAwsKeyInfo +// only implements ToObjectValue() and Type(). +func (o CreateAwsKeyInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key_alias": o.KeyAlias, + "key_arn": o.KeyArn, + "reuse_key_for_cluster_volumes": o.ReuseKeyForClusterVolumes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAwsKeyInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key_alias": types.StringType, + "key_arn": types.StringType, + "reuse_key_for_cluster_volumes": types.BoolType, + }, + } +} + type CreateCredentialAwsCredentials struct { - StsRole []CreateCredentialStsRole `tfsdk:"sts_role" tf:"optional,object"` + StsRole types.List `tfsdk:"sts_role" tf:"optional,object"` } func (newState *CreateCredentialAwsCredentials) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCredentialAwsCredentials) { @@ -98,8 +332,69 @@ func (newState *CreateCredentialAwsCredentials) SyncEffectiveFieldsDuringCreateO func (newState *CreateCredentialAwsCredentials) SyncEffectiveFieldsDuringRead(existingState CreateCredentialAwsCredentials) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCredentialAwsCredentials. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCredentialAwsCredentials) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sts_role": reflect.TypeOf(CreateCredentialStsRole{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCredentialAwsCredentials +// only implements ToObjectValue() and Type(). +func (o CreateCredentialAwsCredentials) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "sts_role": o.StsRole, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCredentialAwsCredentials) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "sts_role": basetypes.ListType{ + ElemType: CreateCredentialStsRole{}.Type(ctx), + }, + }, + } +} + +// GetStsRole returns the value of the StsRole field in CreateCredentialAwsCredentials as +// a CreateCredentialStsRole value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCredentialAwsCredentials) GetStsRole(ctx context.Context) (CreateCredentialStsRole, bool) { + var e CreateCredentialStsRole + if o.StsRole.IsNull() || o.StsRole.IsUnknown() { + return e, false + } + var v []CreateCredentialStsRole + d := o.StsRole.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStsRole sets the value of the StsRole field in CreateCredentialAwsCredentials. +func (o *CreateCredentialAwsCredentials) SetStsRole(ctx context.Context, v CreateCredentialStsRole) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sts_role"] + o.StsRole = types.ListValueMust(t, vs) +} + type CreateCredentialRequest struct { - AwsCredentials []CreateCredentialAwsCredentials `tfsdk:"aws_credentials" tf:"object"` + AwsCredentials types.List `tfsdk:"aws_credentials" tf:"object"` // The human-readable name of the credential configuration object. CredentialsName types.String `tfsdk:"credentials_name" tf:""` } @@ -110,6 +405,69 @@ func (newState *CreateCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateCredentialRequest) SyncEffectiveFieldsDuringRead(existingState CreateCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_credentials": reflect.TypeOf(CreateCredentialAwsCredentials{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCredentialRequest +// only implements ToObjectValue() and Type(). +func (o CreateCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_credentials": o.AwsCredentials, + "credentials_name": o.CredentialsName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_credentials": basetypes.ListType{ + ElemType: CreateCredentialAwsCredentials{}.Type(ctx), + }, + "credentials_name": types.StringType, + }, + } +} + +// GetAwsCredentials returns the value of the AwsCredentials field in CreateCredentialRequest as +// a CreateCredentialAwsCredentials value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCredentialRequest) GetAwsCredentials(ctx context.Context) (CreateCredentialAwsCredentials, bool) { + var e CreateCredentialAwsCredentials + if o.AwsCredentials.IsNull() || o.AwsCredentials.IsUnknown() { + return e, false + } + var v []CreateCredentialAwsCredentials + d := o.AwsCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsCredentials sets the value of the AwsCredentials field in CreateCredentialRequest. +func (o *CreateCredentialRequest) SetAwsCredentials(ctx context.Context, v CreateCredentialAwsCredentials) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_credentials"] + o.AwsCredentials = types.ListValueMust(t, vs) +} + type CreateCredentialStsRole struct { // The Amazon Resource Name (ARN) of the cross account role. RoleArn types.String `tfsdk:"role_arn" tf:"optional"` @@ -121,12 +479,43 @@ func (newState *CreateCredentialStsRole) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateCredentialStsRole) SyncEffectiveFieldsDuringRead(existingState CreateCredentialStsRole) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCredentialStsRole. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCredentialStsRole) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCredentialStsRole +// only implements ToObjectValue() and Type(). +func (o CreateCredentialStsRole) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "role_arn": o.RoleArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCredentialStsRole) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "role_arn": types.StringType, + }, + } +} + type CreateCustomerManagedKeyRequest struct { - AwsKeyInfo []CreateAwsKeyInfo `tfsdk:"aws_key_info" tf:"optional,object"` + AwsKeyInfo types.List `tfsdk:"aws_key_info" tf:"optional,object"` - GcpKeyInfo []CreateGcpKeyInfo `tfsdk:"gcp_key_info" tf:"optional,object"` + GcpKeyInfo types.List `tfsdk:"gcp_key_info" tf:"optional,object"` // The cases that the key can be used for. - UseCases []types.String `tfsdk:"use_cases" tf:""` + UseCases types.List `tfsdk:"use_cases" tf:""` } func (newState *CreateCustomerManagedKeyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateCustomerManagedKeyRequest) { @@ -135,6 +524,129 @@ func (newState *CreateCustomerManagedKeyRequest) SyncEffectiveFieldsDuringCreate func (newState *CreateCustomerManagedKeyRequest) SyncEffectiveFieldsDuringRead(existingState CreateCustomerManagedKeyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCustomerManagedKeyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCustomerManagedKeyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_key_info": reflect.TypeOf(CreateAwsKeyInfo{}), + "gcp_key_info": reflect.TypeOf(CreateGcpKeyInfo{}), + "use_cases": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCustomerManagedKeyRequest +// only implements ToObjectValue() and Type(). +func (o CreateCustomerManagedKeyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_key_info": o.AwsKeyInfo, + "gcp_key_info": o.GcpKeyInfo, + "use_cases": o.UseCases, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCustomerManagedKeyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_key_info": basetypes.ListType{ + ElemType: CreateAwsKeyInfo{}.Type(ctx), + }, + "gcp_key_info": basetypes.ListType{ + ElemType: CreateGcpKeyInfo{}.Type(ctx), + }, + "use_cases": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAwsKeyInfo returns the value of the AwsKeyInfo field in CreateCustomerManagedKeyRequest as +// a CreateAwsKeyInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCustomerManagedKeyRequest) GetAwsKeyInfo(ctx context.Context) (CreateAwsKeyInfo, bool) { + var e CreateAwsKeyInfo + if o.AwsKeyInfo.IsNull() || o.AwsKeyInfo.IsUnknown() { + return e, false + } + var v []CreateAwsKeyInfo + d := o.AwsKeyInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsKeyInfo sets the value of the AwsKeyInfo field in CreateCustomerManagedKeyRequest. +func (o *CreateCustomerManagedKeyRequest) SetAwsKeyInfo(ctx context.Context, v CreateAwsKeyInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_key_info"] + o.AwsKeyInfo = types.ListValueMust(t, vs) +} + +// GetGcpKeyInfo returns the value of the GcpKeyInfo field in CreateCustomerManagedKeyRequest as +// a CreateGcpKeyInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCustomerManagedKeyRequest) GetGcpKeyInfo(ctx context.Context) (CreateGcpKeyInfo, bool) { + var e CreateGcpKeyInfo + if o.GcpKeyInfo.IsNull() || o.GcpKeyInfo.IsUnknown() { + return e, false + } + var v []CreateGcpKeyInfo + d := o.GcpKeyInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpKeyInfo sets the value of the GcpKeyInfo field in CreateCustomerManagedKeyRequest. +func (o *CreateCustomerManagedKeyRequest) SetGcpKeyInfo(ctx context.Context, v CreateGcpKeyInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_key_info"] + o.GcpKeyInfo = types.ListValueMust(t, vs) +} + +// GetUseCases returns the value of the UseCases field in CreateCustomerManagedKeyRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateCustomerManagedKeyRequest) GetUseCases(ctx context.Context) ([]types.String, bool) { + if o.UseCases.IsNull() || o.UseCases.IsUnknown() { + return nil, false + } + var v []types.String + d := o.UseCases.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUseCases sets the value of the UseCases field in CreateCustomerManagedKeyRequest. +func (o *CreateCustomerManagedKeyRequest) SetUseCases(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["use_cases"] + t = t.(attr.TypeWithElementType).ElementType() + o.UseCases = types.ListValueMust(t, vs) +} + type CreateGcpKeyInfo struct { // The GCP KMS key's resource name KmsKeyId types.String `tfsdk:"kms_key_id" tf:""` @@ -146,23 +658,54 @@ func (newState *CreateGcpKeyInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan C func (newState *CreateGcpKeyInfo) SyncEffectiveFieldsDuringRead(existingState CreateGcpKeyInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateGcpKeyInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateGcpKeyInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateGcpKeyInfo +// only implements ToObjectValue() and Type(). +func (o CreateGcpKeyInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "kms_key_id": o.KmsKeyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateGcpKeyInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "kms_key_id": types.StringType, + }, + } +} + type CreateNetworkRequest struct { // The Google Cloud specific information for this network (for example, the // VPC ID, subnet ID, and secondary IP ranges). - GcpNetworkInfo []GcpNetworkInfo `tfsdk:"gcp_network_info" tf:"optional,object"` + GcpNetworkInfo types.List `tfsdk:"gcp_network_info" tf:"optional,object"` // The human-readable name of the network configuration. NetworkName types.String `tfsdk:"network_name" tf:""` // IDs of one to five security groups associated with this network. Security // group IDs **cannot** be used in multiple network configurations. - SecurityGroupIds []types.String `tfsdk:"security_group_ids" tf:"optional"` + SecurityGroupIds types.List `tfsdk:"security_group_ids" tf:"optional"` // IDs of at least two subnets associated with this network. Subnet IDs // **cannot** be used in multiple network configurations. - SubnetIds []types.String `tfsdk:"subnet_ids" tf:"optional"` + SubnetIds types.List `tfsdk:"subnet_ids" tf:"optional"` // If specified, contains the VPC endpoints used to allow cluster // communication from this VPC over [AWS PrivateLink]. // // [AWS PrivateLink]: https://aws.amazon.com/privatelink/ - VpcEndpoints []NetworkVpcEndpoints `tfsdk:"vpc_endpoints" tf:"optional,object"` + VpcEndpoints types.List `tfsdk:"vpc_endpoints" tf:"optional,object"` // The ID of the VPC associated with this network. VPC IDs can be used in // multiple network configurations. VpcId types.String `tfsdk:"vpc_id" tf:"optional"` @@ -174,9 +717,167 @@ func (newState *CreateNetworkRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *CreateNetworkRequest) SyncEffectiveFieldsDuringRead(existingState CreateNetworkRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateNetworkRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateNetworkRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "gcp_network_info": reflect.TypeOf(GcpNetworkInfo{}), + "security_group_ids": reflect.TypeOf(types.String{}), + "subnet_ids": reflect.TypeOf(types.String{}), + "vpc_endpoints": reflect.TypeOf(NetworkVpcEndpoints{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateNetworkRequest +// only implements ToObjectValue() and Type(). +func (o CreateNetworkRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "gcp_network_info": o.GcpNetworkInfo, + "network_name": o.NetworkName, + "security_group_ids": o.SecurityGroupIds, + "subnet_ids": o.SubnetIds, + "vpc_endpoints": o.VpcEndpoints, + "vpc_id": o.VpcId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateNetworkRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "gcp_network_info": basetypes.ListType{ + ElemType: GcpNetworkInfo{}.Type(ctx), + }, + "network_name": types.StringType, + "security_group_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "subnet_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "vpc_endpoints": basetypes.ListType{ + ElemType: NetworkVpcEndpoints{}.Type(ctx), + }, + "vpc_id": types.StringType, + }, + } +} + +// GetGcpNetworkInfo returns the value of the GcpNetworkInfo field in CreateNetworkRequest as +// a GcpNetworkInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateNetworkRequest) GetGcpNetworkInfo(ctx context.Context) (GcpNetworkInfo, bool) { + var e GcpNetworkInfo + if o.GcpNetworkInfo.IsNull() || o.GcpNetworkInfo.IsUnknown() { + return e, false + } + var v []GcpNetworkInfo + d := o.GcpNetworkInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpNetworkInfo sets the value of the GcpNetworkInfo field in CreateNetworkRequest. +func (o *CreateNetworkRequest) SetGcpNetworkInfo(ctx context.Context, v GcpNetworkInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_network_info"] + o.GcpNetworkInfo = types.ListValueMust(t, vs) +} + +// GetSecurityGroupIds returns the value of the SecurityGroupIds field in CreateNetworkRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateNetworkRequest) GetSecurityGroupIds(ctx context.Context) ([]types.String, bool) { + if o.SecurityGroupIds.IsNull() || o.SecurityGroupIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SecurityGroupIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSecurityGroupIds sets the value of the SecurityGroupIds field in CreateNetworkRequest. +func (o *CreateNetworkRequest) SetSecurityGroupIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["security_group_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.SecurityGroupIds = types.ListValueMust(t, vs) +} + +// GetSubnetIds returns the value of the SubnetIds field in CreateNetworkRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateNetworkRequest) GetSubnetIds(ctx context.Context) ([]types.String, bool) { + if o.SubnetIds.IsNull() || o.SubnetIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SubnetIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSubnetIds sets the value of the SubnetIds field in CreateNetworkRequest. +func (o *CreateNetworkRequest) SetSubnetIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subnet_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.SubnetIds = types.ListValueMust(t, vs) +} + +// GetVpcEndpoints returns the value of the VpcEndpoints field in CreateNetworkRequest as +// a NetworkVpcEndpoints value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateNetworkRequest) GetVpcEndpoints(ctx context.Context) (NetworkVpcEndpoints, bool) { + var e NetworkVpcEndpoints + if o.VpcEndpoints.IsNull() || o.VpcEndpoints.IsUnknown() { + return e, false + } + var v []NetworkVpcEndpoints + d := o.VpcEndpoints.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVpcEndpoints sets the value of the VpcEndpoints field in CreateNetworkRequest. +func (o *CreateNetworkRequest) SetVpcEndpoints(ctx context.Context, v NetworkVpcEndpoints) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["vpc_endpoints"] + o.VpcEndpoints = types.ListValueMust(t, vs) +} + type CreateStorageConfigurationRequest struct { // Root S3 bucket information. - RootBucketInfo []RootBucketInfo `tfsdk:"root_bucket_info" tf:"object"` + RootBucketInfo types.List `tfsdk:"root_bucket_info" tf:"object"` // The human-readable name of the storage configuration. StorageConfigurationName types.String `tfsdk:"storage_configuration_name" tf:""` } @@ -187,12 +888,75 @@ func (newState *CreateStorageConfigurationRequest) SyncEffectiveFieldsDuringCrea func (newState *CreateStorageConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState CreateStorageConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateStorageConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateStorageConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "root_bucket_info": reflect.TypeOf(RootBucketInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateStorageConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o CreateStorageConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "root_bucket_info": o.RootBucketInfo, + "storage_configuration_name": o.StorageConfigurationName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateStorageConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "root_bucket_info": basetypes.ListType{ + ElemType: RootBucketInfo{}.Type(ctx), + }, + "storage_configuration_name": types.StringType, + }, + } +} + +// GetRootBucketInfo returns the value of the RootBucketInfo field in CreateStorageConfigurationRequest as +// a RootBucketInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateStorageConfigurationRequest) GetRootBucketInfo(ctx context.Context) (RootBucketInfo, bool) { + var e RootBucketInfo + if o.RootBucketInfo.IsNull() || o.RootBucketInfo.IsUnknown() { + return e, false + } + var v []RootBucketInfo + d := o.RootBucketInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRootBucketInfo sets the value of the RootBucketInfo field in CreateStorageConfigurationRequest. +func (o *CreateStorageConfigurationRequest) SetRootBucketInfo(ctx context.Context, v RootBucketInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["root_bucket_info"] + o.RootBucketInfo = types.ListValueMust(t, vs) +} + type CreateVpcEndpointRequest struct { // The ID of the VPC endpoint object in AWS. AwsVpcEndpointId types.String `tfsdk:"aws_vpc_endpoint_id" tf:"optional"` // The Google Cloud specific information for this Private Service Connect // endpoint. - GcpVpcEndpointInfo []GcpVpcEndpointInfo `tfsdk:"gcp_vpc_endpoint_info" tf:"optional,object"` + GcpVpcEndpointInfo types.List `tfsdk:"gcp_vpc_endpoint_info" tf:"optional,object"` // The AWS region in which this VPC endpoint object exists. Region types.String `tfsdk:"region" tf:"optional"` // The human-readable name of the storage configuration. @@ -205,6 +969,73 @@ func (newState *CreateVpcEndpointRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CreateVpcEndpointRequest) SyncEffectiveFieldsDuringRead(existingState CreateVpcEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateVpcEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateVpcEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "gcp_vpc_endpoint_info": reflect.TypeOf(GcpVpcEndpointInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateVpcEndpointRequest +// only implements ToObjectValue() and Type(). +func (o CreateVpcEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_vpc_endpoint_id": o.AwsVpcEndpointId, + "gcp_vpc_endpoint_info": o.GcpVpcEndpointInfo, + "region": o.Region, + "vpc_endpoint_name": o.VpcEndpointName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateVpcEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_vpc_endpoint_id": types.StringType, + "gcp_vpc_endpoint_info": basetypes.ListType{ + ElemType: GcpVpcEndpointInfo{}.Type(ctx), + }, + "region": types.StringType, + "vpc_endpoint_name": types.StringType, + }, + } +} + +// GetGcpVpcEndpointInfo returns the value of the GcpVpcEndpointInfo field in CreateVpcEndpointRequest as +// a GcpVpcEndpointInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateVpcEndpointRequest) GetGcpVpcEndpointInfo(ctx context.Context) (GcpVpcEndpointInfo, bool) { + var e GcpVpcEndpointInfo + if o.GcpVpcEndpointInfo.IsNull() || o.GcpVpcEndpointInfo.IsUnknown() { + return e, false + } + var v []GcpVpcEndpointInfo + d := o.GcpVpcEndpointInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpVpcEndpointInfo sets the value of the GcpVpcEndpointInfo field in CreateVpcEndpointRequest. +func (o *CreateVpcEndpointRequest) SetGcpVpcEndpointInfo(ctx context.Context, v GcpVpcEndpointInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_vpc_endpoint_info"] + o.GcpVpcEndpointInfo = types.ListValueMust(t, vs) +} + type CreateWorkspaceRequest struct { // The AWS region of the workspace's data plane. AwsRegion types.String `tfsdk:"aws_region" tf:"optional"` @@ -213,14 +1044,14 @@ type CreateWorkspaceRequest struct { Cloud types.String `tfsdk:"cloud" tf:"optional"` // The general workspace configurations that are specific to cloud // providers. - CloudResourceContainer []CloudResourceContainer `tfsdk:"cloud_resource_container" tf:"optional,object"` + CloudResourceContainer types.List `tfsdk:"cloud_resource_container" tf:"optional,object"` // ID of the workspace's credential configuration object. CredentialsId types.String `tfsdk:"credentials_id" tf:"optional"` // The custom tags key-value pairing that is attached to this workspace. The // key-value pair is a string of utf-8 characters. The value can be an empty // string, with maximum length of 255 characters. The key can be of maximum // length of 127 characters, and cannot be empty. - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // The deployment name defines part of the subdomain for the workspace. The // workspace URL for the web application and REST APIs is // `.cloud.databricks.com`. For example, if the @@ -274,9 +1105,9 @@ type CreateWorkspaceRequest struct { // for a new workspace]. // // [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html - GcpManagedNetworkConfig []GcpManagedNetworkConfig `tfsdk:"gcp_managed_network_config" tf:"optional,object"` + GcpManagedNetworkConfig types.List `tfsdk:"gcp_managed_network_config" tf:"optional,object"` // The configurations for the GKE cluster of a Databricks workspace. - GkeConfig []GkeConfig `tfsdk:"gke_config" tf:"optional,object"` + GkeConfig types.List `tfsdk:"gke_config" tf:"optional,object"` // Whether no public IP is enabled for the workspace. IsNoPublicIpEnabled types.Bool `tfsdk:"is_no_public_ip_enabled" tf:"optional"` // The Google Cloud region of the workspace data plane in your Google @@ -324,11 +1155,191 @@ func (newState *CreateWorkspaceRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateWorkspaceRequest) SyncEffectiveFieldsDuringRead(existingState CreateWorkspaceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateWorkspaceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateWorkspaceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cloud_resource_container": reflect.TypeOf(CloudResourceContainer{}), + "custom_tags": reflect.TypeOf(types.String{}), + "gcp_managed_network_config": reflect.TypeOf(GcpManagedNetworkConfig{}), + "gke_config": reflect.TypeOf(GkeConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateWorkspaceRequest +// only implements ToObjectValue() and Type(). +func (o CreateWorkspaceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_region": o.AwsRegion, + "cloud": o.Cloud, + "cloud_resource_container": o.CloudResourceContainer, + "credentials_id": o.CredentialsId, + "custom_tags": o.CustomTags, + "deployment_name": o.DeploymentName, + "gcp_managed_network_config": o.GcpManagedNetworkConfig, + "gke_config": o.GkeConfig, + "is_no_public_ip_enabled": o.IsNoPublicIpEnabled, + "location": o.Location, + "managed_services_customer_managed_key_id": o.ManagedServicesCustomerManagedKeyId, + "network_id": o.NetworkId, + "pricing_tier": o.PricingTier, + "private_access_settings_id": o.PrivateAccessSettingsId, + "storage_configuration_id": o.StorageConfigurationId, + "storage_customer_managed_key_id": o.StorageCustomerManagedKeyId, + "workspace_name": o.WorkspaceName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateWorkspaceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_region": types.StringType, + "cloud": types.StringType, + "cloud_resource_container": basetypes.ListType{ + ElemType: CloudResourceContainer{}.Type(ctx), + }, + "credentials_id": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "deployment_name": types.StringType, + "gcp_managed_network_config": basetypes.ListType{ + ElemType: GcpManagedNetworkConfig{}.Type(ctx), + }, + "gke_config": basetypes.ListType{ + ElemType: GkeConfig{}.Type(ctx), + }, + "is_no_public_ip_enabled": types.BoolType, + "location": types.StringType, + "managed_services_customer_managed_key_id": types.StringType, + "network_id": types.StringType, + "pricing_tier": types.StringType, + "private_access_settings_id": types.StringType, + "storage_configuration_id": types.StringType, + "storage_customer_managed_key_id": types.StringType, + "workspace_name": types.StringType, + }, + } +} + +// GetCloudResourceContainer returns the value of the CloudResourceContainer field in CreateWorkspaceRequest as +// a CloudResourceContainer value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWorkspaceRequest) GetCloudResourceContainer(ctx context.Context) (CloudResourceContainer, bool) { + var e CloudResourceContainer + if o.CloudResourceContainer.IsNull() || o.CloudResourceContainer.IsUnknown() { + return e, false + } + var v []CloudResourceContainer + d := o.CloudResourceContainer.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloudResourceContainer sets the value of the CloudResourceContainer field in CreateWorkspaceRequest. +func (o *CreateWorkspaceRequest) SetCloudResourceContainer(ctx context.Context, v CloudResourceContainer) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cloud_resource_container"] + o.CloudResourceContainer = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in CreateWorkspaceRequest as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWorkspaceRequest) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in CreateWorkspaceRequest. +func (o *CreateWorkspaceRequest) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetGcpManagedNetworkConfig returns the value of the GcpManagedNetworkConfig field in CreateWorkspaceRequest as +// a GcpManagedNetworkConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWorkspaceRequest) GetGcpManagedNetworkConfig(ctx context.Context) (GcpManagedNetworkConfig, bool) { + var e GcpManagedNetworkConfig + if o.GcpManagedNetworkConfig.IsNull() || o.GcpManagedNetworkConfig.IsUnknown() { + return e, false + } + var v []GcpManagedNetworkConfig + d := o.GcpManagedNetworkConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpManagedNetworkConfig sets the value of the GcpManagedNetworkConfig field in CreateWorkspaceRequest. +func (o *CreateWorkspaceRequest) SetGcpManagedNetworkConfig(ctx context.Context, v GcpManagedNetworkConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_managed_network_config"] + o.GcpManagedNetworkConfig = types.ListValueMust(t, vs) +} + +// GetGkeConfig returns the value of the GkeConfig field in CreateWorkspaceRequest as +// a GkeConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWorkspaceRequest) GetGkeConfig(ctx context.Context) (GkeConfig, bool) { + var e GkeConfig + if o.GkeConfig.IsNull() || o.GkeConfig.IsUnknown() { + return e, false + } + var v []GkeConfig + d := o.GkeConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGkeConfig sets the value of the GkeConfig field in CreateWorkspaceRequest. +func (o *CreateWorkspaceRequest) SetGkeConfig(ctx context.Context, v GkeConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gke_config"] + o.GkeConfig = types.ListValueMust(t, vs) +} + type Credential struct { // The Databricks account ID that hosts the credential. AccountId types.String `tfsdk:"account_id" tf:"optional"` - AwsCredentials []AwsCredentials `tfsdk:"aws_credentials" tf:"optional,object"` + AwsCredentials types.List `tfsdk:"aws_credentials" tf:"optional,object"` // Time in epoch milliseconds when the credential was created. CreationTime types.Int64 `tfsdk:"creation_time" tf:"computed,optional"` // Databricks credential configuration ID. @@ -343,6 +1354,75 @@ func (newState *Credential) SyncEffectiveFieldsDuringCreateOrUpdate(plan Credent func (newState *Credential) SyncEffectiveFieldsDuringRead(existingState Credential) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Credential. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Credential) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_credentials": reflect.TypeOf(AwsCredentials{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Credential +// only implements ToObjectValue() and Type(). +func (o Credential) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "aws_credentials": o.AwsCredentials, + "creation_time": o.CreationTime, + "credentials_id": o.CredentialsId, + "credentials_name": o.CredentialsName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Credential) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "aws_credentials": basetypes.ListType{ + ElemType: AwsCredentials{}.Type(ctx), + }, + "creation_time": types.Int64Type, + "credentials_id": types.StringType, + "credentials_name": types.StringType, + }, + } +} + +// GetAwsCredentials returns the value of the AwsCredentials field in Credential as +// a AwsCredentials value. +// If the field is unknown or null, the boolean return value is false. +func (o *Credential) GetAwsCredentials(ctx context.Context) (AwsCredentials, bool) { + var e AwsCredentials + if o.AwsCredentials.IsNull() || o.AwsCredentials.IsUnknown() { + return e, false + } + var v []AwsCredentials + d := o.AwsCredentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsCredentials sets the value of the AwsCredentials field in Credential. +func (o *Credential) SetAwsCredentials(ctx context.Context, v AwsCredentials) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_credentials"] + o.AwsCredentials = types.ListValueMust(t, vs) +} + // The general workspace configurations that are specific to Google Cloud. type CustomerFacingGcpCloudResourceContainer struct { // The Google Cloud project ID, which the workspace uses to instantiate @@ -356,19 +1436,50 @@ func (newState *CustomerFacingGcpCloudResourceContainer) SyncEffectiveFieldsDuri func (newState *CustomerFacingGcpCloudResourceContainer) SyncEffectiveFieldsDuringRead(existingState CustomerFacingGcpCloudResourceContainer) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CustomerFacingGcpCloudResourceContainer. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CustomerFacingGcpCloudResourceContainer) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CustomerFacingGcpCloudResourceContainer +// only implements ToObjectValue() and Type(). +func (o CustomerFacingGcpCloudResourceContainer) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "project_id": o.ProjectId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CustomerFacingGcpCloudResourceContainer) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "project_id": types.StringType, + }, + } +} + type CustomerManagedKey struct { // The Databricks account ID that holds the customer-managed key. AccountId types.String `tfsdk:"account_id" tf:"optional"` - AwsKeyInfo []AwsKeyInfo `tfsdk:"aws_key_info" tf:"optional,object"` + AwsKeyInfo types.List `tfsdk:"aws_key_info" tf:"optional,object"` // Time in epoch milliseconds when the customer key was created. CreationTime types.Int64 `tfsdk:"creation_time" tf:"computed,optional"` // ID of the encryption key configuration object. CustomerManagedKeyId types.String `tfsdk:"customer_managed_key_id" tf:"optional"` - GcpKeyInfo []GcpKeyInfo `tfsdk:"gcp_key_info" tf:"optional,object"` + GcpKeyInfo types.List `tfsdk:"gcp_key_info" tf:"optional,object"` // The cases that the key can be used for. - UseCases []types.String `tfsdk:"use_cases" tf:"optional"` + UseCases types.List `tfsdk:"use_cases" tf:"optional"` } func (newState *CustomerManagedKey) SyncEffectiveFieldsDuringCreateOrUpdate(plan CustomerManagedKey) { @@ -377,6 +1488,135 @@ func (newState *CustomerManagedKey) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CustomerManagedKey) SyncEffectiveFieldsDuringRead(existingState CustomerManagedKey) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CustomerManagedKey. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CustomerManagedKey) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_key_info": reflect.TypeOf(AwsKeyInfo{}), + "gcp_key_info": reflect.TypeOf(GcpKeyInfo{}), + "use_cases": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CustomerManagedKey +// only implements ToObjectValue() and Type(). +func (o CustomerManagedKey) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "aws_key_info": o.AwsKeyInfo, + "creation_time": o.CreationTime, + "customer_managed_key_id": o.CustomerManagedKeyId, + "gcp_key_info": o.GcpKeyInfo, + "use_cases": o.UseCases, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CustomerManagedKey) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "aws_key_info": basetypes.ListType{ + ElemType: AwsKeyInfo{}.Type(ctx), + }, + "creation_time": types.Int64Type, + "customer_managed_key_id": types.StringType, + "gcp_key_info": basetypes.ListType{ + ElemType: GcpKeyInfo{}.Type(ctx), + }, + "use_cases": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAwsKeyInfo returns the value of the AwsKeyInfo field in CustomerManagedKey as +// a AwsKeyInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CustomerManagedKey) GetAwsKeyInfo(ctx context.Context) (AwsKeyInfo, bool) { + var e AwsKeyInfo + if o.AwsKeyInfo.IsNull() || o.AwsKeyInfo.IsUnknown() { + return e, false + } + var v []AwsKeyInfo + d := o.AwsKeyInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsKeyInfo sets the value of the AwsKeyInfo field in CustomerManagedKey. +func (o *CustomerManagedKey) SetAwsKeyInfo(ctx context.Context, v AwsKeyInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_key_info"] + o.AwsKeyInfo = types.ListValueMust(t, vs) +} + +// GetGcpKeyInfo returns the value of the GcpKeyInfo field in CustomerManagedKey as +// a GcpKeyInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CustomerManagedKey) GetGcpKeyInfo(ctx context.Context) (GcpKeyInfo, bool) { + var e GcpKeyInfo + if o.GcpKeyInfo.IsNull() || o.GcpKeyInfo.IsUnknown() { + return e, false + } + var v []GcpKeyInfo + d := o.GcpKeyInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpKeyInfo sets the value of the GcpKeyInfo field in CustomerManagedKey. +func (o *CustomerManagedKey) SetGcpKeyInfo(ctx context.Context, v GcpKeyInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_key_info"] + o.GcpKeyInfo = types.ListValueMust(t, vs) +} + +// GetUseCases returns the value of the UseCases field in CustomerManagedKey as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CustomerManagedKey) GetUseCases(ctx context.Context) ([]types.String, bool) { + if o.UseCases.IsNull() || o.UseCases.IsUnknown() { + return nil, false + } + var v []types.String + d := o.UseCases.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUseCases sets the value of the UseCases field in CustomerManagedKey. +func (o *CustomerManagedKey) SetUseCases(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["use_cases"] + t = t.(attr.TypeWithElementType).ElementType() + o.UseCases = types.ListValueMust(t, vs) +} + // Delete credential configuration type DeleteCredentialRequest struct { // Databricks Account API credential configuration ID @@ -389,6 +1629,37 @@ func (newState *DeleteCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *DeleteCredentialRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCredentialRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credentials_id": o.CredentialsId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credentials_id": types.StringType, + }, + } +} + // Delete encryption key configuration type DeleteEncryptionKeyRequest struct { // Databricks encryption key configuration ID. @@ -401,6 +1672,37 @@ func (newState *DeleteEncryptionKeyRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteEncryptionKeyRequest) SyncEffectiveFieldsDuringRead(existingState DeleteEncryptionKeyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteEncryptionKeyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteEncryptionKeyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteEncryptionKeyRequest +// only implements ToObjectValue() and Type(). +func (o DeleteEncryptionKeyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "customer_managed_key_id": o.CustomerManagedKeyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteEncryptionKeyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "customer_managed_key_id": types.StringType, + }, + } +} + // Delete a network configuration type DeleteNetworkRequest struct { // Databricks Account API network configuration ID. @@ -413,6 +1715,37 @@ func (newState *DeleteNetworkRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteNetworkRequest) SyncEffectiveFieldsDuringRead(existingState DeleteNetworkRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteNetworkRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteNetworkRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteNetworkRequest +// only implements ToObjectValue() and Type(). +func (o DeleteNetworkRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_id": o.NetworkId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteNetworkRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_id": types.StringType, + }, + } +} + // Delete a private access settings object type DeletePrivateAccesRequest struct { // Databricks Account API private access settings ID. @@ -425,6 +1758,37 @@ func (newState *DeletePrivateAccesRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeletePrivateAccesRequest) SyncEffectiveFieldsDuringRead(existingState DeletePrivateAccesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePrivateAccesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePrivateAccesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePrivateAccesRequest +// only implements ToObjectValue() and Type(). +func (o DeletePrivateAccesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "private_access_settings_id": o.PrivateAccessSettingsId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePrivateAccesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "private_access_settings_id": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -434,6 +1798,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete storage configuration type DeleteStorageRequest struct { // Databricks Account API storage configuration ID. @@ -446,6 +1837,37 @@ func (newState *DeleteStorageRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteStorageRequest) SyncEffectiveFieldsDuringRead(existingState DeleteStorageRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteStorageRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteStorageRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteStorageRequest +// only implements ToObjectValue() and Type(). +func (o DeleteStorageRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "storage_configuration_id": o.StorageConfigurationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteStorageRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "storage_configuration_id": types.StringType, + }, + } +} + // Delete VPC endpoint configuration type DeleteVpcEndpointRequest struct { // Databricks VPC endpoint ID. @@ -458,6 +1880,37 @@ func (newState *DeleteVpcEndpointRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *DeleteVpcEndpointRequest) SyncEffectiveFieldsDuringRead(existingState DeleteVpcEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteVpcEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteVpcEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteVpcEndpointRequest +// only implements ToObjectValue() and Type(). +func (o DeleteVpcEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "vpc_endpoint_id": o.VpcEndpointId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteVpcEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "vpc_endpoint_id": types.StringType, + }, + } +} + // Delete a workspace type DeleteWorkspaceRequest struct { // Workspace ID. @@ -470,6 +1923,37 @@ func (newState *DeleteWorkspaceRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteWorkspaceRequest) SyncEffectiveFieldsDuringRead(existingState DeleteWorkspaceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWorkspaceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWorkspaceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWorkspaceRequest +// only implements ToObjectValue() and Type(). +func (o DeleteWorkspaceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWorkspaceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_id": types.Int64Type, + }, + } +} + type ExternalCustomerInfo struct { // Email of the authoritative user. AuthoritativeUserEmail types.String `tfsdk:"authoritative_user_email" tf:"optional"` @@ -485,6 +1969,41 @@ func (newState *ExternalCustomerInfo) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ExternalCustomerInfo) SyncEffectiveFieldsDuringRead(existingState ExternalCustomerInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExternalCustomerInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExternalCustomerInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExternalCustomerInfo +// only implements ToObjectValue() and Type(). +func (o ExternalCustomerInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "authoritative_user_email": o.AuthoritativeUserEmail, + "authoritative_user_full_name": o.AuthoritativeUserFullName, + "customer_name": o.CustomerName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExternalCustomerInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "authoritative_user_email": types.StringType, + "authoritative_user_full_name": types.StringType, + "customer_name": types.StringType, + }, + } +} + type GcpKeyInfo struct { // The GCP KMS key's resource name KmsKeyId types.String `tfsdk:"kms_key_id" tf:""` @@ -496,6 +2015,37 @@ func (newState *GcpKeyInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan GcpKeyI func (newState *GcpKeyInfo) SyncEffectiveFieldsDuringRead(existingState GcpKeyInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcpKeyInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcpKeyInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcpKeyInfo +// only implements ToObjectValue() and Type(). +func (o GcpKeyInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "kms_key_id": o.KmsKeyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcpKeyInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "kms_key_id": types.StringType, + }, + } +} + // The network settings for the workspace. The configurations are only for // Databricks-managed VPCs. It is ignored if you specify a customer-managed VPC // in the `network_id` field.", All the IP range configurations must be mutually @@ -537,6 +2087,41 @@ func (newState *GcpManagedNetworkConfig) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GcpManagedNetworkConfig) SyncEffectiveFieldsDuringRead(existingState GcpManagedNetworkConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcpManagedNetworkConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcpManagedNetworkConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcpManagedNetworkConfig +// only implements ToObjectValue() and Type(). +func (o GcpManagedNetworkConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "gke_cluster_pod_ip_range": o.GkeClusterPodIpRange, + "gke_cluster_service_ip_range": o.GkeClusterServiceIpRange, + "subnet_cidr": o.SubnetCidr, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcpManagedNetworkConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "gke_cluster_pod_ip_range": types.StringType, + "gke_cluster_service_ip_range": types.StringType, + "subnet_cidr": types.StringType, + }, + } +} + // The Google Cloud specific information for this network (for example, the VPC // ID, subnet ID, and secondary IP ranges). type GcpNetworkInfo struct { @@ -566,6 +2151,47 @@ func (newState *GcpNetworkInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Gcp func (newState *GcpNetworkInfo) SyncEffectiveFieldsDuringRead(existingState GcpNetworkInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcpNetworkInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcpNetworkInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcpNetworkInfo +// only implements ToObjectValue() and Type(). +func (o GcpNetworkInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_project_id": o.NetworkProjectId, + "pod_ip_range_name": o.PodIpRangeName, + "service_ip_range_name": o.ServiceIpRangeName, + "subnet_id": o.SubnetId, + "subnet_region": o.SubnetRegion, + "vpc_id": o.VpcId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcpNetworkInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_project_id": types.StringType, + "pod_ip_range_name": types.StringType, + "service_ip_range_name": types.StringType, + "subnet_id": types.StringType, + "subnet_region": types.StringType, + "vpc_id": types.StringType, + }, + } +} + // The Google Cloud specific information for this Private Service Connect // endpoint. type GcpVpcEndpointInfo struct { @@ -588,6 +2214,45 @@ func (newState *GcpVpcEndpointInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GcpVpcEndpointInfo) SyncEffectiveFieldsDuringRead(existingState GcpVpcEndpointInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GcpVpcEndpointInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GcpVpcEndpointInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GcpVpcEndpointInfo +// only implements ToObjectValue() and Type(). +func (o GcpVpcEndpointInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_region": o.EndpointRegion, + "project_id": o.ProjectId, + "psc_connection_id": o.PscConnectionId, + "psc_endpoint_name": o.PscEndpointName, + "service_attachment_id": o.ServiceAttachmentId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GcpVpcEndpointInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_region": types.StringType, + "project_id": types.StringType, + "psc_connection_id": types.StringType, + "psc_endpoint_name": types.StringType, + "service_attachment_id": types.StringType, + }, + } +} + // Get credential configuration type GetCredentialRequest struct { // Databricks Account API credential configuration ID @@ -600,6 +2265,37 @@ func (newState *GetCredentialRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GetCredentialRequest) SyncEffectiveFieldsDuringRead(existingState GetCredentialRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCredentialRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCredentialRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCredentialRequest +// only implements ToObjectValue() and Type(). +func (o GetCredentialRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credentials_id": o.CredentialsId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCredentialRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credentials_id": types.StringType, + }, + } +} + // Get encryption key configuration type GetEncryptionKeyRequest struct { // Databricks encryption key configuration ID. @@ -612,6 +2308,37 @@ func (newState *GetEncryptionKeyRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GetEncryptionKeyRequest) SyncEffectiveFieldsDuringRead(existingState GetEncryptionKeyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEncryptionKeyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEncryptionKeyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEncryptionKeyRequest +// only implements ToObjectValue() and Type(). +func (o GetEncryptionKeyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "customer_managed_key_id": o.CustomerManagedKeyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEncryptionKeyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "customer_managed_key_id": types.StringType, + }, + } +} + // Get a network configuration type GetNetworkRequest struct { // Databricks Account API network configuration ID. @@ -624,6 +2351,37 @@ func (newState *GetNetworkRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetNetworkRequest) SyncEffectiveFieldsDuringRead(existingState GetNetworkRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetNetworkRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetNetworkRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetNetworkRequest +// only implements ToObjectValue() and Type(). +func (o GetNetworkRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_id": o.NetworkId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetNetworkRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_id": types.StringType, + }, + } +} + // Get a private access settings object type GetPrivateAccesRequest struct { // Databricks Account API private access settings ID. @@ -636,6 +2394,37 @@ func (newState *GetPrivateAccesRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetPrivateAccesRequest) SyncEffectiveFieldsDuringRead(existingState GetPrivateAccesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPrivateAccesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPrivateAccesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPrivateAccesRequest +// only implements ToObjectValue() and Type(). +func (o GetPrivateAccesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "private_access_settings_id": o.PrivateAccessSettingsId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPrivateAccesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "private_access_settings_id": types.StringType, + }, + } +} + // Get storage configuration type GetStorageRequest struct { // Databricks Account API storage configuration ID. @@ -648,6 +2437,37 @@ func (newState *GetStorageRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetStorageRequest) SyncEffectiveFieldsDuringRead(existingState GetStorageRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStorageRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStorageRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStorageRequest +// only implements ToObjectValue() and Type(). +func (o GetStorageRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "storage_configuration_id": o.StorageConfigurationId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStorageRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "storage_configuration_id": types.StringType, + }, + } +} + // Get a VPC endpoint configuration type GetVpcEndpointRequest struct { // Databricks VPC endpoint ID. @@ -660,6 +2480,37 @@ func (newState *GetVpcEndpointRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *GetVpcEndpointRequest) SyncEffectiveFieldsDuringRead(existingState GetVpcEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetVpcEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetVpcEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetVpcEndpointRequest +// only implements ToObjectValue() and Type(). +func (o GetVpcEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "vpc_endpoint_id": o.VpcEndpointId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetVpcEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "vpc_endpoint_id": types.StringType, + }, + } +} + // Get a workspace type GetWorkspaceRequest struct { // Workspace ID. @@ -672,6 +2523,37 @@ func (newState *GetWorkspaceRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetWorkspaceRequest) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceRequest +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_id": types.Int64Type, + }, + } +} + // The configurations for the GKE cluster of a Databricks workspace. type GkeConfig struct { // Specifies the network connectivity types for the GKE nodes and the GKE @@ -696,29 +2578,62 @@ func (newState *GkeConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan GkeConfi func (newState *GkeConfig) SyncEffectiveFieldsDuringRead(existingState GkeConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GkeConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GkeConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GkeConfig +// only implements ToObjectValue() and Type(). +func (o GkeConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "connectivity_type": o.ConnectivityType, + "master_ip_range": o.MasterIpRange, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GkeConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "connectivity_type": types.StringType, + "master_ip_range": types.StringType, + }, + } +} + type Network struct { // The Databricks account ID associated with this network configuration. AccountId types.String `tfsdk:"account_id" tf:"optional"` // Time in epoch milliseconds when the network was created. CreationTime types.Int64 `tfsdk:"creation_time" tf:"computed,optional"` // Array of error messages about the network configuration. - ErrorMessages []NetworkHealth `tfsdk:"error_messages" tf:"computed,optional"` + ErrorMessages types.List `tfsdk:"error_messages" tf:"computed,optional"` // The Google Cloud specific information for this network (for example, the // VPC ID, subnet ID, and secondary IP ranges). - GcpNetworkInfo []GcpNetworkInfo `tfsdk:"gcp_network_info" tf:"optional,object"` + GcpNetworkInfo types.List `tfsdk:"gcp_network_info" tf:"optional,object"` // The Databricks network configuration ID. NetworkId types.String `tfsdk:"network_id" tf:"optional"` // The human-readable name of the network configuration. NetworkName types.String `tfsdk:"network_name" tf:"optional"` - SecurityGroupIds []types.String `tfsdk:"security_group_ids" tf:"optional"` + SecurityGroupIds types.List `tfsdk:"security_group_ids" tf:"optional"` - SubnetIds []types.String `tfsdk:"subnet_ids" tf:"optional"` + SubnetIds types.List `tfsdk:"subnet_ids" tf:"optional"` // If specified, contains the VPC endpoints used to allow cluster // communication from this VPC over [AWS PrivateLink]. // // [AWS PrivateLink]: https://aws.amazon.com/privatelink/ - VpcEndpoints []NetworkVpcEndpoints `tfsdk:"vpc_endpoints" tf:"optional,object"` + VpcEndpoints types.List `tfsdk:"vpc_endpoints" tf:"optional,object"` // The ID of the VPC associated with this network configuration. VPC IDs can // be used in multiple networks. VpcId types.String `tfsdk:"vpc_id" tf:"optional"` @@ -727,7 +2642,7 @@ type Network struct { // Broken. * `WARNED`: Warned. VpcStatus types.String `tfsdk:"vpc_status" tf:"computed,optional"` // Array of warning messages about the network configuration. - WarningMessages []NetworkWarning `tfsdk:"warning_messages" tf:"computed,optional"` + WarningMessages types.List `tfsdk:"warning_messages" tf:"computed,optional"` // Workspace ID associated with this network configuration. WorkspaceId types.Int64 `tfsdk:"workspace_id" tf:"optional"` } @@ -738,6 +2653,236 @@ func (newState *Network) SyncEffectiveFieldsDuringCreateOrUpdate(plan Network) { func (newState *Network) SyncEffectiveFieldsDuringRead(existingState Network) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Network. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Network) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "error_messages": reflect.TypeOf(NetworkHealth{}), + "gcp_network_info": reflect.TypeOf(GcpNetworkInfo{}), + "security_group_ids": reflect.TypeOf(types.String{}), + "subnet_ids": reflect.TypeOf(types.String{}), + "vpc_endpoints": reflect.TypeOf(NetworkVpcEndpoints{}), + "warning_messages": reflect.TypeOf(NetworkWarning{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Network +// only implements ToObjectValue() and Type(). +func (o Network) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "creation_time": o.CreationTime, + "error_messages": o.ErrorMessages, + "gcp_network_info": o.GcpNetworkInfo, + "network_id": o.NetworkId, + "network_name": o.NetworkName, + "security_group_ids": o.SecurityGroupIds, + "subnet_ids": o.SubnetIds, + "vpc_endpoints": o.VpcEndpoints, + "vpc_id": o.VpcId, + "vpc_status": o.VpcStatus, + "warning_messages": o.WarningMessages, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Network) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "creation_time": types.Int64Type, + "error_messages": basetypes.ListType{ + ElemType: NetworkHealth{}.Type(ctx), + }, + "gcp_network_info": basetypes.ListType{ + ElemType: GcpNetworkInfo{}.Type(ctx), + }, + "network_id": types.StringType, + "network_name": types.StringType, + "security_group_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "subnet_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "vpc_endpoints": basetypes.ListType{ + ElemType: NetworkVpcEndpoints{}.Type(ctx), + }, + "vpc_id": types.StringType, + "vpc_status": types.StringType, + "warning_messages": basetypes.ListType{ + ElemType: NetworkWarning{}.Type(ctx), + }, + "workspace_id": types.Int64Type, + }, + } +} + +// GetErrorMessages returns the value of the ErrorMessages field in Network as +// a slice of NetworkHealth values. +// If the field is unknown or null, the boolean return value is false. +func (o *Network) GetErrorMessages(ctx context.Context) ([]NetworkHealth, bool) { + if o.ErrorMessages.IsNull() || o.ErrorMessages.IsUnknown() { + return nil, false + } + var v []NetworkHealth + d := o.ErrorMessages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetErrorMessages sets the value of the ErrorMessages field in Network. +func (o *Network) SetErrorMessages(ctx context.Context, v []NetworkHealth) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["error_messages"] + t = t.(attr.TypeWithElementType).ElementType() + o.ErrorMessages = types.ListValueMust(t, vs) +} + +// GetGcpNetworkInfo returns the value of the GcpNetworkInfo field in Network as +// a GcpNetworkInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *Network) GetGcpNetworkInfo(ctx context.Context) (GcpNetworkInfo, bool) { + var e GcpNetworkInfo + if o.GcpNetworkInfo.IsNull() || o.GcpNetworkInfo.IsUnknown() { + return e, false + } + var v []GcpNetworkInfo + d := o.GcpNetworkInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpNetworkInfo sets the value of the GcpNetworkInfo field in Network. +func (o *Network) SetGcpNetworkInfo(ctx context.Context, v GcpNetworkInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_network_info"] + o.GcpNetworkInfo = types.ListValueMust(t, vs) +} + +// GetSecurityGroupIds returns the value of the SecurityGroupIds field in Network as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Network) GetSecurityGroupIds(ctx context.Context) ([]types.String, bool) { + if o.SecurityGroupIds.IsNull() || o.SecurityGroupIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SecurityGroupIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSecurityGroupIds sets the value of the SecurityGroupIds field in Network. +func (o *Network) SetSecurityGroupIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["security_group_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.SecurityGroupIds = types.ListValueMust(t, vs) +} + +// GetSubnetIds returns the value of the SubnetIds field in Network as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Network) GetSubnetIds(ctx context.Context) ([]types.String, bool) { + if o.SubnetIds.IsNull() || o.SubnetIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.SubnetIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSubnetIds sets the value of the SubnetIds field in Network. +func (o *Network) SetSubnetIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subnet_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.SubnetIds = types.ListValueMust(t, vs) +} + +// GetVpcEndpoints returns the value of the VpcEndpoints field in Network as +// a NetworkVpcEndpoints value. +// If the field is unknown or null, the boolean return value is false. +func (o *Network) GetVpcEndpoints(ctx context.Context) (NetworkVpcEndpoints, bool) { + var e NetworkVpcEndpoints + if o.VpcEndpoints.IsNull() || o.VpcEndpoints.IsUnknown() { + return e, false + } + var v []NetworkVpcEndpoints + d := o.VpcEndpoints.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVpcEndpoints sets the value of the VpcEndpoints field in Network. +func (o *Network) SetVpcEndpoints(ctx context.Context, v NetworkVpcEndpoints) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["vpc_endpoints"] + o.VpcEndpoints = types.ListValueMust(t, vs) +} + +// GetWarningMessages returns the value of the WarningMessages field in Network as +// a slice of NetworkWarning values. +// If the field is unknown or null, the boolean return value is false. +func (o *Network) GetWarningMessages(ctx context.Context) ([]NetworkWarning, bool) { + if o.WarningMessages.IsNull() || o.WarningMessages.IsUnknown() { + return nil, false + } + var v []NetworkWarning + d := o.WarningMessages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWarningMessages sets the value of the WarningMessages field in Network. +func (o *Network) SetWarningMessages(ctx context.Context, v []NetworkWarning) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["warning_messages"] + t = t.(attr.TypeWithElementType).ElementType() + o.WarningMessages = types.ListValueMust(t, vs) +} + type NetworkHealth struct { // Details of the error. ErrorMessage types.String `tfsdk:"error_message" tf:"optional"` @@ -752,6 +2897,39 @@ func (newState *NetworkHealth) SyncEffectiveFieldsDuringCreateOrUpdate(plan Netw func (newState *NetworkHealth) SyncEffectiveFieldsDuringRead(existingState NetworkHealth) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NetworkHealth. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NetworkHealth) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NetworkHealth +// only implements ToObjectValue() and Type(). +func (o NetworkHealth) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error_message": o.ErrorMessage, + "error_type": o.ErrorType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NetworkHealth) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error_message": types.StringType, + "error_type": types.StringType, + }, + } +} + // If specified, contains the VPC endpoints used to allow cluster communication // from this VPC over [AWS PrivateLink]. // @@ -759,10 +2937,10 @@ func (newState *NetworkHealth) SyncEffectiveFieldsDuringRead(existingState Netwo type NetworkVpcEndpoints struct { // The VPC endpoint ID used by this network to access the Databricks secure // cluster connectivity relay. - DataplaneRelay []types.String `tfsdk:"dataplane_relay" tf:""` + DataplaneRelay types.List `tfsdk:"dataplane_relay" tf:""` // The VPC endpoint ID used by this network to access the Databricks REST // API. - RestApi []types.String `tfsdk:"rest_api" tf:""` + RestApi types.List `tfsdk:"rest_api" tf:""` } func (newState *NetworkVpcEndpoints) SyncEffectiveFieldsDuringCreateOrUpdate(plan NetworkVpcEndpoints) { @@ -771,6 +2949,98 @@ func (newState *NetworkVpcEndpoints) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *NetworkVpcEndpoints) SyncEffectiveFieldsDuringRead(existingState NetworkVpcEndpoints) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NetworkVpcEndpoints. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NetworkVpcEndpoints) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dataplane_relay": reflect.TypeOf(types.String{}), + "rest_api": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NetworkVpcEndpoints +// only implements ToObjectValue() and Type(). +func (o NetworkVpcEndpoints) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dataplane_relay": o.DataplaneRelay, + "rest_api": o.RestApi, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NetworkVpcEndpoints) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dataplane_relay": basetypes.ListType{ + ElemType: types.StringType, + }, + "rest_api": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetDataplaneRelay returns the value of the DataplaneRelay field in NetworkVpcEndpoints as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *NetworkVpcEndpoints) GetDataplaneRelay(ctx context.Context) ([]types.String, bool) { + if o.DataplaneRelay.IsNull() || o.DataplaneRelay.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DataplaneRelay.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDataplaneRelay sets the value of the DataplaneRelay field in NetworkVpcEndpoints. +func (o *NetworkVpcEndpoints) SetDataplaneRelay(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dataplane_relay"] + t = t.(attr.TypeWithElementType).ElementType() + o.DataplaneRelay = types.ListValueMust(t, vs) +} + +// GetRestApi returns the value of the RestApi field in NetworkVpcEndpoints as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *NetworkVpcEndpoints) GetRestApi(ctx context.Context) ([]types.String, bool) { + if o.RestApi.IsNull() || o.RestApi.IsUnknown() { + return nil, false + } + var v []types.String + d := o.RestApi.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRestApi sets the value of the RestApi field in NetworkVpcEndpoints. +func (o *NetworkVpcEndpoints) SetRestApi(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rest_api"] + t = t.(attr.TypeWithElementType).ElementType() + o.RestApi = types.ListValueMust(t, vs) +} + type NetworkWarning struct { // Details of the warning. WarningMessage types.String `tfsdk:"warning_message" tf:"optional"` @@ -785,11 +3055,44 @@ func (newState *NetworkWarning) SyncEffectiveFieldsDuringCreateOrUpdate(plan Net func (newState *NetworkWarning) SyncEffectiveFieldsDuringRead(existingState NetworkWarning) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NetworkWarning. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NetworkWarning) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NetworkWarning +// only implements ToObjectValue() and Type(). +func (o NetworkWarning) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "warning_message": o.WarningMessage, + "warning_type": o.WarningType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NetworkWarning) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "warning_message": types.StringType, + "warning_type": types.StringType, + }, + } +} + type PrivateAccessSettings struct { // The Databricks account ID that hosts the credential. AccountId types.String `tfsdk:"account_id" tf:"optional"` // An array of Databricks VPC endpoint IDs. - AllowedVpcEndpointIds []types.String `tfsdk:"allowed_vpc_endpoint_ids" tf:"optional"` + AllowedVpcEndpointIds types.List `tfsdk:"allowed_vpc_endpoint_ids" tf:"optional"` // The private access level controls which VPC endpoints can connect to the // UI or API of any workspace that attaches this private access settings // object. * `ACCOUNT` level access (the default) allows only VPC endpoints @@ -818,6 +3121,79 @@ func (newState *PrivateAccessSettings) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *PrivateAccessSettings) SyncEffectiveFieldsDuringRead(existingState PrivateAccessSettings) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PrivateAccessSettings. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PrivateAccessSettings) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "allowed_vpc_endpoint_ids": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PrivateAccessSettings +// only implements ToObjectValue() and Type(). +func (o PrivateAccessSettings) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "allowed_vpc_endpoint_ids": o.AllowedVpcEndpointIds, + "private_access_level": o.PrivateAccessLevel, + "private_access_settings_id": o.PrivateAccessSettingsId, + "private_access_settings_name": o.PrivateAccessSettingsName, + "public_access_enabled": o.PublicAccessEnabled, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PrivateAccessSettings) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "allowed_vpc_endpoint_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "private_access_level": types.StringType, + "private_access_settings_id": types.StringType, + "private_access_settings_name": types.StringType, + "public_access_enabled": types.BoolType, + "region": types.StringType, + }, + } +} + +// GetAllowedVpcEndpointIds returns the value of the AllowedVpcEndpointIds field in PrivateAccessSettings as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PrivateAccessSettings) GetAllowedVpcEndpointIds(ctx context.Context) ([]types.String, bool) { + if o.AllowedVpcEndpointIds.IsNull() || o.AllowedVpcEndpointIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.AllowedVpcEndpointIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllowedVpcEndpointIds sets the value of the AllowedVpcEndpointIds field in PrivateAccessSettings. +func (o *PrivateAccessSettings) SetAllowedVpcEndpointIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["allowed_vpc_endpoint_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllowedVpcEndpointIds = types.ListValueMust(t, vs) +} + type ReplaceResponse struct { } @@ -827,6 +3203,33 @@ func (newState *ReplaceResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Re func (newState *ReplaceResponse) SyncEffectiveFieldsDuringRead(existingState ReplaceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReplaceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReplaceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReplaceResponse +// only implements ToObjectValue() and Type(). +func (o ReplaceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ReplaceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Root S3 bucket information. type RootBucketInfo struct { // The name of the S3 bucket. @@ -839,13 +3242,44 @@ func (newState *RootBucketInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Roo func (newState *RootBucketInfo) SyncEffectiveFieldsDuringRead(existingState RootBucketInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RootBucketInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RootBucketInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RootBucketInfo +// only implements ToObjectValue() and Type(). +func (o RootBucketInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bucket_name": o.BucketName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RootBucketInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bucket_name": types.StringType, + }, + } +} + type StorageConfiguration struct { // The Databricks account ID that hosts the credential. AccountId types.String `tfsdk:"account_id" tf:"computed,optional"` // Time in epoch milliseconds when the storage configuration was created. CreationTime types.Int64 `tfsdk:"creation_time" tf:"computed,optional"` // Root S3 bucket information. - RootBucketInfo []RootBucketInfo `tfsdk:"root_bucket_info" tf:"optional,object"` + RootBucketInfo types.List `tfsdk:"root_bucket_info" tf:"optional,object"` // Databricks storage configuration ID. StorageConfigurationId types.String `tfsdk:"storage_configuration_id" tf:"optional"` // The human-readable name of the storage configuration. @@ -858,6 +3292,75 @@ func (newState *StorageConfiguration) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *StorageConfiguration) SyncEffectiveFieldsDuringRead(existingState StorageConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StorageConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StorageConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "root_bucket_info": reflect.TypeOf(RootBucketInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StorageConfiguration +// only implements ToObjectValue() and Type(). +func (o StorageConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "creation_time": o.CreationTime, + "root_bucket_info": o.RootBucketInfo, + "storage_configuration_id": o.StorageConfigurationId, + "storage_configuration_name": o.StorageConfigurationName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StorageConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "creation_time": types.Int64Type, + "root_bucket_info": basetypes.ListType{ + ElemType: RootBucketInfo{}.Type(ctx), + }, + "storage_configuration_id": types.StringType, + "storage_configuration_name": types.StringType, + }, + } +} + +// GetRootBucketInfo returns the value of the RootBucketInfo field in StorageConfiguration as +// a RootBucketInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *StorageConfiguration) GetRootBucketInfo(ctx context.Context) (RootBucketInfo, bool) { + var e RootBucketInfo + if o.RootBucketInfo.IsNull() || o.RootBucketInfo.IsUnknown() { + return e, false + } + var v []RootBucketInfo + d := o.RootBucketInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRootBucketInfo sets the value of the RootBucketInfo field in StorageConfiguration. +func (o *StorageConfiguration) SetRootBucketInfo(ctx context.Context, v RootBucketInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["root_bucket_info"] + o.RootBucketInfo = types.ListValueMust(t, vs) +} + type StsRole struct { // The external ID that needs to be trusted by the cross-account role. This // is always your Databricks account ID. @@ -872,6 +3375,39 @@ func (newState *StsRole) SyncEffectiveFieldsDuringCreateOrUpdate(plan StsRole) { func (newState *StsRole) SyncEffectiveFieldsDuringRead(existingState StsRole) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StsRole. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StsRole) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StsRole +// only implements ToObjectValue() and Type(). +func (o StsRole) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "external_id": o.ExternalId, + "role_arn": o.RoleArn, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StsRole) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "external_id": types.StringType, + "role_arn": types.StringType, + }, + } +} + type UpdateResponse struct { } @@ -881,6 +3417,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateWorkspaceRequest struct { // The AWS region of the workspace's data plane (for example, `us-west-2`). // This parameter is available only for updating failed workspaces. @@ -892,7 +3455,7 @@ type UpdateWorkspaceRequest struct { // key-value pair is a string of utf-8 characters. The value can be an empty // string, with maximum length of 255 characters. The key can be of maximum // length of 127 characters, and cannot be empty. - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // The ID of the workspace's managed services encryption key configuration // object. This parameter is available only for updating failed workspaces. ManagedServicesCustomerManagedKeyId types.String `tfsdk:"managed_services_customer_managed_key_id" tf:"optional"` @@ -922,6 +3485,85 @@ func (newState *UpdateWorkspaceRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateWorkspaceRequest) SyncEffectiveFieldsDuringRead(existingState UpdateWorkspaceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateWorkspaceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateWorkspaceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "custom_tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateWorkspaceRequest +// only implements ToObjectValue() and Type(). +func (o UpdateWorkspaceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_region": o.AwsRegion, + "credentials_id": o.CredentialsId, + "custom_tags": o.CustomTags, + "managed_services_customer_managed_key_id": o.ManagedServicesCustomerManagedKeyId, + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "network_id": o.NetworkId, + "private_access_settings_id": o.PrivateAccessSettingsId, + "storage_configuration_id": o.StorageConfigurationId, + "storage_customer_managed_key_id": o.StorageCustomerManagedKeyId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateWorkspaceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_region": types.StringType, + "credentials_id": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "managed_services_customer_managed_key_id": types.StringType, + "network_connectivity_config_id": types.StringType, + "network_id": types.StringType, + "private_access_settings_id": types.StringType, + "storage_configuration_id": types.StringType, + "storage_customer_managed_key_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + +// GetCustomTags returns the value of the CustomTags field in UpdateWorkspaceRequest as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateWorkspaceRequest) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in UpdateWorkspaceRequest. +func (o *UpdateWorkspaceRequest) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + type UpsertPrivateAccessSettingsRequest struct { // An array of Databricks VPC endpoint IDs. This is the Databricks ID that // is returned when registering the VPC endpoint configuration in your @@ -937,7 +3579,7 @@ type UpsertPrivateAccessSettingsRequest struct { // public internet, see [IP access lists]. // // [IP access lists]: https://docs.databricks.com/security/network/ip-access-list.html - AllowedVpcEndpointIds []types.String `tfsdk:"allowed_vpc_endpoint_ids" tf:"optional"` + AllowedVpcEndpointIds types.List `tfsdk:"allowed_vpc_endpoint_ids" tf:"optional"` // The private access level controls which VPC endpoints can connect to the // UI or API of any workspace that attaches this private access settings // object. * `ACCOUNT` level access (the default) allows only VPC endpoints @@ -966,6 +3608,77 @@ func (newState *UpsertPrivateAccessSettingsRequest) SyncEffectiveFieldsDuringCre func (newState *UpsertPrivateAccessSettingsRequest) SyncEffectiveFieldsDuringRead(existingState UpsertPrivateAccessSettingsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpsertPrivateAccessSettingsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpsertPrivateAccessSettingsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "allowed_vpc_endpoint_ids": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpsertPrivateAccessSettingsRequest +// only implements ToObjectValue() and Type(). +func (o UpsertPrivateAccessSettingsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allowed_vpc_endpoint_ids": o.AllowedVpcEndpointIds, + "private_access_level": o.PrivateAccessLevel, + "private_access_settings_id": o.PrivateAccessSettingsId, + "private_access_settings_name": o.PrivateAccessSettingsName, + "public_access_enabled": o.PublicAccessEnabled, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpsertPrivateAccessSettingsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allowed_vpc_endpoint_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "private_access_level": types.StringType, + "private_access_settings_id": types.StringType, + "private_access_settings_name": types.StringType, + "public_access_enabled": types.BoolType, + "region": types.StringType, + }, + } +} + +// GetAllowedVpcEndpointIds returns the value of the AllowedVpcEndpointIds field in UpsertPrivateAccessSettingsRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpsertPrivateAccessSettingsRequest) GetAllowedVpcEndpointIds(ctx context.Context) ([]types.String, bool) { + if o.AllowedVpcEndpointIds.IsNull() || o.AllowedVpcEndpointIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.AllowedVpcEndpointIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllowedVpcEndpointIds sets the value of the AllowedVpcEndpointIds field in UpsertPrivateAccessSettingsRequest. +func (o *UpsertPrivateAccessSettingsRequest) SetAllowedVpcEndpointIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["allowed_vpc_endpoint_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllowedVpcEndpointIds = types.ListValueMust(t, vs) +} + type VpcEndpoint struct { // The Databricks account ID that hosts the VPC endpoint configuration. AccountId types.String `tfsdk:"account_id" tf:"optional"` @@ -982,7 +3695,7 @@ type VpcEndpoint struct { AwsVpcEndpointId types.String `tfsdk:"aws_vpc_endpoint_id" tf:"optional"` // The Google Cloud specific information for this Private Service Connect // endpoint. - GcpVpcEndpointInfo []GcpVpcEndpointInfo `tfsdk:"gcp_vpc_endpoint_info" tf:"optional,object"` + GcpVpcEndpointInfo types.List `tfsdk:"gcp_vpc_endpoint_info" tf:"optional,object"` // The AWS region in which this VPC endpoint object exists. Region types.String `tfsdk:"region" tf:"optional"` // The current state (such as `available` or `rejected`) of the VPC @@ -1010,18 +3723,97 @@ func (newState *VpcEndpoint) SyncEffectiveFieldsDuringCreateOrUpdate(plan VpcEnd func (newState *VpcEndpoint) SyncEffectiveFieldsDuringRead(existingState VpcEndpoint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in VpcEndpoint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a VpcEndpoint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "gcp_vpc_endpoint_info": reflect.TypeOf(GcpVpcEndpointInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, VpcEndpoint +// only implements ToObjectValue() and Type(). +func (o VpcEndpoint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "aws_account_id": o.AwsAccountId, + "aws_endpoint_service_id": o.AwsEndpointServiceId, + "aws_vpc_endpoint_id": o.AwsVpcEndpointId, + "gcp_vpc_endpoint_info": o.GcpVpcEndpointInfo, + "region": o.Region, + "state": o.State, + "use_case": o.UseCase, + "vpc_endpoint_id": o.VpcEndpointId, + "vpc_endpoint_name": o.VpcEndpointName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o VpcEndpoint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "aws_account_id": types.StringType, + "aws_endpoint_service_id": types.StringType, + "aws_vpc_endpoint_id": types.StringType, + "gcp_vpc_endpoint_info": basetypes.ListType{ + ElemType: GcpVpcEndpointInfo{}.Type(ctx), + }, + "region": types.StringType, + "state": types.StringType, + "use_case": types.StringType, + "vpc_endpoint_id": types.StringType, + "vpc_endpoint_name": types.StringType, + }, + } +} + +// GetGcpVpcEndpointInfo returns the value of the GcpVpcEndpointInfo field in VpcEndpoint as +// a GcpVpcEndpointInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *VpcEndpoint) GetGcpVpcEndpointInfo(ctx context.Context) (GcpVpcEndpointInfo, bool) { + var e GcpVpcEndpointInfo + if o.GcpVpcEndpointInfo.IsNull() || o.GcpVpcEndpointInfo.IsUnknown() { + return e, false + } + var v []GcpVpcEndpointInfo + d := o.GcpVpcEndpointInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpVpcEndpointInfo sets the value of the GcpVpcEndpointInfo field in VpcEndpoint. +func (o *VpcEndpoint) SetGcpVpcEndpointInfo(ctx context.Context, v GcpVpcEndpointInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_vpc_endpoint_info"] + o.GcpVpcEndpointInfo = types.ListValueMust(t, vs) +} + type Workspace struct { // Databricks account ID. AccountId types.String `tfsdk:"account_id" tf:"optional"` // The AWS region of the workspace data plane (for example, `us-west-2`). AwsRegion types.String `tfsdk:"aws_region" tf:"optional"` - AzureWorkspaceInfo []AzureWorkspaceInfo `tfsdk:"azure_workspace_info" tf:"optional,object"` + AzureWorkspaceInfo types.List `tfsdk:"azure_workspace_info" tf:"optional,object"` // The cloud name. This field always has the value `gcp`. Cloud types.String `tfsdk:"cloud" tf:"optional"` // The general workspace configurations that are specific to cloud // providers. - CloudResourceContainer []CloudResourceContainer `tfsdk:"cloud_resource_container" tf:"optional,object"` + CloudResourceContainer types.List `tfsdk:"cloud_resource_container" tf:"optional,object"` // Time in epoch milliseconds when the workspace was created. CreationTime types.Int64 `tfsdk:"creation_time" tf:"computed,optional"` // ID of the workspace's credential configuration object. @@ -1030,7 +3822,7 @@ type Workspace struct { // key-value pair is a string of utf-8 characters. The value can be an empty // string, with maximum length of 255 characters. The key can be of maximum // length of 127 characters, and cannot be empty. - CustomTags map[string]types.String `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.Map `tfsdk:"custom_tags" tf:"optional"` // The deployment name defines part of the subdomain for the workspace. The // workspace URL for web application and REST APIs is // `.cloud.databricks.com`. @@ -1041,7 +3833,7 @@ type Workspace struct { // If this workspace is for a external customer, then external_customer_info // is populated. If this workspace is not for a external customer, then // external_customer_info is empty. - ExternalCustomerInfo []ExternalCustomerInfo `tfsdk:"external_customer_info" tf:"optional,object"` + ExternalCustomerInfo types.List `tfsdk:"external_customer_info" tf:"optional,object"` // The network settings for the workspace. The configurations are only for // Databricks-managed VPCs. It is ignored if you specify a customer-managed // VPC in the `network_id` field.", All the IP range configurations must be @@ -1065,9 +3857,9 @@ type Workspace struct { // for a new workspace]. // // [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html - GcpManagedNetworkConfig []GcpManagedNetworkConfig `tfsdk:"gcp_managed_network_config" tf:"optional,object"` + GcpManagedNetworkConfig types.List `tfsdk:"gcp_managed_network_config" tf:"optional,object"` // The configurations for the GKE cluster of a Databricks workspace. - GkeConfig []GkeConfig `tfsdk:"gke_config" tf:"optional,object"` + GkeConfig types.List `tfsdk:"gke_config" tf:"optional,object"` // Whether no public IP is enabled for the workspace. IsNoPublicIpEnabled types.Bool `tfsdk:"is_no_public_ip_enabled" tf:"optional"` // The Google Cloud region of the workspace data plane in your Google @@ -1115,3 +3907,255 @@ func (newState *Workspace) SyncEffectiveFieldsDuringCreateOrUpdate(plan Workspac func (newState *Workspace) SyncEffectiveFieldsDuringRead(existingState Workspace) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Workspace. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Workspace) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "azure_workspace_info": reflect.TypeOf(AzureWorkspaceInfo{}), + "cloud_resource_container": reflect.TypeOf(CloudResourceContainer{}), + "custom_tags": reflect.TypeOf(types.String{}), + "external_customer_info": reflect.TypeOf(ExternalCustomerInfo{}), + "gcp_managed_network_config": reflect.TypeOf(GcpManagedNetworkConfig{}), + "gke_config": reflect.TypeOf(GkeConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Workspace +// only implements ToObjectValue() and Type(). +func (o Workspace) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "aws_region": o.AwsRegion, + "azure_workspace_info": o.AzureWorkspaceInfo, + "cloud": o.Cloud, + "cloud_resource_container": o.CloudResourceContainer, + "creation_time": o.CreationTime, + "credentials_id": o.CredentialsId, + "custom_tags": o.CustomTags, + "deployment_name": o.DeploymentName, + "external_customer_info": o.ExternalCustomerInfo, + "gcp_managed_network_config": o.GcpManagedNetworkConfig, + "gke_config": o.GkeConfig, + "is_no_public_ip_enabled": o.IsNoPublicIpEnabled, + "location": o.Location, + "managed_services_customer_managed_key_id": o.ManagedServicesCustomerManagedKeyId, + "network_id": o.NetworkId, + "pricing_tier": o.PricingTier, + "private_access_settings_id": o.PrivateAccessSettingsId, + "storage_configuration_id": o.StorageConfigurationId, + "storage_customer_managed_key_id": o.StorageCustomerManagedKeyId, + "workspace_id": o.WorkspaceId, + "workspace_name": o.WorkspaceName, + "workspace_status": o.WorkspaceStatus, + "workspace_status_message": o.WorkspaceStatusMessage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Workspace) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "aws_region": types.StringType, + "azure_workspace_info": basetypes.ListType{ + ElemType: AzureWorkspaceInfo{}.Type(ctx), + }, + "cloud": types.StringType, + "cloud_resource_container": basetypes.ListType{ + ElemType: CloudResourceContainer{}.Type(ctx), + }, + "creation_time": types.Int64Type, + "credentials_id": types.StringType, + "custom_tags": basetypes.MapType{ + ElemType: types.StringType, + }, + "deployment_name": types.StringType, + "external_customer_info": basetypes.ListType{ + ElemType: ExternalCustomerInfo{}.Type(ctx), + }, + "gcp_managed_network_config": basetypes.ListType{ + ElemType: GcpManagedNetworkConfig{}.Type(ctx), + }, + "gke_config": basetypes.ListType{ + ElemType: GkeConfig{}.Type(ctx), + }, + "is_no_public_ip_enabled": types.BoolType, + "location": types.StringType, + "managed_services_customer_managed_key_id": types.StringType, + "network_id": types.StringType, + "pricing_tier": types.StringType, + "private_access_settings_id": types.StringType, + "storage_configuration_id": types.StringType, + "storage_customer_managed_key_id": types.StringType, + "workspace_id": types.Int64Type, + "workspace_name": types.StringType, + "workspace_status": types.StringType, + "workspace_status_message": types.StringType, + }, + } +} + +// GetAzureWorkspaceInfo returns the value of the AzureWorkspaceInfo field in Workspace as +// a AzureWorkspaceInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *Workspace) GetAzureWorkspaceInfo(ctx context.Context) (AzureWorkspaceInfo, bool) { + var e AzureWorkspaceInfo + if o.AzureWorkspaceInfo.IsNull() || o.AzureWorkspaceInfo.IsUnknown() { + return e, false + } + var v []AzureWorkspaceInfo + d := o.AzureWorkspaceInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureWorkspaceInfo sets the value of the AzureWorkspaceInfo field in Workspace. +func (o *Workspace) SetAzureWorkspaceInfo(ctx context.Context, v AzureWorkspaceInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_workspace_info"] + o.AzureWorkspaceInfo = types.ListValueMust(t, vs) +} + +// GetCloudResourceContainer returns the value of the CloudResourceContainer field in Workspace as +// a CloudResourceContainer value. +// If the field is unknown or null, the boolean return value is false. +func (o *Workspace) GetCloudResourceContainer(ctx context.Context) (CloudResourceContainer, bool) { + var e CloudResourceContainer + if o.CloudResourceContainer.IsNull() || o.CloudResourceContainer.IsUnknown() { + return e, false + } + var v []CloudResourceContainer + d := o.CloudResourceContainer.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCloudResourceContainer sets the value of the CloudResourceContainer field in Workspace. +func (o *Workspace) SetCloudResourceContainer(ctx context.Context, v CloudResourceContainer) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cloud_resource_container"] + o.CloudResourceContainer = types.ListValueMust(t, vs) +} + +// GetCustomTags returns the value of the CustomTags field in Workspace as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Workspace) GetCustomTags(ctx context.Context) (map[string]types.String, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in Workspace. +func (o *Workspace) SetCustomTags(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.MapValueMust(t, vs) +} + +// GetExternalCustomerInfo returns the value of the ExternalCustomerInfo field in Workspace as +// a ExternalCustomerInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *Workspace) GetExternalCustomerInfo(ctx context.Context) (ExternalCustomerInfo, bool) { + var e ExternalCustomerInfo + if o.ExternalCustomerInfo.IsNull() || o.ExternalCustomerInfo.IsUnknown() { + return e, false + } + var v []ExternalCustomerInfo + d := o.ExternalCustomerInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExternalCustomerInfo sets the value of the ExternalCustomerInfo field in Workspace. +func (o *Workspace) SetExternalCustomerInfo(ctx context.Context, v ExternalCustomerInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["external_customer_info"] + o.ExternalCustomerInfo = types.ListValueMust(t, vs) +} + +// GetGcpManagedNetworkConfig returns the value of the GcpManagedNetworkConfig field in Workspace as +// a GcpManagedNetworkConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Workspace) GetGcpManagedNetworkConfig(ctx context.Context) (GcpManagedNetworkConfig, bool) { + var e GcpManagedNetworkConfig + if o.GcpManagedNetworkConfig.IsNull() || o.GcpManagedNetworkConfig.IsUnknown() { + return e, false + } + var v []GcpManagedNetworkConfig + d := o.GcpManagedNetworkConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGcpManagedNetworkConfig sets the value of the GcpManagedNetworkConfig field in Workspace. +func (o *Workspace) SetGcpManagedNetworkConfig(ctx context.Context, v GcpManagedNetworkConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gcp_managed_network_config"] + o.GcpManagedNetworkConfig = types.ListValueMust(t, vs) +} + +// GetGkeConfig returns the value of the GkeConfig field in Workspace as +// a GkeConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Workspace) GetGkeConfig(ctx context.Context) (GkeConfig, bool) { + var e GkeConfig + if o.GkeConfig.IsNull() || o.GkeConfig.IsUnknown() { + return e, false + } + var v []GkeConfig + d := o.GkeConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGkeConfig sets the value of the GkeConfig field in Workspace. +func (o *Workspace) SetGkeConfig(ctx context.Context, v GkeConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["gke_config"] + o.GkeConfig = types.ListValueMust(t, vs) +} diff --git a/internal/service/serving_tf/model.go b/internal/service/serving_tf/model.go index 940de56ad..0a1d00c0c 100755 --- a/internal/service/serving_tf/model.go +++ b/internal/service/serving_tf/model.go @@ -11,10 +11,15 @@ We use go-native types for lists and maps intentionally for the ease for convert package serving_tf import ( - "io" + "context" + "reflect" - "github.com/databricks/databricks-sdk-go/service/oauth2" + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/databricks/terraform-provider-databricks/internal/service/oauth2_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type Ai21LabsConfig struct { @@ -36,20 +41,53 @@ func (newState *Ai21LabsConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ai2 func (newState *Ai21LabsConfig) SyncEffectiveFieldsDuringRead(existingState Ai21LabsConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Ai21LabsConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Ai21LabsConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Ai21LabsConfig +// only implements ToObjectValue() and Type(). +func (o Ai21LabsConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ai21labs_api_key": o.Ai21labsApiKey, + "ai21labs_api_key_plaintext": o.Ai21labsApiKeyPlaintext, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Ai21LabsConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ai21labs_api_key": types.StringType, + "ai21labs_api_key_plaintext": types.StringType, + }, + } +} + type AiGatewayConfig struct { // Configuration for AI Guardrails to prevent unwanted data and unsafe data // in requests and responses. - Guardrails []AiGatewayGuardrails `tfsdk:"guardrails" tf:"optional,object"` + Guardrails types.List `tfsdk:"guardrails" tf:"optional,object"` // Configuration for payload logging using inference tables. Use these // tables to monitor and audit data being sent to and received from model // APIs and to improve model quality. - InferenceTableConfig []AiGatewayInferenceTableConfig `tfsdk:"inference_table_config" tf:"optional,object"` + InferenceTableConfig types.List `tfsdk:"inference_table_config" tf:"optional,object"` // Configuration for rate limits which can be set to limit endpoint traffic. - RateLimits []AiGatewayRateLimit `tfsdk:"rate_limits" tf:"optional"` + RateLimits types.List `tfsdk:"rate_limits" tf:"optional"` // Configuration to enable usage tracking using system tables. These tables // allow you to monitor operational usage on endpoints and their associated // costs. - UsageTrackingConfig []AiGatewayUsageTrackingConfig `tfsdk:"usage_tracking_config" tf:"optional,object"` + UsageTrackingConfig types.List `tfsdk:"usage_tracking_config" tf:"optional,object"` } func (newState *AiGatewayConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan AiGatewayConfig) { @@ -58,17 +96,171 @@ func (newState *AiGatewayConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ai func (newState *AiGatewayConfig) SyncEffectiveFieldsDuringRead(existingState AiGatewayConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "guardrails": reflect.TypeOf(AiGatewayGuardrails{}), + "inference_table_config": reflect.TypeOf(AiGatewayInferenceTableConfig{}), + "rate_limits": reflect.TypeOf(AiGatewayRateLimit{}), + "usage_tracking_config": reflect.TypeOf(AiGatewayUsageTrackingConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayConfig +// only implements ToObjectValue() and Type(). +func (o AiGatewayConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "guardrails": o.Guardrails, + "inference_table_config": o.InferenceTableConfig, + "rate_limits": o.RateLimits, + "usage_tracking_config": o.UsageTrackingConfig, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "guardrails": basetypes.ListType{ + ElemType: AiGatewayGuardrails{}.Type(ctx), + }, + "inference_table_config": basetypes.ListType{ + ElemType: AiGatewayInferenceTableConfig{}.Type(ctx), + }, + "rate_limits": basetypes.ListType{ + ElemType: AiGatewayRateLimit{}.Type(ctx), + }, + "usage_tracking_config": basetypes.ListType{ + ElemType: AiGatewayUsageTrackingConfig{}.Type(ctx), + }, + }, + } +} + +// GetGuardrails returns the value of the Guardrails field in AiGatewayConfig as +// a AiGatewayGuardrails value. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayConfig) GetGuardrails(ctx context.Context) (AiGatewayGuardrails, bool) { + var e AiGatewayGuardrails + if o.Guardrails.IsNull() || o.Guardrails.IsUnknown() { + return e, false + } + var v []AiGatewayGuardrails + d := o.Guardrails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGuardrails sets the value of the Guardrails field in AiGatewayConfig. +func (o *AiGatewayConfig) SetGuardrails(ctx context.Context, v AiGatewayGuardrails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["guardrails"] + o.Guardrails = types.ListValueMust(t, vs) +} + +// GetInferenceTableConfig returns the value of the InferenceTableConfig field in AiGatewayConfig as +// a AiGatewayInferenceTableConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayConfig) GetInferenceTableConfig(ctx context.Context) (AiGatewayInferenceTableConfig, bool) { + var e AiGatewayInferenceTableConfig + if o.InferenceTableConfig.IsNull() || o.InferenceTableConfig.IsUnknown() { + return e, false + } + var v []AiGatewayInferenceTableConfig + d := o.InferenceTableConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInferenceTableConfig sets the value of the InferenceTableConfig field in AiGatewayConfig. +func (o *AiGatewayConfig) SetInferenceTableConfig(ctx context.Context, v AiGatewayInferenceTableConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inference_table_config"] + o.InferenceTableConfig = types.ListValueMust(t, vs) +} + +// GetRateLimits returns the value of the RateLimits field in AiGatewayConfig as +// a slice of AiGatewayRateLimit values. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayConfig) GetRateLimits(ctx context.Context) ([]AiGatewayRateLimit, bool) { + if o.RateLimits.IsNull() || o.RateLimits.IsUnknown() { + return nil, false + } + var v []AiGatewayRateLimit + d := o.RateLimits.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRateLimits sets the value of the RateLimits field in AiGatewayConfig. +func (o *AiGatewayConfig) SetRateLimits(ctx context.Context, v []AiGatewayRateLimit) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rate_limits"] + t = t.(attr.TypeWithElementType).ElementType() + o.RateLimits = types.ListValueMust(t, vs) +} + +// GetUsageTrackingConfig returns the value of the UsageTrackingConfig field in AiGatewayConfig as +// a AiGatewayUsageTrackingConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayConfig) GetUsageTrackingConfig(ctx context.Context) (AiGatewayUsageTrackingConfig, bool) { + var e AiGatewayUsageTrackingConfig + if o.UsageTrackingConfig.IsNull() || o.UsageTrackingConfig.IsUnknown() { + return e, false + } + var v []AiGatewayUsageTrackingConfig + d := o.UsageTrackingConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUsageTrackingConfig sets the value of the UsageTrackingConfig field in AiGatewayConfig. +func (o *AiGatewayConfig) SetUsageTrackingConfig(ctx context.Context, v AiGatewayUsageTrackingConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["usage_tracking_config"] + o.UsageTrackingConfig = types.ListValueMust(t, vs) +} + type AiGatewayGuardrailParameters struct { // List of invalid keywords. AI guardrail uses keyword or string matching to // decide if the keyword exists in the request or response content. - InvalidKeywords []types.String `tfsdk:"invalid_keywords" tf:"optional"` + InvalidKeywords types.List `tfsdk:"invalid_keywords" tf:"optional"` // Configuration for guardrail PII filter. - Pii []AiGatewayGuardrailPiiBehavior `tfsdk:"pii" tf:"optional,object"` + Pii types.List `tfsdk:"pii" tf:"optional,object"` // Indicates whether the safety filter is enabled. Safety types.Bool `tfsdk:"safety" tf:"optional"` // The list of allowed topics. Given a chat request, this guardrail flags // the request if its topic is not in the allowed topics. - ValidTopics []types.String `tfsdk:"valid_topics" tf:"optional"` + ValidTopics types.List `tfsdk:"valid_topics" tf:"optional"` } func (newState *AiGatewayGuardrailParameters) SyncEffectiveFieldsDuringCreateOrUpdate(plan AiGatewayGuardrailParameters) { @@ -77,6 +269,131 @@ func (newState *AiGatewayGuardrailParameters) SyncEffectiveFieldsDuringCreateOrU func (newState *AiGatewayGuardrailParameters) SyncEffectiveFieldsDuringRead(existingState AiGatewayGuardrailParameters) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayGuardrailParameters. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayGuardrailParameters) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "invalid_keywords": reflect.TypeOf(types.String{}), + "pii": reflect.TypeOf(AiGatewayGuardrailPiiBehavior{}), + "valid_topics": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayGuardrailParameters +// only implements ToObjectValue() and Type(). +func (o AiGatewayGuardrailParameters) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "invalid_keywords": o.InvalidKeywords, + "pii": o.Pii, + "safety": o.Safety, + "valid_topics": o.ValidTopics, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayGuardrailParameters) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "invalid_keywords": basetypes.ListType{ + ElemType: types.StringType, + }, + "pii": basetypes.ListType{ + ElemType: AiGatewayGuardrailPiiBehavior{}.Type(ctx), + }, + "safety": types.BoolType, + "valid_topics": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetInvalidKeywords returns the value of the InvalidKeywords field in AiGatewayGuardrailParameters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayGuardrailParameters) GetInvalidKeywords(ctx context.Context) ([]types.String, bool) { + if o.InvalidKeywords.IsNull() || o.InvalidKeywords.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InvalidKeywords.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInvalidKeywords sets the value of the InvalidKeywords field in AiGatewayGuardrailParameters. +func (o *AiGatewayGuardrailParameters) SetInvalidKeywords(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["invalid_keywords"] + t = t.(attr.TypeWithElementType).ElementType() + o.InvalidKeywords = types.ListValueMust(t, vs) +} + +// GetPii returns the value of the Pii field in AiGatewayGuardrailParameters as +// a AiGatewayGuardrailPiiBehavior value. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayGuardrailParameters) GetPii(ctx context.Context) (AiGatewayGuardrailPiiBehavior, bool) { + var e AiGatewayGuardrailPiiBehavior + if o.Pii.IsNull() || o.Pii.IsUnknown() { + return e, false + } + var v []AiGatewayGuardrailPiiBehavior + d := o.Pii.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPii sets the value of the Pii field in AiGatewayGuardrailParameters. +func (o *AiGatewayGuardrailParameters) SetPii(ctx context.Context, v AiGatewayGuardrailPiiBehavior) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pii"] + o.Pii = types.ListValueMust(t, vs) +} + +// GetValidTopics returns the value of the ValidTopics field in AiGatewayGuardrailParameters as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayGuardrailParameters) GetValidTopics(ctx context.Context) ([]types.String, bool) { + if o.ValidTopics.IsNull() || o.ValidTopics.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ValidTopics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValidTopics sets the value of the ValidTopics field in AiGatewayGuardrailParameters. +func (o *AiGatewayGuardrailParameters) SetValidTopics(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["valid_topics"] + t = t.(attr.TypeWithElementType).ElementType() + o.ValidTopics = types.ListValueMust(t, vs) +} + type AiGatewayGuardrailPiiBehavior struct { // Behavior for PII filter. Currently only 'BLOCK' is supported. If 'BLOCK' // is set for the input guardrail and the request contains PII, the request @@ -93,11 +410,42 @@ func (newState *AiGatewayGuardrailPiiBehavior) SyncEffectiveFieldsDuringCreateOr func (newState *AiGatewayGuardrailPiiBehavior) SyncEffectiveFieldsDuringRead(existingState AiGatewayGuardrailPiiBehavior) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayGuardrailPiiBehavior. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayGuardrailPiiBehavior) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayGuardrailPiiBehavior +// only implements ToObjectValue() and Type(). +func (o AiGatewayGuardrailPiiBehavior) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "behavior": o.Behavior, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayGuardrailPiiBehavior) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "behavior": types.StringType, + }, + } +} + type AiGatewayGuardrails struct { // Configuration for input guardrail filters. - Input []AiGatewayGuardrailParameters `tfsdk:"input" tf:"optional,object"` + Input types.List `tfsdk:"input" tf:"optional,object"` // Configuration for output guardrail filters. - Output []AiGatewayGuardrailParameters `tfsdk:"output" tf:"optional,object"` + Output types.List `tfsdk:"output" tf:"optional,object"` } func (newState *AiGatewayGuardrails) SyncEffectiveFieldsDuringCreateOrUpdate(plan AiGatewayGuardrails) { @@ -106,6 +454,98 @@ func (newState *AiGatewayGuardrails) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *AiGatewayGuardrails) SyncEffectiveFieldsDuringRead(existingState AiGatewayGuardrails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayGuardrails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayGuardrails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "input": reflect.TypeOf(AiGatewayGuardrailParameters{}), + "output": reflect.TypeOf(AiGatewayGuardrailParameters{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayGuardrails +// only implements ToObjectValue() and Type(). +func (o AiGatewayGuardrails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "input": o.Input, + "output": o.Output, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayGuardrails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "input": basetypes.ListType{ + ElemType: AiGatewayGuardrailParameters{}.Type(ctx), + }, + "output": basetypes.ListType{ + ElemType: AiGatewayGuardrailParameters{}.Type(ctx), + }, + }, + } +} + +// GetInput returns the value of the Input field in AiGatewayGuardrails as +// a AiGatewayGuardrailParameters value. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayGuardrails) GetInput(ctx context.Context) (AiGatewayGuardrailParameters, bool) { + var e AiGatewayGuardrailParameters + if o.Input.IsNull() || o.Input.IsUnknown() { + return e, false + } + var v []AiGatewayGuardrailParameters + d := o.Input.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInput sets the value of the Input field in AiGatewayGuardrails. +func (o *AiGatewayGuardrails) SetInput(ctx context.Context, v AiGatewayGuardrailParameters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["input"] + o.Input = types.ListValueMust(t, vs) +} + +// GetOutput returns the value of the Output field in AiGatewayGuardrails as +// a AiGatewayGuardrailParameters value. +// If the field is unknown or null, the boolean return value is false. +func (o *AiGatewayGuardrails) GetOutput(ctx context.Context) (AiGatewayGuardrailParameters, bool) { + var e AiGatewayGuardrailParameters + if o.Output.IsNull() || o.Output.IsUnknown() { + return e, false + } + var v []AiGatewayGuardrailParameters + d := o.Output.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOutput sets the value of the Output field in AiGatewayGuardrails. +func (o *AiGatewayGuardrails) SetOutput(ctx context.Context, v AiGatewayGuardrailParameters) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["output"] + o.Output = types.ListValueMust(t, vs) +} + type AiGatewayInferenceTableConfig struct { // The name of the catalog in Unity Catalog. Required when enabling // inference tables. NOTE: On update, you have to disable inference table @@ -128,6 +568,43 @@ func (newState *AiGatewayInferenceTableConfig) SyncEffectiveFieldsDuringCreateOr func (newState *AiGatewayInferenceTableConfig) SyncEffectiveFieldsDuringRead(existingState AiGatewayInferenceTableConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayInferenceTableConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayInferenceTableConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayInferenceTableConfig +// only implements ToObjectValue() and Type(). +func (o AiGatewayInferenceTableConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "enabled": o.Enabled, + "schema_name": o.SchemaName, + "table_name_prefix": o.TableNamePrefix, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayInferenceTableConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "enabled": types.BoolType, + "schema_name": types.StringType, + "table_name_prefix": types.StringType, + }, + } +} + type AiGatewayRateLimit struct { // Used to specify how many calls are allowed for a key within the // renewal_period. @@ -146,6 +623,41 @@ func (newState *AiGatewayRateLimit) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AiGatewayRateLimit) SyncEffectiveFieldsDuringRead(existingState AiGatewayRateLimit) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayRateLimit. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayRateLimit) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayRateLimit +// only implements ToObjectValue() and Type(). +func (o AiGatewayRateLimit) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "calls": o.Calls, + "key": o.Key, + "renewal_period": o.RenewalPeriod, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayRateLimit) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "calls": types.Int64Type, + "key": types.StringType, + "renewal_period": types.StringType, + }, + } +} + type AiGatewayUsageTrackingConfig struct { // Whether to enable usage tracking. Enabled types.Bool `tfsdk:"enabled" tf:"optional"` @@ -157,6 +669,37 @@ func (newState *AiGatewayUsageTrackingConfig) SyncEffectiveFieldsDuringCreateOrU func (newState *AiGatewayUsageTrackingConfig) SyncEffectiveFieldsDuringRead(existingState AiGatewayUsageTrackingConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AiGatewayUsageTrackingConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AiGatewayUsageTrackingConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AiGatewayUsageTrackingConfig +// only implements ToObjectValue() and Type(). +func (o AiGatewayUsageTrackingConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AiGatewayUsageTrackingConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + }, + } +} + type AmazonBedrockConfig struct { // The Databricks secret key reference for an AWS access key ID with // permissions to interact with Bedrock services. If you prefer to paste @@ -197,6 +740,47 @@ func (newState *AmazonBedrockConfig) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *AmazonBedrockConfig) SyncEffectiveFieldsDuringRead(existingState AmazonBedrockConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AmazonBedrockConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AmazonBedrockConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AmazonBedrockConfig +// only implements ToObjectValue() and Type(). +func (o AmazonBedrockConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_access_key_id": o.AwsAccessKeyId, + "aws_access_key_id_plaintext": o.AwsAccessKeyIdPlaintext, + "aws_region": o.AwsRegion, + "aws_secret_access_key": o.AwsSecretAccessKey, + "aws_secret_access_key_plaintext": o.AwsSecretAccessKeyPlaintext, + "bedrock_provider": o.BedrockProvider, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AmazonBedrockConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_access_key_id": types.StringType, + "aws_access_key_id_plaintext": types.StringType, + "aws_region": types.StringType, + "aws_secret_access_key": types.StringType, + "aws_secret_access_key_plaintext": types.StringType, + "bedrock_provider": types.StringType, + }, + } +} + type AnthropicConfig struct { // The Databricks secret key reference for an Anthropic API key. If you // prefer to paste your API key directly, see `anthropic_api_key_plaintext`. @@ -216,6 +800,39 @@ func (newState *AnthropicConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan An func (newState *AnthropicConfig) SyncEffectiveFieldsDuringRead(existingState AnthropicConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AnthropicConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AnthropicConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AnthropicConfig +// only implements ToObjectValue() and Type(). +func (o AnthropicConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "anthropic_api_key": o.AnthropicApiKey, + "anthropic_api_key_plaintext": o.AnthropicApiKeyPlaintext, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AnthropicConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "anthropic_api_key": types.StringType, + "anthropic_api_key_plaintext": types.StringType, + }, + } +} + type AutoCaptureConfigInput struct { // The name of the catalog in Unity Catalog. NOTE: On update, you cannot // change the catalog name if the inference table is already enabled. @@ -236,6 +853,43 @@ func (newState *AutoCaptureConfigInput) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *AutoCaptureConfigInput) SyncEffectiveFieldsDuringRead(existingState AutoCaptureConfigInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AutoCaptureConfigInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AutoCaptureConfigInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AutoCaptureConfigInput +// only implements ToObjectValue() and Type(). +func (o AutoCaptureConfigInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "enabled": o.Enabled, + "schema_name": o.SchemaName, + "table_name_prefix": o.TableNamePrefix, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AutoCaptureConfigInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "enabled": types.BoolType, + "schema_name": types.StringType, + "table_name_prefix": types.StringType, + }, + } +} + type AutoCaptureConfigOutput struct { // The name of the catalog in Unity Catalog. CatalogName types.String `tfsdk:"catalog_name" tf:"optional"` @@ -244,7 +898,7 @@ type AutoCaptureConfigOutput struct { // The name of the schema in Unity Catalog. SchemaName types.String `tfsdk:"schema_name" tf:"optional"` - State []AutoCaptureState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The prefix of the table in Unity Catalog. TableNamePrefix types.String `tfsdk:"table_name_prefix" tf:"optional"` } @@ -255,8 +909,77 @@ func (newState *AutoCaptureConfigOutput) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *AutoCaptureConfigOutput) SyncEffectiveFieldsDuringRead(existingState AutoCaptureConfigOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AutoCaptureConfigOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AutoCaptureConfigOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "state": reflect.TypeOf(AutoCaptureState{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AutoCaptureConfigOutput +// only implements ToObjectValue() and Type(). +func (o AutoCaptureConfigOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog_name": o.CatalogName, + "enabled": o.Enabled, + "schema_name": o.SchemaName, + "state": o.State, + "table_name_prefix": o.TableNamePrefix, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AutoCaptureConfigOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog_name": types.StringType, + "enabled": types.BoolType, + "schema_name": types.StringType, + "state": basetypes.ListType{ + ElemType: AutoCaptureState{}.Type(ctx), + }, + "table_name_prefix": types.StringType, + }, + } +} + +// GetState returns the value of the State field in AutoCaptureConfigOutput as +// a AutoCaptureState value. +// If the field is unknown or null, the boolean return value is false. +func (o *AutoCaptureConfigOutput) GetState(ctx context.Context) (AutoCaptureState, bool) { + var e AutoCaptureState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []AutoCaptureState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in AutoCaptureConfigOutput. +func (o *AutoCaptureConfigOutput) SetState(ctx context.Context, v AutoCaptureState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + type AutoCaptureState struct { - PayloadTable []PayloadTable `tfsdk:"payload_table" tf:"optional,object"` + PayloadTable types.List `tfsdk:"payload_table" tf:"optional,object"` } func (newState *AutoCaptureState) SyncEffectiveFieldsDuringCreateOrUpdate(plan AutoCaptureState) { @@ -265,6 +988,67 @@ func (newState *AutoCaptureState) SyncEffectiveFieldsDuringCreateOrUpdate(plan A func (newState *AutoCaptureState) SyncEffectiveFieldsDuringRead(existingState AutoCaptureState) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AutoCaptureState. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AutoCaptureState) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "payload_table": reflect.TypeOf(PayloadTable{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AutoCaptureState +// only implements ToObjectValue() and Type(). +func (o AutoCaptureState) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "payload_table": o.PayloadTable, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AutoCaptureState) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "payload_table": basetypes.ListType{ + ElemType: PayloadTable{}.Type(ctx), + }, + }, + } +} + +// GetPayloadTable returns the value of the PayloadTable field in AutoCaptureState as +// a PayloadTable value. +// If the field is unknown or null, the boolean return value is false. +func (o *AutoCaptureState) GetPayloadTable(ctx context.Context) (PayloadTable, bool) { + var e PayloadTable + if o.PayloadTable.IsNull() || o.PayloadTable.IsUnknown() { + return e, false + } + var v []PayloadTable + d := o.PayloadTable.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPayloadTable sets the value of the PayloadTable field in AutoCaptureState. +func (o *AutoCaptureState) SetPayloadTable(ctx context.Context, v PayloadTable) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["payload_table"] + o.PayloadTable = types.ListValueMust(t, vs) +} + // Get build logs for a served model type BuildLogsRequest struct { // The name of the serving endpoint that the served model belongs to. This @@ -281,6 +1065,39 @@ func (newState *BuildLogsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan B func (newState *BuildLogsRequest) SyncEffectiveFieldsDuringRead(existingState BuildLogsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BuildLogsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BuildLogsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BuildLogsRequest +// only implements ToObjectValue() and Type(). +func (o BuildLogsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "served_model_name": o.ServedModelName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BuildLogsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "served_model_name": types.StringType, + }, + } +} + type BuildLogsResponse struct { // The logs associated with building the served entity's environment. Logs types.String `tfsdk:"logs" tf:""` @@ -292,6 +1109,37 @@ func (newState *BuildLogsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *BuildLogsResponse) SyncEffectiveFieldsDuringRead(existingState BuildLogsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BuildLogsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BuildLogsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BuildLogsResponse +// only implements ToObjectValue() and Type(). +func (o BuildLogsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "logs": o.Logs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BuildLogsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "logs": types.StringType, + }, + } +} + type ChatMessage struct { // The content of the message. Content types.String `tfsdk:"content" tf:"optional"` @@ -305,6 +1153,39 @@ func (newState *ChatMessage) SyncEffectiveFieldsDuringCreateOrUpdate(plan ChatMe func (newState *ChatMessage) SyncEffectiveFieldsDuringRead(existingState ChatMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ChatMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ChatMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ChatMessage +// only implements ToObjectValue() and Type(). +func (o ChatMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "role": o.Role, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ChatMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "role": types.StringType, + }, + } +} + type CohereConfig struct { // This is an optional field to provide a customized base URL for the Cohere // API. If left unspecified, the standard Cohere base URL is used. @@ -327,24 +1208,59 @@ func (newState *CohereConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan Coher func (newState *CohereConfig) SyncEffectiveFieldsDuringRead(existingState CohereConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CohereConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CohereConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CohereConfig +// only implements ToObjectValue() and Type(). +func (o CohereConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cohere_api_base": o.CohereApiBase, + "cohere_api_key": o.CohereApiKey, + "cohere_api_key_plaintext": o.CohereApiKeyPlaintext, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CohereConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cohere_api_base": types.StringType, + "cohere_api_key": types.StringType, + "cohere_api_key_plaintext": types.StringType, + }, + } +} + type CreateServingEndpoint struct { // The AI Gateway configuration for the serving endpoint. NOTE: only // external model endpoints are supported as of now. - AiGateway []AiGatewayConfig `tfsdk:"ai_gateway" tf:"optional,object"` + AiGateway types.List `tfsdk:"ai_gateway" tf:"optional,object"` // The core config of the serving endpoint. - Config []EndpointCoreConfigInput `tfsdk:"config" tf:"object"` + Config types.List `tfsdk:"config" tf:"object"` // The name of the serving endpoint. This field is required and must be // unique across a Databricks workspace. An endpoint name can consist of // alphanumeric characters, dashes, and underscores. Name types.String `tfsdk:"name" tf:""` // Rate limits to be applied to the serving endpoint. NOTE: this field is // deprecated, please use AI Gateway to manage rate limits. - RateLimits []RateLimit `tfsdk:"rate_limits" tf:"optional"` + RateLimits types.List `tfsdk:"rate_limits" tf:"optional"` // Enable route optimization for the serving endpoint. RouteOptimized types.Bool `tfsdk:"route_optimized" tf:"optional"` // Tags to be attached to the serving endpoint and automatically propagated // to billing logs. - Tags []EndpointTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *CreateServingEndpoint) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateServingEndpoint) { @@ -353,6 +1269,164 @@ func (newState *CreateServingEndpoint) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateServingEndpoint) SyncEffectiveFieldsDuringRead(existingState CreateServingEndpoint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateServingEndpoint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateServingEndpoint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ai_gateway": reflect.TypeOf(AiGatewayConfig{}), + "config": reflect.TypeOf(EndpointCoreConfigInput{}), + "rate_limits": reflect.TypeOf(RateLimit{}), + "tags": reflect.TypeOf(EndpointTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateServingEndpoint +// only implements ToObjectValue() and Type(). +func (o CreateServingEndpoint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ai_gateway": o.AiGateway, + "config": o.Config, + "name": o.Name, + "rate_limits": o.RateLimits, + "route_optimized": o.RouteOptimized, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateServingEndpoint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ai_gateway": basetypes.ListType{ + ElemType: AiGatewayConfig{}.Type(ctx), + }, + "config": basetypes.ListType{ + ElemType: EndpointCoreConfigInput{}.Type(ctx), + }, + "name": types.StringType, + "rate_limits": basetypes.ListType{ + ElemType: RateLimit{}.Type(ctx), + }, + "route_optimized": types.BoolType, + "tags": basetypes.ListType{ + ElemType: EndpointTag{}.Type(ctx), + }, + }, + } +} + +// GetAiGateway returns the value of the AiGateway field in CreateServingEndpoint as +// a AiGatewayConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateServingEndpoint) GetAiGateway(ctx context.Context) (AiGatewayConfig, bool) { + var e AiGatewayConfig + if o.AiGateway.IsNull() || o.AiGateway.IsUnknown() { + return e, false + } + var v []AiGatewayConfig + d := o.AiGateway.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAiGateway sets the value of the AiGateway field in CreateServingEndpoint. +func (o *CreateServingEndpoint) SetAiGateway(ctx context.Context, v AiGatewayConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ai_gateway"] + o.AiGateway = types.ListValueMust(t, vs) +} + +// GetConfig returns the value of the Config field in CreateServingEndpoint as +// a EndpointCoreConfigInput value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateServingEndpoint) GetConfig(ctx context.Context) (EndpointCoreConfigInput, bool) { + var e EndpointCoreConfigInput + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []EndpointCoreConfigInput + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in CreateServingEndpoint. +func (o *CreateServingEndpoint) SetConfig(ctx context.Context, v EndpointCoreConfigInput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + +// GetRateLimits returns the value of the RateLimits field in CreateServingEndpoint as +// a slice of RateLimit values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateServingEndpoint) GetRateLimits(ctx context.Context) ([]RateLimit, bool) { + if o.RateLimits.IsNull() || o.RateLimits.IsUnknown() { + return nil, false + } + var v []RateLimit + d := o.RateLimits.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRateLimits sets the value of the RateLimits field in CreateServingEndpoint. +func (o *CreateServingEndpoint) SetRateLimits(ctx context.Context, v []RateLimit) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rate_limits"] + t = t.(attr.TypeWithElementType).ElementType() + o.RateLimits = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in CreateServingEndpoint as +// a slice of EndpointTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateServingEndpoint) GetTags(ctx context.Context) ([]EndpointTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []EndpointTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateServingEndpoint. +func (o *CreateServingEndpoint) SetTags(ctx context.Context, v []EndpointTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type DatabricksModelServingConfig struct { // The Databricks secret key reference for a Databricks API token that // corresponds to a user or service principal with Can Query access to the @@ -379,12 +1453,47 @@ func (newState *DatabricksModelServingConfig) SyncEffectiveFieldsDuringCreateOrU func (newState *DatabricksModelServingConfig) SyncEffectiveFieldsDuringRead(existingState DatabricksModelServingConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DatabricksModelServingConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DatabricksModelServingConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DatabricksModelServingConfig +// only implements ToObjectValue() and Type(). +func (o DatabricksModelServingConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "databricks_api_token": o.DatabricksApiToken, + "databricks_api_token_plaintext": o.DatabricksApiTokenPlaintext, + "databricks_workspace_url": o.DatabricksWorkspaceUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DatabricksModelServingConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "databricks_api_token": types.StringType, + "databricks_api_token_plaintext": types.StringType, + "databricks_workspace_url": types.StringType, + }, + } +} + type DataframeSplitInput struct { - Columns []any `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` - Data []any `tfsdk:"data" tf:"optional"` + Data types.List `tfsdk:"data" tf:"optional"` - Index []types.Int64 `tfsdk:"index" tf:"optional"` + Index types.List `tfsdk:"index" tf:"optional"` } func (newState *DataframeSplitInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan DataframeSplitInput) { @@ -393,6 +1502,129 @@ func (newState *DataframeSplitInput) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DataframeSplitInput) SyncEffectiveFieldsDuringRead(existingState DataframeSplitInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DataframeSplitInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DataframeSplitInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(types.Object{}), + "data": reflect.TypeOf(types.Object{}), + "index": reflect.TypeOf(types.Int64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DataframeSplitInput +// only implements ToObjectValue() and Type(). +func (o DataframeSplitInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns": o.Columns, + "data": o.Data, + "index": o.Index, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DataframeSplitInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns": basetypes.ListType{ + ElemType: types.ObjectType{}, + }, + "data": basetypes.ListType{ + ElemType: types.ObjectType{}, + }, + "index": basetypes.ListType{ + ElemType: types.Int64Type, + }, + }, + } +} + +// GetColumns returns the value of the Columns field in DataframeSplitInput as +// a slice of types.Object values. +// If the field is unknown or null, the boolean return value is false. +func (o *DataframeSplitInput) GetColumns(ctx context.Context) ([]types.Object, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []types.Object + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in DataframeSplitInput. +func (o *DataframeSplitInput) SetColumns(ctx context.Context, v []types.Object) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + +// GetData returns the value of the Data field in DataframeSplitInput as +// a slice of types.Object values. +// If the field is unknown or null, the boolean return value is false. +func (o *DataframeSplitInput) GetData(ctx context.Context) ([]types.Object, bool) { + if o.Data.IsNull() || o.Data.IsUnknown() { + return nil, false + } + var v []types.Object + d := o.Data.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetData sets the value of the Data field in DataframeSplitInput. +func (o *DataframeSplitInput) SetData(ctx context.Context, v []types.Object) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data"] + t = t.(attr.TypeWithElementType).ElementType() + o.Data = types.ListValueMust(t, vs) +} + +// GetIndex returns the value of the Index field in DataframeSplitInput as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *DataframeSplitInput) GetIndex(ctx context.Context) ([]types.Int64, bool) { + if o.Index.IsNull() || o.Index.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.Index.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIndex sets the value of the Index field in DataframeSplitInput. +func (o *DataframeSplitInput) SetIndex(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["index"] + t = t.(attr.TypeWithElementType).ElementType() + o.Index = types.ListValueMust(t, vs) +} + type DeleteResponse struct { } @@ -402,6 +1634,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a serving endpoint type DeleteServingEndpointRequest struct { // The name of the serving endpoint. This field is required. @@ -414,8 +1673,39 @@ func (newState *DeleteServingEndpointRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteServingEndpointRequest) SyncEffectiveFieldsDuringRead(existingState DeleteServingEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteServingEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteServingEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteServingEndpointRequest +// only implements ToObjectValue() and Type(). +func (o DeleteServingEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteServingEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type EmbeddingsV1ResponseEmbeddingElement struct { - Embedding []types.Float64 `tfsdk:"embedding" tf:"optional"` + Embedding types.List `tfsdk:"embedding" tf:"optional"` // The index of the embedding in the response. Index types.Int64 `tfsdk:"index" tf:"optional"` // This will always be 'embedding'. @@ -428,21 +1718,86 @@ func (newState *EmbeddingsV1ResponseEmbeddingElement) SyncEffectiveFieldsDuringC func (newState *EmbeddingsV1ResponseEmbeddingElement) SyncEffectiveFieldsDuringRead(existingState EmbeddingsV1ResponseEmbeddingElement) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EmbeddingsV1ResponseEmbeddingElement. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EmbeddingsV1ResponseEmbeddingElement) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "embedding": reflect.TypeOf(types.Float64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EmbeddingsV1ResponseEmbeddingElement +// only implements ToObjectValue() and Type(). +func (o EmbeddingsV1ResponseEmbeddingElement) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "embedding": o.Embedding, + "index": o.Index, + "object": o.Object, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EmbeddingsV1ResponseEmbeddingElement) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "embedding": basetypes.ListType{ + ElemType: types.Float64Type, + }, + "index": types.Int64Type, + "object": types.StringType, + }, + } +} + +// GetEmbedding returns the value of the Embedding field in EmbeddingsV1ResponseEmbeddingElement as +// a slice of types.Float64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *EmbeddingsV1ResponseEmbeddingElement) GetEmbedding(ctx context.Context) ([]types.Float64, bool) { + if o.Embedding.IsNull() || o.Embedding.IsUnknown() { + return nil, false + } + var v []types.Float64 + d := o.Embedding.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbedding sets the value of the Embedding field in EmbeddingsV1ResponseEmbeddingElement. +func (o *EmbeddingsV1ResponseEmbeddingElement) SetEmbedding(ctx context.Context, v []types.Float64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding"] + t = t.(attr.TypeWithElementType).ElementType() + o.Embedding = types.ListValueMust(t, vs) +} + type EndpointCoreConfigInput struct { // Configuration for Inference Tables which automatically logs requests and // responses to Unity Catalog. - AutoCaptureConfig []AutoCaptureConfigInput `tfsdk:"auto_capture_config" tf:"optional,object"` + AutoCaptureConfig types.List `tfsdk:"auto_capture_config" tf:"optional,object"` // The name of the serving endpoint to update. This field is required. Name types.String `tfsdk:"-"` // A list of served entities for the endpoint to serve. A serving endpoint // can have up to 15 served entities. - ServedEntities []ServedEntityInput `tfsdk:"served_entities" tf:"optional"` + ServedEntities types.List `tfsdk:"served_entities" tf:"optional"` // (Deprecated, use served_entities instead) A list of served models for the // endpoint to serve. A serving endpoint can have up to 15 served models. - ServedModels []ServedModelInput `tfsdk:"served_models" tf:"optional"` + ServedModels types.List `tfsdk:"served_models" tf:"optional"` // The traffic config defining how invocations to the serving endpoint // should be routed. - TrafficConfig []TrafficConfig `tfsdk:"traffic_config" tf:"optional,object"` + TrafficConfig types.List `tfsdk:"traffic_config" tf:"optional,object"` } func (newState *EndpointCoreConfigInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan EndpointCoreConfigInput) { @@ -451,19 +1806,175 @@ func (newState *EndpointCoreConfigInput) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *EndpointCoreConfigInput) SyncEffectiveFieldsDuringRead(existingState EndpointCoreConfigInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointCoreConfigInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointCoreConfigInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "auto_capture_config": reflect.TypeOf(AutoCaptureConfigInput{}), + "served_entities": reflect.TypeOf(ServedEntityInput{}), + "served_models": reflect.TypeOf(ServedModelInput{}), + "traffic_config": reflect.TypeOf(TrafficConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointCoreConfigInput +// only implements ToObjectValue() and Type(). +func (o EndpointCoreConfigInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_capture_config": o.AutoCaptureConfig, + "name": o.Name, + "served_entities": o.ServedEntities, + "served_models": o.ServedModels, + "traffic_config": o.TrafficConfig, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointCoreConfigInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_capture_config": basetypes.ListType{ + ElemType: AutoCaptureConfigInput{}.Type(ctx), + }, + "name": types.StringType, + "served_entities": basetypes.ListType{ + ElemType: ServedEntityInput{}.Type(ctx), + }, + "served_models": basetypes.ListType{ + ElemType: ServedModelInput{}.Type(ctx), + }, + "traffic_config": basetypes.ListType{ + ElemType: TrafficConfig{}.Type(ctx), + }, + }, + } +} + +// GetAutoCaptureConfig returns the value of the AutoCaptureConfig field in EndpointCoreConfigInput as +// a AutoCaptureConfigInput value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigInput) GetAutoCaptureConfig(ctx context.Context) (AutoCaptureConfigInput, bool) { + var e AutoCaptureConfigInput + if o.AutoCaptureConfig.IsNull() || o.AutoCaptureConfig.IsUnknown() { + return e, false + } + var v []AutoCaptureConfigInput + d := o.AutoCaptureConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoCaptureConfig sets the value of the AutoCaptureConfig field in EndpointCoreConfigInput. +func (o *EndpointCoreConfigInput) SetAutoCaptureConfig(ctx context.Context, v AutoCaptureConfigInput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["auto_capture_config"] + o.AutoCaptureConfig = types.ListValueMust(t, vs) +} + +// GetServedEntities returns the value of the ServedEntities field in EndpointCoreConfigInput as +// a slice of ServedEntityInput values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigInput) GetServedEntities(ctx context.Context) ([]ServedEntityInput, bool) { + if o.ServedEntities.IsNull() || o.ServedEntities.IsUnknown() { + return nil, false + } + var v []ServedEntityInput + d := o.ServedEntities.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedEntities sets the value of the ServedEntities field in EndpointCoreConfigInput. +func (o *EndpointCoreConfigInput) SetServedEntities(ctx context.Context, v []ServedEntityInput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_entities"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedEntities = types.ListValueMust(t, vs) +} + +// GetServedModels returns the value of the ServedModels field in EndpointCoreConfigInput as +// a slice of ServedModelInput values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigInput) GetServedModels(ctx context.Context) ([]ServedModelInput, bool) { + if o.ServedModels.IsNull() || o.ServedModels.IsUnknown() { + return nil, false + } + var v []ServedModelInput + d := o.ServedModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedModels sets the value of the ServedModels field in EndpointCoreConfigInput. +func (o *EndpointCoreConfigInput) SetServedModels(ctx context.Context, v []ServedModelInput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedModels = types.ListValueMust(t, vs) +} + +// GetTrafficConfig returns the value of the TrafficConfig field in EndpointCoreConfigInput as +// a TrafficConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigInput) GetTrafficConfig(ctx context.Context) (TrafficConfig, bool) { + var e TrafficConfig + if o.TrafficConfig.IsNull() || o.TrafficConfig.IsUnknown() { + return e, false + } + var v []TrafficConfig + d := o.TrafficConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrafficConfig sets the value of the TrafficConfig field in EndpointCoreConfigInput. +func (o *EndpointCoreConfigInput) SetTrafficConfig(ctx context.Context, v TrafficConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["traffic_config"] + o.TrafficConfig = types.ListValueMust(t, vs) +} + type EndpointCoreConfigOutput struct { // Configuration for Inference Tables which automatically logs requests and // responses to Unity Catalog. - AutoCaptureConfig []AutoCaptureConfigOutput `tfsdk:"auto_capture_config" tf:"optional,object"` + AutoCaptureConfig types.List `tfsdk:"auto_capture_config" tf:"optional,object"` // The config version that the serving endpoint is currently serving. ConfigVersion types.Int64 `tfsdk:"config_version" tf:"optional"` // The list of served entities under the serving endpoint config. - ServedEntities []ServedEntityOutput `tfsdk:"served_entities" tf:"optional"` + ServedEntities types.List `tfsdk:"served_entities" tf:"optional"` // (Deprecated, use served_entities instead) The list of served models under // the serving endpoint config. - ServedModels []ServedModelOutput `tfsdk:"served_models" tf:"optional"` + ServedModels types.List `tfsdk:"served_models" tf:"optional"` // The traffic configuration associated with the serving endpoint config. - TrafficConfig []TrafficConfig `tfsdk:"traffic_config" tf:"optional,object"` + TrafficConfig types.List `tfsdk:"traffic_config" tf:"optional,object"` } func (newState *EndpointCoreConfigOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan EndpointCoreConfigOutput) { @@ -472,12 +1983,168 @@ func (newState *EndpointCoreConfigOutput) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *EndpointCoreConfigOutput) SyncEffectiveFieldsDuringRead(existingState EndpointCoreConfigOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointCoreConfigOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointCoreConfigOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "auto_capture_config": reflect.TypeOf(AutoCaptureConfigOutput{}), + "served_entities": reflect.TypeOf(ServedEntityOutput{}), + "served_models": reflect.TypeOf(ServedModelOutput{}), + "traffic_config": reflect.TypeOf(TrafficConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointCoreConfigOutput +// only implements ToObjectValue() and Type(). +func (o EndpointCoreConfigOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_capture_config": o.AutoCaptureConfig, + "config_version": o.ConfigVersion, + "served_entities": o.ServedEntities, + "served_models": o.ServedModels, + "traffic_config": o.TrafficConfig, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointCoreConfigOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_capture_config": basetypes.ListType{ + ElemType: AutoCaptureConfigOutput{}.Type(ctx), + }, + "config_version": types.Int64Type, + "served_entities": basetypes.ListType{ + ElemType: ServedEntityOutput{}.Type(ctx), + }, + "served_models": basetypes.ListType{ + ElemType: ServedModelOutput{}.Type(ctx), + }, + "traffic_config": basetypes.ListType{ + ElemType: TrafficConfig{}.Type(ctx), + }, + }, + } +} + +// GetAutoCaptureConfig returns the value of the AutoCaptureConfig field in EndpointCoreConfigOutput as +// a AutoCaptureConfigOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigOutput) GetAutoCaptureConfig(ctx context.Context) (AutoCaptureConfigOutput, bool) { + var e AutoCaptureConfigOutput + if o.AutoCaptureConfig.IsNull() || o.AutoCaptureConfig.IsUnknown() { + return e, false + } + var v []AutoCaptureConfigOutput + d := o.AutoCaptureConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoCaptureConfig sets the value of the AutoCaptureConfig field in EndpointCoreConfigOutput. +func (o *EndpointCoreConfigOutput) SetAutoCaptureConfig(ctx context.Context, v AutoCaptureConfigOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["auto_capture_config"] + o.AutoCaptureConfig = types.ListValueMust(t, vs) +} + +// GetServedEntities returns the value of the ServedEntities field in EndpointCoreConfigOutput as +// a slice of ServedEntityOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigOutput) GetServedEntities(ctx context.Context) ([]ServedEntityOutput, bool) { + if o.ServedEntities.IsNull() || o.ServedEntities.IsUnknown() { + return nil, false + } + var v []ServedEntityOutput + d := o.ServedEntities.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedEntities sets the value of the ServedEntities field in EndpointCoreConfigOutput. +func (o *EndpointCoreConfigOutput) SetServedEntities(ctx context.Context, v []ServedEntityOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_entities"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedEntities = types.ListValueMust(t, vs) +} + +// GetServedModels returns the value of the ServedModels field in EndpointCoreConfigOutput as +// a slice of ServedModelOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigOutput) GetServedModels(ctx context.Context) ([]ServedModelOutput, bool) { + if o.ServedModels.IsNull() || o.ServedModels.IsUnknown() { + return nil, false + } + var v []ServedModelOutput + d := o.ServedModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedModels sets the value of the ServedModels field in EndpointCoreConfigOutput. +func (o *EndpointCoreConfigOutput) SetServedModels(ctx context.Context, v []ServedModelOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedModels = types.ListValueMust(t, vs) +} + +// GetTrafficConfig returns the value of the TrafficConfig field in EndpointCoreConfigOutput as +// a TrafficConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigOutput) GetTrafficConfig(ctx context.Context) (TrafficConfig, bool) { + var e TrafficConfig + if o.TrafficConfig.IsNull() || o.TrafficConfig.IsUnknown() { + return e, false + } + var v []TrafficConfig + d := o.TrafficConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrafficConfig sets the value of the TrafficConfig field in EndpointCoreConfigOutput. +func (o *EndpointCoreConfigOutput) SetTrafficConfig(ctx context.Context, v TrafficConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["traffic_config"] + o.TrafficConfig = types.ListValueMust(t, vs) +} + type EndpointCoreConfigSummary struct { // The list of served entities under the serving endpoint config. - ServedEntities []ServedEntitySpec `tfsdk:"served_entities" tf:"optional"` + ServedEntities types.List `tfsdk:"served_entities" tf:"optional"` // (Deprecated, use served_entities instead) The list of served models under // the serving endpoint config. - ServedModels []ServedModelSpec `tfsdk:"served_models" tf:"optional"` + ServedModels types.List `tfsdk:"served_models" tf:"optional"` } func (newState *EndpointCoreConfigSummary) SyncEffectiveFieldsDuringCreateOrUpdate(plan EndpointCoreConfigSummary) { @@ -486,23 +2153,115 @@ func (newState *EndpointCoreConfigSummary) SyncEffectiveFieldsDuringCreateOrUpda func (newState *EndpointCoreConfigSummary) SyncEffectiveFieldsDuringRead(existingState EndpointCoreConfigSummary) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointCoreConfigSummary. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointCoreConfigSummary) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "served_entities": reflect.TypeOf(ServedEntitySpec{}), + "served_models": reflect.TypeOf(ServedModelSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointCoreConfigSummary +// only implements ToObjectValue() and Type(). +func (o EndpointCoreConfigSummary) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "served_entities": o.ServedEntities, + "served_models": o.ServedModels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointCoreConfigSummary) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "served_entities": basetypes.ListType{ + ElemType: ServedEntitySpec{}.Type(ctx), + }, + "served_models": basetypes.ListType{ + ElemType: ServedModelSpec{}.Type(ctx), + }, + }, + } +} + +// GetServedEntities returns the value of the ServedEntities field in EndpointCoreConfigSummary as +// a slice of ServedEntitySpec values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigSummary) GetServedEntities(ctx context.Context) ([]ServedEntitySpec, bool) { + if o.ServedEntities.IsNull() || o.ServedEntities.IsUnknown() { + return nil, false + } + var v []ServedEntitySpec + d := o.ServedEntities.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedEntities sets the value of the ServedEntities field in EndpointCoreConfigSummary. +func (o *EndpointCoreConfigSummary) SetServedEntities(ctx context.Context, v []ServedEntitySpec) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_entities"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedEntities = types.ListValueMust(t, vs) +} + +// GetServedModels returns the value of the ServedModels field in EndpointCoreConfigSummary as +// a slice of ServedModelSpec values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointCoreConfigSummary) GetServedModels(ctx context.Context) ([]ServedModelSpec, bool) { + if o.ServedModels.IsNull() || o.ServedModels.IsUnknown() { + return nil, false + } + var v []ServedModelSpec + d := o.ServedModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedModels sets the value of the ServedModels field in EndpointCoreConfigSummary. +func (o *EndpointCoreConfigSummary) SetServedModels(ctx context.Context, v []ServedModelSpec) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedModels = types.ListValueMust(t, vs) +} + type EndpointPendingConfig struct { // Configuration for Inference Tables which automatically logs requests and // responses to Unity Catalog. - AutoCaptureConfig []AutoCaptureConfigOutput `tfsdk:"auto_capture_config" tf:"optional,object"` + AutoCaptureConfig types.List `tfsdk:"auto_capture_config" tf:"optional,object"` // The config version that the serving endpoint is currently serving. ConfigVersion types.Int64 `tfsdk:"config_version" tf:"optional"` // The list of served entities belonging to the last issued update to the // serving endpoint. - ServedEntities []ServedEntityOutput `tfsdk:"served_entities" tf:"optional"` + ServedEntities types.List `tfsdk:"served_entities" tf:"optional"` // (Deprecated, use served_entities instead) The list of served models // belonging to the last issued update to the serving endpoint. - ServedModels []ServedModelOutput `tfsdk:"served_models" tf:"optional"` + ServedModels types.List `tfsdk:"served_models" tf:"optional"` // The timestamp when the update to the pending config started. StartTime types.Int64 `tfsdk:"start_time" tf:"optional"` // The traffic config defining how invocations to the serving endpoint // should be routed. - TrafficConfig []TrafficConfig `tfsdk:"traffic_config" tf:"optional,object"` + TrafficConfig types.List `tfsdk:"traffic_config" tf:"optional,object"` } func (newState *EndpointPendingConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan EndpointPendingConfig) { @@ -511,6 +2270,164 @@ func (newState *EndpointPendingConfig) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *EndpointPendingConfig) SyncEffectiveFieldsDuringRead(existingState EndpointPendingConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointPendingConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointPendingConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "auto_capture_config": reflect.TypeOf(AutoCaptureConfigOutput{}), + "served_entities": reflect.TypeOf(ServedEntityOutput{}), + "served_models": reflect.TypeOf(ServedModelOutput{}), + "traffic_config": reflect.TypeOf(TrafficConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointPendingConfig +// only implements ToObjectValue() and Type(). +func (o EndpointPendingConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_capture_config": o.AutoCaptureConfig, + "config_version": o.ConfigVersion, + "served_entities": o.ServedEntities, + "served_models": o.ServedModels, + "start_time": o.StartTime, + "traffic_config": o.TrafficConfig, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointPendingConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_capture_config": basetypes.ListType{ + ElemType: AutoCaptureConfigOutput{}.Type(ctx), + }, + "config_version": types.Int64Type, + "served_entities": basetypes.ListType{ + ElemType: ServedEntityOutput{}.Type(ctx), + }, + "served_models": basetypes.ListType{ + ElemType: ServedModelOutput{}.Type(ctx), + }, + "start_time": types.Int64Type, + "traffic_config": basetypes.ListType{ + ElemType: TrafficConfig{}.Type(ctx), + }, + }, + } +} + +// GetAutoCaptureConfig returns the value of the AutoCaptureConfig field in EndpointPendingConfig as +// a AutoCaptureConfigOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointPendingConfig) GetAutoCaptureConfig(ctx context.Context) (AutoCaptureConfigOutput, bool) { + var e AutoCaptureConfigOutput + if o.AutoCaptureConfig.IsNull() || o.AutoCaptureConfig.IsUnknown() { + return e, false + } + var v []AutoCaptureConfigOutput + d := o.AutoCaptureConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutoCaptureConfig sets the value of the AutoCaptureConfig field in EndpointPendingConfig. +func (o *EndpointPendingConfig) SetAutoCaptureConfig(ctx context.Context, v AutoCaptureConfigOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["auto_capture_config"] + o.AutoCaptureConfig = types.ListValueMust(t, vs) +} + +// GetServedEntities returns the value of the ServedEntities field in EndpointPendingConfig as +// a slice of ServedEntityOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointPendingConfig) GetServedEntities(ctx context.Context) ([]ServedEntityOutput, bool) { + if o.ServedEntities.IsNull() || o.ServedEntities.IsUnknown() { + return nil, false + } + var v []ServedEntityOutput + d := o.ServedEntities.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedEntities sets the value of the ServedEntities field in EndpointPendingConfig. +func (o *EndpointPendingConfig) SetServedEntities(ctx context.Context, v []ServedEntityOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_entities"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedEntities = types.ListValueMust(t, vs) +} + +// GetServedModels returns the value of the ServedModels field in EndpointPendingConfig as +// a slice of ServedModelOutput values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointPendingConfig) GetServedModels(ctx context.Context) ([]ServedModelOutput, bool) { + if o.ServedModels.IsNull() || o.ServedModels.IsUnknown() { + return nil, false + } + var v []ServedModelOutput + d := o.ServedModels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetServedModels sets the value of the ServedModels field in EndpointPendingConfig. +func (o *EndpointPendingConfig) SetServedModels(ctx context.Context, v []ServedModelOutput) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["served_models"] + t = t.(attr.TypeWithElementType).ElementType() + o.ServedModels = types.ListValueMust(t, vs) +} + +// GetTrafficConfig returns the value of the TrafficConfig field in EndpointPendingConfig as +// a TrafficConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointPendingConfig) GetTrafficConfig(ctx context.Context) (TrafficConfig, bool) { + var e TrafficConfig + if o.TrafficConfig.IsNull() || o.TrafficConfig.IsUnknown() { + return e, false + } + var v []TrafficConfig + d := o.TrafficConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTrafficConfig sets the value of the TrafficConfig field in EndpointPendingConfig. +func (o *EndpointPendingConfig) SetTrafficConfig(ctx context.Context, v TrafficConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["traffic_config"] + o.TrafficConfig = types.ListValueMust(t, vs) +} + type EndpointState struct { // The state of an endpoint's config update. This informs the user if the // pending_config is in progress, if the update failed, or if there is no @@ -531,6 +2448,39 @@ func (newState *EndpointState) SyncEffectiveFieldsDuringCreateOrUpdate(plan Endp func (newState *EndpointState) SyncEffectiveFieldsDuringRead(existingState EndpointState) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointState. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointState) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointState +// only implements ToObjectValue() and Type(). +func (o EndpointState) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "config_update": o.ConfigUpdate, + "ready": o.Ready, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointState) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "config_update": types.StringType, + "ready": types.StringType, + }, + } +} + type EndpointTag struct { // Key field for a serving endpoint tag. Key types.String `tfsdk:"key" tf:""` @@ -544,6 +2494,39 @@ func (newState *EndpointTag) SyncEffectiveFieldsDuringCreateOrUpdate(plan Endpoi func (newState *EndpointTag) SyncEffectiveFieldsDuringRead(existingState EndpointTag) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointTag. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointTag) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointTag +// only implements ToObjectValue() and Type(). +func (o EndpointTag) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointTag) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + // Get metrics of a serving endpoint type ExportMetricsRequest struct { // The name of the serving endpoint to retrieve metrics for. This field is @@ -557,8 +2540,39 @@ func (newState *ExportMetricsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ExportMetricsRequest) SyncEffectiveFieldsDuringRead(existingState ExportMetricsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExportMetricsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExportMetricsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExportMetricsRequest +// only implements ToObjectValue() and Type(). +func (o ExportMetricsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExportMetricsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type ExportMetricsResponse struct { - Contents io.ReadCloser `tfsdk:"-"` + Contents types.Object `tfsdk:"-"` } func (newState *ExportMetricsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ExportMetricsResponse) { @@ -567,27 +2581,58 @@ func (newState *ExportMetricsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ExportMetricsResponse) SyncEffectiveFieldsDuringRead(existingState ExportMetricsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExportMetricsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExportMetricsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExportMetricsResponse +// only implements ToObjectValue() and Type(). +func (o ExportMetricsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "contents": o.Contents, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExportMetricsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "contents": types.ObjectType{}, + }, + } +} + type ExternalModel struct { // AI21Labs Config. Only required if the provider is 'ai21labs'. - Ai21labsConfig []Ai21LabsConfig `tfsdk:"ai21labs_config" tf:"optional,object"` + Ai21labsConfig types.List `tfsdk:"ai21labs_config" tf:"optional,object"` // Amazon Bedrock Config. Only required if the provider is 'amazon-bedrock'. - AmazonBedrockConfig []AmazonBedrockConfig `tfsdk:"amazon_bedrock_config" tf:"optional,object"` + AmazonBedrockConfig types.List `tfsdk:"amazon_bedrock_config" tf:"optional,object"` // Anthropic Config. Only required if the provider is 'anthropic'. - AnthropicConfig []AnthropicConfig `tfsdk:"anthropic_config" tf:"optional,object"` + AnthropicConfig types.List `tfsdk:"anthropic_config" tf:"optional,object"` // Cohere Config. Only required if the provider is 'cohere'. - CohereConfig []CohereConfig `tfsdk:"cohere_config" tf:"optional,object"` + CohereConfig types.List `tfsdk:"cohere_config" tf:"optional,object"` // Databricks Model Serving Config. Only required if the provider is // 'databricks-model-serving'. - DatabricksModelServingConfig []DatabricksModelServingConfig `tfsdk:"databricks_model_serving_config" tf:"optional,object"` + DatabricksModelServingConfig types.List `tfsdk:"databricks_model_serving_config" tf:"optional,object"` // Google Cloud Vertex AI Config. Only required if the provider is // 'google-cloud-vertex-ai'. - GoogleCloudVertexAiConfig []GoogleCloudVertexAiConfig `tfsdk:"google_cloud_vertex_ai_config" tf:"optional,object"` + GoogleCloudVertexAiConfig types.List `tfsdk:"google_cloud_vertex_ai_config" tf:"optional,object"` // The name of the external model. Name types.String `tfsdk:"name" tf:""` // OpenAI Config. Only required if the provider is 'openai'. - OpenaiConfig []OpenAiConfig `tfsdk:"openai_config" tf:"optional,object"` + OpenaiConfig types.List `tfsdk:"openai_config" tf:"optional,object"` // PaLM Config. Only required if the provider is 'palm'. - PalmConfig []PaLmConfig `tfsdk:"palm_config" tf:"optional,object"` + PalmConfig types.List `tfsdk:"palm_config" tf:"optional,object"` // The name of the provider for the external model. Currently, the supported // providers are 'ai21labs', 'anthropic', 'amazon-bedrock', 'cohere', // 'databricks-model-serving', 'google-cloud-vertex-ai', 'openai', and @@ -603,6 +2648,290 @@ func (newState *ExternalModel) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exte func (newState *ExternalModel) SyncEffectiveFieldsDuringRead(existingState ExternalModel) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExternalModel. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExternalModel) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ai21labs_config": reflect.TypeOf(Ai21LabsConfig{}), + "amazon_bedrock_config": reflect.TypeOf(AmazonBedrockConfig{}), + "anthropic_config": reflect.TypeOf(AnthropicConfig{}), + "cohere_config": reflect.TypeOf(CohereConfig{}), + "databricks_model_serving_config": reflect.TypeOf(DatabricksModelServingConfig{}), + "google_cloud_vertex_ai_config": reflect.TypeOf(GoogleCloudVertexAiConfig{}), + "openai_config": reflect.TypeOf(OpenAiConfig{}), + "palm_config": reflect.TypeOf(PaLmConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExternalModel +// only implements ToObjectValue() and Type(). +func (o ExternalModel) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ai21labs_config": o.Ai21labsConfig, + "amazon_bedrock_config": o.AmazonBedrockConfig, + "anthropic_config": o.AnthropicConfig, + "cohere_config": o.CohereConfig, + "databricks_model_serving_config": o.DatabricksModelServingConfig, + "google_cloud_vertex_ai_config": o.GoogleCloudVertexAiConfig, + "name": o.Name, + "openai_config": o.OpenaiConfig, + "palm_config": o.PalmConfig, + "provider": o.Provider, + "task": o.Task, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExternalModel) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ai21labs_config": basetypes.ListType{ + ElemType: Ai21LabsConfig{}.Type(ctx), + }, + "amazon_bedrock_config": basetypes.ListType{ + ElemType: AmazonBedrockConfig{}.Type(ctx), + }, + "anthropic_config": basetypes.ListType{ + ElemType: AnthropicConfig{}.Type(ctx), + }, + "cohere_config": basetypes.ListType{ + ElemType: CohereConfig{}.Type(ctx), + }, + "databricks_model_serving_config": basetypes.ListType{ + ElemType: DatabricksModelServingConfig{}.Type(ctx), + }, + "google_cloud_vertex_ai_config": basetypes.ListType{ + ElemType: GoogleCloudVertexAiConfig{}.Type(ctx), + }, + "name": types.StringType, + "openai_config": basetypes.ListType{ + ElemType: OpenAiConfig{}.Type(ctx), + }, + "palm_config": basetypes.ListType{ + ElemType: PaLmConfig{}.Type(ctx), + }, + "provider": types.StringType, + "task": types.StringType, + }, + } +} + +// GetAi21labsConfig returns the value of the Ai21labsConfig field in ExternalModel as +// a Ai21LabsConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetAi21labsConfig(ctx context.Context) (Ai21LabsConfig, bool) { + var e Ai21LabsConfig + if o.Ai21labsConfig.IsNull() || o.Ai21labsConfig.IsUnknown() { + return e, false + } + var v []Ai21LabsConfig + d := o.Ai21labsConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAi21labsConfig sets the value of the Ai21labsConfig field in ExternalModel. +func (o *ExternalModel) SetAi21labsConfig(ctx context.Context, v Ai21LabsConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ai21labs_config"] + o.Ai21labsConfig = types.ListValueMust(t, vs) +} + +// GetAmazonBedrockConfig returns the value of the AmazonBedrockConfig field in ExternalModel as +// a AmazonBedrockConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetAmazonBedrockConfig(ctx context.Context) (AmazonBedrockConfig, bool) { + var e AmazonBedrockConfig + if o.AmazonBedrockConfig.IsNull() || o.AmazonBedrockConfig.IsUnknown() { + return e, false + } + var v []AmazonBedrockConfig + d := o.AmazonBedrockConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAmazonBedrockConfig sets the value of the AmazonBedrockConfig field in ExternalModel. +func (o *ExternalModel) SetAmazonBedrockConfig(ctx context.Context, v AmazonBedrockConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["amazon_bedrock_config"] + o.AmazonBedrockConfig = types.ListValueMust(t, vs) +} + +// GetAnthropicConfig returns the value of the AnthropicConfig field in ExternalModel as +// a AnthropicConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetAnthropicConfig(ctx context.Context) (AnthropicConfig, bool) { + var e AnthropicConfig + if o.AnthropicConfig.IsNull() || o.AnthropicConfig.IsUnknown() { + return e, false + } + var v []AnthropicConfig + d := o.AnthropicConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAnthropicConfig sets the value of the AnthropicConfig field in ExternalModel. +func (o *ExternalModel) SetAnthropicConfig(ctx context.Context, v AnthropicConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["anthropic_config"] + o.AnthropicConfig = types.ListValueMust(t, vs) +} + +// GetCohereConfig returns the value of the CohereConfig field in ExternalModel as +// a CohereConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetCohereConfig(ctx context.Context) (CohereConfig, bool) { + var e CohereConfig + if o.CohereConfig.IsNull() || o.CohereConfig.IsUnknown() { + return e, false + } + var v []CohereConfig + d := o.CohereConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCohereConfig sets the value of the CohereConfig field in ExternalModel. +func (o *ExternalModel) SetCohereConfig(ctx context.Context, v CohereConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cohere_config"] + o.CohereConfig = types.ListValueMust(t, vs) +} + +// GetDatabricksModelServingConfig returns the value of the DatabricksModelServingConfig field in ExternalModel as +// a DatabricksModelServingConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetDatabricksModelServingConfig(ctx context.Context) (DatabricksModelServingConfig, bool) { + var e DatabricksModelServingConfig + if o.DatabricksModelServingConfig.IsNull() || o.DatabricksModelServingConfig.IsUnknown() { + return e, false + } + var v []DatabricksModelServingConfig + d := o.DatabricksModelServingConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDatabricksModelServingConfig sets the value of the DatabricksModelServingConfig field in ExternalModel. +func (o *ExternalModel) SetDatabricksModelServingConfig(ctx context.Context, v DatabricksModelServingConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["databricks_model_serving_config"] + o.DatabricksModelServingConfig = types.ListValueMust(t, vs) +} + +// GetGoogleCloudVertexAiConfig returns the value of the GoogleCloudVertexAiConfig field in ExternalModel as +// a GoogleCloudVertexAiConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetGoogleCloudVertexAiConfig(ctx context.Context) (GoogleCloudVertexAiConfig, bool) { + var e GoogleCloudVertexAiConfig + if o.GoogleCloudVertexAiConfig.IsNull() || o.GoogleCloudVertexAiConfig.IsUnknown() { + return e, false + } + var v []GoogleCloudVertexAiConfig + d := o.GoogleCloudVertexAiConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGoogleCloudVertexAiConfig sets the value of the GoogleCloudVertexAiConfig field in ExternalModel. +func (o *ExternalModel) SetGoogleCloudVertexAiConfig(ctx context.Context, v GoogleCloudVertexAiConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["google_cloud_vertex_ai_config"] + o.GoogleCloudVertexAiConfig = types.ListValueMust(t, vs) +} + +// GetOpenaiConfig returns the value of the OpenaiConfig field in ExternalModel as +// a OpenAiConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetOpenaiConfig(ctx context.Context) (OpenAiConfig, bool) { + var e OpenAiConfig + if o.OpenaiConfig.IsNull() || o.OpenaiConfig.IsUnknown() { + return e, false + } + var v []OpenAiConfig + d := o.OpenaiConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOpenaiConfig sets the value of the OpenaiConfig field in ExternalModel. +func (o *ExternalModel) SetOpenaiConfig(ctx context.Context, v OpenAiConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["openai_config"] + o.OpenaiConfig = types.ListValueMust(t, vs) +} + +// GetPalmConfig returns the value of the PalmConfig field in ExternalModel as +// a PaLmConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalModel) GetPalmConfig(ctx context.Context) (PaLmConfig, bool) { + var e PaLmConfig + if o.PalmConfig.IsNull() || o.PalmConfig.IsUnknown() { + return e, false + } + var v []PaLmConfig + d := o.PalmConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPalmConfig sets the value of the PalmConfig field in ExternalModel. +func (o *ExternalModel) SetPalmConfig(ctx context.Context, v PaLmConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["palm_config"] + o.PalmConfig = types.ListValueMust(t, vs) +} + type ExternalModelUsageElement struct { // The number of tokens in the chat/completions response. CompletionTokens types.Int64 `tfsdk:"completion_tokens" tf:"optional"` @@ -618,6 +2947,41 @@ func (newState *ExternalModelUsageElement) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ExternalModelUsageElement) SyncEffectiveFieldsDuringRead(existingState ExternalModelUsageElement) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExternalModelUsageElement. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExternalModelUsageElement) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExternalModelUsageElement +// only implements ToObjectValue() and Type(). +func (o ExternalModelUsageElement) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "completion_tokens": o.CompletionTokens, + "prompt_tokens": o.PromptTokens, + "total_tokens": o.TotalTokens, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExternalModelUsageElement) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "completion_tokens": types.Int64Type, + "prompt_tokens": types.Int64Type, + "total_tokens": types.Int64Type, + }, + } +} + type FoundationModel struct { // The description of the foundation model. Description types.String `tfsdk:"description" tf:"optional"` @@ -635,6 +2999,43 @@ func (newState *FoundationModel) SyncEffectiveFieldsDuringCreateOrUpdate(plan Fo func (newState *FoundationModel) SyncEffectiveFieldsDuringRead(existingState FoundationModel) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FoundationModel. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FoundationModel) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FoundationModel +// only implements ToObjectValue() and Type(). +func (o FoundationModel) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "display_name": o.DisplayName, + "docs": o.Docs, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FoundationModel) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "display_name": types.StringType, + "docs": types.StringType, + "name": types.StringType, + }, + } +} + // Get the schema for a serving endpoint type GetOpenApiRequest struct { // The name of the serving endpoint that the served model belongs to. This @@ -648,6 +3049,37 @@ func (newState *GetOpenApiRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetOpenApiRequest) SyncEffectiveFieldsDuringRead(existingState GetOpenApiRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetOpenApiRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetOpenApiRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetOpenApiRequest +// only implements ToObjectValue() and Type(). +func (o GetOpenApiRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetOpenApiRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // The response is an OpenAPI spec in JSON format that typically includes fields // like openapi, info, servers and paths, etc. type GetOpenApiResponse struct { @@ -659,6 +3091,33 @@ func (newState *GetOpenApiResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetOpenApiResponse) SyncEffectiveFieldsDuringRead(existingState GetOpenApiResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetOpenApiResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetOpenApiResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetOpenApiResponse +// only implements ToObjectValue() and Type(). +func (o GetOpenApiResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o GetOpenApiResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Get serving endpoint permission levels type GetServingEndpointPermissionLevelsRequest struct { // The serving endpoint for which to get or manage permissions. @@ -671,9 +3130,40 @@ func (newState *GetServingEndpointPermissionLevelsRequest) SyncEffectiveFieldsDu func (newState *GetServingEndpointPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetServingEndpointPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetServingEndpointPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetServingEndpointPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetServingEndpointPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetServingEndpointPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "serving_endpoint_id": o.ServingEndpointId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetServingEndpointPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "serving_endpoint_id": types.StringType, + }, + } +} + type GetServingEndpointPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []ServingEndpointPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetServingEndpointPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetServingEndpointPermissionLevelsResponse) { @@ -682,6 +3172,67 @@ func (newState *GetServingEndpointPermissionLevelsResponse) SyncEffectiveFieldsD func (newState *GetServingEndpointPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetServingEndpointPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetServingEndpointPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetServingEndpointPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(ServingEndpointPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetServingEndpointPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetServingEndpointPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetServingEndpointPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: ServingEndpointPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetServingEndpointPermissionLevelsResponse as +// a slice of ServingEndpointPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetServingEndpointPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]ServingEndpointPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []ServingEndpointPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetServingEndpointPermissionLevelsResponse. +func (o *GetServingEndpointPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []ServingEndpointPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get serving endpoint permissions type GetServingEndpointPermissionsRequest struct { // The serving endpoint for which to get or manage permissions. @@ -694,6 +3245,37 @@ func (newState *GetServingEndpointPermissionsRequest) SyncEffectiveFieldsDuringC func (newState *GetServingEndpointPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetServingEndpointPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetServingEndpointPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetServingEndpointPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetServingEndpointPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetServingEndpointPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "serving_endpoint_id": o.ServingEndpointId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetServingEndpointPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "serving_endpoint_id": types.StringType, + }, + } +} + // Get a single serving endpoint type GetServingEndpointRequest struct { // The name of the serving endpoint. This field is required. @@ -706,6 +3288,37 @@ func (newState *GetServingEndpointRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GetServingEndpointRequest) SyncEffectiveFieldsDuringRead(existingState GetServingEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetServingEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetServingEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetServingEndpointRequest +// only implements ToObjectValue() and Type(). +func (o GetServingEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetServingEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type GoogleCloudVertexAiConfig struct { // The Databricks secret key reference for a private key for the service // account which has access to the Google Cloud Vertex AI Service. See [Best @@ -742,9 +3355,46 @@ func (newState *GoogleCloudVertexAiConfig) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GoogleCloudVertexAiConfig) SyncEffectiveFieldsDuringRead(existingState GoogleCloudVertexAiConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GoogleCloudVertexAiConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GoogleCloudVertexAiConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GoogleCloudVertexAiConfig +// only implements ToObjectValue() and Type(). +func (o GoogleCloudVertexAiConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "private_key": o.PrivateKey, + "private_key_plaintext": o.PrivateKeyPlaintext, + "project_id": o.ProjectId, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GoogleCloudVertexAiConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "private_key": types.StringType, + "private_key_plaintext": types.StringType, + "project_id": types.StringType, + "region": types.StringType, + }, + } +} + type ListEndpointsResponse struct { // The list of endpoints. - Endpoints []ServingEndpoint `tfsdk:"endpoints" tf:"optional"` + Endpoints types.List `tfsdk:"endpoints" tf:"optional"` } func (newState *ListEndpointsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListEndpointsResponse) { @@ -753,6 +3403,67 @@ func (newState *ListEndpointsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListEndpointsResponse) SyncEffectiveFieldsDuringRead(existingState ListEndpointsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListEndpointsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListEndpointsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "endpoints": reflect.TypeOf(ServingEndpoint{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListEndpointsResponse +// only implements ToObjectValue() and Type(). +func (o ListEndpointsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoints": o.Endpoints, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListEndpointsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoints": basetypes.ListType{ + ElemType: ServingEndpoint{}.Type(ctx), + }, + }, + } +} + +// GetEndpoints returns the value of the Endpoints field in ListEndpointsResponse as +// a slice of ServingEndpoint values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListEndpointsResponse) GetEndpoints(ctx context.Context) ([]ServingEndpoint, bool) { + if o.Endpoints.IsNull() || o.Endpoints.IsUnknown() { + return nil, false + } + var v []ServingEndpoint + d := o.Endpoints.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEndpoints sets the value of the Endpoints field in ListEndpointsResponse. +func (o *ListEndpointsResponse) SetEndpoints(ctx context.Context, v []ServingEndpoint) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["endpoints"] + t = t.(attr.TypeWithElementType).ElementType() + o.Endpoints = types.ListValueMust(t, vs) +} + // Get the latest logs for a served model type LogsRequest struct { // The name of the serving endpoint that the served model belongs to. This @@ -769,9 +3480,42 @@ func (newState *LogsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan LogsRe func (newState *LogsRequest) SyncEffectiveFieldsDuringRead(existingState LogsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LogsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LogsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LogsRequest +// only implements ToObjectValue() and Type(). +func (o LogsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "served_model_name": o.ServedModelName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LogsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "served_model_name": types.StringType, + }, + } +} + type ModelDataPlaneInfo struct { // Information required to query DataPlane API 'query' endpoint. - QueryInfo oauth2.DataPlaneInfo `tfsdk:"query_info" tf:"optional,object"` + QueryInfo types.List `tfsdk:"query_info" tf:"optional,object"` } func (newState *ModelDataPlaneInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ModelDataPlaneInfo) { @@ -780,6 +3524,67 @@ func (newState *ModelDataPlaneInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ModelDataPlaneInfo) SyncEffectiveFieldsDuringRead(existingState ModelDataPlaneInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ModelDataPlaneInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ModelDataPlaneInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "query_info": reflect.TypeOf(oauth2_tf.DataPlaneInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ModelDataPlaneInfo +// only implements ToObjectValue() and Type(). +func (o ModelDataPlaneInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query_info": o.QueryInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ModelDataPlaneInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query_info": basetypes.ListType{ + ElemType: oauth2_tf.DataPlaneInfo{}.Type(ctx), + }, + }, + } +} + +// GetQueryInfo returns the value of the QueryInfo field in ModelDataPlaneInfo as +// a oauth2_tf.DataPlaneInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ModelDataPlaneInfo) GetQueryInfo(ctx context.Context) (oauth2_tf.DataPlaneInfo, bool) { + var e oauth2_tf.DataPlaneInfo + if o.QueryInfo.IsNull() || o.QueryInfo.IsUnknown() { + return e, false + } + var v []oauth2_tf.DataPlaneInfo + d := o.QueryInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueryInfo sets the value of the QueryInfo field in ModelDataPlaneInfo. +func (o *ModelDataPlaneInfo) SetQueryInfo(ctx context.Context, v oauth2_tf.DataPlaneInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query_info"] + o.QueryInfo = types.ListValueMust(t, vs) +} + type OpenAiConfig struct { // This field is only required for Azure AD OpenAI and is the Microsoft // Entra Client ID. @@ -840,6 +3645,57 @@ func (newState *OpenAiConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan OpenA func (newState *OpenAiConfig) SyncEffectiveFieldsDuringRead(existingState OpenAiConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OpenAiConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OpenAiConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OpenAiConfig +// only implements ToObjectValue() and Type(). +func (o OpenAiConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "microsoft_entra_client_id": o.MicrosoftEntraClientId, + "microsoft_entra_client_secret": o.MicrosoftEntraClientSecret, + "microsoft_entra_client_secret_plaintext": o.MicrosoftEntraClientSecretPlaintext, + "microsoft_entra_tenant_id": o.MicrosoftEntraTenantId, + "openai_api_base": o.OpenaiApiBase, + "openai_api_key": o.OpenaiApiKey, + "openai_api_key_plaintext": o.OpenaiApiKeyPlaintext, + "openai_api_type": o.OpenaiApiType, + "openai_api_version": o.OpenaiApiVersion, + "openai_deployment_name": o.OpenaiDeploymentName, + "openai_organization": o.OpenaiOrganization, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o OpenAiConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "microsoft_entra_client_id": types.StringType, + "microsoft_entra_client_secret": types.StringType, + "microsoft_entra_client_secret_plaintext": types.StringType, + "microsoft_entra_tenant_id": types.StringType, + "openai_api_base": types.StringType, + "openai_api_key": types.StringType, + "openai_api_key_plaintext": types.StringType, + "openai_api_type": types.StringType, + "openai_api_version": types.StringType, + "openai_deployment_name": types.StringType, + "openai_organization": types.StringType, + }, + } +} + type PaLmConfig struct { // The Databricks secret key reference for a PaLM API key. If you prefer to // paste your API key directly, see `palm_api_key_plaintext`. You must @@ -859,11 +3715,44 @@ func (newState *PaLmConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan PaLmCon func (newState *PaLmConfig) SyncEffectiveFieldsDuringRead(existingState PaLmConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PaLmConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PaLmConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PaLmConfig +// only implements ToObjectValue() and Type(). +func (o PaLmConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "palm_api_key": o.PalmApiKey, + "palm_api_key_plaintext": o.PalmApiKeyPlaintext, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PaLmConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "palm_api_key": types.StringType, + "palm_api_key_plaintext": types.StringType, + }, + } +} + type PatchServingEndpointTags struct { // List of endpoint tags to add - AddTags []EndpointTag `tfsdk:"add_tags" tf:"optional"` + AddTags types.List `tfsdk:"add_tags" tf:"optional"` // List of tag keys to delete - DeleteTags []types.String `tfsdk:"delete_tags" tf:"optional"` + DeleteTags types.List `tfsdk:"delete_tags" tf:"optional"` // The name of the serving endpoint who's tags to patch. This field is // required. Name types.String `tfsdk:"-"` @@ -875,6 +3764,100 @@ func (newState *PatchServingEndpointTags) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *PatchServingEndpointTags) SyncEffectiveFieldsDuringRead(existingState PatchServingEndpointTags) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PatchServingEndpointTags. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PatchServingEndpointTags) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "add_tags": reflect.TypeOf(EndpointTag{}), + "delete_tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PatchServingEndpointTags +// only implements ToObjectValue() and Type(). +func (o PatchServingEndpointTags) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "add_tags": o.AddTags, + "delete_tags": o.DeleteTags, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PatchServingEndpointTags) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "add_tags": basetypes.ListType{ + ElemType: EndpointTag{}.Type(ctx), + }, + "delete_tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "name": types.StringType, + }, + } +} + +// GetAddTags returns the value of the AddTags field in PatchServingEndpointTags as +// a slice of EndpointTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *PatchServingEndpointTags) GetAddTags(ctx context.Context) ([]EndpointTag, bool) { + if o.AddTags.IsNull() || o.AddTags.IsUnknown() { + return nil, false + } + var v []EndpointTag + d := o.AddTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAddTags sets the value of the AddTags field in PatchServingEndpointTags. +func (o *PatchServingEndpointTags) SetAddTags(ctx context.Context, v []EndpointTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["add_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.AddTags = types.ListValueMust(t, vs) +} + +// GetDeleteTags returns the value of the DeleteTags field in PatchServingEndpointTags as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PatchServingEndpointTags) GetDeleteTags(ctx context.Context) ([]types.String, bool) { + if o.DeleteTags.IsNull() || o.DeleteTags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DeleteTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDeleteTags sets the value of the DeleteTags field in PatchServingEndpointTags. +func (o *PatchServingEndpointTags) SetDeleteTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["delete_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.DeleteTags = types.ListValueMust(t, vs) +} + type PayloadTable struct { // The name of the payload table. Name types.String `tfsdk:"name" tf:"optional"` @@ -890,24 +3873,59 @@ func (newState *PayloadTable) SyncEffectiveFieldsDuringCreateOrUpdate(plan Paylo func (newState *PayloadTable) SyncEffectiveFieldsDuringRead(existingState PayloadTable) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PayloadTable. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PayloadTable) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PayloadTable +// only implements ToObjectValue() and Type(). +func (o PayloadTable) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "status": o.Status, + "status_message": o.StatusMessage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PayloadTable) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "status": types.StringType, + "status_message": types.StringType, + }, + } +} + // Update AI Gateway of a serving endpoint type PutAiGatewayRequest struct { // Configuration for AI Guardrails to prevent unwanted data and unsafe data // in requests and responses. - Guardrails []AiGatewayGuardrails `tfsdk:"guardrails" tf:"optional,object"` + Guardrails types.List `tfsdk:"guardrails" tf:"optional,object"` // Configuration for payload logging using inference tables. Use these // tables to monitor and audit data being sent to and received from model // APIs and to improve model quality. - InferenceTableConfig []AiGatewayInferenceTableConfig `tfsdk:"inference_table_config" tf:"optional,object"` + InferenceTableConfig types.List `tfsdk:"inference_table_config" tf:"optional,object"` // The name of the serving endpoint whose AI Gateway is being updated. This // field is required. Name types.String `tfsdk:"-"` // Configuration for rate limits which can be set to limit endpoint traffic. - RateLimits []AiGatewayRateLimit `tfsdk:"rate_limits" tf:"optional"` + RateLimits types.List `tfsdk:"rate_limits" tf:"optional"` // Configuration to enable usage tracking using system tables. These tables // allow you to monitor operational usage on endpoints and their associated // costs. - UsageTrackingConfig []AiGatewayUsageTrackingConfig `tfsdk:"usage_tracking_config" tf:"optional,object"` + UsageTrackingConfig types.List `tfsdk:"usage_tracking_config" tf:"optional,object"` } func (newState *PutAiGatewayRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutAiGatewayRequest) { @@ -916,20 +3934,176 @@ func (newState *PutAiGatewayRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *PutAiGatewayRequest) SyncEffectiveFieldsDuringRead(existingState PutAiGatewayRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutAiGatewayRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutAiGatewayRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "guardrails": reflect.TypeOf(AiGatewayGuardrails{}), + "inference_table_config": reflect.TypeOf(AiGatewayInferenceTableConfig{}), + "rate_limits": reflect.TypeOf(AiGatewayRateLimit{}), + "usage_tracking_config": reflect.TypeOf(AiGatewayUsageTrackingConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutAiGatewayRequest +// only implements ToObjectValue() and Type(). +func (o PutAiGatewayRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "guardrails": o.Guardrails, + "inference_table_config": o.InferenceTableConfig, + "name": o.Name, + "rate_limits": o.RateLimits, + "usage_tracking_config": o.UsageTrackingConfig, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PutAiGatewayRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "guardrails": basetypes.ListType{ + ElemType: AiGatewayGuardrails{}.Type(ctx), + }, + "inference_table_config": basetypes.ListType{ + ElemType: AiGatewayInferenceTableConfig{}.Type(ctx), + }, + "name": types.StringType, + "rate_limits": basetypes.ListType{ + ElemType: AiGatewayRateLimit{}.Type(ctx), + }, + "usage_tracking_config": basetypes.ListType{ + ElemType: AiGatewayUsageTrackingConfig{}.Type(ctx), + }, + }, + } +} + +// GetGuardrails returns the value of the Guardrails field in PutAiGatewayRequest as +// a AiGatewayGuardrails value. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayRequest) GetGuardrails(ctx context.Context) (AiGatewayGuardrails, bool) { + var e AiGatewayGuardrails + if o.Guardrails.IsNull() || o.Guardrails.IsUnknown() { + return e, false + } + var v []AiGatewayGuardrails + d := o.Guardrails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGuardrails sets the value of the Guardrails field in PutAiGatewayRequest. +func (o *PutAiGatewayRequest) SetGuardrails(ctx context.Context, v AiGatewayGuardrails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["guardrails"] + o.Guardrails = types.ListValueMust(t, vs) +} + +// GetInferenceTableConfig returns the value of the InferenceTableConfig field in PutAiGatewayRequest as +// a AiGatewayInferenceTableConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayRequest) GetInferenceTableConfig(ctx context.Context) (AiGatewayInferenceTableConfig, bool) { + var e AiGatewayInferenceTableConfig + if o.InferenceTableConfig.IsNull() || o.InferenceTableConfig.IsUnknown() { + return e, false + } + var v []AiGatewayInferenceTableConfig + d := o.InferenceTableConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInferenceTableConfig sets the value of the InferenceTableConfig field in PutAiGatewayRequest. +func (o *PutAiGatewayRequest) SetInferenceTableConfig(ctx context.Context, v AiGatewayInferenceTableConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inference_table_config"] + o.InferenceTableConfig = types.ListValueMust(t, vs) +} + +// GetRateLimits returns the value of the RateLimits field in PutAiGatewayRequest as +// a slice of AiGatewayRateLimit values. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayRequest) GetRateLimits(ctx context.Context) ([]AiGatewayRateLimit, bool) { + if o.RateLimits.IsNull() || o.RateLimits.IsUnknown() { + return nil, false + } + var v []AiGatewayRateLimit + d := o.RateLimits.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRateLimits sets the value of the RateLimits field in PutAiGatewayRequest. +func (o *PutAiGatewayRequest) SetRateLimits(ctx context.Context, v []AiGatewayRateLimit) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rate_limits"] + t = t.(attr.TypeWithElementType).ElementType() + o.RateLimits = types.ListValueMust(t, vs) +} + +// GetUsageTrackingConfig returns the value of the UsageTrackingConfig field in PutAiGatewayRequest as +// a AiGatewayUsageTrackingConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayRequest) GetUsageTrackingConfig(ctx context.Context) (AiGatewayUsageTrackingConfig, bool) { + var e AiGatewayUsageTrackingConfig + if o.UsageTrackingConfig.IsNull() || o.UsageTrackingConfig.IsUnknown() { + return e, false + } + var v []AiGatewayUsageTrackingConfig + d := o.UsageTrackingConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUsageTrackingConfig sets the value of the UsageTrackingConfig field in PutAiGatewayRequest. +func (o *PutAiGatewayRequest) SetUsageTrackingConfig(ctx context.Context, v AiGatewayUsageTrackingConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["usage_tracking_config"] + o.UsageTrackingConfig = types.ListValueMust(t, vs) +} + type PutAiGatewayResponse struct { // Configuration for AI Guardrails to prevent unwanted data and unsafe data // in requests and responses. - Guardrails []AiGatewayGuardrails `tfsdk:"guardrails" tf:"optional,object"` + Guardrails types.List `tfsdk:"guardrails" tf:"optional,object"` // Configuration for payload logging using inference tables. Use these // tables to monitor and audit data being sent to and received from model // APIs and to improve model quality . - InferenceTableConfig []AiGatewayInferenceTableConfig `tfsdk:"inference_table_config" tf:"optional,object"` + InferenceTableConfig types.List `tfsdk:"inference_table_config" tf:"optional,object"` // Configuration for rate limits which can be set to limit endpoint traffic. - RateLimits []AiGatewayRateLimit `tfsdk:"rate_limits" tf:"optional"` + RateLimits types.List `tfsdk:"rate_limits" tf:"optional"` // Configuration to enable usage tracking using system tables. These tables // allow you to monitor operational usage on endpoints and their associated // costs. - UsageTrackingConfig []AiGatewayUsageTrackingConfig `tfsdk:"usage_tracking_config" tf:"optional,object"` + UsageTrackingConfig types.List `tfsdk:"usage_tracking_config" tf:"optional,object"` } func (newState *PutAiGatewayResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutAiGatewayResponse) { @@ -938,13 +4112,167 @@ func (newState *PutAiGatewayResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *PutAiGatewayResponse) SyncEffectiveFieldsDuringRead(existingState PutAiGatewayResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutAiGatewayResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutAiGatewayResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "guardrails": reflect.TypeOf(AiGatewayGuardrails{}), + "inference_table_config": reflect.TypeOf(AiGatewayInferenceTableConfig{}), + "rate_limits": reflect.TypeOf(AiGatewayRateLimit{}), + "usage_tracking_config": reflect.TypeOf(AiGatewayUsageTrackingConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutAiGatewayResponse +// only implements ToObjectValue() and Type(). +func (o PutAiGatewayResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "guardrails": o.Guardrails, + "inference_table_config": o.InferenceTableConfig, + "rate_limits": o.RateLimits, + "usage_tracking_config": o.UsageTrackingConfig, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PutAiGatewayResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "guardrails": basetypes.ListType{ + ElemType: AiGatewayGuardrails{}.Type(ctx), + }, + "inference_table_config": basetypes.ListType{ + ElemType: AiGatewayInferenceTableConfig{}.Type(ctx), + }, + "rate_limits": basetypes.ListType{ + ElemType: AiGatewayRateLimit{}.Type(ctx), + }, + "usage_tracking_config": basetypes.ListType{ + ElemType: AiGatewayUsageTrackingConfig{}.Type(ctx), + }, + }, + } +} + +// GetGuardrails returns the value of the Guardrails field in PutAiGatewayResponse as +// a AiGatewayGuardrails value. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayResponse) GetGuardrails(ctx context.Context) (AiGatewayGuardrails, bool) { + var e AiGatewayGuardrails + if o.Guardrails.IsNull() || o.Guardrails.IsUnknown() { + return e, false + } + var v []AiGatewayGuardrails + d := o.Guardrails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGuardrails sets the value of the Guardrails field in PutAiGatewayResponse. +func (o *PutAiGatewayResponse) SetGuardrails(ctx context.Context, v AiGatewayGuardrails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["guardrails"] + o.Guardrails = types.ListValueMust(t, vs) +} + +// GetInferenceTableConfig returns the value of the InferenceTableConfig field in PutAiGatewayResponse as +// a AiGatewayInferenceTableConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayResponse) GetInferenceTableConfig(ctx context.Context) (AiGatewayInferenceTableConfig, bool) { + var e AiGatewayInferenceTableConfig + if o.InferenceTableConfig.IsNull() || o.InferenceTableConfig.IsUnknown() { + return e, false + } + var v []AiGatewayInferenceTableConfig + d := o.InferenceTableConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInferenceTableConfig sets the value of the InferenceTableConfig field in PutAiGatewayResponse. +func (o *PutAiGatewayResponse) SetInferenceTableConfig(ctx context.Context, v AiGatewayInferenceTableConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inference_table_config"] + o.InferenceTableConfig = types.ListValueMust(t, vs) +} + +// GetRateLimits returns the value of the RateLimits field in PutAiGatewayResponse as +// a slice of AiGatewayRateLimit values. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayResponse) GetRateLimits(ctx context.Context) ([]AiGatewayRateLimit, bool) { + if o.RateLimits.IsNull() || o.RateLimits.IsUnknown() { + return nil, false + } + var v []AiGatewayRateLimit + d := o.RateLimits.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRateLimits sets the value of the RateLimits field in PutAiGatewayResponse. +func (o *PutAiGatewayResponse) SetRateLimits(ctx context.Context, v []AiGatewayRateLimit) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rate_limits"] + t = t.(attr.TypeWithElementType).ElementType() + o.RateLimits = types.ListValueMust(t, vs) +} + +// GetUsageTrackingConfig returns the value of the UsageTrackingConfig field in PutAiGatewayResponse as +// a AiGatewayUsageTrackingConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *PutAiGatewayResponse) GetUsageTrackingConfig(ctx context.Context) (AiGatewayUsageTrackingConfig, bool) { + var e AiGatewayUsageTrackingConfig + if o.UsageTrackingConfig.IsNull() || o.UsageTrackingConfig.IsUnknown() { + return e, false + } + var v []AiGatewayUsageTrackingConfig + d := o.UsageTrackingConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUsageTrackingConfig sets the value of the UsageTrackingConfig field in PutAiGatewayResponse. +func (o *PutAiGatewayResponse) SetUsageTrackingConfig(ctx context.Context, v AiGatewayUsageTrackingConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["usage_tracking_config"] + o.UsageTrackingConfig = types.ListValueMust(t, vs) +} + // Update rate limits of a serving endpoint type PutRequest struct { // The name of the serving endpoint whose rate limits are being updated. // This field is required. Name types.String `tfsdk:"-"` // The list of endpoint rate limits. - RateLimits []RateLimit `tfsdk:"rate_limits" tf:"optional"` + RateLimits types.List `tfsdk:"rate_limits" tf:"optional"` } func (newState *PutRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutRequest) { @@ -953,9 +4281,72 @@ func (newState *PutRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutRequ func (newState *PutRequest) SyncEffectiveFieldsDuringRead(existingState PutRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "rate_limits": reflect.TypeOf(RateLimit{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutRequest +// only implements ToObjectValue() and Type(). +func (o PutRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "rate_limits": o.RateLimits, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PutRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "rate_limits": basetypes.ListType{ + ElemType: RateLimit{}.Type(ctx), + }, + }, + } +} + +// GetRateLimits returns the value of the RateLimits field in PutRequest as +// a slice of RateLimit values. +// If the field is unknown or null, the boolean return value is false. +func (o *PutRequest) GetRateLimits(ctx context.Context) ([]RateLimit, bool) { + if o.RateLimits.IsNull() || o.RateLimits.IsUnknown() { + return nil, false + } + var v []RateLimit + d := o.RateLimits.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRateLimits sets the value of the RateLimits field in PutRequest. +func (o *PutRequest) SetRateLimits(ctx context.Context, v []RateLimit) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rate_limits"] + t = t.(attr.TypeWithElementType).ElementType() + o.RateLimits = types.ListValueMust(t, vs) +} + type PutResponse struct { // The list of endpoint rate limits. - RateLimits []RateLimit `tfsdk:"rate_limits" tf:"optional"` + RateLimits types.List `tfsdk:"rate_limits" tf:"optional"` } func (newState *PutResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutResponse) { @@ -964,24 +4355,85 @@ func (newState *PutResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutRes func (newState *PutResponse) SyncEffectiveFieldsDuringRead(existingState PutResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "rate_limits": reflect.TypeOf(RateLimit{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutResponse +// only implements ToObjectValue() and Type(). +func (o PutResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "rate_limits": o.RateLimits, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PutResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "rate_limits": basetypes.ListType{ + ElemType: RateLimit{}.Type(ctx), + }, + }, + } +} + +// GetRateLimits returns the value of the RateLimits field in PutResponse as +// a slice of RateLimit values. +// If the field is unknown or null, the boolean return value is false. +func (o *PutResponse) GetRateLimits(ctx context.Context) ([]RateLimit, bool) { + if o.RateLimits.IsNull() || o.RateLimits.IsUnknown() { + return nil, false + } + var v []RateLimit + d := o.RateLimits.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRateLimits sets the value of the RateLimits field in PutResponse. +func (o *PutResponse) SetRateLimits(ctx context.Context, v []RateLimit) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["rate_limits"] + t = t.(attr.TypeWithElementType).ElementType() + o.RateLimits = types.ListValueMust(t, vs) +} + type QueryEndpointInput struct { // Pandas Dataframe input in the records orientation. - DataframeRecords []any `tfsdk:"dataframe_records" tf:"optional"` + DataframeRecords types.List `tfsdk:"dataframe_records" tf:"optional"` // Pandas Dataframe input in the split orientation. - DataframeSplit []DataframeSplitInput `tfsdk:"dataframe_split" tf:"optional,object"` + DataframeSplit types.List `tfsdk:"dataframe_split" tf:"optional,object"` // The extra parameters field used ONLY for __completions, chat,__ and // __embeddings external & foundation model__ serving endpoints. This is a // map of strings and should only be used with other external/foundation // model query fields. - ExtraParams map[string]types.String `tfsdk:"extra_params" tf:"optional"` + ExtraParams types.Map `tfsdk:"extra_params" tf:"optional"` // The input string (or array of strings) field used ONLY for __embeddings // external & foundation model__ serving endpoints and is the only field // (along with extra_params if needed) used by embeddings queries. - Input any `tfsdk:"input" tf:"optional"` + Input types.Object `tfsdk:"input" tf:"optional"` // Tensor-based input in columnar format. - Inputs any `tfsdk:"inputs" tf:"optional"` + Inputs types.Object `tfsdk:"inputs" tf:"optional"` // Tensor-based input in row format. - Instances []any `tfsdk:"instances" tf:"optional"` + Instances types.List `tfsdk:"instances" tf:"optional"` // The max tokens field used ONLY for __completions__ and __chat external & // foundation model__ serving endpoints. This is an integer and should only // be used with other chat/completions query fields. @@ -989,7 +4441,7 @@ type QueryEndpointInput struct { // The messages field used ONLY for __chat external & foundation model__ // serving endpoints. This is a map of strings and should only be used with // other chat query fields. - Messages []ChatMessage `tfsdk:"messages" tf:"optional"` + Messages types.List `tfsdk:"messages" tf:"optional"` // The n (number of candidates) field used ONLY for __completions__ and // __chat external & foundation model__ serving endpoints. This is an // integer between 1 and 5 with a default of 1 and should only be used with @@ -1000,11 +4452,11 @@ type QueryEndpointInput struct { // The prompt string (or array of strings) field used ONLY for __completions // external & foundation model__ serving endpoints and should only be used // with other completions query fields. - Prompt any `tfsdk:"prompt" tf:"optional"` + Prompt types.Object `tfsdk:"prompt" tf:"optional"` // The stop sequences field used ONLY for __completions__ and __chat // external & foundation model__ serving endpoints. This is a list of // strings and should only be used with other chat/completions query fields. - Stop []types.String `tfsdk:"stop" tf:"optional"` + Stop types.List `tfsdk:"stop" tf:"optional"` // The stream field used ONLY for __completions__ and __chat external & // foundation model__ serving endpoints. This is a boolean defaulting to // false and should only be used with other chat/completions query fields. @@ -1022,16 +4474,248 @@ func (newState *QueryEndpointInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *QueryEndpointInput) SyncEffectiveFieldsDuringRead(existingState QueryEndpointInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryEndpointInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryEndpointInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "dataframe_records": reflect.TypeOf(types.Object{}), + "dataframe_split": reflect.TypeOf(DataframeSplitInput{}), + "extra_params": reflect.TypeOf(types.String{}), + "instances": reflect.TypeOf(types.Object{}), + "messages": reflect.TypeOf(ChatMessage{}), + "stop": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryEndpointInput +// only implements ToObjectValue() and Type(). +func (o QueryEndpointInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dataframe_records": o.DataframeRecords, + "dataframe_split": o.DataframeSplit, + "extra_params": o.ExtraParams, + "input": o.Input, + "inputs": o.Inputs, + "instances": o.Instances, + "max_tokens": o.MaxTokens, + "messages": o.Messages, + "n": o.N, + "name": o.Name, + "prompt": o.Prompt, + "stop": o.Stop, + "stream": o.Stream, + "temperature": o.Temperature, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryEndpointInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dataframe_records": basetypes.ListType{ + ElemType: types.ObjectType{}, + }, + "dataframe_split": basetypes.ListType{ + ElemType: DataframeSplitInput{}.Type(ctx), + }, + "extra_params": basetypes.MapType{ + ElemType: types.StringType, + }, + "input": types.ObjectType{}, + "inputs": types.ObjectType{}, + "instances": basetypes.ListType{ + ElemType: types.ObjectType{}, + }, + "max_tokens": types.Int64Type, + "messages": basetypes.ListType{ + ElemType: ChatMessage{}.Type(ctx), + }, + "n": types.Int64Type, + "name": types.StringType, + "prompt": types.ObjectType{}, + "stop": basetypes.ListType{ + ElemType: types.StringType, + }, + "stream": types.BoolType, + "temperature": types.Float64Type, + }, + } +} + +// GetDataframeRecords returns the value of the DataframeRecords field in QueryEndpointInput as +// a slice of types.Object values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointInput) GetDataframeRecords(ctx context.Context) ([]types.Object, bool) { + if o.DataframeRecords.IsNull() || o.DataframeRecords.IsUnknown() { + return nil, false + } + var v []types.Object + d := o.DataframeRecords.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDataframeRecords sets the value of the DataframeRecords field in QueryEndpointInput. +func (o *QueryEndpointInput) SetDataframeRecords(ctx context.Context, v []types.Object) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dataframe_records"] + t = t.(attr.TypeWithElementType).ElementType() + o.DataframeRecords = types.ListValueMust(t, vs) +} + +// GetDataframeSplit returns the value of the DataframeSplit field in QueryEndpointInput as +// a DataframeSplitInput value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointInput) GetDataframeSplit(ctx context.Context) (DataframeSplitInput, bool) { + var e DataframeSplitInput + if o.DataframeSplit.IsNull() || o.DataframeSplit.IsUnknown() { + return e, false + } + var v []DataframeSplitInput + d := o.DataframeSplit.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataframeSplit sets the value of the DataframeSplit field in QueryEndpointInput. +func (o *QueryEndpointInput) SetDataframeSplit(ctx context.Context, v DataframeSplitInput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["dataframe_split"] + o.DataframeSplit = types.ListValueMust(t, vs) +} + +// GetExtraParams returns the value of the ExtraParams field in QueryEndpointInput as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointInput) GetExtraParams(ctx context.Context) (map[string]types.String, bool) { + if o.ExtraParams.IsNull() || o.ExtraParams.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.ExtraParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExtraParams sets the value of the ExtraParams field in QueryEndpointInput. +func (o *QueryEndpointInput) SetExtraParams(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["extra_params"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExtraParams = types.MapValueMust(t, vs) +} + +// GetInstances returns the value of the Instances field in QueryEndpointInput as +// a slice of types.Object values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointInput) GetInstances(ctx context.Context) ([]types.Object, bool) { + if o.Instances.IsNull() || o.Instances.IsUnknown() { + return nil, false + } + var v []types.Object + d := o.Instances.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInstances sets the value of the Instances field in QueryEndpointInput. +func (o *QueryEndpointInput) SetInstances(ctx context.Context, v []types.Object) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["instances"] + t = t.(attr.TypeWithElementType).ElementType() + o.Instances = types.ListValueMust(t, vs) +} + +// GetMessages returns the value of the Messages field in QueryEndpointInput as +// a slice of ChatMessage values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointInput) GetMessages(ctx context.Context) ([]ChatMessage, bool) { + if o.Messages.IsNull() || o.Messages.IsUnknown() { + return nil, false + } + var v []ChatMessage + d := o.Messages.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetMessages sets the value of the Messages field in QueryEndpointInput. +func (o *QueryEndpointInput) SetMessages(ctx context.Context, v []ChatMessage) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["messages"] + t = t.(attr.TypeWithElementType).ElementType() + o.Messages = types.ListValueMust(t, vs) +} + +// GetStop returns the value of the Stop field in QueryEndpointInput as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointInput) GetStop(ctx context.Context) ([]types.String, bool) { + if o.Stop.IsNull() || o.Stop.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Stop.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStop sets the value of the Stop field in QueryEndpointInput. +func (o *QueryEndpointInput) SetStop(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["stop"] + t = t.(attr.TypeWithElementType).ElementType() + o.Stop = types.ListValueMust(t, vs) +} + type QueryEndpointResponse struct { // The list of choices returned by the __chat or completions // external/foundation model__ serving endpoint. - Choices []V1ResponseChoiceElement `tfsdk:"choices" tf:"optional"` + Choices types.List `tfsdk:"choices" tf:"optional"` // The timestamp in seconds when the query was created in Unix time returned // by a __completions or chat external/foundation model__ serving endpoint. Created types.Int64 `tfsdk:"created" tf:"optional"` // The list of the embeddings returned by the __embeddings // external/foundation model__ serving endpoint. - Data []EmbeddingsV1ResponseEmbeddingElement `tfsdk:"data" tf:"optional"` + Data types.List `tfsdk:"data" tf:"optional"` // The ID of the query that may be returned by a __completions or chat // external/foundation model__ serving endpoint. Id types.String `tfsdk:"id" tf:"optional"` @@ -1043,14 +4727,14 @@ type QueryEndpointResponse struct { // embeddings)]. Object types.String `tfsdk:"object" tf:"optional"` // The predictions returned by the serving endpoint. - Predictions []any `tfsdk:"predictions" tf:"optional"` + Predictions types.List `tfsdk:"predictions" tf:"optional"` // The name of the served model that served the request. This is useful when // there are multiple models behind the same endpoint with traffic split. ServedModelName types.String `tfsdk:"-"` // The usage object that may be returned by the __external/foundation // model__ serving endpoint. This contains information about the number of // tokens used in the prompt and response. - Usage []ExternalModelUsageElement `tfsdk:"usage" tf:"optional,object"` + Usage types.List `tfsdk:"usage" tf:"optional,object"` } func (newState *QueryEndpointResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryEndpointResponse) { @@ -1059,6 +4743,170 @@ func (newState *QueryEndpointResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *QueryEndpointResponse) SyncEffectiveFieldsDuringRead(existingState QueryEndpointResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryEndpointResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryEndpointResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "choices": reflect.TypeOf(V1ResponseChoiceElement{}), + "data": reflect.TypeOf(EmbeddingsV1ResponseEmbeddingElement{}), + "predictions": reflect.TypeOf(types.Object{}), + "usage": reflect.TypeOf(ExternalModelUsageElement{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryEndpointResponse +// only implements ToObjectValue() and Type(). +func (o QueryEndpointResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "choices": o.Choices, + "created": o.Created, + "data": o.Data, + "id": o.Id, + "model": o.Model, + "object": o.Object, + "predictions": o.Predictions, + "served-model-name": o.ServedModelName, + "usage": o.Usage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryEndpointResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "choices": basetypes.ListType{ + ElemType: V1ResponseChoiceElement{}.Type(ctx), + }, + "created": types.Int64Type, + "data": basetypes.ListType{ + ElemType: EmbeddingsV1ResponseEmbeddingElement{}.Type(ctx), + }, + "id": types.StringType, + "model": types.StringType, + "object": types.StringType, + "predictions": basetypes.ListType{ + ElemType: types.ObjectType{}, + }, + "served-model-name": types.StringType, + "usage": basetypes.ListType{ + ElemType: ExternalModelUsageElement{}.Type(ctx), + }, + }, + } +} + +// GetChoices returns the value of the Choices field in QueryEndpointResponse as +// a slice of V1ResponseChoiceElement values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointResponse) GetChoices(ctx context.Context) ([]V1ResponseChoiceElement, bool) { + if o.Choices.IsNull() || o.Choices.IsUnknown() { + return nil, false + } + var v []V1ResponseChoiceElement + d := o.Choices.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChoices sets the value of the Choices field in QueryEndpointResponse. +func (o *QueryEndpointResponse) SetChoices(ctx context.Context, v []V1ResponseChoiceElement) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["choices"] + t = t.(attr.TypeWithElementType).ElementType() + o.Choices = types.ListValueMust(t, vs) +} + +// GetData returns the value of the Data field in QueryEndpointResponse as +// a slice of EmbeddingsV1ResponseEmbeddingElement values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointResponse) GetData(ctx context.Context) ([]EmbeddingsV1ResponseEmbeddingElement, bool) { + if o.Data.IsNull() || o.Data.IsUnknown() { + return nil, false + } + var v []EmbeddingsV1ResponseEmbeddingElement + d := o.Data.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetData sets the value of the Data field in QueryEndpointResponse. +func (o *QueryEndpointResponse) SetData(ctx context.Context, v []EmbeddingsV1ResponseEmbeddingElement) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data"] + t = t.(attr.TypeWithElementType).ElementType() + o.Data = types.ListValueMust(t, vs) +} + +// GetPredictions returns the value of the Predictions field in QueryEndpointResponse as +// a slice of types.Object values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointResponse) GetPredictions(ctx context.Context) ([]types.Object, bool) { + if o.Predictions.IsNull() || o.Predictions.IsUnknown() { + return nil, false + } + var v []types.Object + d := o.Predictions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPredictions sets the value of the Predictions field in QueryEndpointResponse. +func (o *QueryEndpointResponse) SetPredictions(ctx context.Context, v []types.Object) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["predictions"] + t = t.(attr.TypeWithElementType).ElementType() + o.Predictions = types.ListValueMust(t, vs) +} + +// GetUsage returns the value of the Usage field in QueryEndpointResponse as +// a ExternalModelUsageElement value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEndpointResponse) GetUsage(ctx context.Context) (ExternalModelUsageElement, bool) { + var e ExternalModelUsageElement + if o.Usage.IsNull() || o.Usage.IsUnknown() { + return e, false + } + var v []ExternalModelUsageElement + d := o.Usage.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUsage sets the value of the Usage field in QueryEndpointResponse. +func (o *QueryEndpointResponse) SetUsage(ctx context.Context, v ExternalModelUsageElement) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["usage"] + o.Usage = types.ListValueMust(t, vs) +} + type RateLimit struct { // Used to specify how many calls are allowed for a key within the // renewal_period. @@ -1078,6 +4926,41 @@ func (newState *RateLimit) SyncEffectiveFieldsDuringCreateOrUpdate(plan RateLimi func (newState *RateLimit) SyncEffectiveFieldsDuringRead(existingState RateLimit) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RateLimit. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RateLimit) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RateLimit +// only implements ToObjectValue() and Type(). +func (o RateLimit) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "calls": o.Calls, + "key": o.Key, + "renewal_period": o.RenewalPeriod, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RateLimit) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "calls": types.Int64Type, + "key": types.StringType, + "renewal_period": types.StringType, + }, + } +} + type Route struct { // The name of the served model this route configures traffic for. ServedModelName types.String `tfsdk:"served_model_name" tf:""` @@ -1092,6 +4975,39 @@ func (newState *Route) SyncEffectiveFieldsDuringCreateOrUpdate(plan Route) { func (newState *Route) SyncEffectiveFieldsDuringRead(existingState Route) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Route. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Route) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Route +// only implements ToObjectValue() and Type(). +func (o Route) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "served_model_name": o.ServedModelName, + "traffic_percentage": o.TrafficPercentage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Route) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "served_model_name": types.StringType, + "traffic_percentage": types.Int64Type, + }, + } +} + type ServedEntityInput struct { // The name of the entity to be served. The entity may be a model in the // Databricks Model Registry, a model in the Unity Catalog (UC), or a @@ -1108,7 +5024,7 @@ type ServedEntityInput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - EnvironmentVars map[string]types.String `tfsdk:"environment_vars" tf:"optional"` + EnvironmentVars types.Map `tfsdk:"environment_vars" tf:"optional"` // The external model to be served. NOTE: Only one of external_model and // (entity_name, entity_version, workload_size, workload_type, and // scale_to_zero_enabled) can be specified with the latter set being used @@ -1117,7 +5033,7 @@ type ServedEntityInput struct { // endpoint without external_model. If the endpoint is created without // external_model, users cannot update it to add external_model later. The // task type of all external models within an endpoint must be the same. - ExternalModel []ExternalModel `tfsdk:"external_model" tf:"optional,object"` + ExternalModel types.List `tfsdk:"external_model" tf:"optional,object"` // ARN of the instance profile that the served entity uses to access AWS // resources. InstanceProfileArn types.String `tfsdk:"instance_profile_arn" tf:"optional"` @@ -1159,6 +5075,116 @@ func (newState *ServedEntityInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ServedEntityInput) SyncEffectiveFieldsDuringRead(existingState ServedEntityInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedEntityInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedEntityInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "environment_vars": reflect.TypeOf(types.String{}), + "external_model": reflect.TypeOf(ExternalModel{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedEntityInput +// only implements ToObjectValue() and Type(). +func (o ServedEntityInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "entity_name": o.EntityName, + "entity_version": o.EntityVersion, + "environment_vars": o.EnvironmentVars, + "external_model": o.ExternalModel, + "instance_profile_arn": o.InstanceProfileArn, + "max_provisioned_throughput": o.MaxProvisionedThroughput, + "min_provisioned_throughput": o.MinProvisionedThroughput, + "name": o.Name, + "scale_to_zero_enabled": o.ScaleToZeroEnabled, + "workload_size": o.WorkloadSize, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedEntityInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "entity_name": types.StringType, + "entity_version": types.StringType, + "environment_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "external_model": basetypes.ListType{ + ElemType: ExternalModel{}.Type(ctx), + }, + "instance_profile_arn": types.StringType, + "max_provisioned_throughput": types.Int64Type, + "min_provisioned_throughput": types.Int64Type, + "name": types.StringType, + "scale_to_zero_enabled": types.BoolType, + "workload_size": types.StringType, + "workload_type": types.StringType, + }, + } +} + +// GetEnvironmentVars returns the value of the EnvironmentVars field in ServedEntityInput as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntityInput) GetEnvironmentVars(ctx context.Context) (map[string]types.String, bool) { + if o.EnvironmentVars.IsNull() || o.EnvironmentVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.EnvironmentVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironmentVars sets the value of the EnvironmentVars field in ServedEntityInput. +func (o *ServedEntityInput) SetEnvironmentVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environment_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.EnvironmentVars = types.MapValueMust(t, vs) +} + +// GetExternalModel returns the value of the ExternalModel field in ServedEntityInput as +// a ExternalModel value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntityInput) GetExternalModel(ctx context.Context) (ExternalModel, bool) { + var e ExternalModel + if o.ExternalModel.IsNull() || o.ExternalModel.IsUnknown() { + return e, false + } + var v []ExternalModel + d := o.ExternalModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExternalModel sets the value of the ExternalModel field in ServedEntityInput. +func (o *ServedEntityInput) SetExternalModel(ctx context.Context, v ExternalModel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["external_model"] + o.ExternalModel = types.ListValueMust(t, vs) +} + type ServedEntityOutput struct { // The creation timestamp of the served entity in Unix time. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1179,17 +5205,17 @@ type ServedEntityOutput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - EnvironmentVars map[string]types.String `tfsdk:"environment_vars" tf:"optional"` + EnvironmentVars types.Map `tfsdk:"environment_vars" tf:"optional"` // The external model that is served. NOTE: Only one of external_model, // foundation_model, and (entity_name, entity_version, workload_size, // workload_type, and scale_to_zero_enabled) is returned based on the // endpoint type. - ExternalModel []ExternalModel `tfsdk:"external_model" tf:"optional,object"` + ExternalModel types.List `tfsdk:"external_model" tf:"optional,object"` // The foundation model that is served. NOTE: Only one of foundation_model, // external_model, and (entity_name, entity_version, workload_size, // workload_type, and scale_to_zero_enabled) is returned based on the // endpoint type. - FoundationModel []FoundationModel `tfsdk:"foundation_model" tf:"optional,object"` + FoundationModel types.List `tfsdk:"foundation_model" tf:"optional,object"` // ARN of the instance profile that the served entity uses to access AWS // resources. InstanceProfileArn types.String `tfsdk:"instance_profile_arn" tf:"optional"` @@ -1203,7 +5229,7 @@ type ServedEntityOutput struct { // zero. ScaleToZeroEnabled types.Bool `tfsdk:"scale_to_zero_enabled" tf:"optional"` // Information corresponding to the state of the served entity. - State []ServedModelState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The workload size of the served entity. The workload size corresponds to // a range of provisioned concurrency that the compute autoscales between. A // single unit of provisioned concurrency can process one request at a time. @@ -1228,6 +5254,182 @@ func (newState *ServedEntityOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ServedEntityOutput) SyncEffectiveFieldsDuringRead(existingState ServedEntityOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedEntityOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedEntityOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "environment_vars": reflect.TypeOf(types.String{}), + "external_model": reflect.TypeOf(ExternalModel{}), + "foundation_model": reflect.TypeOf(FoundationModel{}), + "state": reflect.TypeOf(ServedModelState{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedEntityOutput +// only implements ToObjectValue() and Type(). +func (o ServedEntityOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "creator": o.Creator, + "entity_name": o.EntityName, + "entity_version": o.EntityVersion, + "environment_vars": o.EnvironmentVars, + "external_model": o.ExternalModel, + "foundation_model": o.FoundationModel, + "instance_profile_arn": o.InstanceProfileArn, + "max_provisioned_throughput": o.MaxProvisionedThroughput, + "min_provisioned_throughput": o.MinProvisionedThroughput, + "name": o.Name, + "scale_to_zero_enabled": o.ScaleToZeroEnabled, + "state": o.State, + "workload_size": o.WorkloadSize, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedEntityOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "creator": types.StringType, + "entity_name": types.StringType, + "entity_version": types.StringType, + "environment_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "external_model": basetypes.ListType{ + ElemType: ExternalModel{}.Type(ctx), + }, + "foundation_model": basetypes.ListType{ + ElemType: FoundationModel{}.Type(ctx), + }, + "instance_profile_arn": types.StringType, + "max_provisioned_throughput": types.Int64Type, + "min_provisioned_throughput": types.Int64Type, + "name": types.StringType, + "scale_to_zero_enabled": types.BoolType, + "state": basetypes.ListType{ + ElemType: ServedModelState{}.Type(ctx), + }, + "workload_size": types.StringType, + "workload_type": types.StringType, + }, + } +} + +// GetEnvironmentVars returns the value of the EnvironmentVars field in ServedEntityOutput as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntityOutput) GetEnvironmentVars(ctx context.Context) (map[string]types.String, bool) { + if o.EnvironmentVars.IsNull() || o.EnvironmentVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.EnvironmentVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironmentVars sets the value of the EnvironmentVars field in ServedEntityOutput. +func (o *ServedEntityOutput) SetEnvironmentVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environment_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.EnvironmentVars = types.MapValueMust(t, vs) +} + +// GetExternalModel returns the value of the ExternalModel field in ServedEntityOutput as +// a ExternalModel value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntityOutput) GetExternalModel(ctx context.Context) (ExternalModel, bool) { + var e ExternalModel + if o.ExternalModel.IsNull() || o.ExternalModel.IsUnknown() { + return e, false + } + var v []ExternalModel + d := o.ExternalModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExternalModel sets the value of the ExternalModel field in ServedEntityOutput. +func (o *ServedEntityOutput) SetExternalModel(ctx context.Context, v ExternalModel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["external_model"] + o.ExternalModel = types.ListValueMust(t, vs) +} + +// GetFoundationModel returns the value of the FoundationModel field in ServedEntityOutput as +// a FoundationModel value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntityOutput) GetFoundationModel(ctx context.Context) (FoundationModel, bool) { + var e FoundationModel + if o.FoundationModel.IsNull() || o.FoundationModel.IsUnknown() { + return e, false + } + var v []FoundationModel + d := o.FoundationModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFoundationModel sets the value of the FoundationModel field in ServedEntityOutput. +func (o *ServedEntityOutput) SetFoundationModel(ctx context.Context, v FoundationModel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["foundation_model"] + o.FoundationModel = types.ListValueMust(t, vs) +} + +// GetState returns the value of the State field in ServedEntityOutput as +// a ServedModelState value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntityOutput) GetState(ctx context.Context) (ServedModelState, bool) { + var e ServedModelState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []ServedModelState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in ServedEntityOutput. +func (o *ServedEntityOutput) SetState(ctx context.Context, v ServedModelState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + type ServedEntitySpec struct { // The name of the entity served. The entity may be a model in the // Databricks Model Registry, a model in the Unity Catalog (UC), or a @@ -1241,11 +5443,11 @@ type ServedEntitySpec struct { // The external model that is served. NOTE: Only one of external_model, // foundation_model, and (entity_name, entity_version) is returned based on // the endpoint type. - ExternalModel []ExternalModel `tfsdk:"external_model" tf:"optional,object"` + ExternalModel types.List `tfsdk:"external_model" tf:"optional,object"` // The foundation model that is served. NOTE: Only one of foundation_model, // external_model, and (entity_name, entity_version) is returned based on // the endpoint type. - FoundationModel []FoundationModel `tfsdk:"foundation_model" tf:"optional,object"` + FoundationModel types.List `tfsdk:"foundation_model" tf:"optional,object"` // The name of the served entity. Name types.String `tfsdk:"name" tf:"optional"` } @@ -1256,6 +5458,104 @@ func (newState *ServedEntitySpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *ServedEntitySpec) SyncEffectiveFieldsDuringRead(existingState ServedEntitySpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedEntitySpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedEntitySpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "external_model": reflect.TypeOf(ExternalModel{}), + "foundation_model": reflect.TypeOf(FoundationModel{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedEntitySpec +// only implements ToObjectValue() and Type(). +func (o ServedEntitySpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "entity_name": o.EntityName, + "entity_version": o.EntityVersion, + "external_model": o.ExternalModel, + "foundation_model": o.FoundationModel, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedEntitySpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "entity_name": types.StringType, + "entity_version": types.StringType, + "external_model": basetypes.ListType{ + ElemType: ExternalModel{}.Type(ctx), + }, + "foundation_model": basetypes.ListType{ + ElemType: FoundationModel{}.Type(ctx), + }, + "name": types.StringType, + }, + } +} + +// GetExternalModel returns the value of the ExternalModel field in ServedEntitySpec as +// a ExternalModel value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntitySpec) GetExternalModel(ctx context.Context) (ExternalModel, bool) { + var e ExternalModel + if o.ExternalModel.IsNull() || o.ExternalModel.IsUnknown() { + return e, false + } + var v []ExternalModel + d := o.ExternalModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetExternalModel sets the value of the ExternalModel field in ServedEntitySpec. +func (o *ServedEntitySpec) SetExternalModel(ctx context.Context, v ExternalModel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["external_model"] + o.ExternalModel = types.ListValueMust(t, vs) +} + +// GetFoundationModel returns the value of the FoundationModel field in ServedEntitySpec as +// a FoundationModel value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedEntitySpec) GetFoundationModel(ctx context.Context) (FoundationModel, bool) { + var e FoundationModel + if o.FoundationModel.IsNull() || o.FoundationModel.IsUnknown() { + return e, false + } + var v []FoundationModel + d := o.FoundationModel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFoundationModel sets the value of the FoundationModel field in ServedEntitySpec. +func (o *ServedEntitySpec) SetFoundationModel(ctx context.Context, v FoundationModel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["foundation_model"] + o.FoundationModel = types.ListValueMust(t, vs) +} + type ServedModelInput struct { // An object containing a set of optional, user-specified environment // variable key-value pairs used for serving this model. Note: this is an @@ -1263,7 +5563,7 @@ type ServedModelInput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - EnvironmentVars map[string]types.String `tfsdk:"environment_vars" tf:"optional"` + EnvironmentVars types.Map `tfsdk:"environment_vars" tf:"optional"` // ARN of the instance profile that the served model will use to access AWS // resources. InstanceProfileArn types.String `tfsdk:"instance_profile_arn" tf:"optional"` @@ -1310,6 +5610,85 @@ func (newState *ServedModelInput) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *ServedModelInput) SyncEffectiveFieldsDuringRead(existingState ServedModelInput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedModelInput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedModelInput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "environment_vars": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedModelInput +// only implements ToObjectValue() and Type(). +func (o ServedModelInput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "environment_vars": o.EnvironmentVars, + "instance_profile_arn": o.InstanceProfileArn, + "max_provisioned_throughput": o.MaxProvisionedThroughput, + "min_provisioned_throughput": o.MinProvisionedThroughput, + "model_name": o.ModelName, + "model_version": o.ModelVersion, + "name": o.Name, + "scale_to_zero_enabled": o.ScaleToZeroEnabled, + "workload_size": o.WorkloadSize, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedModelInput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "environment_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "instance_profile_arn": types.StringType, + "max_provisioned_throughput": types.Int64Type, + "min_provisioned_throughput": types.Int64Type, + "model_name": types.StringType, + "model_version": types.StringType, + "name": types.StringType, + "scale_to_zero_enabled": types.BoolType, + "workload_size": types.StringType, + "workload_type": types.StringType, + }, + } +} + +// GetEnvironmentVars returns the value of the EnvironmentVars field in ServedModelInput as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedModelInput) GetEnvironmentVars(ctx context.Context) (map[string]types.String, bool) { + if o.EnvironmentVars.IsNull() || o.EnvironmentVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.EnvironmentVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironmentVars sets the value of the EnvironmentVars field in ServedModelInput. +func (o *ServedModelInput) SetEnvironmentVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environment_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.EnvironmentVars = types.MapValueMust(t, vs) +} + type ServedModelOutput struct { // The creation timestamp of the served model in Unix time. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` @@ -1321,7 +5700,7 @@ type ServedModelOutput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - EnvironmentVars map[string]types.String `tfsdk:"environment_vars" tf:"optional"` + EnvironmentVars types.Map `tfsdk:"environment_vars" tf:"optional"` // ARN of the instance profile that the served model will use to access AWS // resources. InstanceProfileArn types.String `tfsdk:"instance_profile_arn" tf:"optional"` @@ -1337,7 +5716,7 @@ type ServedModelOutput struct { // zero. ScaleToZeroEnabled types.Bool `tfsdk:"scale_to_zero_enabled" tf:"optional"` // Information corresponding to the state of the Served Model. - State []ServedModelState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // The workload size of the served model. The workload size corresponds to a // range of provisioned concurrency that the compute will autoscale between. // A single unit of provisioned concurrency can process one request at a @@ -1362,6 +5741,116 @@ func (newState *ServedModelOutput) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ServedModelOutput) SyncEffectiveFieldsDuringRead(existingState ServedModelOutput) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedModelOutput. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedModelOutput) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "environment_vars": reflect.TypeOf(types.String{}), + "state": reflect.TypeOf(ServedModelState{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedModelOutput +// only implements ToObjectValue() and Type(). +func (o ServedModelOutput) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "creator": o.Creator, + "environment_vars": o.EnvironmentVars, + "instance_profile_arn": o.InstanceProfileArn, + "model_name": o.ModelName, + "model_version": o.ModelVersion, + "name": o.Name, + "scale_to_zero_enabled": o.ScaleToZeroEnabled, + "state": o.State, + "workload_size": o.WorkloadSize, + "workload_type": o.WorkloadType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedModelOutput) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "creator": types.StringType, + "environment_vars": basetypes.MapType{ + ElemType: types.StringType, + }, + "instance_profile_arn": types.StringType, + "model_name": types.StringType, + "model_version": types.StringType, + "name": types.StringType, + "scale_to_zero_enabled": types.BoolType, + "state": basetypes.ListType{ + ElemType: ServedModelState{}.Type(ctx), + }, + "workload_size": types.StringType, + "workload_type": types.StringType, + }, + } +} + +// GetEnvironmentVars returns the value of the EnvironmentVars field in ServedModelOutput as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedModelOutput) GetEnvironmentVars(ctx context.Context) (map[string]types.String, bool) { + if o.EnvironmentVars.IsNull() || o.EnvironmentVars.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.EnvironmentVars.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnvironmentVars sets the value of the EnvironmentVars field in ServedModelOutput. +func (o *ServedModelOutput) SetEnvironmentVars(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["environment_vars"] + t = t.(attr.TypeWithElementType).ElementType() + o.EnvironmentVars = types.MapValueMust(t, vs) +} + +// GetState returns the value of the State field in ServedModelOutput as +// a ServedModelState value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServedModelOutput) GetState(ctx context.Context) (ServedModelState, bool) { + var e ServedModelState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []ServedModelState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in ServedModelOutput. +func (o *ServedModelOutput) SetState(ctx context.Context, v ServedModelState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + type ServedModelSpec struct { // The name of the model in Databricks Model Registry or the full name of // the model in Unity Catalog. @@ -1379,6 +5868,41 @@ func (newState *ServedModelSpec) SyncEffectiveFieldsDuringCreateOrUpdate(plan Se func (newState *ServedModelSpec) SyncEffectiveFieldsDuringRead(existingState ServedModelSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedModelSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedModelSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedModelSpec +// only implements ToObjectValue() and Type(). +func (o ServedModelSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "model_name": o.ModelName, + "model_version": o.ModelVersion, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedModelSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "model_name": types.StringType, + "model_version": types.StringType, + "name": types.StringType, + }, + } +} + type ServedModelState struct { // The state of the served entity deployment. DEPLOYMENT_CREATING indicates // that the served entity is not ready yet because the deployment is still @@ -1403,6 +5927,39 @@ func (newState *ServedModelState) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *ServedModelState) SyncEffectiveFieldsDuringRead(existingState ServedModelState) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServedModelState. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServedModelState) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServedModelState +// only implements ToObjectValue() and Type(). +func (o ServedModelState) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "deployment": o.Deployment, + "deployment_state_message": o.DeploymentStateMessage, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServedModelState) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "deployment": types.StringType, + "deployment_state_message": types.StringType, + }, + } +} + type ServerLogsResponse struct { // The most recent log lines of the model server processing invocation // requests. @@ -1415,12 +5972,43 @@ func (newState *ServerLogsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ServerLogsResponse) SyncEffectiveFieldsDuringRead(existingState ServerLogsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServerLogsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServerLogsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServerLogsResponse +// only implements ToObjectValue() and Type(). +func (o ServerLogsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "logs": o.Logs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServerLogsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "logs": types.StringType, + }, + } +} + type ServingEndpoint struct { // The AI Gateway configuration for the serving endpoint. NOTE: Only // external model endpoints are currently supported. - AiGateway []AiGatewayConfig `tfsdk:"ai_gateway" tf:"optional,object"` + AiGateway types.List `tfsdk:"ai_gateway" tf:"optional,object"` // The config that is currently being served by the endpoint. - Config []EndpointCoreConfigSummary `tfsdk:"config" tf:"optional,object"` + Config types.List `tfsdk:"config" tf:"optional,object"` // The timestamp when the endpoint was created in Unix time. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` // The email of the user who created the serving endpoint. @@ -1433,9 +6021,9 @@ type ServingEndpoint struct { // The name of the serving endpoint. Name types.String `tfsdk:"name" tf:"optional"` // Information corresponding to the state of the serving endpoint. - State []EndpointState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // Tags attached to the serving endpoint. - Tags []EndpointTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // The task type of the serving endpoint. Task types.String `tfsdk:"task" tf:"optional"` } @@ -1446,6 +6034,172 @@ func (newState *ServingEndpoint) SyncEffectiveFieldsDuringCreateOrUpdate(plan Se func (newState *ServingEndpoint) SyncEffectiveFieldsDuringRead(existingState ServingEndpoint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpoint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpoint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ai_gateway": reflect.TypeOf(AiGatewayConfig{}), + "config": reflect.TypeOf(EndpointCoreConfigSummary{}), + "state": reflect.TypeOf(EndpointState{}), + "tags": reflect.TypeOf(EndpointTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpoint +// only implements ToObjectValue() and Type(). +func (o ServingEndpoint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ai_gateway": o.AiGateway, + "config": o.Config, + "creation_timestamp": o.CreationTimestamp, + "creator": o.Creator, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "name": o.Name, + "state": o.State, + "tags": o.Tags, + "task": o.Task, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpoint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ai_gateway": basetypes.ListType{ + ElemType: AiGatewayConfig{}.Type(ctx), + }, + "config": basetypes.ListType{ + ElemType: EndpointCoreConfigSummary{}.Type(ctx), + }, + "creation_timestamp": types.Int64Type, + "creator": types.StringType, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "name": types.StringType, + "state": basetypes.ListType{ + ElemType: EndpointState{}.Type(ctx), + }, + "tags": basetypes.ListType{ + ElemType: EndpointTag{}.Type(ctx), + }, + "task": types.StringType, + }, + } +} + +// GetAiGateway returns the value of the AiGateway field in ServingEndpoint as +// a AiGatewayConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpoint) GetAiGateway(ctx context.Context) (AiGatewayConfig, bool) { + var e AiGatewayConfig + if o.AiGateway.IsNull() || o.AiGateway.IsUnknown() { + return e, false + } + var v []AiGatewayConfig + d := o.AiGateway.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAiGateway sets the value of the AiGateway field in ServingEndpoint. +func (o *ServingEndpoint) SetAiGateway(ctx context.Context, v AiGatewayConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ai_gateway"] + o.AiGateway = types.ListValueMust(t, vs) +} + +// GetConfig returns the value of the Config field in ServingEndpoint as +// a EndpointCoreConfigSummary value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpoint) GetConfig(ctx context.Context) (EndpointCoreConfigSummary, bool) { + var e EndpointCoreConfigSummary + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []EndpointCoreConfigSummary + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in ServingEndpoint. +func (o *ServingEndpoint) SetConfig(ctx context.Context, v EndpointCoreConfigSummary) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + +// GetState returns the value of the State field in ServingEndpoint as +// a EndpointState value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpoint) GetState(ctx context.Context) (EndpointState, bool) { + var e EndpointState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []EndpointState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in ServingEndpoint. +func (o *ServingEndpoint) SetState(ctx context.Context, v EndpointState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in ServingEndpoint as +// a slice of EndpointTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpoint) GetTags(ctx context.Context) ([]EndpointTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []EndpointTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ServingEndpoint. +func (o *ServingEndpoint) SetTags(ctx context.Context, v []EndpointTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ServingEndpointAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -1463,9 +6217,46 @@ func (newState *ServingEndpointAccessControlRequest) SyncEffectiveFieldsDuringCr func (newState *ServingEndpointAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState ServingEndpointAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o ServingEndpointAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type ServingEndpointAccessControlResponse struct { // All permissions. - AllPermissions []ServingEndpointPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -1482,18 +6273,87 @@ func (newState *ServingEndpointAccessControlResponse) SyncEffectiveFieldsDuringC func (newState *ServingEndpointAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState ServingEndpointAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(ServingEndpointPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o ServingEndpointAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: ServingEndpointPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in ServingEndpointAccessControlResponse as +// a slice of ServingEndpointPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointAccessControlResponse) GetAllPermissions(ctx context.Context) ([]ServingEndpointPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []ServingEndpointPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in ServingEndpointAccessControlResponse. +func (o *ServingEndpointAccessControlResponse) SetAllPermissions(ctx context.Context, v []ServingEndpointPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type ServingEndpointDetailed struct { // The AI Gateway configuration for the serving endpoint. NOTE: Only // external model endpoints are currently supported. - AiGateway []AiGatewayConfig `tfsdk:"ai_gateway" tf:"optional,object"` + AiGateway types.List `tfsdk:"ai_gateway" tf:"optional,object"` // The config that is currently being served by the endpoint. - Config []EndpointCoreConfigOutput `tfsdk:"config" tf:"optional,object"` + Config types.List `tfsdk:"config" tf:"optional,object"` // The timestamp when the endpoint was created in Unix time. CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` // The email of the user who created the serving endpoint. Creator types.String `tfsdk:"creator" tf:"optional"` // Information required to query DataPlane APIs. - DataPlaneInfo []ModelDataPlaneInfo `tfsdk:"data_plane_info" tf:"optional,object"` + DataPlaneInfo types.List `tfsdk:"data_plane_info" tf:"optional,object"` // Endpoint invocation url if route optimization is enabled for endpoint EndpointUrl types.String `tfsdk:"endpoint_url" tf:"optional"` // System-generated ID of the endpoint. This is used to refer to the @@ -1504,16 +6364,16 @@ type ServingEndpointDetailed struct { // The name of the serving endpoint. Name types.String `tfsdk:"name" tf:"optional"` // The config that the endpoint is attempting to update to. - PendingConfig []EndpointPendingConfig `tfsdk:"pending_config" tf:"optional,object"` + PendingConfig types.List `tfsdk:"pending_config" tf:"optional,object"` // The permission level of the principal making the request. PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` // Boolean representing if route optimization has been enabled for the // endpoint RouteOptimized types.Bool `tfsdk:"route_optimized" tf:"optional"` // Information corresponding to the state of the serving endpoint. - State []EndpointState `tfsdk:"state" tf:"optional,object"` + State types.List `tfsdk:"state" tf:"optional,object"` // Tags attached to the serving endpoint. - Tags []EndpointTag `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // The task type of the serving endpoint. Task types.String `tfsdk:"task" tf:"optional"` } @@ -1524,10 +6384,244 @@ func (newState *ServingEndpointDetailed) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ServingEndpointDetailed) SyncEffectiveFieldsDuringRead(existingState ServingEndpointDetailed) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointDetailed. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointDetailed) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ai_gateway": reflect.TypeOf(AiGatewayConfig{}), + "config": reflect.TypeOf(EndpointCoreConfigOutput{}), + "data_plane_info": reflect.TypeOf(ModelDataPlaneInfo{}), + "pending_config": reflect.TypeOf(EndpointPendingConfig{}), + "state": reflect.TypeOf(EndpointState{}), + "tags": reflect.TypeOf(EndpointTag{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointDetailed +// only implements ToObjectValue() and Type(). +func (o ServingEndpointDetailed) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ai_gateway": o.AiGateway, + "config": o.Config, + "creation_timestamp": o.CreationTimestamp, + "creator": o.Creator, + "data_plane_info": o.DataPlaneInfo, + "endpoint_url": o.EndpointUrl, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "name": o.Name, + "pending_config": o.PendingConfig, + "permission_level": o.PermissionLevel, + "route_optimized": o.RouteOptimized, + "state": o.State, + "tags": o.Tags, + "task": o.Task, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointDetailed) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ai_gateway": basetypes.ListType{ + ElemType: AiGatewayConfig{}.Type(ctx), + }, + "config": basetypes.ListType{ + ElemType: EndpointCoreConfigOutput{}.Type(ctx), + }, + "creation_timestamp": types.Int64Type, + "creator": types.StringType, + "data_plane_info": basetypes.ListType{ + ElemType: ModelDataPlaneInfo{}.Type(ctx), + }, + "endpoint_url": types.StringType, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "name": types.StringType, + "pending_config": basetypes.ListType{ + ElemType: EndpointPendingConfig{}.Type(ctx), + }, + "permission_level": types.StringType, + "route_optimized": types.BoolType, + "state": basetypes.ListType{ + ElemType: EndpointState{}.Type(ctx), + }, + "tags": basetypes.ListType{ + ElemType: EndpointTag{}.Type(ctx), + }, + "task": types.StringType, + }, + } +} + +// GetAiGateway returns the value of the AiGateway field in ServingEndpointDetailed as +// a AiGatewayConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointDetailed) GetAiGateway(ctx context.Context) (AiGatewayConfig, bool) { + var e AiGatewayConfig + if o.AiGateway.IsNull() || o.AiGateway.IsUnknown() { + return e, false + } + var v []AiGatewayConfig + d := o.AiGateway.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAiGateway sets the value of the AiGateway field in ServingEndpointDetailed. +func (o *ServingEndpointDetailed) SetAiGateway(ctx context.Context, v AiGatewayConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ai_gateway"] + o.AiGateway = types.ListValueMust(t, vs) +} + +// GetConfig returns the value of the Config field in ServingEndpointDetailed as +// a EndpointCoreConfigOutput value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointDetailed) GetConfig(ctx context.Context) (EndpointCoreConfigOutput, bool) { + var e EndpointCoreConfigOutput + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []EndpointCoreConfigOutput + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in ServingEndpointDetailed. +func (o *ServingEndpointDetailed) SetConfig(ctx context.Context, v EndpointCoreConfigOutput) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + +// GetDataPlaneInfo returns the value of the DataPlaneInfo field in ServingEndpointDetailed as +// a ModelDataPlaneInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointDetailed) GetDataPlaneInfo(ctx context.Context) (ModelDataPlaneInfo, bool) { + var e ModelDataPlaneInfo + if o.DataPlaneInfo.IsNull() || o.DataPlaneInfo.IsUnknown() { + return e, false + } + var v []ModelDataPlaneInfo + d := o.DataPlaneInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataPlaneInfo sets the value of the DataPlaneInfo field in ServingEndpointDetailed. +func (o *ServingEndpointDetailed) SetDataPlaneInfo(ctx context.Context, v ModelDataPlaneInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_plane_info"] + o.DataPlaneInfo = types.ListValueMust(t, vs) +} + +// GetPendingConfig returns the value of the PendingConfig field in ServingEndpointDetailed as +// a EndpointPendingConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointDetailed) GetPendingConfig(ctx context.Context) (EndpointPendingConfig, bool) { + var e EndpointPendingConfig + if o.PendingConfig.IsNull() || o.PendingConfig.IsUnknown() { + return e, false + } + var v []EndpointPendingConfig + d := o.PendingConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPendingConfig sets the value of the PendingConfig field in ServingEndpointDetailed. +func (o *ServingEndpointDetailed) SetPendingConfig(ctx context.Context, v EndpointPendingConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pending_config"] + o.PendingConfig = types.ListValueMust(t, vs) +} + +// GetState returns the value of the State field in ServingEndpointDetailed as +// a EndpointState value. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointDetailed) GetState(ctx context.Context) (EndpointState, bool) { + var e EndpointState + if o.State.IsNull() || o.State.IsUnknown() { + return e, false + } + var v []EndpointState + d := o.State.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetState sets the value of the State field in ServingEndpointDetailed. +func (o *ServingEndpointDetailed) SetState(ctx context.Context, v EndpointState) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["state"] + o.State = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in ServingEndpointDetailed as +// a slice of EndpointTag values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointDetailed) GetTags(ctx context.Context) ([]EndpointTag, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []EndpointTag + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ServingEndpointDetailed. +func (o *ServingEndpointDetailed) SetTags(ctx context.Context, v []EndpointTag) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ServingEndpointPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -1538,8 +6632,73 @@ func (newState *ServingEndpointPermission) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ServingEndpointPermission) SyncEffectiveFieldsDuringRead(existingState ServingEndpointPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointPermission +// only implements ToObjectValue() and Type(). +func (o ServingEndpointPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in ServingEndpointPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in ServingEndpointPermission. +func (o *ServingEndpointPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type ServingEndpointPermissions struct { - AccessControlList []ServingEndpointAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -1552,6 +6711,71 @@ func (newState *ServingEndpointPermissions) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ServingEndpointPermissions) SyncEffectiveFieldsDuringRead(existingState ServingEndpointPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ServingEndpointAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointPermissions +// only implements ToObjectValue() and Type(). +func (o ServingEndpointPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ServingEndpointAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ServingEndpointPermissions as +// a slice of ServingEndpointAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointPermissions) GetAccessControlList(ctx context.Context) ([]ServingEndpointAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ServingEndpointAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ServingEndpointPermissions. +func (o *ServingEndpointPermissions) SetAccessControlList(ctx context.Context, v []ServingEndpointAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type ServingEndpointPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -1564,8 +6788,41 @@ func (newState *ServingEndpointPermissionsDescription) SyncEffectiveFieldsDuring func (newState *ServingEndpointPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState ServingEndpointPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o ServingEndpointPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type ServingEndpointPermissionsRequest struct { - AccessControlList []ServingEndpointAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The serving endpoint for which to get or manage permissions. ServingEndpointId types.String `tfsdk:"-"` } @@ -1576,9 +6833,72 @@ func (newState *ServingEndpointPermissionsRequest) SyncEffectiveFieldsDuringCrea func (newState *ServingEndpointPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState ServingEndpointPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServingEndpointPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServingEndpointPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(ServingEndpointAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServingEndpointPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o ServingEndpointPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "serving_endpoint_id": o.ServingEndpointId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServingEndpointPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: ServingEndpointAccessControlRequest{}.Type(ctx), + }, + "serving_endpoint_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in ServingEndpointPermissionsRequest as +// a slice of ServingEndpointAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *ServingEndpointPermissionsRequest) GetAccessControlList(ctx context.Context) ([]ServingEndpointAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []ServingEndpointAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in ServingEndpointPermissionsRequest. +func (o *ServingEndpointPermissionsRequest) SetAccessControlList(ctx context.Context, v []ServingEndpointAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type TrafficConfig struct { // The list of routes that define traffic to each served entity. - Routes []Route `tfsdk:"routes" tf:"optional"` + Routes types.List `tfsdk:"routes" tf:"optional"` } func (newState *TrafficConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan TrafficConfig) { @@ -1587,6 +6907,67 @@ func (newState *TrafficConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan Traf func (newState *TrafficConfig) SyncEffectiveFieldsDuringRead(existingState TrafficConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TrafficConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TrafficConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "routes": reflect.TypeOf(Route{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TrafficConfig +// only implements ToObjectValue() and Type(). +func (o TrafficConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "routes": o.Routes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TrafficConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "routes": basetypes.ListType{ + ElemType: Route{}.Type(ctx), + }, + }, + } +} + +// GetRoutes returns the value of the Routes field in TrafficConfig as +// a slice of Route values. +// If the field is unknown or null, the boolean return value is false. +func (o *TrafficConfig) GetRoutes(ctx context.Context) ([]Route, bool) { + if o.Routes.IsNull() || o.Routes.IsUnknown() { + return nil, false + } + var v []Route + d := o.Routes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRoutes sets the value of the Routes field in TrafficConfig. +func (o *TrafficConfig) SetRoutes(ctx context.Context, v []Route) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["routes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Routes = types.ListValueMust(t, vs) +} + type V1ResponseChoiceElement struct { // The finish reason returned by the endpoint. FinishReason types.String `tfsdk:"finishReason" tf:"optional"` @@ -1595,7 +6976,7 @@ type V1ResponseChoiceElement struct { // The logprobs returned only by the __completions__ endpoint. Logprobs types.Int64 `tfsdk:"logprobs" tf:"optional"` // The message response from the __chat__ endpoint. - Message []ChatMessage `tfsdk:"message" tf:"optional,object"` + Message types.List `tfsdk:"message" tf:"optional,object"` // The text response from the __completions__ endpoint. Text types.String `tfsdk:"text" tf:"optional"` } @@ -1605,3 +6986,72 @@ func (newState *V1ResponseChoiceElement) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *V1ResponseChoiceElement) SyncEffectiveFieldsDuringRead(existingState V1ResponseChoiceElement) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in V1ResponseChoiceElement. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a V1ResponseChoiceElement) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "message": reflect.TypeOf(ChatMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, V1ResponseChoiceElement +// only implements ToObjectValue() and Type(). +func (o V1ResponseChoiceElement) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "finishReason": o.FinishReason, + "index": o.Index, + "logprobs": o.Logprobs, + "message": o.Message, + "text": o.Text, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o V1ResponseChoiceElement) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "finishReason": types.StringType, + "index": types.Int64Type, + "logprobs": types.Int64Type, + "message": basetypes.ListType{ + ElemType: ChatMessage{}.Type(ctx), + }, + "text": types.StringType, + }, + } +} + +// GetMessage returns the value of the Message field in V1ResponseChoiceElement as +// a ChatMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *V1ResponseChoiceElement) GetMessage(ctx context.Context) (ChatMessage, bool) { + var e ChatMessage + if o.Message.IsNull() || o.Message.IsUnknown() { + return e, false + } + var v []ChatMessage + d := o.Message.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMessage sets the value of the Message field in V1ResponseChoiceElement. +func (o *V1ResponseChoiceElement) SetMessage(ctx context.Context, v ChatMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["message"] + o.Message = types.ListValueMust(t, vs) +} diff --git a/internal/service/settings_tf/model.go b/internal/service/settings_tf/model.go index ca15612fc..bc3f2a8f1 100755 --- a/internal/service/settings_tf/model.go +++ b/internal/service/settings_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package settings_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AibiDashboardEmbeddingAccessPolicy struct { @@ -24,8 +31,39 @@ func (newState *AibiDashboardEmbeddingAccessPolicy) SyncEffectiveFieldsDuringCre func (newState *AibiDashboardEmbeddingAccessPolicy) SyncEffectiveFieldsDuringRead(existingState AibiDashboardEmbeddingAccessPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AibiDashboardEmbeddingAccessPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AibiDashboardEmbeddingAccessPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AibiDashboardEmbeddingAccessPolicy +// only implements ToObjectValue() and Type(). +func (o AibiDashboardEmbeddingAccessPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_policy_type": o.AccessPolicyType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AibiDashboardEmbeddingAccessPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_policy_type": types.StringType, + }, + } +} + type AibiDashboardEmbeddingAccessPolicySetting struct { - AibiDashboardEmbeddingAccessPolicy []AibiDashboardEmbeddingAccessPolicy `tfsdk:"aibi_dashboard_embedding_access_policy" tf:"object"` + AibiDashboardEmbeddingAccessPolicy types.List `tfsdk:"aibi_dashboard_embedding_access_policy" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -48,8 +86,73 @@ func (newState *AibiDashboardEmbeddingAccessPolicySetting) SyncEffectiveFieldsDu func (newState *AibiDashboardEmbeddingAccessPolicySetting) SyncEffectiveFieldsDuringRead(existingState AibiDashboardEmbeddingAccessPolicySetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AibiDashboardEmbeddingAccessPolicySetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AibiDashboardEmbeddingAccessPolicySetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aibi_dashboard_embedding_access_policy": reflect.TypeOf(AibiDashboardEmbeddingAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AibiDashboardEmbeddingAccessPolicySetting +// only implements ToObjectValue() and Type(). +func (o AibiDashboardEmbeddingAccessPolicySetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aibi_dashboard_embedding_access_policy": o.AibiDashboardEmbeddingAccessPolicy, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AibiDashboardEmbeddingAccessPolicySetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aibi_dashboard_embedding_access_policy": basetypes.ListType{ + ElemType: AibiDashboardEmbeddingAccessPolicy{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetAibiDashboardEmbeddingAccessPolicy returns the value of the AibiDashboardEmbeddingAccessPolicy field in AibiDashboardEmbeddingAccessPolicySetting as +// a AibiDashboardEmbeddingAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *AibiDashboardEmbeddingAccessPolicySetting) GetAibiDashboardEmbeddingAccessPolicy(ctx context.Context) (AibiDashboardEmbeddingAccessPolicy, bool) { + var e AibiDashboardEmbeddingAccessPolicy + if o.AibiDashboardEmbeddingAccessPolicy.IsNull() || o.AibiDashboardEmbeddingAccessPolicy.IsUnknown() { + return e, false + } + var v []AibiDashboardEmbeddingAccessPolicy + d := o.AibiDashboardEmbeddingAccessPolicy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAibiDashboardEmbeddingAccessPolicy sets the value of the AibiDashboardEmbeddingAccessPolicy field in AibiDashboardEmbeddingAccessPolicySetting. +func (o *AibiDashboardEmbeddingAccessPolicySetting) SetAibiDashboardEmbeddingAccessPolicy(ctx context.Context, v AibiDashboardEmbeddingAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aibi_dashboard_embedding_access_policy"] + o.AibiDashboardEmbeddingAccessPolicy = types.ListValueMust(t, vs) +} + type AibiDashboardEmbeddingApprovedDomains struct { - ApprovedDomains []types.String `tfsdk:"approved_domains" tf:"optional"` + ApprovedDomains types.List `tfsdk:"approved_domains" tf:"optional"` } func (newState *AibiDashboardEmbeddingApprovedDomains) SyncEffectiveFieldsDuringCreateOrUpdate(plan AibiDashboardEmbeddingApprovedDomains) { @@ -58,8 +161,69 @@ func (newState *AibiDashboardEmbeddingApprovedDomains) SyncEffectiveFieldsDuring func (newState *AibiDashboardEmbeddingApprovedDomains) SyncEffectiveFieldsDuringRead(existingState AibiDashboardEmbeddingApprovedDomains) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AibiDashboardEmbeddingApprovedDomains. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AibiDashboardEmbeddingApprovedDomains) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "approved_domains": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AibiDashboardEmbeddingApprovedDomains +// only implements ToObjectValue() and Type(). +func (o AibiDashboardEmbeddingApprovedDomains) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "approved_domains": o.ApprovedDomains, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AibiDashboardEmbeddingApprovedDomains) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "approved_domains": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetApprovedDomains returns the value of the ApprovedDomains field in AibiDashboardEmbeddingApprovedDomains as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *AibiDashboardEmbeddingApprovedDomains) GetApprovedDomains(ctx context.Context) ([]types.String, bool) { + if o.ApprovedDomains.IsNull() || o.ApprovedDomains.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ApprovedDomains.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetApprovedDomains sets the value of the ApprovedDomains field in AibiDashboardEmbeddingApprovedDomains. +func (o *AibiDashboardEmbeddingApprovedDomains) SetApprovedDomains(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["approved_domains"] + t = t.(attr.TypeWithElementType).ElementType() + o.ApprovedDomains = types.ListValueMust(t, vs) +} + type AibiDashboardEmbeddingApprovedDomainsSetting struct { - AibiDashboardEmbeddingApprovedDomains []AibiDashboardEmbeddingApprovedDomains `tfsdk:"aibi_dashboard_embedding_approved_domains" tf:"object"` + AibiDashboardEmbeddingApprovedDomains types.List `tfsdk:"aibi_dashboard_embedding_approved_domains" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -82,8 +246,73 @@ func (newState *AibiDashboardEmbeddingApprovedDomainsSetting) SyncEffectiveField func (newState *AibiDashboardEmbeddingApprovedDomainsSetting) SyncEffectiveFieldsDuringRead(existingState AibiDashboardEmbeddingApprovedDomainsSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AibiDashboardEmbeddingApprovedDomainsSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AibiDashboardEmbeddingApprovedDomainsSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aibi_dashboard_embedding_approved_domains": reflect.TypeOf(AibiDashboardEmbeddingApprovedDomains{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AibiDashboardEmbeddingApprovedDomainsSetting +// only implements ToObjectValue() and Type(). +func (o AibiDashboardEmbeddingApprovedDomainsSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aibi_dashboard_embedding_approved_domains": o.AibiDashboardEmbeddingApprovedDomains, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AibiDashboardEmbeddingApprovedDomainsSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aibi_dashboard_embedding_approved_domains": basetypes.ListType{ + ElemType: AibiDashboardEmbeddingApprovedDomains{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetAibiDashboardEmbeddingApprovedDomains returns the value of the AibiDashboardEmbeddingApprovedDomains field in AibiDashboardEmbeddingApprovedDomainsSetting as +// a AibiDashboardEmbeddingApprovedDomains value. +// If the field is unknown or null, the boolean return value is false. +func (o *AibiDashboardEmbeddingApprovedDomainsSetting) GetAibiDashboardEmbeddingApprovedDomains(ctx context.Context) (AibiDashboardEmbeddingApprovedDomains, bool) { + var e AibiDashboardEmbeddingApprovedDomains + if o.AibiDashboardEmbeddingApprovedDomains.IsNull() || o.AibiDashboardEmbeddingApprovedDomains.IsUnknown() { + return e, false + } + var v []AibiDashboardEmbeddingApprovedDomains + d := o.AibiDashboardEmbeddingApprovedDomains.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAibiDashboardEmbeddingApprovedDomains sets the value of the AibiDashboardEmbeddingApprovedDomains field in AibiDashboardEmbeddingApprovedDomainsSetting. +func (o *AibiDashboardEmbeddingApprovedDomainsSetting) SetAibiDashboardEmbeddingApprovedDomains(ctx context.Context, v AibiDashboardEmbeddingApprovedDomains) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aibi_dashboard_embedding_approved_domains"] + o.AibiDashboardEmbeddingApprovedDomains = types.ListValueMust(t, vs) +} + type AutomaticClusterUpdateSetting struct { - AutomaticClusterUpdateWorkspace []ClusterAutoRestartMessage `tfsdk:"automatic_cluster_update_workspace" tf:"object"` + AutomaticClusterUpdateWorkspace types.List `tfsdk:"automatic_cluster_update_workspace" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -106,6 +335,71 @@ func (newState *AutomaticClusterUpdateSetting) SyncEffectiveFieldsDuringCreateOr func (newState *AutomaticClusterUpdateSetting) SyncEffectiveFieldsDuringRead(existingState AutomaticClusterUpdateSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AutomaticClusterUpdateSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AutomaticClusterUpdateSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "automatic_cluster_update_workspace": reflect.TypeOf(ClusterAutoRestartMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AutomaticClusterUpdateSetting +// only implements ToObjectValue() and Type(). +func (o AutomaticClusterUpdateSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "automatic_cluster_update_workspace": o.AutomaticClusterUpdateWorkspace, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AutomaticClusterUpdateSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "automatic_cluster_update_workspace": basetypes.ListType{ + ElemType: ClusterAutoRestartMessage{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetAutomaticClusterUpdateWorkspace returns the value of the AutomaticClusterUpdateWorkspace field in AutomaticClusterUpdateSetting as +// a ClusterAutoRestartMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *AutomaticClusterUpdateSetting) GetAutomaticClusterUpdateWorkspace(ctx context.Context) (ClusterAutoRestartMessage, bool) { + var e ClusterAutoRestartMessage + if o.AutomaticClusterUpdateWorkspace.IsNull() || o.AutomaticClusterUpdateWorkspace.IsUnknown() { + return e, false + } + var v []ClusterAutoRestartMessage + d := o.AutomaticClusterUpdateWorkspace.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAutomaticClusterUpdateWorkspace sets the value of the AutomaticClusterUpdateWorkspace field in AutomaticClusterUpdateSetting. +func (o *AutomaticClusterUpdateSetting) SetAutomaticClusterUpdateWorkspace(ctx context.Context, v ClusterAutoRestartMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["automatic_cluster_update_workspace"] + o.AutomaticClusterUpdateWorkspace = types.ListValueMust(t, vs) +} + type BooleanMessage struct { Value types.Bool `tfsdk:"value" tf:"optional"` } @@ -116,6 +410,37 @@ func (newState *BooleanMessage) SyncEffectiveFieldsDuringCreateOrUpdate(plan Boo func (newState *BooleanMessage) SyncEffectiveFieldsDuringRead(existingState BooleanMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BooleanMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BooleanMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BooleanMessage +// only implements ToObjectValue() and Type(). +func (o BooleanMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BooleanMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": types.BoolType, + }, + } +} + type ClusterAutoRestartMessage struct { CanToggle types.Bool `tfsdk:"can_toggle" tf:"optional"` @@ -126,9 +451,9 @@ type ClusterAutoRestartMessage struct { // intended to use only for purposes like showing an error message to the // customer with the additional details. For example, using these details we // can check why exactly the feature is disabled for this customer. - EnablementDetails []ClusterAutoRestartMessageEnablementDetails `tfsdk:"enablement_details" tf:"optional,object"` + EnablementDetails types.List `tfsdk:"enablement_details" tf:"optional,object"` - MaintenanceWindow []ClusterAutoRestartMessageMaintenanceWindow `tfsdk:"maintenance_window" tf:"optional,object"` + MaintenanceWindow types.List `tfsdk:"maintenance_window" tf:"optional,object"` RestartEvenIfNoUpdatesAvailable types.Bool `tfsdk:"restart_even_if_no_updates_available" tf:"optional"` } @@ -139,6 +464,104 @@ func (newState *ClusterAutoRestartMessage) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ClusterAutoRestartMessage) SyncEffectiveFieldsDuringRead(existingState ClusterAutoRestartMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAutoRestartMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAutoRestartMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "enablement_details": reflect.TypeOf(ClusterAutoRestartMessageEnablementDetails{}), + "maintenance_window": reflect.TypeOf(ClusterAutoRestartMessageMaintenanceWindow{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAutoRestartMessage +// only implements ToObjectValue() and Type(). +func (o ClusterAutoRestartMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "can_toggle": o.CanToggle, + "enabled": o.Enabled, + "enablement_details": o.EnablementDetails, + "maintenance_window": o.MaintenanceWindow, + "restart_even_if_no_updates_available": o.RestartEvenIfNoUpdatesAvailable, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAutoRestartMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "can_toggle": types.BoolType, + "enabled": types.BoolType, + "enablement_details": basetypes.ListType{ + ElemType: ClusterAutoRestartMessageEnablementDetails{}.Type(ctx), + }, + "maintenance_window": basetypes.ListType{ + ElemType: ClusterAutoRestartMessageMaintenanceWindow{}.Type(ctx), + }, + "restart_even_if_no_updates_available": types.BoolType, + }, + } +} + +// GetEnablementDetails returns the value of the EnablementDetails field in ClusterAutoRestartMessage as +// a ClusterAutoRestartMessageEnablementDetails value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAutoRestartMessage) GetEnablementDetails(ctx context.Context) (ClusterAutoRestartMessageEnablementDetails, bool) { + var e ClusterAutoRestartMessageEnablementDetails + if o.EnablementDetails.IsNull() || o.EnablementDetails.IsUnknown() { + return e, false + } + var v []ClusterAutoRestartMessageEnablementDetails + d := o.EnablementDetails.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEnablementDetails sets the value of the EnablementDetails field in ClusterAutoRestartMessage. +func (o *ClusterAutoRestartMessage) SetEnablementDetails(ctx context.Context, v ClusterAutoRestartMessageEnablementDetails) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["enablement_details"] + o.EnablementDetails = types.ListValueMust(t, vs) +} + +// GetMaintenanceWindow returns the value of the MaintenanceWindow field in ClusterAutoRestartMessage as +// a ClusterAutoRestartMessageMaintenanceWindow value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAutoRestartMessage) GetMaintenanceWindow(ctx context.Context) (ClusterAutoRestartMessageMaintenanceWindow, bool) { + var e ClusterAutoRestartMessageMaintenanceWindow + if o.MaintenanceWindow.IsNull() || o.MaintenanceWindow.IsUnknown() { + return e, false + } + var v []ClusterAutoRestartMessageMaintenanceWindow + d := o.MaintenanceWindow.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMaintenanceWindow sets the value of the MaintenanceWindow field in ClusterAutoRestartMessage. +func (o *ClusterAutoRestartMessage) SetMaintenanceWindow(ctx context.Context, v ClusterAutoRestartMessageMaintenanceWindow) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["maintenance_window"] + o.MaintenanceWindow = types.ListValueMust(t, vs) +} + // Contains an information about the enablement status judging (e.g. whether the // enterprise tier is enabled) This is only additional information that MUST NOT // be used to decide whether the setting is enabled or not. This is intended to @@ -161,8 +584,43 @@ func (newState *ClusterAutoRestartMessageEnablementDetails) SyncEffectiveFieldsD func (newState *ClusterAutoRestartMessageEnablementDetails) SyncEffectiveFieldsDuringRead(existingState ClusterAutoRestartMessageEnablementDetails) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAutoRestartMessageEnablementDetails. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAutoRestartMessageEnablementDetails) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAutoRestartMessageEnablementDetails +// only implements ToObjectValue() and Type(). +func (o ClusterAutoRestartMessageEnablementDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "forced_for_compliance_mode": o.ForcedForComplianceMode, + "unavailable_for_disabled_entitlement": o.UnavailableForDisabledEntitlement, + "unavailable_for_non_enterprise_tier": o.UnavailableForNonEnterpriseTier, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAutoRestartMessageEnablementDetails) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "forced_for_compliance_mode": types.BoolType, + "unavailable_for_disabled_entitlement": types.BoolType, + "unavailable_for_non_enterprise_tier": types.BoolType, + }, + } +} + type ClusterAutoRestartMessageMaintenanceWindow struct { - WeekDayBasedSchedule []ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule `tfsdk:"week_day_based_schedule" tf:"optional,object"` + WeekDayBasedSchedule types.List `tfsdk:"week_day_based_schedule" tf:"optional,object"` } func (newState *ClusterAutoRestartMessageMaintenanceWindow) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterAutoRestartMessageMaintenanceWindow) { @@ -171,12 +629,73 @@ func (newState *ClusterAutoRestartMessageMaintenanceWindow) SyncEffectiveFieldsD func (newState *ClusterAutoRestartMessageMaintenanceWindow) SyncEffectiveFieldsDuringRead(existingState ClusterAutoRestartMessageMaintenanceWindow) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAutoRestartMessageMaintenanceWindow. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAutoRestartMessageMaintenanceWindow) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "week_day_based_schedule": reflect.TypeOf(ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAutoRestartMessageMaintenanceWindow +// only implements ToObjectValue() and Type(). +func (o ClusterAutoRestartMessageMaintenanceWindow) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "week_day_based_schedule": o.WeekDayBasedSchedule, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAutoRestartMessageMaintenanceWindow) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "week_day_based_schedule": basetypes.ListType{ + ElemType: ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule{}.Type(ctx), + }, + }, + } +} + +// GetWeekDayBasedSchedule returns the value of the WeekDayBasedSchedule field in ClusterAutoRestartMessageMaintenanceWindow as +// a ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAutoRestartMessageMaintenanceWindow) GetWeekDayBasedSchedule(ctx context.Context) (ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule, bool) { + var e ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule + if o.WeekDayBasedSchedule.IsNull() || o.WeekDayBasedSchedule.IsUnknown() { + return e, false + } + var v []ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule + d := o.WeekDayBasedSchedule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWeekDayBasedSchedule sets the value of the WeekDayBasedSchedule field in ClusterAutoRestartMessageMaintenanceWindow. +func (o *ClusterAutoRestartMessageMaintenanceWindow) SetWeekDayBasedSchedule(ctx context.Context, v ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["week_day_based_schedule"] + o.WeekDayBasedSchedule = types.ListValueMust(t, vs) +} + type ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule struct { DayOfWeek types.String `tfsdk:"day_of_week" tf:"optional"` Frequency types.String `tfsdk:"frequency" tf:"optional"` - WindowStartTime []ClusterAutoRestartMessageMaintenanceWindowWindowStartTime `tfsdk:"window_start_time" tf:"optional,object"` + WindowStartTime types.List `tfsdk:"window_start_time" tf:"optional,object"` } func (newState *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) SyncEffectiveFieldsDuringCreateOrUpdate(plan ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) { @@ -185,6 +704,71 @@ func (newState *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) func (newState *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) SyncEffectiveFieldsDuringRead(existingState ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "window_start_time": reflect.TypeOf(ClusterAutoRestartMessageMaintenanceWindowWindowStartTime{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule +// only implements ToObjectValue() and Type(). +func (o ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "day_of_week": o.DayOfWeek, + "frequency": o.Frequency, + "window_start_time": o.WindowStartTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "day_of_week": types.StringType, + "frequency": types.StringType, + "window_start_time": basetypes.ListType{ + ElemType: ClusterAutoRestartMessageMaintenanceWindowWindowStartTime{}.Type(ctx), + }, + }, + } +} + +// GetWindowStartTime returns the value of the WindowStartTime field in ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule as +// a ClusterAutoRestartMessageMaintenanceWindowWindowStartTime value. +// If the field is unknown or null, the boolean return value is false. +func (o *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) GetWindowStartTime(ctx context.Context) (ClusterAutoRestartMessageMaintenanceWindowWindowStartTime, bool) { + var e ClusterAutoRestartMessageMaintenanceWindowWindowStartTime + if o.WindowStartTime.IsNull() || o.WindowStartTime.IsUnknown() { + return e, false + } + var v []ClusterAutoRestartMessageMaintenanceWindowWindowStartTime + d := o.WindowStartTime.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetWindowStartTime sets the value of the WindowStartTime field in ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule. +func (o *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) SetWindowStartTime(ctx context.Context, v ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["window_start_time"] + o.WindowStartTime = types.ListValueMust(t, vs) +} + type ClusterAutoRestartMessageMaintenanceWindowWindowStartTime struct { Hours types.Int64 `tfsdk:"hours" tf:"optional"` @@ -197,10 +781,43 @@ func (newState *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) SyncE func (newState *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) SyncEffectiveFieldsDuringRead(existingState ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ClusterAutoRestartMessageMaintenanceWindowWindowStartTime. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ClusterAutoRestartMessageMaintenanceWindowWindowStartTime +// only implements ToObjectValue() and Type(). +func (o ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "hours": o.Hours, + "minutes": o.Minutes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "hours": types.Int64Type, + "minutes": types.Int64Type, + }, + } +} + // SHIELD feature: CSP type ComplianceSecurityProfile struct { // Set by customers when they request Compliance Security Profile (CSP) - ComplianceStandards []types.String `tfsdk:"compliance_standards" tf:"optional"` + ComplianceStandards types.List `tfsdk:"compliance_standards" tf:"optional"` IsEnabled types.Bool `tfsdk:"is_enabled" tf:"optional"` } @@ -211,9 +828,72 @@ func (newState *ComplianceSecurityProfile) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ComplianceSecurityProfile) SyncEffectiveFieldsDuringRead(existingState ComplianceSecurityProfile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ComplianceSecurityProfile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ComplianceSecurityProfile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "compliance_standards": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ComplianceSecurityProfile +// only implements ToObjectValue() and Type(). +func (o ComplianceSecurityProfile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "compliance_standards": o.ComplianceStandards, + "is_enabled": o.IsEnabled, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ComplianceSecurityProfile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "compliance_standards": basetypes.ListType{ + ElemType: types.StringType, + }, + "is_enabled": types.BoolType, + }, + } +} + +// GetComplianceStandards returns the value of the ComplianceStandards field in ComplianceSecurityProfile as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ComplianceSecurityProfile) GetComplianceStandards(ctx context.Context) ([]types.String, bool) { + if o.ComplianceStandards.IsNull() || o.ComplianceStandards.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ComplianceStandards.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetComplianceStandards sets the value of the ComplianceStandards field in ComplianceSecurityProfile. +func (o *ComplianceSecurityProfile) SetComplianceStandards(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["compliance_standards"] + t = t.(attr.TypeWithElementType).ElementType() + o.ComplianceStandards = types.ListValueMust(t, vs) +} + type ComplianceSecurityProfileSetting struct { // SHIELD feature: CSP - ComplianceSecurityProfileWorkspace []ComplianceSecurityProfile `tfsdk:"compliance_security_profile_workspace" tf:"object"` + ComplianceSecurityProfileWorkspace types.List `tfsdk:"compliance_security_profile_workspace" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -236,16 +916,81 @@ func (newState *ComplianceSecurityProfileSetting) SyncEffectiveFieldsDuringCreat func (newState *ComplianceSecurityProfileSetting) SyncEffectiveFieldsDuringRead(existingState ComplianceSecurityProfileSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ComplianceSecurityProfileSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ComplianceSecurityProfileSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "compliance_security_profile_workspace": reflect.TypeOf(ComplianceSecurityProfile{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ComplianceSecurityProfileSetting +// only implements ToObjectValue() and Type(). +func (o ComplianceSecurityProfileSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "compliance_security_profile_workspace": o.ComplianceSecurityProfileWorkspace, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ComplianceSecurityProfileSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "compliance_security_profile_workspace": basetypes.ListType{ + ElemType: ComplianceSecurityProfile{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetComplianceSecurityProfileWorkspace returns the value of the ComplianceSecurityProfileWorkspace field in ComplianceSecurityProfileSetting as +// a ComplianceSecurityProfile value. +// If the field is unknown or null, the boolean return value is false. +func (o *ComplianceSecurityProfileSetting) GetComplianceSecurityProfileWorkspace(ctx context.Context) (ComplianceSecurityProfile, bool) { + var e ComplianceSecurityProfile + if o.ComplianceSecurityProfileWorkspace.IsNull() || o.ComplianceSecurityProfileWorkspace.IsUnknown() { + return e, false + } + var v []ComplianceSecurityProfile + d := o.ComplianceSecurityProfileWorkspace.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetComplianceSecurityProfileWorkspace sets the value of the ComplianceSecurityProfileWorkspace field in ComplianceSecurityProfileSetting. +func (o *ComplianceSecurityProfileSetting) SetComplianceSecurityProfileWorkspace(ctx context.Context, v ComplianceSecurityProfile) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["compliance_security_profile_workspace"] + o.ComplianceSecurityProfileWorkspace = types.ListValueMust(t, vs) +} + type Config struct { - Email []EmailConfig `tfsdk:"email" tf:"optional,object"` + Email types.List `tfsdk:"email" tf:"optional,object"` - GenericWebhook []GenericWebhookConfig `tfsdk:"generic_webhook" tf:"optional,object"` + GenericWebhook types.List `tfsdk:"generic_webhook" tf:"optional,object"` - MicrosoftTeams []MicrosoftTeamsConfig `tfsdk:"microsoft_teams" tf:"optional,object"` + MicrosoftTeams types.List `tfsdk:"microsoft_teams" tf:"optional,object"` - Pagerduty []PagerdutyConfig `tfsdk:"pagerduty" tf:"optional,object"` + Pagerduty types.List `tfsdk:"pagerduty" tf:"optional,object"` - Slack []SlackConfig `tfsdk:"slack" tf:"optional,object"` + Slack types.List `tfsdk:"slack" tf:"optional,object"` } func (newState *Config) SyncEffectiveFieldsDuringCreateOrUpdate(plan Config) { @@ -254,9 +999,194 @@ func (newState *Config) SyncEffectiveFieldsDuringCreateOrUpdate(plan Config) { func (newState *Config) SyncEffectiveFieldsDuringRead(existingState Config) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Config. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Config) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "email": reflect.TypeOf(EmailConfig{}), + "generic_webhook": reflect.TypeOf(GenericWebhookConfig{}), + "microsoft_teams": reflect.TypeOf(MicrosoftTeamsConfig{}), + "pagerduty": reflect.TypeOf(PagerdutyConfig{}), + "slack": reflect.TypeOf(SlackConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Config +// only implements ToObjectValue() and Type(). +func (o Config) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "email": o.Email, + "generic_webhook": o.GenericWebhook, + "microsoft_teams": o.MicrosoftTeams, + "pagerduty": o.Pagerduty, + "slack": o.Slack, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Config) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "email": basetypes.ListType{ + ElemType: EmailConfig{}.Type(ctx), + }, + "generic_webhook": basetypes.ListType{ + ElemType: GenericWebhookConfig{}.Type(ctx), + }, + "microsoft_teams": basetypes.ListType{ + ElemType: MicrosoftTeamsConfig{}.Type(ctx), + }, + "pagerduty": basetypes.ListType{ + ElemType: PagerdutyConfig{}.Type(ctx), + }, + "slack": basetypes.ListType{ + ElemType: SlackConfig{}.Type(ctx), + }, + }, + } +} + +// GetEmail returns the value of the Email field in Config as +// a EmailConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Config) GetEmail(ctx context.Context) (EmailConfig, bool) { + var e EmailConfig + if o.Email.IsNull() || o.Email.IsUnknown() { + return e, false + } + var v []EmailConfig + d := o.Email.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEmail sets the value of the Email field in Config. +func (o *Config) SetEmail(ctx context.Context, v EmailConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["email"] + o.Email = types.ListValueMust(t, vs) +} + +// GetGenericWebhook returns the value of the GenericWebhook field in Config as +// a GenericWebhookConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Config) GetGenericWebhook(ctx context.Context) (GenericWebhookConfig, bool) { + var e GenericWebhookConfig + if o.GenericWebhook.IsNull() || o.GenericWebhook.IsUnknown() { + return e, false + } + var v []GenericWebhookConfig + d := o.GenericWebhook.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGenericWebhook sets the value of the GenericWebhook field in Config. +func (o *Config) SetGenericWebhook(ctx context.Context, v GenericWebhookConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["generic_webhook"] + o.GenericWebhook = types.ListValueMust(t, vs) +} + +// GetMicrosoftTeams returns the value of the MicrosoftTeams field in Config as +// a MicrosoftTeamsConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Config) GetMicrosoftTeams(ctx context.Context) (MicrosoftTeamsConfig, bool) { + var e MicrosoftTeamsConfig + if o.MicrosoftTeams.IsNull() || o.MicrosoftTeams.IsUnknown() { + return e, false + } + var v []MicrosoftTeamsConfig + d := o.MicrosoftTeams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMicrosoftTeams sets the value of the MicrosoftTeams field in Config. +func (o *Config) SetMicrosoftTeams(ctx context.Context, v MicrosoftTeamsConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["microsoft_teams"] + o.MicrosoftTeams = types.ListValueMust(t, vs) +} + +// GetPagerduty returns the value of the Pagerduty field in Config as +// a PagerdutyConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Config) GetPagerduty(ctx context.Context) (PagerdutyConfig, bool) { + var e PagerdutyConfig + if o.Pagerduty.IsNull() || o.Pagerduty.IsUnknown() { + return e, false + } + var v []PagerdutyConfig + d := o.Pagerduty.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPagerduty sets the value of the Pagerduty field in Config. +func (o *Config) SetPagerduty(ctx context.Context, v PagerdutyConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["pagerduty"] + o.Pagerduty = types.ListValueMust(t, vs) +} + +// GetSlack returns the value of the Slack field in Config as +// a SlackConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *Config) GetSlack(ctx context.Context) (SlackConfig, bool) { + var e SlackConfig + if o.Slack.IsNull() || o.Slack.IsUnknown() { + return e, false + } + var v []SlackConfig + d := o.Slack.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSlack sets the value of the Slack field in Config. +func (o *Config) SetSlack(ctx context.Context, v SlackConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["slack"] + o.Slack = types.ListValueMust(t, vs) +} + // Details required to configure a block list or allow list. type CreateIpAccessList struct { - IpAddresses []types.String `tfsdk:"ip_addresses" tf:"optional"` + IpAddresses types.List `tfsdk:"ip_addresses" tf:"optional"` // Label for the IP access list. This **cannot** be empty. Label types.String `tfsdk:"label" tf:""` // Type of IP access list. Valid values are as follows and are @@ -274,10 +1204,75 @@ func (newState *CreateIpAccessList) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateIpAccessList) SyncEffectiveFieldsDuringRead(existingState CreateIpAccessList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateIpAccessList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateIpAccessList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateIpAccessList +// only implements ToObjectValue() and Type(). +func (o CreateIpAccessList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_addresses": o.IpAddresses, + "label": o.Label, + "list_type": o.ListType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateIpAccessList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + "label": types.StringType, + "list_type": types.StringType, + }, + } +} + +// GetIpAddresses returns the value of the IpAddresses field in CreateIpAccessList as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateIpAccessList) GetIpAddresses(ctx context.Context) ([]types.String, bool) { + if o.IpAddresses.IsNull() || o.IpAddresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.IpAddresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIpAddresses sets the value of the IpAddresses field in CreateIpAccessList. +func (o *CreateIpAccessList) SetIpAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.IpAddresses = types.ListValueMust(t, vs) +} + // An IP access list was successfully created. type CreateIpAccessListResponse struct { // Definition of an IP Access list - IpAccessList []IpAccessListInfo `tfsdk:"ip_access_list" tf:"optional,object"` + IpAccessList types.List `tfsdk:"ip_access_list" tf:"optional,object"` } func (newState *CreateIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateIpAccessListResponse) { @@ -286,6 +1281,67 @@ func (newState *CreateIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateIpAccessListResponse) SyncEffectiveFieldsDuringRead(existingState CreateIpAccessListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateIpAccessListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateIpAccessListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_list": reflect.TypeOf(IpAccessListInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateIpAccessListResponse +// only implements ToObjectValue() and Type(). +func (o CreateIpAccessListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list": o.IpAccessList, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateIpAccessListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list": basetypes.ListType{ + ElemType: IpAccessListInfo{}.Type(ctx), + }, + }, + } +} + +// GetIpAccessList returns the value of the IpAccessList field in CreateIpAccessListResponse as +// a IpAccessListInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateIpAccessListResponse) GetIpAccessList(ctx context.Context) (IpAccessListInfo, bool) { + var e IpAccessListInfo + if o.IpAccessList.IsNull() || o.IpAccessList.IsUnknown() { + return e, false + } + var v []IpAccessListInfo + d := o.IpAccessList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIpAccessList sets the value of the IpAccessList field in CreateIpAccessListResponse. +func (o *CreateIpAccessListResponse) SetIpAccessList(ctx context.Context, v IpAccessListInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_list"] + o.IpAccessList = types.ListValueMust(t, vs) +} + type CreateNetworkConnectivityConfigRequest struct { // The name of the network connectivity configuration. The name can contain // alphanumeric characters, hyphens, and underscores. The length must be @@ -304,10 +1360,43 @@ func (newState *CreateNetworkConnectivityConfigRequest) SyncEffectiveFieldsDurin func (newState *CreateNetworkConnectivityConfigRequest) SyncEffectiveFieldsDuringRead(existingState CreateNetworkConnectivityConfigRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateNetworkConnectivityConfigRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateNetworkConnectivityConfigRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateNetworkConnectivityConfigRequest +// only implements ToObjectValue() and Type(). +func (o CreateNetworkConnectivityConfigRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "region": o.Region, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateNetworkConnectivityConfigRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "region": types.StringType, + }, + } +} + type CreateNotificationDestinationRequest struct { // The configuration for the notification destination. Must wrap EXACTLY one // of the nested configs. - Config []Config `tfsdk:"config" tf:"optional,object"` + Config types.List `tfsdk:"config" tf:"optional,object"` // The display name for the notification destination. DisplayName types.String `tfsdk:"display_name" tf:"optional"` } @@ -318,6 +1407,69 @@ func (newState *CreateNotificationDestinationRequest) SyncEffectiveFieldsDuringC func (newState *CreateNotificationDestinationRequest) SyncEffectiveFieldsDuringRead(existingState CreateNotificationDestinationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateNotificationDestinationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateNotificationDestinationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "config": reflect.TypeOf(Config{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateNotificationDestinationRequest +// only implements ToObjectValue() and Type(). +func (o CreateNotificationDestinationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "config": o.Config, + "display_name": o.DisplayName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateNotificationDestinationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "config": basetypes.ListType{ + ElemType: Config{}.Type(ctx), + }, + "display_name": types.StringType, + }, + } +} + +// GetConfig returns the value of the Config field in CreateNotificationDestinationRequest as +// a Config value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateNotificationDestinationRequest) GetConfig(ctx context.Context) (Config, bool) { + var e Config + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []Config + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in CreateNotificationDestinationRequest. +func (o *CreateNotificationDestinationRequest) SetConfig(ctx context.Context, v Config) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + // Configuration details for creating on-behalf tokens. type CreateOboTokenRequest struct { // Application ID of the service principal. @@ -334,9 +1486,44 @@ func (newState *CreateOboTokenRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *CreateOboTokenRequest) SyncEffectiveFieldsDuringRead(existingState CreateOboTokenRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateOboTokenRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateOboTokenRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateOboTokenRequest +// only implements ToObjectValue() and Type(). +func (o CreateOboTokenRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "application_id": o.ApplicationId, + "comment": o.Comment, + "lifetime_seconds": o.LifetimeSeconds, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateOboTokenRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "application_id": types.StringType, + "comment": types.StringType, + "lifetime_seconds": types.Int64Type, + }, + } +} + // An on-behalf token was successfully created for the service principal. type CreateOboTokenResponse struct { - TokenInfo []TokenInfo `tfsdk:"token_info" tf:"optional,object"` + TokenInfo types.List `tfsdk:"token_info" tf:"optional,object"` // Value of the token. TokenValue types.String `tfsdk:"token_value" tf:"optional"` } @@ -347,6 +1534,69 @@ func (newState *CreateOboTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateOboTokenResponse) SyncEffectiveFieldsDuringRead(existingState CreateOboTokenResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateOboTokenResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateOboTokenResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_info": reflect.TypeOf(TokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateOboTokenResponse +// only implements ToObjectValue() and Type(). +func (o CreateOboTokenResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_info": o.TokenInfo, + "token_value": o.TokenValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateOboTokenResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_info": basetypes.ListType{ + ElemType: TokenInfo{}.Type(ctx), + }, + "token_value": types.StringType, + }, + } +} + +// GetTokenInfo returns the value of the TokenInfo field in CreateOboTokenResponse as +// a TokenInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateOboTokenResponse) GetTokenInfo(ctx context.Context) (TokenInfo, bool) { + var e TokenInfo + if o.TokenInfo.IsNull() || o.TokenInfo.IsUnknown() { + return e, false + } + var v []TokenInfo + d := o.TokenInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenInfo sets the value of the TokenInfo field in CreateOboTokenResponse. +func (o *CreateOboTokenResponse) SetTokenInfo(ctx context.Context, v TokenInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_info"] + o.TokenInfo = types.ListValueMust(t, vs) +} + type CreatePrivateEndpointRuleRequest struct { // The sub-resource type (group ID) of the target resource. Note that to // connect to workspace root storage (root DBFS), you need two endpoints, @@ -364,6 +1614,41 @@ func (newState *CreatePrivateEndpointRuleRequest) SyncEffectiveFieldsDuringCreat func (newState *CreatePrivateEndpointRuleRequest) SyncEffectiveFieldsDuringRead(existingState CreatePrivateEndpointRuleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreatePrivateEndpointRuleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreatePrivateEndpointRuleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreatePrivateEndpointRuleRequest +// only implements ToObjectValue() and Type(). +func (o CreatePrivateEndpointRuleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_id": o.GroupId, + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "resource_id": o.ResourceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreatePrivateEndpointRuleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_id": types.StringType, + "network_connectivity_config_id": types.StringType, + "resource_id": types.StringType, + }, + } +} + type CreateTokenRequest struct { // Optional description to attach to the token. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -379,9 +1664,42 @@ func (newState *CreateTokenRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateTokenRequest) SyncEffectiveFieldsDuringRead(existingState CreateTokenRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateTokenRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateTokenRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateTokenRequest +// only implements ToObjectValue() and Type(). +func (o CreateTokenRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "lifetime_seconds": o.LifetimeSeconds, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateTokenRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "lifetime_seconds": types.Int64Type, + }, + } +} + type CreateTokenResponse struct { // The information for the new token. - TokenInfo []PublicTokenInfo `tfsdk:"token_info" tf:"optional,object"` + TokenInfo types.List `tfsdk:"token_info" tf:"optional,object"` // The value of the new token. TokenValue types.String `tfsdk:"token_value" tf:"optional"` } @@ -392,11 +1710,74 @@ func (newState *CreateTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *CreateTokenResponse) SyncEffectiveFieldsDuringRead(existingState CreateTokenResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateTokenResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateTokenResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_info": reflect.TypeOf(PublicTokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateTokenResponse +// only implements ToObjectValue() and Type(). +func (o CreateTokenResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_info": o.TokenInfo, + "token_value": o.TokenValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateTokenResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_info": basetypes.ListType{ + ElemType: PublicTokenInfo{}.Type(ctx), + }, + "token_value": types.StringType, + }, + } +} + +// GetTokenInfo returns the value of the TokenInfo field in CreateTokenResponse as +// a PublicTokenInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateTokenResponse) GetTokenInfo(ctx context.Context) (PublicTokenInfo, bool) { + var e PublicTokenInfo + if o.TokenInfo.IsNull() || o.TokenInfo.IsUnknown() { + return e, false + } + var v []PublicTokenInfo + d := o.TokenInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenInfo sets the value of the TokenInfo field in CreateTokenResponse. +func (o *CreateTokenResponse) SetTokenInfo(ctx context.Context, v PublicTokenInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_info"] + o.TokenInfo = types.ListValueMust(t, vs) +} + // Account level policy for CSP type CspEnablementAccount struct { // Set by customers when they request Compliance Security Profile (CSP) // Invariants are enforced in Settings policy. - ComplianceStandards []types.String `tfsdk:"compliance_standards" tf:"optional"` + ComplianceStandards types.List `tfsdk:"compliance_standards" tf:"optional"` // Enforced = it cannot be overriden at workspace level. IsEnforced types.Bool `tfsdk:"is_enforced" tf:"optional"` } @@ -407,9 +1788,72 @@ func (newState *CspEnablementAccount) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *CspEnablementAccount) SyncEffectiveFieldsDuringRead(existingState CspEnablementAccount) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CspEnablementAccount. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CspEnablementAccount) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "compliance_standards": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CspEnablementAccount +// only implements ToObjectValue() and Type(). +func (o CspEnablementAccount) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "compliance_standards": o.ComplianceStandards, + "is_enforced": o.IsEnforced, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CspEnablementAccount) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "compliance_standards": basetypes.ListType{ + ElemType: types.StringType, + }, + "is_enforced": types.BoolType, + }, + } +} + +// GetComplianceStandards returns the value of the ComplianceStandards field in CspEnablementAccount as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CspEnablementAccount) GetComplianceStandards(ctx context.Context) ([]types.String, bool) { + if o.ComplianceStandards.IsNull() || o.ComplianceStandards.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ComplianceStandards.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetComplianceStandards sets the value of the ComplianceStandards field in CspEnablementAccount. +func (o *CspEnablementAccount) SetComplianceStandards(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["compliance_standards"] + t = t.(attr.TypeWithElementType).ElementType() + o.ComplianceStandards = types.ListValueMust(t, vs) +} + type CspEnablementAccountSetting struct { // Account level policy for CSP - CspEnablementAccount []CspEnablementAccount `tfsdk:"csp_enablement_account" tf:"object"` + CspEnablementAccount types.List `tfsdk:"csp_enablement_account" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -432,6 +1876,71 @@ func (newState *CspEnablementAccountSetting) SyncEffectiveFieldsDuringCreateOrUp func (newState *CspEnablementAccountSetting) SyncEffectiveFieldsDuringRead(existingState CspEnablementAccountSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CspEnablementAccountSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CspEnablementAccountSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "csp_enablement_account": reflect.TypeOf(CspEnablementAccount{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CspEnablementAccountSetting +// only implements ToObjectValue() and Type(). +func (o CspEnablementAccountSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "csp_enablement_account": o.CspEnablementAccount, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CspEnablementAccountSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "csp_enablement_account": basetypes.ListType{ + ElemType: CspEnablementAccount{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetCspEnablementAccount returns the value of the CspEnablementAccount field in CspEnablementAccountSetting as +// a CspEnablementAccount value. +// If the field is unknown or null, the boolean return value is false. +func (o *CspEnablementAccountSetting) GetCspEnablementAccount(ctx context.Context) (CspEnablementAccount, bool) { + var e CspEnablementAccount + if o.CspEnablementAccount.IsNull() || o.CspEnablementAccount.IsUnknown() { + return e, false + } + var v []CspEnablementAccount + d := o.CspEnablementAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCspEnablementAccount sets the value of the CspEnablementAccount field in CspEnablementAccountSetting. +func (o *CspEnablementAccountSetting) SetCspEnablementAccount(ctx context.Context, v CspEnablementAccount) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["csp_enablement_account"] + o.CspEnablementAccount = types.ListValueMust(t, vs) +} + // This represents the setting configuration for the default namespace in the // Databricks workspace. Setting the default catalog for the workspace // determines the catalog that is used when queries do not reference a fully @@ -451,7 +1960,7 @@ type DefaultNamespaceSetting struct { // PATCH request to identify the setting version you are updating. Etag types.String `tfsdk:"etag" tf:"optional"` - Namespace []StringMessage `tfsdk:"namespace" tf:"object"` + Namespace types.List `tfsdk:"namespace" tf:"object"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. @@ -466,6 +1975,71 @@ func (newState *DefaultNamespaceSetting) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *DefaultNamespaceSetting) SyncEffectiveFieldsDuringRead(existingState DefaultNamespaceSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DefaultNamespaceSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DefaultNamespaceSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "namespace": reflect.TypeOf(StringMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DefaultNamespaceSetting +// only implements ToObjectValue() and Type(). +func (o DefaultNamespaceSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "namespace": o.Namespace, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DefaultNamespaceSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "namespace": basetypes.ListType{ + ElemType: StringMessage{}.Type(ctx), + }, + "setting_name": types.StringType, + }, + } +} + +// GetNamespace returns the value of the Namespace field in DefaultNamespaceSetting as +// a StringMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *DefaultNamespaceSetting) GetNamespace(ctx context.Context) (StringMessage, bool) { + var e StringMessage + if o.Namespace.IsNull() || o.Namespace.IsUnknown() { + return e, false + } + var v []StringMessage + d := o.Namespace.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNamespace sets the value of the Namespace field in DefaultNamespaceSetting. +func (o *DefaultNamespaceSetting) SetNamespace(ctx context.Context, v StringMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["namespace"] + o.Namespace = types.ListValueMust(t, vs) +} + // Delete access list type DeleteAccountIpAccessListRequest struct { // The ID for the corresponding IP access list @@ -478,6 +2052,37 @@ func (newState *DeleteAccountIpAccessListRequest) SyncEffectiveFieldsDuringCreat func (newState *DeleteAccountIpAccessListRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountIpAccessListRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountIpAccessListRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountIpAccessListRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountIpAccessListRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountIpAccessListRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list_id": o.IpAccessListId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountIpAccessListRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list_id": types.StringType, + }, + } +} + // Delete the AI/BI dashboard embedding access policy type DeleteAibiDashboardEmbeddingAccessPolicySettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -496,6 +2101,37 @@ func (newState *DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffe func (newState *DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAibiDashboardEmbeddingAccessPolicySettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAibiDashboardEmbeddingAccessPolicySettingRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteAibiDashboardEmbeddingAccessPolicySettingResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -514,6 +2150,37 @@ func (newState *DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) SyncEff func (newState *DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) SyncEffectiveFieldsDuringRead(existingState DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAibiDashboardEmbeddingAccessPolicySettingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAibiDashboardEmbeddingAccessPolicySettingResponse +// only implements ToObjectValue() and Type(). +func (o DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete AI/BI dashboard embedding approved domains type DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -532,6 +2199,37 @@ func (newState *DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncE func (newState *DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -550,6 +2248,37 @@ func (newState *DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) Sync func (newState *DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) SyncEffectiveFieldsDuringRead(existingState DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse +// only implements ToObjectValue() and Type(). +func (o DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete the default namespace setting type DeleteDefaultNamespaceSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -568,6 +2297,37 @@ func (newState *DeleteDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringC func (newState *DeleteDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDefaultNamespaceSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDefaultNamespaceSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDefaultNamespaceSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDefaultNamespaceSettingRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDefaultNamespaceSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDefaultNamespaceSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteDefaultNamespaceSettingResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -586,6 +2346,37 @@ func (newState *DeleteDefaultNamespaceSettingResponse) SyncEffectiveFieldsDuring func (newState *DeleteDefaultNamespaceSettingResponse) SyncEffectiveFieldsDuringRead(existingState DeleteDefaultNamespaceSettingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDefaultNamespaceSettingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDefaultNamespaceSettingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDefaultNamespaceSettingResponse +// only implements ToObjectValue() and Type(). +func (o DeleteDefaultNamespaceSettingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDefaultNamespaceSettingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete Legacy Access Disablement Status type DeleteDisableLegacyAccessRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -604,6 +2395,37 @@ func (newState *DeleteDisableLegacyAccessRequest) SyncEffectiveFieldsDuringCreat func (newState *DeleteDisableLegacyAccessRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDisableLegacyAccessRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDisableLegacyAccessRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDisableLegacyAccessRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDisableLegacyAccessRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDisableLegacyAccessRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDisableLegacyAccessRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteDisableLegacyAccessResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -622,6 +2444,37 @@ func (newState *DeleteDisableLegacyAccessResponse) SyncEffectiveFieldsDuringCrea func (newState *DeleteDisableLegacyAccessResponse) SyncEffectiveFieldsDuringRead(existingState DeleteDisableLegacyAccessResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDisableLegacyAccessResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDisableLegacyAccessResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDisableLegacyAccessResponse +// only implements ToObjectValue() and Type(). +func (o DeleteDisableLegacyAccessResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDisableLegacyAccessResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete the disable legacy DBFS setting type DeleteDisableLegacyDbfsRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -640,6 +2493,37 @@ func (newState *DeleteDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringCreateO func (newState *DeleteDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDisableLegacyDbfsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDisableLegacyDbfsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDisableLegacyDbfsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDisableLegacyDbfsRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDisableLegacyDbfsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDisableLegacyDbfsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteDisableLegacyDbfsResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -658,6 +2542,37 @@ func (newState *DeleteDisableLegacyDbfsResponse) SyncEffectiveFieldsDuringCreate func (newState *DeleteDisableLegacyDbfsResponse) SyncEffectiveFieldsDuringRead(existingState DeleteDisableLegacyDbfsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDisableLegacyDbfsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDisableLegacyDbfsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDisableLegacyDbfsResponse +// only implements ToObjectValue() and Type(). +func (o DeleteDisableLegacyDbfsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDisableLegacyDbfsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete the disable legacy features setting type DeleteDisableLegacyFeaturesRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -676,6 +2591,37 @@ func (newState *DeleteDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringCre func (newState *DeleteDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDisableLegacyFeaturesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDisableLegacyFeaturesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDisableLegacyFeaturesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDisableLegacyFeaturesRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDisableLegacyFeaturesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDisableLegacyFeaturesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteDisableLegacyFeaturesResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -694,6 +2640,37 @@ func (newState *DeleteDisableLegacyFeaturesResponse) SyncEffectiveFieldsDuringCr func (newState *DeleteDisableLegacyFeaturesResponse) SyncEffectiveFieldsDuringRead(existingState DeleteDisableLegacyFeaturesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDisableLegacyFeaturesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDisableLegacyFeaturesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDisableLegacyFeaturesResponse +// only implements ToObjectValue() and Type(). +func (o DeleteDisableLegacyFeaturesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDisableLegacyFeaturesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete access list type DeleteIpAccessListRequest struct { // The ID for the corresponding IP access list @@ -706,6 +2683,37 @@ func (newState *DeleteIpAccessListRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteIpAccessListRequest) SyncEffectiveFieldsDuringRead(existingState DeleteIpAccessListRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteIpAccessListRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteIpAccessListRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteIpAccessListRequest +// only implements ToObjectValue() and Type(). +func (o DeleteIpAccessListRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list_id": o.IpAccessListId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteIpAccessListRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list_id": types.StringType, + }, + } +} + // Delete a network connectivity configuration type DeleteNetworkConnectivityConfigurationRequest struct { // Your Network Connectvity Configuration ID. @@ -718,6 +2726,37 @@ func (newState *DeleteNetworkConnectivityConfigurationRequest) SyncEffectiveFiel func (newState *DeleteNetworkConnectivityConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteNetworkConnectivityConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteNetworkConnectivityConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteNetworkConnectivityConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteNetworkConnectivityConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteNetworkConnectivityConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteNetworkConnectivityConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_connectivity_config_id": types.StringType, + }, + } +} + type DeleteNetworkConnectivityConfigurationResponse struct { } @@ -727,6 +2766,33 @@ func (newState *DeleteNetworkConnectivityConfigurationResponse) SyncEffectiveFie func (newState *DeleteNetworkConnectivityConfigurationResponse) SyncEffectiveFieldsDuringRead(existingState DeleteNetworkConnectivityConfigurationResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteNetworkConnectivityConfigurationResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteNetworkConnectivityConfigurationResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteNetworkConnectivityConfigurationResponse +// only implements ToObjectValue() and Type(). +func (o DeleteNetworkConnectivityConfigurationResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteNetworkConnectivityConfigurationResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a notification destination type DeleteNotificationDestinationRequest struct { Id types.String `tfsdk:"-"` @@ -738,6 +2804,37 @@ func (newState *DeleteNotificationDestinationRequest) SyncEffectiveFieldsDuringC func (newState *DeleteNotificationDestinationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteNotificationDestinationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteNotificationDestinationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteNotificationDestinationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteNotificationDestinationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteNotificationDestinationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteNotificationDestinationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete Personal Compute setting type DeletePersonalComputeSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -756,6 +2853,37 @@ func (newState *DeletePersonalComputeSettingRequest) SyncEffectiveFieldsDuringCr func (newState *DeletePersonalComputeSettingRequest) SyncEffectiveFieldsDuringRead(existingState DeletePersonalComputeSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePersonalComputeSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePersonalComputeSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePersonalComputeSettingRequest +// only implements ToObjectValue() and Type(). +func (o DeletePersonalComputeSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePersonalComputeSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeletePersonalComputeSettingResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -774,6 +2902,37 @@ func (newState *DeletePersonalComputeSettingResponse) SyncEffectiveFieldsDuringC func (newState *DeletePersonalComputeSettingResponse) SyncEffectiveFieldsDuringRead(existingState DeletePersonalComputeSettingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePersonalComputeSettingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePersonalComputeSettingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePersonalComputeSettingResponse +// only implements ToObjectValue() and Type(). +func (o DeletePersonalComputeSettingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePersonalComputeSettingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete a private endpoint rule type DeletePrivateEndpointRuleRequest struct { // Your Network Connectvity Configuration ID. @@ -788,6 +2947,39 @@ func (newState *DeletePrivateEndpointRuleRequest) SyncEffectiveFieldsDuringCreat func (newState *DeletePrivateEndpointRuleRequest) SyncEffectiveFieldsDuringRead(existingState DeletePrivateEndpointRuleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeletePrivateEndpointRuleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeletePrivateEndpointRuleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeletePrivateEndpointRuleRequest +// only implements ToObjectValue() and Type(). +func (o DeletePrivateEndpointRuleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "private_endpoint_rule_id": o.PrivateEndpointRuleId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeletePrivateEndpointRuleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_connectivity_config_id": types.StringType, + "private_endpoint_rule_id": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -797,6 +2989,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete the restrict workspace admins setting type DeleteRestrictWorkspaceAdminsSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -815,6 +3034,37 @@ func (newState *DeleteRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFields func (newState *DeleteRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFieldsDuringRead(existingState DeleteRestrictWorkspaceAdminsSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRestrictWorkspaceAdminsSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRestrictWorkspaceAdminsSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRestrictWorkspaceAdminsSettingRequest +// only implements ToObjectValue() and Type(). +func (o DeleteRestrictWorkspaceAdminsSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRestrictWorkspaceAdminsSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // The etag is returned. type DeleteRestrictWorkspaceAdminsSettingResponse struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -833,6 +3083,37 @@ func (newState *DeleteRestrictWorkspaceAdminsSettingResponse) SyncEffectiveField func (newState *DeleteRestrictWorkspaceAdminsSettingResponse) SyncEffectiveFieldsDuringRead(existingState DeleteRestrictWorkspaceAdminsSettingResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRestrictWorkspaceAdminsSettingResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRestrictWorkspaceAdminsSettingResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRestrictWorkspaceAdminsSettingResponse +// only implements ToObjectValue() and Type(). +func (o DeleteRestrictWorkspaceAdminsSettingResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRestrictWorkspaceAdminsSettingResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Delete a token type DeleteTokenManagementRequest struct { // The ID of the token to revoke. @@ -845,8 +3126,39 @@ func (newState *DeleteTokenManagementRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteTokenManagementRequest) SyncEffectiveFieldsDuringRead(existingState DeleteTokenManagementRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteTokenManagementRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteTokenManagementRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteTokenManagementRequest +// only implements ToObjectValue() and Type(). +func (o DeleteTokenManagementRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_id": o.TokenId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteTokenManagementRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_id": types.StringType, + }, + } +} + type DisableLegacyAccess struct { - DisableLegacyAccess []BooleanMessage `tfsdk:"disable_legacy_access" tf:"object"` + DisableLegacyAccess types.List `tfsdk:"disable_legacy_access" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -869,8 +3181,73 @@ func (newState *DisableLegacyAccess) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DisableLegacyAccess) SyncEffectiveFieldsDuringRead(existingState DisableLegacyAccess) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DisableLegacyAccess. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DisableLegacyAccess) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "disable_legacy_access": reflect.TypeOf(BooleanMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DisableLegacyAccess +// only implements ToObjectValue() and Type(). +func (o DisableLegacyAccess) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "disable_legacy_access": o.DisableLegacyAccess, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DisableLegacyAccess) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "disable_legacy_access": basetypes.ListType{ + ElemType: BooleanMessage{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetDisableLegacyAccess returns the value of the DisableLegacyAccess field in DisableLegacyAccess as +// a BooleanMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *DisableLegacyAccess) GetDisableLegacyAccess(ctx context.Context) (BooleanMessage, bool) { + var e BooleanMessage + if o.DisableLegacyAccess.IsNull() || o.DisableLegacyAccess.IsUnknown() { + return e, false + } + var v []BooleanMessage + d := o.DisableLegacyAccess.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDisableLegacyAccess sets the value of the DisableLegacyAccess field in DisableLegacyAccess. +func (o *DisableLegacyAccess) SetDisableLegacyAccess(ctx context.Context, v BooleanMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disable_legacy_access"] + o.DisableLegacyAccess = types.ListValueMust(t, vs) +} + type DisableLegacyDbfs struct { - DisableLegacyDbfs []BooleanMessage `tfsdk:"disable_legacy_dbfs" tf:"object"` + DisableLegacyDbfs types.List `tfsdk:"disable_legacy_dbfs" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -893,8 +3270,73 @@ func (newState *DisableLegacyDbfs) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DisableLegacyDbfs) SyncEffectiveFieldsDuringRead(existingState DisableLegacyDbfs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DisableLegacyDbfs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DisableLegacyDbfs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "disable_legacy_dbfs": reflect.TypeOf(BooleanMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DisableLegacyDbfs +// only implements ToObjectValue() and Type(). +func (o DisableLegacyDbfs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "disable_legacy_dbfs": o.DisableLegacyDbfs, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DisableLegacyDbfs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "disable_legacy_dbfs": basetypes.ListType{ + ElemType: BooleanMessage{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetDisableLegacyDbfs returns the value of the DisableLegacyDbfs field in DisableLegacyDbfs as +// a BooleanMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *DisableLegacyDbfs) GetDisableLegacyDbfs(ctx context.Context) (BooleanMessage, bool) { + var e BooleanMessage + if o.DisableLegacyDbfs.IsNull() || o.DisableLegacyDbfs.IsUnknown() { + return e, false + } + var v []BooleanMessage + d := o.DisableLegacyDbfs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDisableLegacyDbfs sets the value of the DisableLegacyDbfs field in DisableLegacyDbfs. +func (o *DisableLegacyDbfs) SetDisableLegacyDbfs(ctx context.Context, v BooleanMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disable_legacy_dbfs"] + o.DisableLegacyDbfs = types.ListValueMust(t, vs) +} + type DisableLegacyFeatures struct { - DisableLegacyFeatures []BooleanMessage `tfsdk:"disable_legacy_features" tf:"object"` + DisableLegacyFeatures types.List `tfsdk:"disable_legacy_features" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -917,13 +3359,78 @@ func (newState *DisableLegacyFeatures) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DisableLegacyFeatures) SyncEffectiveFieldsDuringRead(existingState DisableLegacyFeatures) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DisableLegacyFeatures. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DisableLegacyFeatures) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "disable_legacy_features": reflect.TypeOf(BooleanMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DisableLegacyFeatures +// only implements ToObjectValue() and Type(). +func (o DisableLegacyFeatures) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "disable_legacy_features": o.DisableLegacyFeatures, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DisableLegacyFeatures) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "disable_legacy_features": basetypes.ListType{ + ElemType: BooleanMessage{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetDisableLegacyFeatures returns the value of the DisableLegacyFeatures field in DisableLegacyFeatures as +// a BooleanMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *DisableLegacyFeatures) GetDisableLegacyFeatures(ctx context.Context) (BooleanMessage, bool) { + var e BooleanMessage + if o.DisableLegacyFeatures.IsNull() || o.DisableLegacyFeatures.IsUnknown() { + return e, false + } + var v []BooleanMessage + d := o.DisableLegacyFeatures.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDisableLegacyFeatures sets the value of the DisableLegacyFeatures field in DisableLegacyFeatures. +func (o *DisableLegacyFeatures) SetDisableLegacyFeatures(ctx context.Context, v BooleanMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["disable_legacy_features"] + o.DisableLegacyFeatures = types.ListValueMust(t, vs) +} + // The network policies applying for egress traffic. This message is used by the // UI/REST API. We translate this message to the format expected by the // dataplane in Lakehouse Network Manager (for the format expected by the // dataplane, see networkconfig.textproto). type EgressNetworkPolicy struct { // The access policy enforced for egress traffic to the internet. - InternetAccess []EgressNetworkPolicyInternetAccessPolicy `tfsdk:"internet_access" tf:"optional,object"` + InternetAccess types.List `tfsdk:"internet_access" tf:"optional,object"` } func (newState *EgressNetworkPolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan EgressNetworkPolicy) { @@ -932,13 +3439,74 @@ func (newState *EgressNetworkPolicy) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *EgressNetworkPolicy) SyncEffectiveFieldsDuringRead(existingState EgressNetworkPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EgressNetworkPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EgressNetworkPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "internet_access": reflect.TypeOf(EgressNetworkPolicyInternetAccessPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EgressNetworkPolicy +// only implements ToObjectValue() and Type(). +func (o EgressNetworkPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "internet_access": o.InternetAccess, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EgressNetworkPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "internet_access": basetypes.ListType{ + ElemType: EgressNetworkPolicyInternetAccessPolicy{}.Type(ctx), + }, + }, + } +} + +// GetInternetAccess returns the value of the InternetAccess field in EgressNetworkPolicy as +// a EgressNetworkPolicyInternetAccessPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *EgressNetworkPolicy) GetInternetAccess(ctx context.Context) (EgressNetworkPolicyInternetAccessPolicy, bool) { + var e EgressNetworkPolicyInternetAccessPolicy + if o.InternetAccess.IsNull() || o.InternetAccess.IsUnknown() { + return e, false + } + var v []EgressNetworkPolicyInternetAccessPolicy + d := o.InternetAccess.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetInternetAccess sets the value of the InternetAccess field in EgressNetworkPolicy. +func (o *EgressNetworkPolicy) SetInternetAccess(ctx context.Context, v EgressNetworkPolicyInternetAccessPolicy) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["internet_access"] + o.InternetAccess = types.ListValueMust(t, vs) +} + type EgressNetworkPolicyInternetAccessPolicy struct { - AllowedInternetDestinations []EgressNetworkPolicyInternetAccessPolicyInternetDestination `tfsdk:"allowed_internet_destinations" tf:"optional"` + AllowedInternetDestinations types.List `tfsdk:"allowed_internet_destinations" tf:"optional"` - AllowedStorageDestinations []EgressNetworkPolicyInternetAccessPolicyStorageDestination `tfsdk:"allowed_storage_destinations" tf:"optional"` + AllowedStorageDestinations types.List `tfsdk:"allowed_storage_destinations" tf:"optional"` // Optional. If not specified, assume the policy is enforced for all // workloads. - LogOnlyMode []EgressNetworkPolicyInternetAccessPolicyLogOnlyMode `tfsdk:"log_only_mode" tf:"optional,object"` + LogOnlyMode types.List `tfsdk:"log_only_mode" tf:"optional,object"` // At which level can Databricks and Databricks managed compute access // Internet. FULL_ACCESS: Databricks can access Internet. No blocking rules // will apply. RESTRICTED_ACCESS: Databricks can only access explicitly @@ -954,6 +3522,131 @@ func (newState *EgressNetworkPolicyInternetAccessPolicy) SyncEffectiveFieldsDuri func (newState *EgressNetworkPolicyInternetAccessPolicy) SyncEffectiveFieldsDuringRead(existingState EgressNetworkPolicyInternetAccessPolicy) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EgressNetworkPolicyInternetAccessPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EgressNetworkPolicyInternetAccessPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "allowed_internet_destinations": reflect.TypeOf(EgressNetworkPolicyInternetAccessPolicyInternetDestination{}), + "allowed_storage_destinations": reflect.TypeOf(EgressNetworkPolicyInternetAccessPolicyStorageDestination{}), + "log_only_mode": reflect.TypeOf(EgressNetworkPolicyInternetAccessPolicyLogOnlyMode{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EgressNetworkPolicyInternetAccessPolicy +// only implements ToObjectValue() and Type(). +func (o EgressNetworkPolicyInternetAccessPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allowed_internet_destinations": o.AllowedInternetDestinations, + "allowed_storage_destinations": o.AllowedStorageDestinations, + "log_only_mode": o.LogOnlyMode, + "restriction_mode": o.RestrictionMode, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EgressNetworkPolicyInternetAccessPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allowed_internet_destinations": basetypes.ListType{ + ElemType: EgressNetworkPolicyInternetAccessPolicyInternetDestination{}.Type(ctx), + }, + "allowed_storage_destinations": basetypes.ListType{ + ElemType: EgressNetworkPolicyInternetAccessPolicyStorageDestination{}.Type(ctx), + }, + "log_only_mode": basetypes.ListType{ + ElemType: EgressNetworkPolicyInternetAccessPolicyLogOnlyMode{}.Type(ctx), + }, + "restriction_mode": types.StringType, + }, + } +} + +// GetAllowedInternetDestinations returns the value of the AllowedInternetDestinations field in EgressNetworkPolicyInternetAccessPolicy as +// a slice of EgressNetworkPolicyInternetAccessPolicyInternetDestination values. +// If the field is unknown or null, the boolean return value is false. +func (o *EgressNetworkPolicyInternetAccessPolicy) GetAllowedInternetDestinations(ctx context.Context) ([]EgressNetworkPolicyInternetAccessPolicyInternetDestination, bool) { + if o.AllowedInternetDestinations.IsNull() || o.AllowedInternetDestinations.IsUnknown() { + return nil, false + } + var v []EgressNetworkPolicyInternetAccessPolicyInternetDestination + d := o.AllowedInternetDestinations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllowedInternetDestinations sets the value of the AllowedInternetDestinations field in EgressNetworkPolicyInternetAccessPolicy. +func (o *EgressNetworkPolicyInternetAccessPolicy) SetAllowedInternetDestinations(ctx context.Context, v []EgressNetworkPolicyInternetAccessPolicyInternetDestination) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["allowed_internet_destinations"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllowedInternetDestinations = types.ListValueMust(t, vs) +} + +// GetAllowedStorageDestinations returns the value of the AllowedStorageDestinations field in EgressNetworkPolicyInternetAccessPolicy as +// a slice of EgressNetworkPolicyInternetAccessPolicyStorageDestination values. +// If the field is unknown or null, the boolean return value is false. +func (o *EgressNetworkPolicyInternetAccessPolicy) GetAllowedStorageDestinations(ctx context.Context) ([]EgressNetworkPolicyInternetAccessPolicyStorageDestination, bool) { + if o.AllowedStorageDestinations.IsNull() || o.AllowedStorageDestinations.IsUnknown() { + return nil, false + } + var v []EgressNetworkPolicyInternetAccessPolicyStorageDestination + d := o.AllowedStorageDestinations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllowedStorageDestinations sets the value of the AllowedStorageDestinations field in EgressNetworkPolicyInternetAccessPolicy. +func (o *EgressNetworkPolicyInternetAccessPolicy) SetAllowedStorageDestinations(ctx context.Context, v []EgressNetworkPolicyInternetAccessPolicyStorageDestination) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["allowed_storage_destinations"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllowedStorageDestinations = types.ListValueMust(t, vs) +} + +// GetLogOnlyMode returns the value of the LogOnlyMode field in EgressNetworkPolicyInternetAccessPolicy as +// a EgressNetworkPolicyInternetAccessPolicyLogOnlyMode value. +// If the field is unknown or null, the boolean return value is false. +func (o *EgressNetworkPolicyInternetAccessPolicy) GetLogOnlyMode(ctx context.Context) (EgressNetworkPolicyInternetAccessPolicyLogOnlyMode, bool) { + var e EgressNetworkPolicyInternetAccessPolicyLogOnlyMode + if o.LogOnlyMode.IsNull() || o.LogOnlyMode.IsUnknown() { + return e, false + } + var v []EgressNetworkPolicyInternetAccessPolicyLogOnlyMode + d := o.LogOnlyMode.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLogOnlyMode sets the value of the LogOnlyMode field in EgressNetworkPolicyInternetAccessPolicy. +func (o *EgressNetworkPolicyInternetAccessPolicy) SetLogOnlyMode(ctx context.Context, v EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["log_only_mode"] + o.LogOnlyMode = types.ListValueMust(t, vs) +} + // Users can specify accessible internet destinations when outbound access is // restricted. We only support domain name (FQDN) destinations for the time // being, though going forwards we want to support host names and IP addresses. @@ -966,7 +3659,7 @@ type EgressNetworkPolicyInternetAccessPolicyInternetDestination struct { // filtering (i.e. SNI based filtering, filtering by FQDN). Protocol types.String `tfsdk:"protocol" tf:"optional"` - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *EgressNetworkPolicyInternetAccessPolicyInternetDestination) SyncEffectiveFieldsDuringCreateOrUpdate(plan EgressNetworkPolicyInternetAccessPolicyInternetDestination) { @@ -975,10 +3668,45 @@ func (newState *EgressNetworkPolicyInternetAccessPolicyInternetDestination) Sync func (newState *EgressNetworkPolicyInternetAccessPolicyInternetDestination) SyncEffectiveFieldsDuringRead(existingState EgressNetworkPolicyInternetAccessPolicyInternetDestination) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EgressNetworkPolicyInternetAccessPolicyInternetDestination. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EgressNetworkPolicyInternetAccessPolicyInternetDestination) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EgressNetworkPolicyInternetAccessPolicyInternetDestination +// only implements ToObjectValue() and Type(). +func (o EgressNetworkPolicyInternetAccessPolicyInternetDestination) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination": o.Destination, + "protocol": o.Protocol, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EgressNetworkPolicyInternetAccessPolicyInternetDestination) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination": types.StringType, + "protocol": types.StringType, + "type": types.StringType, + }, + } +} + type EgressNetworkPolicyInternetAccessPolicyLogOnlyMode struct { LogOnlyModeType types.String `tfsdk:"log_only_mode_type" tf:"optional"` - Workloads []types.String `tfsdk:"workloads" tf:"optional"` + Workloads types.List `tfsdk:"workloads" tf:"optional"` } func (newState *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) SyncEffectiveFieldsDuringCreateOrUpdate(plan EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) { @@ -987,9 +3715,72 @@ func (newState *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) SyncEffectiv func (newState *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) SyncEffectiveFieldsDuringRead(existingState EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EgressNetworkPolicyInternetAccessPolicyLogOnlyMode. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "workloads": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EgressNetworkPolicyInternetAccessPolicyLogOnlyMode +// only implements ToObjectValue() and Type(). +func (o EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "log_only_mode_type": o.LogOnlyModeType, + "workloads": o.Workloads, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "log_only_mode_type": types.StringType, + "workloads": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetWorkloads returns the value of the Workloads field in EgressNetworkPolicyInternetAccessPolicyLogOnlyMode as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) GetWorkloads(ctx context.Context) ([]types.String, bool) { + if o.Workloads.IsNull() || o.Workloads.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Workloads.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWorkloads sets the value of the Workloads field in EgressNetworkPolicyInternetAccessPolicyLogOnlyMode. +func (o *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) SetWorkloads(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["workloads"] + t = t.(attr.TypeWithElementType).ElementType() + o.Workloads = types.ListValueMust(t, vs) +} + // Users can specify accessible storage destinations. type EgressNetworkPolicyInternetAccessPolicyStorageDestination struct { - AllowedPaths []types.String `tfsdk:"allowed_paths" tf:"optional"` + AllowedPaths types.List `tfsdk:"allowed_paths" tf:"optional"` AzureContainer types.String `tfsdk:"azure_container" tf:"optional"` @@ -1003,7 +3794,7 @@ type EgressNetworkPolicyInternetAccessPolicyStorageDestination struct { Region types.String `tfsdk:"region" tf:"optional"` - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *EgressNetworkPolicyInternetAccessPolicyStorageDestination) SyncEffectiveFieldsDuringCreateOrUpdate(plan EgressNetworkPolicyInternetAccessPolicyStorageDestination) { @@ -1012,9 +3803,84 @@ func (newState *EgressNetworkPolicyInternetAccessPolicyStorageDestination) SyncE func (newState *EgressNetworkPolicyInternetAccessPolicyStorageDestination) SyncEffectiveFieldsDuringRead(existingState EgressNetworkPolicyInternetAccessPolicyStorageDestination) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EgressNetworkPolicyInternetAccessPolicyStorageDestination. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EgressNetworkPolicyInternetAccessPolicyStorageDestination) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "allowed_paths": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EgressNetworkPolicyInternetAccessPolicyStorageDestination +// only implements ToObjectValue() and Type(). +func (o EgressNetworkPolicyInternetAccessPolicyStorageDestination) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allowed_paths": o.AllowedPaths, + "azure_container": o.AzureContainer, + "azure_dns_zone": o.AzureDnsZone, + "azure_storage_account": o.AzureStorageAccount, + "azure_storage_service": o.AzureStorageService, + "bucket_name": o.BucketName, + "region": o.Region, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EgressNetworkPolicyInternetAccessPolicyStorageDestination) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allowed_paths": basetypes.ListType{ + ElemType: types.StringType, + }, + "azure_container": types.StringType, + "azure_dns_zone": types.StringType, + "azure_storage_account": types.StringType, + "azure_storage_service": types.StringType, + "bucket_name": types.StringType, + "region": types.StringType, + "type": types.StringType, + }, + } +} + +// GetAllowedPaths returns the value of the AllowedPaths field in EgressNetworkPolicyInternetAccessPolicyStorageDestination as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EgressNetworkPolicyInternetAccessPolicyStorageDestination) GetAllowedPaths(ctx context.Context) ([]types.String, bool) { + if o.AllowedPaths.IsNull() || o.AllowedPaths.IsUnknown() { + return nil, false + } + var v []types.String + d := o.AllowedPaths.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllowedPaths sets the value of the AllowedPaths field in EgressNetworkPolicyInternetAccessPolicyStorageDestination. +func (o *EgressNetworkPolicyInternetAccessPolicyStorageDestination) SetAllowedPaths(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["allowed_paths"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllowedPaths = types.ListValueMust(t, vs) +} + type EmailConfig struct { // Email addresses to notify. - Addresses []types.String `tfsdk:"addresses" tf:"optional"` + Addresses types.List `tfsdk:"addresses" tf:"optional"` } func (newState *EmailConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan EmailConfig) { @@ -1023,6 +3889,67 @@ func (newState *EmailConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan EmailC func (newState *EmailConfig) SyncEffectiveFieldsDuringRead(existingState EmailConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EmailConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EmailConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EmailConfig +// only implements ToObjectValue() and Type(). +func (o EmailConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "addresses": o.Addresses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EmailConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAddresses returns the value of the Addresses field in EmailConfig as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EmailConfig) GetAddresses(ctx context.Context) ([]types.String, bool) { + if o.Addresses.IsNull() || o.Addresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Addresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAddresses sets the value of the Addresses field in EmailConfig. +func (o *EmailConfig) SetAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.Addresses = types.ListValueMust(t, vs) +} + type Empty struct { } @@ -1032,6 +3959,33 @@ func (newState *Empty) SyncEffectiveFieldsDuringCreateOrUpdate(plan Empty) { func (newState *Empty) SyncEffectiveFieldsDuringRead(existingState Empty) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Empty. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Empty) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Empty +// only implements ToObjectValue() and Type(). +func (o Empty) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o Empty) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // SHIELD feature: ESM type EnhancedSecurityMonitoring struct { IsEnabled types.Bool `tfsdk:"is_enabled" tf:"optional"` @@ -1043,9 +3997,40 @@ func (newState *EnhancedSecurityMonitoring) SyncEffectiveFieldsDuringCreateOrUpd func (newState *EnhancedSecurityMonitoring) SyncEffectiveFieldsDuringRead(existingState EnhancedSecurityMonitoring) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnhancedSecurityMonitoring. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnhancedSecurityMonitoring) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnhancedSecurityMonitoring +// only implements ToObjectValue() and Type(). +func (o EnhancedSecurityMonitoring) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_enabled": o.IsEnabled, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnhancedSecurityMonitoring) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_enabled": types.BoolType, + }, + } +} + type EnhancedSecurityMonitoringSetting struct { // SHIELD feature: ESM - EnhancedSecurityMonitoringWorkspace []EnhancedSecurityMonitoring `tfsdk:"enhanced_security_monitoring_workspace" tf:"object"` + EnhancedSecurityMonitoringWorkspace types.List `tfsdk:"enhanced_security_monitoring_workspace" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -1068,6 +4053,71 @@ func (newState *EnhancedSecurityMonitoringSetting) SyncEffectiveFieldsDuringCrea func (newState *EnhancedSecurityMonitoringSetting) SyncEffectiveFieldsDuringRead(existingState EnhancedSecurityMonitoringSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnhancedSecurityMonitoringSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnhancedSecurityMonitoringSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "enhanced_security_monitoring_workspace": reflect.TypeOf(EnhancedSecurityMonitoring{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnhancedSecurityMonitoringSetting +// only implements ToObjectValue() and Type(). +func (o EnhancedSecurityMonitoringSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enhanced_security_monitoring_workspace": o.EnhancedSecurityMonitoringWorkspace, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnhancedSecurityMonitoringSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enhanced_security_monitoring_workspace": basetypes.ListType{ + ElemType: EnhancedSecurityMonitoring{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetEnhancedSecurityMonitoringWorkspace returns the value of the EnhancedSecurityMonitoringWorkspace field in EnhancedSecurityMonitoringSetting as +// a EnhancedSecurityMonitoring value. +// If the field is unknown or null, the boolean return value is false. +func (o *EnhancedSecurityMonitoringSetting) GetEnhancedSecurityMonitoringWorkspace(ctx context.Context) (EnhancedSecurityMonitoring, bool) { + var e EnhancedSecurityMonitoring + if o.EnhancedSecurityMonitoringWorkspace.IsNull() || o.EnhancedSecurityMonitoringWorkspace.IsUnknown() { + return e, false + } + var v []EnhancedSecurityMonitoring + d := o.EnhancedSecurityMonitoringWorkspace.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEnhancedSecurityMonitoringWorkspace sets the value of the EnhancedSecurityMonitoringWorkspace field in EnhancedSecurityMonitoringSetting. +func (o *EnhancedSecurityMonitoringSetting) SetEnhancedSecurityMonitoringWorkspace(ctx context.Context, v EnhancedSecurityMonitoring) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["enhanced_security_monitoring_workspace"] + o.EnhancedSecurityMonitoringWorkspace = types.ListValueMust(t, vs) +} + // Account level policy for ESM type EsmEnablementAccount struct { IsEnforced types.Bool `tfsdk:"is_enforced" tf:"optional"` @@ -1079,9 +4129,40 @@ func (newState *EsmEnablementAccount) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *EsmEnablementAccount) SyncEffectiveFieldsDuringRead(existingState EsmEnablementAccount) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EsmEnablementAccount. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EsmEnablementAccount) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EsmEnablementAccount +// only implements ToObjectValue() and Type(). +func (o EsmEnablementAccount) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "is_enforced": o.IsEnforced, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EsmEnablementAccount) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "is_enforced": types.BoolType, + }, + } +} + type EsmEnablementAccountSetting struct { // Account level policy for ESM - EsmEnablementAccount []EsmEnablementAccount `tfsdk:"esm_enablement_account" tf:"object"` + EsmEnablementAccount types.List `tfsdk:"esm_enablement_account" tf:"object"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to // help prevent simultaneous writes of a setting overwriting each other. It @@ -1104,6 +4185,71 @@ func (newState *EsmEnablementAccountSetting) SyncEffectiveFieldsDuringCreateOrUp func (newState *EsmEnablementAccountSetting) SyncEffectiveFieldsDuringRead(existingState EsmEnablementAccountSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EsmEnablementAccountSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EsmEnablementAccountSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "esm_enablement_account": reflect.TypeOf(EsmEnablementAccount{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EsmEnablementAccountSetting +// only implements ToObjectValue() and Type(). +func (o EsmEnablementAccountSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "esm_enablement_account": o.EsmEnablementAccount, + "etag": o.Etag, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EsmEnablementAccountSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "esm_enablement_account": basetypes.ListType{ + ElemType: EsmEnablementAccount{}.Type(ctx), + }, + "etag": types.StringType, + "setting_name": types.StringType, + }, + } +} + +// GetEsmEnablementAccount returns the value of the EsmEnablementAccount field in EsmEnablementAccountSetting as +// a EsmEnablementAccount value. +// If the field is unknown or null, the boolean return value is false. +func (o *EsmEnablementAccountSetting) GetEsmEnablementAccount(ctx context.Context) (EsmEnablementAccount, bool) { + var e EsmEnablementAccount + if o.EsmEnablementAccount.IsNull() || o.EsmEnablementAccount.IsUnknown() { + return e, false + } + var v []EsmEnablementAccount + d := o.EsmEnablementAccount.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEsmEnablementAccount sets the value of the EsmEnablementAccount field in EsmEnablementAccountSetting. +func (o *EsmEnablementAccountSetting) SetEsmEnablementAccount(ctx context.Context, v EsmEnablementAccount) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["esm_enablement_account"] + o.EsmEnablementAccount = types.ListValueMust(t, vs) +} + // The exchange token is the result of the token exchange with the IdP type ExchangeToken struct { // The requested token. @@ -1114,7 +4260,7 @@ type ExchangeToken struct { // User ID of the user that owns this token. OwnerId types.Int64 `tfsdk:"ownerId" tf:"optional"` // The scopes of access granted in the token. - Scopes []types.String `tfsdk:"scopes" tf:"optional"` + Scopes types.List `tfsdk:"scopes" tf:"optional"` // The type of this exchange token TokenType types.String `tfsdk:"tokenType" tf:"optional"` } @@ -1125,14 +4271,83 @@ func (newState *ExchangeToken) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exch func (newState *ExchangeToken) SyncEffectiveFieldsDuringRead(existingState ExchangeToken) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExchangeToken. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExchangeToken) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "scopes": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExchangeToken +// only implements ToObjectValue() and Type(). +func (o ExchangeToken) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential": o.Credential, + "credentialEolTime": o.CredentialEolTime, + "ownerId": o.OwnerId, + "scopes": o.Scopes, + "tokenType": o.TokenType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExchangeToken) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential": types.StringType, + "credentialEolTime": types.Int64Type, + "ownerId": types.Int64Type, + "scopes": basetypes.ListType{ + ElemType: types.StringType, + }, + "tokenType": types.StringType, + }, + } +} + +// GetScopes returns the value of the Scopes field in ExchangeToken as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExchangeToken) GetScopes(ctx context.Context) ([]types.String, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in ExchangeToken. +func (o *ExchangeToken) SetScopes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + // Exchange a token with the IdP type ExchangeTokenRequest struct { // The partition of Credentials store - PartitionId []PartitionId `tfsdk:"partitionId" tf:"object"` + PartitionId types.List `tfsdk:"partitionId" tf:"object"` // Array of scopes for the token request. - Scopes []types.String `tfsdk:"scopes" tf:""` + Scopes types.List `tfsdk:"scopes" tf:""` // A list of token types being requested - TokenType []types.String `tfsdk:"tokenType" tf:""` + TokenType types.List `tfsdk:"tokenType" tf:""` } func (newState *ExchangeTokenRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ExchangeTokenRequest) { @@ -1141,9 +4356,132 @@ func (newState *ExchangeTokenRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ExchangeTokenRequest) SyncEffectiveFieldsDuringRead(existingState ExchangeTokenRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExchangeTokenRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExchangeTokenRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "partitionId": reflect.TypeOf(PartitionId{}), + "scopes": reflect.TypeOf(types.String{}), + "tokenType": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExchangeTokenRequest +// only implements ToObjectValue() and Type(). +func (o ExchangeTokenRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "partitionId": o.PartitionId, + "scopes": o.Scopes, + "tokenType": o.TokenType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExchangeTokenRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "partitionId": basetypes.ListType{ + ElemType: PartitionId{}.Type(ctx), + }, + "scopes": basetypes.ListType{ + ElemType: types.StringType, + }, + "tokenType": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPartitionId returns the value of the PartitionId field in ExchangeTokenRequest as +// a PartitionId value. +// If the field is unknown or null, the boolean return value is false. +func (o *ExchangeTokenRequest) GetPartitionId(ctx context.Context) (PartitionId, bool) { + var e PartitionId + if o.PartitionId.IsNull() || o.PartitionId.IsUnknown() { + return e, false + } + var v []PartitionId + d := o.PartitionId.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPartitionId sets the value of the PartitionId field in ExchangeTokenRequest. +func (o *ExchangeTokenRequest) SetPartitionId(ctx context.Context, v PartitionId) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["partitionId"] + o.PartitionId = types.ListValueMust(t, vs) +} + +// GetScopes returns the value of the Scopes field in ExchangeTokenRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExchangeTokenRequest) GetScopes(ctx context.Context) ([]types.String, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in ExchangeTokenRequest. +func (o *ExchangeTokenRequest) SetScopes(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + +// GetTokenType returns the value of the TokenType field in ExchangeTokenRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExchangeTokenRequest) GetTokenType(ctx context.Context) ([]types.String, bool) { + if o.TokenType.IsNull() || o.TokenType.IsUnknown() { + return nil, false + } + var v []types.String + d := o.TokenType.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTokenType sets the value of the TokenType field in ExchangeTokenRequest. +func (o *ExchangeTokenRequest) SetTokenType(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tokenType"] + t = t.(attr.TypeWithElementType).ElementType() + o.TokenType = types.ListValueMust(t, vs) +} + // Exhanged tokens were successfully returned. type ExchangeTokenResponse struct { - Values []ExchangeToken `tfsdk:"values" tf:"optional"` + Values types.List `tfsdk:"values" tf:"optional"` } func (newState *ExchangeTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ExchangeTokenResponse) { @@ -1152,10 +4490,71 @@ func (newState *ExchangeTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ExchangeTokenResponse) SyncEffectiveFieldsDuringRead(existingState ExchangeTokenResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExchangeTokenResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExchangeTokenResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "values": reflect.TypeOf(ExchangeToken{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExchangeTokenResponse +// only implements ToObjectValue() and Type(). +func (o ExchangeTokenResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "values": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExchangeTokenResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "values": basetypes.ListType{ + ElemType: ExchangeToken{}.Type(ctx), + }, + }, + } +} + +// GetValues returns the value of the Values field in ExchangeTokenResponse as +// a slice of ExchangeToken values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExchangeTokenResponse) GetValues(ctx context.Context) ([]ExchangeToken, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []ExchangeToken + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in ExchangeTokenResponse. +func (o *ExchangeTokenResponse) SetValues(ctx context.Context, v []ExchangeToken) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["values"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + // An IP access list was successfully returned. type FetchIpAccessListResponse struct { // Definition of an IP Access list - IpAccessList []IpAccessListInfo `tfsdk:"ip_access_list" tf:"optional,object"` + IpAccessList types.List `tfsdk:"ip_access_list" tf:"optional,object"` } func (newState *FetchIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan FetchIpAccessListResponse) { @@ -1164,6 +4563,67 @@ func (newState *FetchIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *FetchIpAccessListResponse) SyncEffectiveFieldsDuringRead(existingState FetchIpAccessListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FetchIpAccessListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FetchIpAccessListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_list": reflect.TypeOf(IpAccessListInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FetchIpAccessListResponse +// only implements ToObjectValue() and Type(). +func (o FetchIpAccessListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list": o.IpAccessList, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FetchIpAccessListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list": basetypes.ListType{ + ElemType: IpAccessListInfo{}.Type(ctx), + }, + }, + } +} + +// GetIpAccessList returns the value of the IpAccessList field in FetchIpAccessListResponse as +// a IpAccessListInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *FetchIpAccessListResponse) GetIpAccessList(ctx context.Context) (IpAccessListInfo, bool) { + var e IpAccessListInfo + if o.IpAccessList.IsNull() || o.IpAccessList.IsUnknown() { + return e, false + } + var v []IpAccessListInfo + d := o.IpAccessList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIpAccessList sets the value of the IpAccessList field in FetchIpAccessListResponse. +func (o *FetchIpAccessListResponse) SetIpAccessList(ctx context.Context, v IpAccessListInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_list"] + o.IpAccessList = types.ListValueMust(t, vs) +} + type GenericWebhookConfig struct { // [Input-Only][Optional] Password for webhook. Password types.String `tfsdk:"password" tf:"optional"` @@ -1185,6 +4645,47 @@ func (newState *GenericWebhookConfig) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GenericWebhookConfig) SyncEffectiveFieldsDuringRead(existingState GenericWebhookConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GenericWebhookConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GenericWebhookConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GenericWebhookConfig +// only implements ToObjectValue() and Type(). +func (o GenericWebhookConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "password": o.Password, + "password_set": o.PasswordSet, + "url": o.Url, + "url_set": o.UrlSet, + "username": o.Username, + "username_set": o.UsernameSet, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GenericWebhookConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "password": types.StringType, + "password_set": types.BoolType, + "url": types.StringType, + "url_set": types.BoolType, + "username": types.StringType, + "username_set": types.BoolType, + }, + } +} + // Get IP access list type GetAccountIpAccessListRequest struct { // The ID for the corresponding IP access list @@ -1197,6 +4698,37 @@ func (newState *GetAccountIpAccessListRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetAccountIpAccessListRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountIpAccessListRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountIpAccessListRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountIpAccessListRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountIpAccessListRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountIpAccessListRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list_id": o.IpAccessListId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountIpAccessListRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list_id": types.StringType, + }, + } +} + // Retrieve the AI/BI dashboard embedding access policy type GetAibiDashboardEmbeddingAccessPolicySettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1215,6 +4747,37 @@ func (newState *GetAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffecti func (newState *GetAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffectiveFieldsDuringRead(existingState GetAibiDashboardEmbeddingAccessPolicySettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAibiDashboardEmbeddingAccessPolicySettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAibiDashboardEmbeddingAccessPolicySettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAibiDashboardEmbeddingAccessPolicySettingRequest +// only implements ToObjectValue() and Type(). +func (o GetAibiDashboardEmbeddingAccessPolicySettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAibiDashboardEmbeddingAccessPolicySettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Retrieve the list of domains approved to host embedded AI/BI dashboards type GetAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1233,6 +4796,37 @@ func (newState *GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncEffe func (newState *GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAibiDashboardEmbeddingApprovedDomainsSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAibiDashboardEmbeddingApprovedDomainsSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the automatic cluster update setting type GetAutomaticClusterUpdateSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1251,6 +4845,37 @@ func (newState *GetAutomaticClusterUpdateSettingRequest) SyncEffectiveFieldsDuri func (newState *GetAutomaticClusterUpdateSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetAutomaticClusterUpdateSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAutomaticClusterUpdateSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAutomaticClusterUpdateSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAutomaticClusterUpdateSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetAutomaticClusterUpdateSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAutomaticClusterUpdateSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the compliance security profile setting type GetComplianceSecurityProfileSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1269,6 +4894,37 @@ func (newState *GetComplianceSecurityProfileSettingRequest) SyncEffectiveFieldsD func (newState *GetComplianceSecurityProfileSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetComplianceSecurityProfileSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetComplianceSecurityProfileSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetComplianceSecurityProfileSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetComplianceSecurityProfileSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetComplianceSecurityProfileSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetComplianceSecurityProfileSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the compliance security profile setting for new workspaces type GetCspEnablementAccountSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1287,6 +4943,37 @@ func (newState *GetCspEnablementAccountSettingRequest) SyncEffectiveFieldsDuring func (newState *GetCspEnablementAccountSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetCspEnablementAccountSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCspEnablementAccountSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCspEnablementAccountSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCspEnablementAccountSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetCspEnablementAccountSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCspEnablementAccountSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the default namespace setting type GetDefaultNamespaceSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1305,6 +4992,37 @@ func (newState *GetDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringCrea func (newState *GetDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetDefaultNamespaceSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDefaultNamespaceSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDefaultNamespaceSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDefaultNamespaceSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetDefaultNamespaceSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDefaultNamespaceSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Retrieve Legacy Access Disablement Status type GetDisableLegacyAccessRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1323,6 +5041,37 @@ func (newState *GetDisableLegacyAccessRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetDisableLegacyAccessRequest) SyncEffectiveFieldsDuringRead(existingState GetDisableLegacyAccessRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDisableLegacyAccessRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDisableLegacyAccessRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDisableLegacyAccessRequest +// only implements ToObjectValue() and Type(). +func (o GetDisableLegacyAccessRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDisableLegacyAccessRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the disable legacy DBFS setting type GetDisableLegacyDbfsRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1341,6 +5090,37 @@ func (newState *GetDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringRead(existingState GetDisableLegacyDbfsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDisableLegacyDbfsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDisableLegacyDbfsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDisableLegacyDbfsRequest +// only implements ToObjectValue() and Type(). +func (o GetDisableLegacyDbfsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDisableLegacyDbfsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the disable legacy features setting type GetDisableLegacyFeaturesRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1353,10 +5133,41 @@ type GetDisableLegacyFeaturesRequest struct { Etag types.String `tfsdk:"-"` } -func (newState *GetDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetDisableLegacyFeaturesRequest) { +func (newState *GetDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetDisableLegacyFeaturesRequest) { +} + +func (newState *GetDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringRead(existingState GetDisableLegacyFeaturesRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDisableLegacyFeaturesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDisableLegacyFeaturesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} } -func (newState *GetDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringRead(existingState GetDisableLegacyFeaturesRequest) { +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDisableLegacyFeaturesRequest +// only implements ToObjectValue() and Type(). +func (o GetDisableLegacyFeaturesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDisableLegacyFeaturesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } } // Get the enhanced security monitoring setting @@ -1377,6 +5188,37 @@ func (newState *GetEnhancedSecurityMonitoringSettingRequest) SyncEffectiveFields func (newState *GetEnhancedSecurityMonitoringSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetEnhancedSecurityMonitoringSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEnhancedSecurityMonitoringSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEnhancedSecurityMonitoringSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEnhancedSecurityMonitoringSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetEnhancedSecurityMonitoringSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEnhancedSecurityMonitoringSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get the enhanced security monitoring setting for new workspaces type GetEsmEnablementAccountSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1395,6 +5237,37 @@ func (newState *GetEsmEnablementAccountSettingRequest) SyncEffectiveFieldsDuring func (newState *GetEsmEnablementAccountSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetEsmEnablementAccountSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEsmEnablementAccountSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEsmEnablementAccountSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEsmEnablementAccountSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetEsmEnablementAccountSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEsmEnablementAccountSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get access list type GetIpAccessListRequest struct { // The ID for the corresponding IP access list @@ -1407,9 +5280,40 @@ func (newState *GetIpAccessListRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetIpAccessListRequest) SyncEffectiveFieldsDuringRead(existingState GetIpAccessListRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetIpAccessListRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetIpAccessListRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetIpAccessListRequest +// only implements ToObjectValue() and Type(). +func (o GetIpAccessListRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list_id": o.IpAccessListId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetIpAccessListRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list_id": types.StringType, + }, + } +} + type GetIpAccessListResponse struct { // Definition of an IP Access list - IpAccessList []IpAccessListInfo `tfsdk:"ip_access_list" tf:"optional,object"` + IpAccessList types.List `tfsdk:"ip_access_list" tf:"optional,object"` } func (newState *GetIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetIpAccessListResponse) { @@ -1418,9 +5322,70 @@ func (newState *GetIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GetIpAccessListResponse) SyncEffectiveFieldsDuringRead(existingState GetIpAccessListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetIpAccessListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetIpAccessListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_list": reflect.TypeOf(IpAccessListInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetIpAccessListResponse +// only implements ToObjectValue() and Type(). +func (o GetIpAccessListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_list": o.IpAccessList, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetIpAccessListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_list": basetypes.ListType{ + ElemType: IpAccessListInfo{}.Type(ctx), + }, + }, + } +} + +// GetIpAccessList returns the value of the IpAccessList field in GetIpAccessListResponse as +// a IpAccessListInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetIpAccessListResponse) GetIpAccessList(ctx context.Context) (IpAccessListInfo, bool) { + var e IpAccessListInfo + if o.IpAccessList.IsNull() || o.IpAccessList.IsUnknown() { + return e, false + } + var v []IpAccessListInfo + d := o.IpAccessList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIpAccessList sets the value of the IpAccessList field in GetIpAccessListResponse. +func (o *GetIpAccessListResponse) SetIpAccessList(ctx context.Context, v IpAccessListInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_list"] + o.IpAccessList = types.ListValueMust(t, vs) +} + // IP access lists were successfully returned. type GetIpAccessListsResponse struct { - IpAccessLists []IpAccessListInfo `tfsdk:"ip_access_lists" tf:"optional"` + IpAccessLists types.List `tfsdk:"ip_access_lists" tf:"optional"` } func (newState *GetIpAccessListsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetIpAccessListsResponse) { @@ -1429,6 +5394,67 @@ func (newState *GetIpAccessListsResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *GetIpAccessListsResponse) SyncEffectiveFieldsDuringRead(existingState GetIpAccessListsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetIpAccessListsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetIpAccessListsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_lists": reflect.TypeOf(IpAccessListInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetIpAccessListsResponse +// only implements ToObjectValue() and Type(). +func (o GetIpAccessListsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_lists": o.IpAccessLists, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetIpAccessListsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_lists": basetypes.ListType{ + ElemType: IpAccessListInfo{}.Type(ctx), + }, + }, + } +} + +// GetIpAccessLists returns the value of the IpAccessLists field in GetIpAccessListsResponse as +// a slice of IpAccessListInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetIpAccessListsResponse) GetIpAccessLists(ctx context.Context) ([]IpAccessListInfo, bool) { + if o.IpAccessLists.IsNull() || o.IpAccessLists.IsUnknown() { + return nil, false + } + var v []IpAccessListInfo + d := o.IpAccessLists.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIpAccessLists sets the value of the IpAccessLists field in GetIpAccessListsResponse. +func (o *GetIpAccessListsResponse) SetIpAccessLists(ctx context.Context, v []IpAccessListInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_lists"] + t = t.(attr.TypeWithElementType).ElementType() + o.IpAccessLists = types.ListValueMust(t, vs) +} + // Get a network connectivity configuration type GetNetworkConnectivityConfigurationRequest struct { // Your Network Connectvity Configuration ID. @@ -1441,6 +5467,37 @@ func (newState *GetNetworkConnectivityConfigurationRequest) SyncEffectiveFieldsD func (newState *GetNetworkConnectivityConfigurationRequest) SyncEffectiveFieldsDuringRead(existingState GetNetworkConnectivityConfigurationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetNetworkConnectivityConfigurationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetNetworkConnectivityConfigurationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetNetworkConnectivityConfigurationRequest +// only implements ToObjectValue() and Type(). +func (o GetNetworkConnectivityConfigurationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetNetworkConnectivityConfigurationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_connectivity_config_id": types.StringType, + }, + } +} + // Get a notification destination type GetNotificationDestinationRequest struct { Id types.String `tfsdk:"-"` @@ -1452,6 +5509,37 @@ func (newState *GetNotificationDestinationRequest) SyncEffectiveFieldsDuringCrea func (newState *GetNotificationDestinationRequest) SyncEffectiveFieldsDuringRead(existingState GetNotificationDestinationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetNotificationDestinationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetNotificationDestinationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetNotificationDestinationRequest +// only implements ToObjectValue() and Type(). +func (o GetNotificationDestinationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetNotificationDestinationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Get Personal Compute setting type GetPersonalComputeSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1470,6 +5558,37 @@ func (newState *GetPersonalComputeSettingRequest) SyncEffectiveFieldsDuringCreat func (newState *GetPersonalComputeSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetPersonalComputeSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPersonalComputeSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPersonalComputeSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPersonalComputeSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetPersonalComputeSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPersonalComputeSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Get a private endpoint rule type GetPrivateEndpointRuleRequest struct { // Your Network Connectvity Configuration ID. @@ -1484,6 +5603,39 @@ func (newState *GetPrivateEndpointRuleRequest) SyncEffectiveFieldsDuringCreateOr func (newState *GetPrivateEndpointRuleRequest) SyncEffectiveFieldsDuringRead(existingState GetPrivateEndpointRuleRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetPrivateEndpointRuleRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetPrivateEndpointRuleRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetPrivateEndpointRuleRequest +// only implements ToObjectValue() and Type(). +func (o GetPrivateEndpointRuleRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "private_endpoint_rule_id": o.PrivateEndpointRuleId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetPrivateEndpointRuleRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_connectivity_config_id": types.StringType, + "private_endpoint_rule_id": types.StringType, + }, + } +} + // Get the restrict workspace admins setting type GetRestrictWorkspaceAdminsSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1502,6 +5654,37 @@ func (newState *GetRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFieldsDur func (newState *GetRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFieldsDuringRead(existingState GetRestrictWorkspaceAdminsSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRestrictWorkspaceAdminsSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRestrictWorkspaceAdminsSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRestrictWorkspaceAdminsSettingRequest +// only implements ToObjectValue() and Type(). +func (o GetRestrictWorkspaceAdminsSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRestrictWorkspaceAdminsSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + }, + } +} + // Check configuration status type GetStatusRequest struct { Keys types.String `tfsdk:"-"` @@ -1513,6 +5696,37 @@ func (newState *GetStatusRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetStatusRequest) SyncEffectiveFieldsDuringRead(existingState GetStatusRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStatusRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStatusRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStatusRequest +// only implements ToObjectValue() and Type(). +func (o GetStatusRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "keys": o.Keys, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStatusRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "keys": types.StringType, + }, + } +} + // Get token info type GetTokenManagementRequest struct { // The ID of the token to get. @@ -1525,9 +5739,40 @@ func (newState *GetTokenManagementRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GetTokenManagementRequest) SyncEffectiveFieldsDuringRead(existingState GetTokenManagementRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetTokenManagementRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetTokenManagementRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetTokenManagementRequest +// only implements ToObjectValue() and Type(). +func (o GetTokenManagementRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_id": o.TokenId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetTokenManagementRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_id": types.StringType, + }, + } +} + type GetTokenPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []TokenPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetTokenPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetTokenPermissionLevelsResponse) { @@ -1536,9 +5781,70 @@ func (newState *GetTokenPermissionLevelsResponse) SyncEffectiveFieldsDuringCreat func (newState *GetTokenPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetTokenPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetTokenPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetTokenPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(TokenPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetTokenPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetTokenPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetTokenPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: TokenPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetTokenPermissionLevelsResponse as +// a slice of TokenPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetTokenPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]TokenPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []TokenPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetTokenPermissionLevelsResponse. +func (o *GetTokenPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []TokenPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Token with specified Token ID was successfully returned. type GetTokenResponse struct { - TokenInfo []TokenInfo `tfsdk:"token_info" tf:"optional,object"` + TokenInfo types.List `tfsdk:"token_info" tf:"optional,object"` } func (newState *GetTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetTokenResponse) { @@ -1547,6 +5853,67 @@ func (newState *GetTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetTokenResponse) SyncEffectiveFieldsDuringRead(existingState GetTokenResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetTokenResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetTokenResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_info": reflect.TypeOf(TokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetTokenResponse +// only implements ToObjectValue() and Type(). +func (o GetTokenResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_info": o.TokenInfo, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetTokenResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_info": basetypes.ListType{ + ElemType: TokenInfo{}.Type(ctx), + }, + }, + } +} + +// GetTokenInfo returns the value of the TokenInfo field in GetTokenResponse as +// a TokenInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetTokenResponse) GetTokenInfo(ctx context.Context) (TokenInfo, bool) { + var e TokenInfo + if o.TokenInfo.IsNull() || o.TokenInfo.IsUnknown() { + return e, false + } + var v []TokenInfo + d := o.TokenInfo.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTokenInfo sets the value of the TokenInfo field in GetTokenResponse. +func (o *GetTokenResponse) SetTokenInfo(ctx context.Context, v TokenInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_info"] + o.TokenInfo = types.ListValueMust(t, vs) +} + // Definition of an IP Access list type IpAccessListInfo struct { // Total number of IP or CIDR values. @@ -1558,7 +5925,7 @@ type IpAccessListInfo struct { // Specifies whether this IP access list is enabled. Enabled types.Bool `tfsdk:"enabled" tf:"optional"` - IpAddresses []types.String `tfsdk:"ip_addresses" tf:"optional"` + IpAddresses types.List `tfsdk:"ip_addresses" tf:"optional"` // Label for the IP access list. This **cannot** be empty. Label types.String `tfsdk:"label" tf:"optional"` // Universally unique identifier (UUID) of the IP access list. @@ -1582,9 +5949,88 @@ func (newState *IpAccessListInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan I func (newState *IpAccessListInfo) SyncEffectiveFieldsDuringRead(existingState IpAccessListInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in IpAccessListInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a IpAccessListInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, IpAccessListInfo +// only implements ToObjectValue() and Type(). +func (o IpAccessListInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "address_count": o.AddressCount, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "enabled": o.Enabled, + "ip_addresses": o.IpAddresses, + "label": o.Label, + "list_id": o.ListId, + "list_type": o.ListType, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o IpAccessListInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "address_count": types.Int64Type, + "created_at": types.Int64Type, + "created_by": types.Int64Type, + "enabled": types.BoolType, + "ip_addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + "label": types.StringType, + "list_id": types.StringType, + "list_type": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.Int64Type, + }, + } +} + +// GetIpAddresses returns the value of the IpAddresses field in IpAccessListInfo as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *IpAccessListInfo) GetIpAddresses(ctx context.Context) ([]types.String, bool) { + if o.IpAddresses.IsNull() || o.IpAddresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.IpAddresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIpAddresses sets the value of the IpAddresses field in IpAccessListInfo. +func (o *IpAccessListInfo) SetIpAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.IpAddresses = types.ListValueMust(t, vs) +} + // IP access lists were successfully returned. type ListIpAccessListResponse struct { - IpAccessLists []IpAccessListInfo `tfsdk:"ip_access_lists" tf:"optional"` + IpAccessLists types.List `tfsdk:"ip_access_lists" tf:"optional"` } func (newState *ListIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListIpAccessListResponse) { @@ -1593,8 +6039,69 @@ func (newState *ListIpAccessListResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListIpAccessListResponse) SyncEffectiveFieldsDuringRead(existingState ListIpAccessListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListIpAccessListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListIpAccessListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_lists": reflect.TypeOf(IpAccessListInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListIpAccessListResponse +// only implements ToObjectValue() and Type(). +func (o ListIpAccessListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "ip_access_lists": o.IpAccessLists, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListIpAccessListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "ip_access_lists": basetypes.ListType{ + ElemType: IpAccessListInfo{}.Type(ctx), + }, + }, + } +} + +// GetIpAccessLists returns the value of the IpAccessLists field in ListIpAccessListResponse as +// a slice of IpAccessListInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListIpAccessListResponse) GetIpAccessLists(ctx context.Context) ([]IpAccessListInfo, bool) { + if o.IpAccessLists.IsNull() || o.IpAccessLists.IsUnknown() { + return nil, false + } + var v []IpAccessListInfo + d := o.IpAccessLists.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIpAccessLists sets the value of the IpAccessLists field in ListIpAccessListResponse. +func (o *ListIpAccessListResponse) SetIpAccessLists(ctx context.Context, v []IpAccessListInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_lists"] + t = t.(attr.TypeWithElementType).ElementType() + o.IpAccessLists = types.ListValueMust(t, vs) +} + type ListNccAzurePrivateEndpointRulesResponse struct { - Items []NccAzurePrivateEndpointRule `tfsdk:"items" tf:"optional"` + Items types.List `tfsdk:"items" tf:"optional"` // A token that can be used to get the next page of results. If null, there // are no more results to show. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -1606,6 +6113,69 @@ func (newState *ListNccAzurePrivateEndpointRulesResponse) SyncEffectiveFieldsDur func (newState *ListNccAzurePrivateEndpointRulesResponse) SyncEffectiveFieldsDuringRead(existingState ListNccAzurePrivateEndpointRulesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNccAzurePrivateEndpointRulesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNccAzurePrivateEndpointRulesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "items": reflect.TypeOf(NccAzurePrivateEndpointRule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNccAzurePrivateEndpointRulesResponse +// only implements ToObjectValue() and Type(). +func (o ListNccAzurePrivateEndpointRulesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "items": o.Items, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNccAzurePrivateEndpointRulesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "items": basetypes.ListType{ + ElemType: NccAzurePrivateEndpointRule{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetItems returns the value of the Items field in ListNccAzurePrivateEndpointRulesResponse as +// a slice of NccAzurePrivateEndpointRule values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListNccAzurePrivateEndpointRulesResponse) GetItems(ctx context.Context) ([]NccAzurePrivateEndpointRule, bool) { + if o.Items.IsNull() || o.Items.IsUnknown() { + return nil, false + } + var v []NccAzurePrivateEndpointRule + d := o.Items.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetItems sets the value of the Items field in ListNccAzurePrivateEndpointRulesResponse. +func (o *ListNccAzurePrivateEndpointRulesResponse) SetItems(ctx context.Context, v []NccAzurePrivateEndpointRule) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["items"] + t = t.(attr.TypeWithElementType).ElementType() + o.Items = types.ListValueMust(t, vs) +} + // List network connectivity configurations type ListNetworkConnectivityConfigurationsRequest struct { // Pagination token to go to next page based on previous query. @@ -1618,8 +6188,39 @@ func (newState *ListNetworkConnectivityConfigurationsRequest) SyncEffectiveField func (newState *ListNetworkConnectivityConfigurationsRequest) SyncEffectiveFieldsDuringRead(existingState ListNetworkConnectivityConfigurationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNetworkConnectivityConfigurationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNetworkConnectivityConfigurationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNetworkConnectivityConfigurationsRequest +// only implements ToObjectValue() and Type(). +func (o ListNetworkConnectivityConfigurationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNetworkConnectivityConfigurationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_token": types.StringType, + }, + } +} + type ListNetworkConnectivityConfigurationsResponse struct { - Items []NetworkConnectivityConfiguration `tfsdk:"items" tf:"optional"` + Items types.List `tfsdk:"items" tf:"optional"` // A token that can be used to get the next page of results. If null, there // are no more results to show. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -1631,6 +6232,69 @@ func (newState *ListNetworkConnectivityConfigurationsResponse) SyncEffectiveFiel func (newState *ListNetworkConnectivityConfigurationsResponse) SyncEffectiveFieldsDuringRead(existingState ListNetworkConnectivityConfigurationsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNetworkConnectivityConfigurationsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNetworkConnectivityConfigurationsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "items": reflect.TypeOf(NetworkConnectivityConfiguration{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNetworkConnectivityConfigurationsResponse +// only implements ToObjectValue() and Type(). +func (o ListNetworkConnectivityConfigurationsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "items": o.Items, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNetworkConnectivityConfigurationsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "items": basetypes.ListType{ + ElemType: NetworkConnectivityConfiguration{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetItems returns the value of the Items field in ListNetworkConnectivityConfigurationsResponse as +// a slice of NetworkConnectivityConfiguration values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListNetworkConnectivityConfigurationsResponse) GetItems(ctx context.Context) ([]NetworkConnectivityConfiguration, bool) { + if o.Items.IsNull() || o.Items.IsUnknown() { + return nil, false + } + var v []NetworkConnectivityConfiguration + d := o.Items.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetItems sets the value of the Items field in ListNetworkConnectivityConfigurationsResponse. +func (o *ListNetworkConnectivityConfigurationsResponse) SetItems(ctx context.Context, v []NetworkConnectivityConfiguration) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["items"] + t = t.(attr.TypeWithElementType).ElementType() + o.Items = types.ListValueMust(t, vs) +} + // List notification destinations type ListNotificationDestinationsRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -1644,11 +6308,44 @@ func (newState *ListNotificationDestinationsRequest) SyncEffectiveFieldsDuringCr func (newState *ListNotificationDestinationsRequest) SyncEffectiveFieldsDuringRead(existingState ListNotificationDestinationsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNotificationDestinationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNotificationDestinationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNotificationDestinationsRequest +// only implements ToObjectValue() and Type(). +func (o ListNotificationDestinationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNotificationDestinationsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListNotificationDestinationsResponse struct { // Page token for next of results. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Results []ListNotificationDestinationsResult `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ListNotificationDestinationsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListNotificationDestinationsResponse) { @@ -1657,6 +6354,69 @@ func (newState *ListNotificationDestinationsResponse) SyncEffectiveFieldsDuringC func (newState *ListNotificationDestinationsResponse) SyncEffectiveFieldsDuringRead(existingState ListNotificationDestinationsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNotificationDestinationsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNotificationDestinationsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(ListNotificationDestinationsResult{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNotificationDestinationsResponse +// only implements ToObjectValue() and Type(). +func (o ListNotificationDestinationsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNotificationDestinationsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "results": basetypes.ListType{ + ElemType: ListNotificationDestinationsResult{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ListNotificationDestinationsResponse as +// a slice of ListNotificationDestinationsResult values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListNotificationDestinationsResponse) GetResults(ctx context.Context) ([]ListNotificationDestinationsResult, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []ListNotificationDestinationsResult + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ListNotificationDestinationsResponse. +func (o *ListNotificationDestinationsResponse) SetResults(ctx context.Context, v []ListNotificationDestinationsResult) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + type ListNotificationDestinationsResult struct { // [Output-only] The type of the notification destination. The type can not // be changed once set. @@ -1673,6 +6433,41 @@ func (newState *ListNotificationDestinationsResult) SyncEffectiveFieldsDuringCre func (newState *ListNotificationDestinationsResult) SyncEffectiveFieldsDuringRead(existingState ListNotificationDestinationsResult) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListNotificationDestinationsResult. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListNotificationDestinationsResult) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListNotificationDestinationsResult +// only implements ToObjectValue() and Type(). +func (o ListNotificationDestinationsResult) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "destination_type": o.DestinationType, + "display_name": o.DisplayName, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListNotificationDestinationsResult) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "destination_type": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + }, + } +} + // List private endpoint rules type ListPrivateEndpointRulesRequest struct { // Your Network Connectvity Configuration ID. @@ -1687,9 +6482,42 @@ func (newState *ListPrivateEndpointRulesRequest) SyncEffectiveFieldsDuringCreate func (newState *ListPrivateEndpointRulesRequest) SyncEffectiveFieldsDuringRead(existingState ListPrivateEndpointRulesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPrivateEndpointRulesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPrivateEndpointRulesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPrivateEndpointRulesRequest +// only implements ToObjectValue() and Type(). +func (o ListPrivateEndpointRulesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPrivateEndpointRulesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "network_connectivity_config_id": types.StringType, + "page_token": types.StringType, + }, + } +} + type ListPublicTokensResponse struct { // The information for each token. - TokenInfos []PublicTokenInfo `tfsdk:"token_infos" tf:"optional"` + TokenInfos types.List `tfsdk:"token_infos" tf:"optional"` } func (newState *ListPublicTokensResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListPublicTokensResponse) { @@ -1698,6 +6526,67 @@ func (newState *ListPublicTokensResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListPublicTokensResponse) SyncEffectiveFieldsDuringRead(existingState ListPublicTokensResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListPublicTokensResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListPublicTokensResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_infos": reflect.TypeOf(PublicTokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListPublicTokensResponse +// only implements ToObjectValue() and Type(). +func (o ListPublicTokensResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_infos": o.TokenInfos, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListPublicTokensResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_infos": basetypes.ListType{ + ElemType: PublicTokenInfo{}.Type(ctx), + }, + }, + } +} + +// GetTokenInfos returns the value of the TokenInfos field in ListPublicTokensResponse as +// a slice of PublicTokenInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListPublicTokensResponse) GetTokenInfos(ctx context.Context) ([]PublicTokenInfo, bool) { + if o.TokenInfos.IsNull() || o.TokenInfos.IsUnknown() { + return nil, false + } + var v []PublicTokenInfo + d := o.TokenInfos.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTokenInfos sets the value of the TokenInfos field in ListPublicTokensResponse. +func (o *ListPublicTokensResponse) SetTokenInfos(ctx context.Context, v []PublicTokenInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_infos"] + t = t.(attr.TypeWithElementType).ElementType() + o.TokenInfos = types.ListValueMust(t, vs) +} + // List all tokens type ListTokenManagementRequest struct { // User ID of the user that created the token. @@ -1712,10 +6601,43 @@ func (newState *ListTokenManagementRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListTokenManagementRequest) SyncEffectiveFieldsDuringRead(existingState ListTokenManagementRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTokenManagementRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTokenManagementRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTokenManagementRequest +// only implements ToObjectValue() and Type(). +func (o ListTokenManagementRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_by_id": o.CreatedById, + "created_by_username": o.CreatedByUsername, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTokenManagementRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_by_id": types.Int64Type, + "created_by_username": types.StringType, + }, + } +} + // Tokens were successfully returned. type ListTokensResponse struct { // Token metadata of each user-created token in the workspace - TokenInfos []TokenInfo `tfsdk:"token_infos" tf:"optional"` + TokenInfos types.List `tfsdk:"token_infos" tf:"optional"` } func (newState *ListTokensResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListTokensResponse) { @@ -1724,6 +6646,67 @@ func (newState *ListTokensResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListTokensResponse) SyncEffectiveFieldsDuringRead(existingState ListTokensResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListTokensResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListTokensResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "token_infos": reflect.TypeOf(TokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListTokensResponse +// only implements ToObjectValue() and Type(). +func (o ListTokensResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_infos": o.TokenInfos, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListTokensResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_infos": basetypes.ListType{ + ElemType: TokenInfo{}.Type(ctx), + }, + }, + } +} + +// GetTokenInfos returns the value of the TokenInfos field in ListTokensResponse as +// a slice of TokenInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListTokensResponse) GetTokenInfos(ctx context.Context) ([]TokenInfo, bool) { + if o.TokenInfos.IsNull() || o.TokenInfos.IsUnknown() { + return nil, false + } + var v []TokenInfo + d := o.TokenInfos.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTokenInfos sets the value of the TokenInfos field in ListTokensResponse. +func (o *ListTokensResponse) SetTokenInfos(ctx context.Context, v []TokenInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["token_infos"] + t = t.(attr.TypeWithElementType).ElementType() + o.TokenInfos = types.ListValueMust(t, vs) +} + type MicrosoftTeamsConfig struct { // [Input-Only] URL for Microsoft Teams. Url types.String `tfsdk:"url" tf:"optional"` @@ -1737,12 +6720,45 @@ func (newState *MicrosoftTeamsConfig) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *MicrosoftTeamsConfig) SyncEffectiveFieldsDuringRead(existingState MicrosoftTeamsConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MicrosoftTeamsConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MicrosoftTeamsConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MicrosoftTeamsConfig +// only implements ToObjectValue() and Type(). +func (o MicrosoftTeamsConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "url": o.Url, + "url_set": o.UrlSet, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MicrosoftTeamsConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "url": types.StringType, + "url_set": types.BoolType, + }, + } +} + // The stable AWS IP CIDR blocks. You can use these to configure the firewall of // your resources to allow traffic from your Databricks workspace. type NccAwsStableIpRule struct { // The list of stable IP CIDR blocks from which Databricks network traffic // originates when accessing your resources. - CidrBlocks []types.String `tfsdk:"cidr_blocks" tf:"optional"` + CidrBlocks types.List `tfsdk:"cidr_blocks" tf:"optional"` } func (newState *NccAwsStableIpRule) SyncEffectiveFieldsDuringCreateOrUpdate(plan NccAwsStableIpRule) { @@ -1751,6 +6767,67 @@ func (newState *NccAwsStableIpRule) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *NccAwsStableIpRule) SyncEffectiveFieldsDuringRead(existingState NccAwsStableIpRule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NccAwsStableIpRule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NccAwsStableIpRule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "cidr_blocks": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NccAwsStableIpRule +// only implements ToObjectValue() and Type(). +func (o NccAwsStableIpRule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "cidr_blocks": o.CidrBlocks, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NccAwsStableIpRule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "cidr_blocks": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetCidrBlocks returns the value of the CidrBlocks field in NccAwsStableIpRule as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *NccAwsStableIpRule) GetCidrBlocks(ctx context.Context) ([]types.String, bool) { + if o.CidrBlocks.IsNull() || o.CidrBlocks.IsUnknown() { + return nil, false + } + var v []types.String + d := o.CidrBlocks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCidrBlocks sets the value of the CidrBlocks field in NccAwsStableIpRule. +func (o *NccAwsStableIpRule) SetCidrBlocks(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["cidr_blocks"] + t = t.(attr.TypeWithElementType).ElementType() + o.CidrBlocks = types.ListValueMust(t, vs) +} + type NccAzurePrivateEndpointRule struct { // The current status of this private endpoint. The private endpoint rules // are effective only if the connection state is `ESTABLISHED`. Remember @@ -1795,17 +6872,66 @@ func (newState *NccAzurePrivateEndpointRule) SyncEffectiveFieldsDuringCreateOrUp func (newState *NccAzurePrivateEndpointRule) SyncEffectiveFieldsDuringRead(existingState NccAzurePrivateEndpointRule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NccAzurePrivateEndpointRule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NccAzurePrivateEndpointRule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NccAzurePrivateEndpointRule +// only implements ToObjectValue() and Type(). +func (o NccAzurePrivateEndpointRule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "connection_state": o.ConnectionState, + "creation_time": o.CreationTime, + "deactivated": o.Deactivated, + "deactivated_at": o.DeactivatedAt, + "endpoint_name": o.EndpointName, + "group_id": o.GroupId, + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "resource_id": o.ResourceId, + "rule_id": o.RuleId, + "updated_time": o.UpdatedTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NccAzurePrivateEndpointRule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "connection_state": types.StringType, + "creation_time": types.Int64Type, + "deactivated": types.BoolType, + "deactivated_at": types.Int64Type, + "endpoint_name": types.StringType, + "group_id": types.StringType, + "network_connectivity_config_id": types.StringType, + "resource_id": types.StringType, + "rule_id": types.StringType, + "updated_time": types.Int64Type, + }, + } +} + // The stable Azure service endpoints. You can configure the firewall of your // Azure resources to allow traffic from your Databricks serverless compute // resources. type NccAzureServiceEndpointRule struct { // The list of subnets from which Databricks network traffic originates when // accessing your Azure resources. - Subnets []types.String `tfsdk:"subnets" tf:"optional"` + Subnets types.List `tfsdk:"subnets" tf:"optional"` // The Azure region in which this service endpoint rule applies. TargetRegion types.String `tfsdk:"target_region" tf:"optional"` // The Azure services to which this service endpoint rule applies to. - TargetServices []types.String `tfsdk:"target_services" tf:"optional"` + TargetServices types.List `tfsdk:"target_services" tf:"optional"` } func (newState *NccAzureServiceEndpointRule) SyncEffectiveFieldsDuringCreateOrUpdate(plan NccAzureServiceEndpointRule) { @@ -1814,16 +6940,110 @@ func (newState *NccAzureServiceEndpointRule) SyncEffectiveFieldsDuringCreateOrUp func (newState *NccAzureServiceEndpointRule) SyncEffectiveFieldsDuringRead(existingState NccAzureServiceEndpointRule) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NccAzureServiceEndpointRule. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NccAzureServiceEndpointRule) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "subnets": reflect.TypeOf(types.String{}), + "target_services": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NccAzureServiceEndpointRule +// only implements ToObjectValue() and Type(). +func (o NccAzureServiceEndpointRule) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "subnets": o.Subnets, + "target_region": o.TargetRegion, + "target_services": o.TargetServices, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NccAzureServiceEndpointRule) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "subnets": basetypes.ListType{ + ElemType: types.StringType, + }, + "target_region": types.StringType, + "target_services": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetSubnets returns the value of the Subnets field in NccAzureServiceEndpointRule as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *NccAzureServiceEndpointRule) GetSubnets(ctx context.Context) ([]types.String, bool) { + if o.Subnets.IsNull() || o.Subnets.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Subnets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSubnets sets the value of the Subnets field in NccAzureServiceEndpointRule. +func (o *NccAzureServiceEndpointRule) SetSubnets(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["subnets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Subnets = types.ListValueMust(t, vs) +} + +// GetTargetServices returns the value of the TargetServices field in NccAzureServiceEndpointRule as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *NccAzureServiceEndpointRule) GetTargetServices(ctx context.Context) ([]types.String, bool) { + if o.TargetServices.IsNull() || o.TargetServices.IsUnknown() { + return nil, false + } + var v []types.String + d := o.TargetServices.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTargetServices sets the value of the TargetServices field in NccAzureServiceEndpointRule. +func (o *NccAzureServiceEndpointRule) SetTargetServices(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["target_services"] + t = t.(attr.TypeWithElementType).ElementType() + o.TargetServices = types.ListValueMust(t, vs) +} + // The network connectivity rules that apply to network traffic from your // serverless compute resources. type NccEgressConfig struct { // The network connectivity rules that are applied by default without // resource specific configurations. You can find the stable network // information of your serverless compute resources here. - DefaultRules []NccEgressDefaultRules `tfsdk:"default_rules" tf:"computed,optional"` + DefaultRules types.List `tfsdk:"default_rules" tf:"computed,optional"` // The network connectivity rules that configured for each destinations. // These rules override default rules. - TargetRules []NccEgressTargetRules `tfsdk:"target_rules" tf:"optional,object"` + TargetRules types.List `tfsdk:"target_rules" tf:"optional,object"` } func (newState *NccEgressConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan NccEgressConfig) { @@ -1832,6 +7052,98 @@ func (newState *NccEgressConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan Nc func (newState *NccEgressConfig) SyncEffectiveFieldsDuringRead(existingState NccEgressConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NccEgressConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NccEgressConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "default_rules": reflect.TypeOf(NccEgressDefaultRules{}), + "target_rules": reflect.TypeOf(NccEgressTargetRules{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NccEgressConfig +// only implements ToObjectValue() and Type(). +func (o NccEgressConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "default_rules": o.DefaultRules, + "target_rules": o.TargetRules, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NccEgressConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "default_rules": basetypes.ListType{ + ElemType: NccEgressDefaultRules{}.Type(ctx), + }, + "target_rules": basetypes.ListType{ + ElemType: NccEgressTargetRules{}.Type(ctx), + }, + }, + } +} + +// GetDefaultRules returns the value of the DefaultRules field in NccEgressConfig as +// a NccEgressDefaultRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *NccEgressConfig) GetDefaultRules(ctx context.Context) (NccEgressDefaultRules, bool) { + var e NccEgressDefaultRules + if o.DefaultRules.IsNull() || o.DefaultRules.IsUnknown() { + return e, false + } + var v []NccEgressDefaultRules + d := o.DefaultRules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDefaultRules sets the value of the DefaultRules field in NccEgressConfig. +func (o *NccEgressConfig) SetDefaultRules(ctx context.Context, v NccEgressDefaultRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["default_rules"] + o.DefaultRules = types.ListValueMust(t, vs) +} + +// GetTargetRules returns the value of the TargetRules field in NccEgressConfig as +// a NccEgressTargetRules value. +// If the field is unknown or null, the boolean return value is false. +func (o *NccEgressConfig) GetTargetRules(ctx context.Context) (NccEgressTargetRules, bool) { + var e NccEgressTargetRules + if o.TargetRules.IsNull() || o.TargetRules.IsUnknown() { + return e, false + } + var v []NccEgressTargetRules + d := o.TargetRules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTargetRules sets the value of the TargetRules field in NccEgressConfig. +func (o *NccEgressConfig) SetTargetRules(ctx context.Context, v NccEgressTargetRules) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["target_rules"] + o.TargetRules = types.ListValueMust(t, vs) +} + // The network connectivity rules that are applied by default without resource // specific configurations. You can find the stable network information of your // serverless compute resources here. @@ -1839,11 +7151,11 @@ type NccEgressDefaultRules struct { // The stable AWS IP CIDR blocks. You can use these to configure the // firewall of your resources to allow traffic from your Databricks // workspace. - AwsStableIpRule []NccAwsStableIpRule `tfsdk:"aws_stable_ip_rule" tf:"optional,object"` + AwsStableIpRule types.List `tfsdk:"aws_stable_ip_rule" tf:"optional,object"` // The stable Azure service endpoints. You can configure the firewall of // your Azure resources to allow traffic from your Databricks serverless // compute resources. - AzureServiceEndpointRule []NccAzureServiceEndpointRule `tfsdk:"azure_service_endpoint_rule" tf:"optional,object"` + AzureServiceEndpointRule types.List `tfsdk:"azure_service_endpoint_rule" tf:"optional,object"` } func (newState *NccEgressDefaultRules) SyncEffectiveFieldsDuringCreateOrUpdate(plan NccEgressDefaultRules) { @@ -1852,10 +7164,102 @@ func (newState *NccEgressDefaultRules) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *NccEgressDefaultRules) SyncEffectiveFieldsDuringRead(existingState NccEgressDefaultRules) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NccEgressDefaultRules. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NccEgressDefaultRules) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "aws_stable_ip_rule": reflect.TypeOf(NccAwsStableIpRule{}), + "azure_service_endpoint_rule": reflect.TypeOf(NccAzureServiceEndpointRule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NccEgressDefaultRules +// only implements ToObjectValue() and Type(). +func (o NccEgressDefaultRules) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "aws_stable_ip_rule": o.AwsStableIpRule, + "azure_service_endpoint_rule": o.AzureServiceEndpointRule, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NccEgressDefaultRules) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "aws_stable_ip_rule": basetypes.ListType{ + ElemType: NccAwsStableIpRule{}.Type(ctx), + }, + "azure_service_endpoint_rule": basetypes.ListType{ + ElemType: NccAzureServiceEndpointRule{}.Type(ctx), + }, + }, + } +} + +// GetAwsStableIpRule returns the value of the AwsStableIpRule field in NccEgressDefaultRules as +// a NccAwsStableIpRule value. +// If the field is unknown or null, the boolean return value is false. +func (o *NccEgressDefaultRules) GetAwsStableIpRule(ctx context.Context) (NccAwsStableIpRule, bool) { + var e NccAwsStableIpRule + if o.AwsStableIpRule.IsNull() || o.AwsStableIpRule.IsUnknown() { + return e, false + } + var v []NccAwsStableIpRule + d := o.AwsStableIpRule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAwsStableIpRule sets the value of the AwsStableIpRule field in NccEgressDefaultRules. +func (o *NccEgressDefaultRules) SetAwsStableIpRule(ctx context.Context, v NccAwsStableIpRule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["aws_stable_ip_rule"] + o.AwsStableIpRule = types.ListValueMust(t, vs) +} + +// GetAzureServiceEndpointRule returns the value of the AzureServiceEndpointRule field in NccEgressDefaultRules as +// a NccAzureServiceEndpointRule value. +// If the field is unknown or null, the boolean return value is false. +func (o *NccEgressDefaultRules) GetAzureServiceEndpointRule(ctx context.Context) (NccAzureServiceEndpointRule, bool) { + var e NccAzureServiceEndpointRule + if o.AzureServiceEndpointRule.IsNull() || o.AzureServiceEndpointRule.IsUnknown() { + return e, false + } + var v []NccAzureServiceEndpointRule + d := o.AzureServiceEndpointRule.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAzureServiceEndpointRule sets the value of the AzureServiceEndpointRule field in NccEgressDefaultRules. +func (o *NccEgressDefaultRules) SetAzureServiceEndpointRule(ctx context.Context, v NccAzureServiceEndpointRule) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_service_endpoint_rule"] + o.AzureServiceEndpointRule = types.ListValueMust(t, vs) +} + // The network connectivity rules that configured for each destinations. These // rules override default rules. type NccEgressTargetRules struct { - AzurePrivateEndpointRules []NccAzurePrivateEndpointRule `tfsdk:"azure_private_endpoint_rules" tf:"optional"` + AzurePrivateEndpointRules types.List `tfsdk:"azure_private_endpoint_rules" tf:"optional"` } func (newState *NccEgressTargetRules) SyncEffectiveFieldsDuringCreateOrUpdate(plan NccEgressTargetRules) { @@ -1864,6 +7268,67 @@ func (newState *NccEgressTargetRules) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *NccEgressTargetRules) SyncEffectiveFieldsDuringRead(existingState NccEgressTargetRules) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NccEgressTargetRules. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NccEgressTargetRules) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "azure_private_endpoint_rules": reflect.TypeOf(NccAzurePrivateEndpointRule{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NccEgressTargetRules +// only implements ToObjectValue() and Type(). +func (o NccEgressTargetRules) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "azure_private_endpoint_rules": o.AzurePrivateEndpointRules, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NccEgressTargetRules) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "azure_private_endpoint_rules": basetypes.ListType{ + ElemType: NccAzurePrivateEndpointRule{}.Type(ctx), + }, + }, + } +} + +// GetAzurePrivateEndpointRules returns the value of the AzurePrivateEndpointRules field in NccEgressTargetRules as +// a slice of NccAzurePrivateEndpointRule values. +// If the field is unknown or null, the boolean return value is false. +func (o *NccEgressTargetRules) GetAzurePrivateEndpointRules(ctx context.Context) ([]NccAzurePrivateEndpointRule, bool) { + if o.AzurePrivateEndpointRules.IsNull() || o.AzurePrivateEndpointRules.IsUnknown() { + return nil, false + } + var v []NccAzurePrivateEndpointRule + d := o.AzurePrivateEndpointRules.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAzurePrivateEndpointRules sets the value of the AzurePrivateEndpointRules field in NccEgressTargetRules. +func (o *NccEgressTargetRules) SetAzurePrivateEndpointRules(ctx context.Context, v []NccAzurePrivateEndpointRule) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["azure_private_endpoint_rules"] + t = t.(attr.TypeWithElementType).ElementType() + o.AzurePrivateEndpointRules = types.ListValueMust(t, vs) +} + type NetworkConnectivityConfiguration struct { // The Databricks account ID that hosts the credential. AccountId types.String `tfsdk:"account_id" tf:"optional"` @@ -1871,7 +7336,7 @@ type NetworkConnectivityConfiguration struct { CreationTime types.Int64 `tfsdk:"creation_time" tf:"computed,optional"` // The network connectivity rules that apply to network traffic from your // serverless compute resources. - EgressConfig []NccEgressConfig `tfsdk:"egress_config" tf:"optional,object"` + EgressConfig types.List `tfsdk:"egress_config" tf:"optional,object"` // The name of the network connectivity configuration. The name can contain // alphanumeric characters, hyphens, and underscores. The length must be // between 3 and 30 characters. The name must match the regular expression @@ -1893,11 +7358,84 @@ func (newState *NetworkConnectivityConfiguration) SyncEffectiveFieldsDuringCreat func (newState *NetworkConnectivityConfiguration) SyncEffectiveFieldsDuringRead(existingState NetworkConnectivityConfiguration) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NetworkConnectivityConfiguration. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NetworkConnectivityConfiguration) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "egress_config": reflect.TypeOf(NccEgressConfig{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NetworkConnectivityConfiguration +// only implements ToObjectValue() and Type(). +func (o NetworkConnectivityConfiguration) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "account_id": o.AccountId, + "creation_time": o.CreationTime, + "egress_config": o.EgressConfig, + "name": o.Name, + "network_connectivity_config_id": o.NetworkConnectivityConfigId, + "region": o.Region, + "updated_time": o.UpdatedTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NetworkConnectivityConfiguration) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "account_id": types.StringType, + "creation_time": types.Int64Type, + "egress_config": basetypes.ListType{ + ElemType: NccEgressConfig{}.Type(ctx), + }, + "name": types.StringType, + "network_connectivity_config_id": types.StringType, + "region": types.StringType, + "updated_time": types.Int64Type, + }, + } +} + +// GetEgressConfig returns the value of the EgressConfig field in NetworkConnectivityConfiguration as +// a NccEgressConfig value. +// If the field is unknown or null, the boolean return value is false. +func (o *NetworkConnectivityConfiguration) GetEgressConfig(ctx context.Context) (NccEgressConfig, bool) { + var e NccEgressConfig + if o.EgressConfig.IsNull() || o.EgressConfig.IsUnknown() { + return e, false + } + var v []NccEgressConfig + d := o.EgressConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEgressConfig sets the value of the EgressConfig field in NetworkConnectivityConfiguration. +func (o *NetworkConnectivityConfiguration) SetEgressConfig(ctx context.Context, v NccEgressConfig) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["egress_config"] + o.EgressConfig = types.ListValueMust(t, vs) +} + type NotificationDestination struct { // The configuration for the notification destination. Will be exactly one // of the nested configs. Only returns for users with workspace admin // permissions. - Config []Config `tfsdk:"config" tf:"optional,object"` + Config types.List `tfsdk:"config" tf:"optional,object"` // [Output-only] The type of the notification destination. The type can not // be changed once set. DestinationType types.String `tfsdk:"destination_type" tf:"optional"` @@ -1913,6 +7451,73 @@ func (newState *NotificationDestination) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *NotificationDestination) SyncEffectiveFieldsDuringRead(existingState NotificationDestination) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NotificationDestination. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NotificationDestination) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "config": reflect.TypeOf(Config{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NotificationDestination +// only implements ToObjectValue() and Type(). +func (o NotificationDestination) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "config": o.Config, + "destination_type": o.DestinationType, + "display_name": o.DisplayName, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NotificationDestination) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "config": basetypes.ListType{ + ElemType: Config{}.Type(ctx), + }, + "destination_type": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + }, + } +} + +// GetConfig returns the value of the Config field in NotificationDestination as +// a Config value. +// If the field is unknown or null, the boolean return value is false. +func (o *NotificationDestination) GetConfig(ctx context.Context) (Config, bool) { + var e Config + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []Config + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in NotificationDestination. +func (o *NotificationDestination) SetConfig(ctx context.Context, v Config) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + type PagerdutyConfig struct { // [Input-Only] Integration key for PagerDuty. IntegrationKey types.String `tfsdk:"integration_key" tf:"optional"` @@ -1926,6 +7531,39 @@ func (newState *PagerdutyConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pa func (newState *PagerdutyConfig) SyncEffectiveFieldsDuringRead(existingState PagerdutyConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PagerdutyConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PagerdutyConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PagerdutyConfig +// only implements ToObjectValue() and Type(). +func (o PagerdutyConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "integration_key": o.IntegrationKey, + "integration_key_set": o.IntegrationKeySet, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PagerdutyConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "integration_key": types.StringType, + "integration_key_set": types.BoolType, + }, + } +} + // Partition by workspace or account type PartitionId struct { // The ID of the workspace. @@ -1938,6 +7576,37 @@ func (newState *PartitionId) SyncEffectiveFieldsDuringCreateOrUpdate(plan Partit func (newState *PartitionId) SyncEffectiveFieldsDuringRead(existingState PartitionId) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PartitionId. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PartitionId) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PartitionId +// only implements ToObjectValue() and Type(). +func (o PartitionId) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspaceId": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PartitionId) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspaceId": types.Int64Type, + }, + } +} + type PersonalComputeMessage struct { // ON: Grants all users in all workspaces access to the Personal Compute // default policy, allowing all users to create single-machine compute @@ -1955,6 +7624,37 @@ func (newState *PersonalComputeMessage) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *PersonalComputeMessage) SyncEffectiveFieldsDuringRead(existingState PersonalComputeMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PersonalComputeMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PersonalComputeMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PersonalComputeMessage +// only implements ToObjectValue() and Type(). +func (o PersonalComputeMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PersonalComputeMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": types.StringType, + }, + } +} + type PersonalComputeSetting struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -1965,7 +7665,7 @@ type PersonalComputeSetting struct { // PATCH request to identify the setting version you are updating. Etag types.String `tfsdk:"etag" tf:"optional"` - PersonalCompute []PersonalComputeMessage `tfsdk:"personal_compute" tf:"object"` + PersonalCompute types.List `tfsdk:"personal_compute" tf:"object"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. @@ -1980,6 +7680,71 @@ func (newState *PersonalComputeSetting) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *PersonalComputeSetting) SyncEffectiveFieldsDuringRead(existingState PersonalComputeSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PersonalComputeSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PersonalComputeSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "personal_compute": reflect.TypeOf(PersonalComputeMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PersonalComputeSetting +// only implements ToObjectValue() and Type(). +func (o PersonalComputeSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "personal_compute": o.PersonalCompute, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PersonalComputeSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "personal_compute": basetypes.ListType{ + ElemType: PersonalComputeMessage{}.Type(ctx), + }, + "setting_name": types.StringType, + }, + } +} + +// GetPersonalCompute returns the value of the PersonalCompute field in PersonalComputeSetting as +// a PersonalComputeMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *PersonalComputeSetting) GetPersonalCompute(ctx context.Context) (PersonalComputeMessage, bool) { + var e PersonalComputeMessage + if o.PersonalCompute.IsNull() || o.PersonalCompute.IsUnknown() { + return e, false + } + var v []PersonalComputeMessage + d := o.PersonalCompute.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPersonalCompute sets the value of the PersonalCompute field in PersonalComputeSetting. +func (o *PersonalComputeSetting) SetPersonalCompute(ctx context.Context, v PersonalComputeMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["personal_compute"] + o.PersonalCompute = types.ListValueMust(t, vs) +} + type PublicTokenInfo struct { // Comment the token was created with, if applicable. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -1998,6 +7763,43 @@ func (newState *PublicTokenInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Pu func (newState *PublicTokenInfo) SyncEffectiveFieldsDuringRead(existingState PublicTokenInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PublicTokenInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PublicTokenInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PublicTokenInfo +// only implements ToObjectValue() and Type(). +func (o PublicTokenInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "creation_time": o.CreationTime, + "expiry_time": o.ExpiryTime, + "token_id": o.TokenId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PublicTokenInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "creation_time": types.Int64Type, + "expiry_time": types.Int64Type, + "token_id": types.StringType, + }, + } +} + // Details required to replace an IP access list. type ReplaceIpAccessList struct { // Specifies whether this IP access list is enabled. @@ -2005,7 +7807,7 @@ type ReplaceIpAccessList struct { // The ID for the corresponding IP access list IpAccessListId types.String `tfsdk:"-"` - IpAddresses []types.String `tfsdk:"ip_addresses" tf:"optional"` + IpAddresses types.List `tfsdk:"ip_addresses" tf:"optional"` // Label for the IP access list. This **cannot** be empty. Label types.String `tfsdk:"label" tf:""` // Type of IP access list. Valid values are as follows and are @@ -2023,6 +7825,75 @@ func (newState *ReplaceIpAccessList) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ReplaceIpAccessList) SyncEffectiveFieldsDuringRead(existingState ReplaceIpAccessList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReplaceIpAccessList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReplaceIpAccessList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReplaceIpAccessList +// only implements ToObjectValue() and Type(). +func (o ReplaceIpAccessList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + "ip_access_list_id": o.IpAccessListId, + "ip_addresses": o.IpAddresses, + "label": o.Label, + "list_type": o.ListType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ReplaceIpAccessList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + "ip_access_list_id": types.StringType, + "ip_addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + "label": types.StringType, + "list_type": types.StringType, + }, + } +} + +// GetIpAddresses returns the value of the IpAddresses field in ReplaceIpAccessList as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ReplaceIpAccessList) GetIpAddresses(ctx context.Context) ([]types.String, bool) { + if o.IpAddresses.IsNull() || o.IpAddresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.IpAddresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIpAddresses sets the value of the IpAddresses field in ReplaceIpAccessList. +func (o *ReplaceIpAccessList) SetIpAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.IpAddresses = types.ListValueMust(t, vs) +} + type ReplaceResponse struct { } @@ -2032,6 +7903,33 @@ func (newState *ReplaceResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Re func (newState *ReplaceResponse) SyncEffectiveFieldsDuringRead(existingState ReplaceResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ReplaceResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ReplaceResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ReplaceResponse +// only implements ToObjectValue() and Type(). +func (o ReplaceResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ReplaceResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type RestrictWorkspaceAdminsMessage struct { Status types.String `tfsdk:"status" tf:""` } @@ -2042,6 +7940,37 @@ func (newState *RestrictWorkspaceAdminsMessage) SyncEffectiveFieldsDuringCreateO func (newState *RestrictWorkspaceAdminsMessage) SyncEffectiveFieldsDuringRead(existingState RestrictWorkspaceAdminsMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestrictWorkspaceAdminsMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestrictWorkspaceAdminsMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestrictWorkspaceAdminsMessage +// only implements ToObjectValue() and Type(). +func (o RestrictWorkspaceAdminsMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestrictWorkspaceAdminsMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "status": types.StringType, + }, + } +} + type RestrictWorkspaceAdminsSetting struct { // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -2052,7 +7981,7 @@ type RestrictWorkspaceAdminsSetting struct { // PATCH request to identify the setting version you are updating. Etag types.String `tfsdk:"etag" tf:"optional"` - RestrictWorkspaceAdmins []RestrictWorkspaceAdminsMessage `tfsdk:"restrict_workspace_admins" tf:"object"` + RestrictWorkspaceAdmins types.List `tfsdk:"restrict_workspace_admins" tf:"object"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. @@ -2067,6 +7996,71 @@ func (newState *RestrictWorkspaceAdminsSetting) SyncEffectiveFieldsDuringCreateO func (newState *RestrictWorkspaceAdminsSetting) SyncEffectiveFieldsDuringRead(existingState RestrictWorkspaceAdminsSetting) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestrictWorkspaceAdminsSetting. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestrictWorkspaceAdminsSetting) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "restrict_workspace_admins": reflect.TypeOf(RestrictWorkspaceAdminsMessage{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestrictWorkspaceAdminsSetting +// only implements ToObjectValue() and Type(). +func (o RestrictWorkspaceAdminsSetting) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "etag": o.Etag, + "restrict_workspace_admins": o.RestrictWorkspaceAdmins, + "setting_name": o.SettingName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestrictWorkspaceAdminsSetting) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "etag": types.StringType, + "restrict_workspace_admins": basetypes.ListType{ + ElemType: RestrictWorkspaceAdminsMessage{}.Type(ctx), + }, + "setting_name": types.StringType, + }, + } +} + +// GetRestrictWorkspaceAdmins returns the value of the RestrictWorkspaceAdmins field in RestrictWorkspaceAdminsSetting as +// a RestrictWorkspaceAdminsMessage value. +// If the field is unknown or null, the boolean return value is false. +func (o *RestrictWorkspaceAdminsSetting) GetRestrictWorkspaceAdmins(ctx context.Context) (RestrictWorkspaceAdminsMessage, bool) { + var e RestrictWorkspaceAdminsMessage + if o.RestrictWorkspaceAdmins.IsNull() || o.RestrictWorkspaceAdmins.IsUnknown() { + return e, false + } + var v []RestrictWorkspaceAdminsMessage + d := o.RestrictWorkspaceAdmins.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRestrictWorkspaceAdmins sets the value of the RestrictWorkspaceAdmins field in RestrictWorkspaceAdminsSetting. +func (o *RestrictWorkspaceAdminsSetting) SetRestrictWorkspaceAdmins(ctx context.Context, v RestrictWorkspaceAdminsMessage) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["restrict_workspace_admins"] + o.RestrictWorkspaceAdmins = types.ListValueMust(t, vs) +} + type RevokeTokenRequest struct { // The ID of the token to be revoked. TokenId types.String `tfsdk:"token_id" tf:""` @@ -2078,6 +8072,37 @@ func (newState *RevokeTokenRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RevokeTokenRequest) SyncEffectiveFieldsDuringRead(existingState RevokeTokenRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RevokeTokenRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RevokeTokenRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RevokeTokenRequest +// only implements ToObjectValue() and Type(). +func (o RevokeTokenRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "token_id": o.TokenId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RevokeTokenRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "token_id": types.StringType, + }, + } +} + type RevokeTokenResponse struct { } @@ -2087,6 +8112,33 @@ func (newState *RevokeTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *RevokeTokenResponse) SyncEffectiveFieldsDuringRead(existingState RevokeTokenResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RevokeTokenResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RevokeTokenResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RevokeTokenResponse +// only implements ToObjectValue() and Type(). +func (o RevokeTokenResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RevokeTokenResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type SetStatusResponse struct { } @@ -2096,6 +8148,33 @@ func (newState *SetStatusResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SetStatusResponse) SyncEffectiveFieldsDuringRead(existingState SetStatusResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetStatusResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetStatusResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetStatusResponse +// only implements ToObjectValue() and Type(). +func (o SetStatusResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SetStatusResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type SlackConfig struct { // [Input-Only] URL for Slack destination. Url types.String `tfsdk:"url" tf:"optional"` @@ -2109,6 +8188,39 @@ func (newState *SlackConfig) SyncEffectiveFieldsDuringCreateOrUpdate(plan SlackC func (newState *SlackConfig) SyncEffectiveFieldsDuringRead(existingState SlackConfig) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SlackConfig. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SlackConfig) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SlackConfig +// only implements ToObjectValue() and Type(). +func (o SlackConfig) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "url": o.Url, + "url_set": o.UrlSet, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SlackConfig) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "url": types.StringType, + "url_set": types.BoolType, + }, + } +} + type StringMessage struct { // Represents a generic string value. Value types.String `tfsdk:"value" tf:"optional"` @@ -2120,6 +8232,37 @@ func (newState *StringMessage) SyncEffectiveFieldsDuringCreateOrUpdate(plan Stri func (newState *StringMessage) SyncEffectiveFieldsDuringRead(existingState StringMessage) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StringMessage. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StringMessage) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StringMessage +// only implements ToObjectValue() and Type(). +func (o StringMessage) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StringMessage) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": types.StringType, + }, + } +} + type TokenAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -2137,9 +8280,46 @@ func (newState *TokenAccessControlRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *TokenAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState TokenAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o TokenAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type TokenAccessControlResponse struct { // All permissions. - AllPermissions []TokenPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -2156,6 +8336,75 @@ func (newState *TokenAccessControlResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *TokenAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState TokenAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(TokenPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o TokenAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: TokenPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in TokenAccessControlResponse as +// a slice of TokenPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *TokenAccessControlResponse) GetAllPermissions(ctx context.Context) ([]TokenPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []TokenPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in TokenAccessControlResponse. +func (o *TokenAccessControlResponse) SetAllPermissions(ctx context.Context, v []TokenPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type TokenInfo struct { // Comment that describes the purpose of the token, specified by the token // creator. @@ -2185,10 +8434,57 @@ func (newState *TokenInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan TokenInf func (newState *TokenInfo) SyncEffectiveFieldsDuringRead(existingState TokenInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenInfo +// only implements ToObjectValue() and Type(). +func (o TokenInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "created_by_id": o.CreatedById, + "created_by_username": o.CreatedByUsername, + "creation_time": o.CreationTime, + "expiry_time": o.ExpiryTime, + "last_used_day": o.LastUsedDay, + "owner_id": o.OwnerId, + "token_id": o.TokenId, + "workspace_id": o.WorkspaceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "created_by_id": types.Int64Type, + "created_by_username": types.StringType, + "creation_time": types.Int64Type, + "expiry_time": types.Int64Type, + "last_used_day": types.Int64Type, + "owner_id": types.Int64Type, + "token_id": types.StringType, + "workspace_id": types.Int64Type, + }, + } +} + type TokenPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -2199,8 +8495,73 @@ func (newState *TokenPermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan To func (newState *TokenPermission) SyncEffectiveFieldsDuringRead(existingState TokenPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenPermission +// only implements ToObjectValue() and Type(). +func (o TokenPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in TokenPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TokenPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in TokenPermission. +func (o *TokenPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type TokenPermissions struct { - AccessControlList []TokenAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -2213,6 +8574,71 @@ func (newState *TokenPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan T func (newState *TokenPermissions) SyncEffectiveFieldsDuringRead(existingState TokenPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(TokenAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenPermissions +// only implements ToObjectValue() and Type(). +func (o TokenPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: TokenAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in TokenPermissions as +// a slice of TokenAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *TokenPermissions) GetAccessControlList(ctx context.Context) ([]TokenAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []TokenAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in TokenPermissions. +func (o *TokenPermissions) SetAccessControlList(ctx context.Context, v []TokenAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type TokenPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -2225,8 +8651,41 @@ func (newState *TokenPermissionsDescription) SyncEffectiveFieldsDuringCreateOrUp func (newState *TokenPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState TokenPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o TokenPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type TokenPermissionsRequest struct { - AccessControlList []TokenAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` } func (newState *TokenPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan TokenPermissionsRequest) { @@ -2235,6 +8694,67 @@ func (newState *TokenPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *TokenPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState TokenPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TokenPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TokenPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(TokenAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TokenPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o TokenPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TokenPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: TokenAccessControlRequest{}.Type(ctx), + }, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in TokenPermissionsRequest as +// a slice of TokenAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *TokenPermissionsRequest) GetAccessControlList(ctx context.Context) ([]TokenAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []TokenAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in TokenPermissionsRequest. +func (o *TokenPermissionsRequest) SetAccessControlList(ctx context.Context, v []TokenAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateAibiDashboardEmbeddingAccessPolicySettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2246,7 +8766,7 @@ type UpdateAibiDashboardEmbeddingAccessPolicySettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []AibiDashboardEmbeddingAccessPolicySetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) { @@ -2255,6 +8775,71 @@ func (newState *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffe func (newState *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAibiDashboardEmbeddingAccessPolicySettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(AibiDashboardEmbeddingAccessPolicySetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAibiDashboardEmbeddingAccessPolicySettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: AibiDashboardEmbeddingAccessPolicySetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateAibiDashboardEmbeddingAccessPolicySettingRequest as +// a AibiDashboardEmbeddingAccessPolicySetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) GetSetting(ctx context.Context) (AibiDashboardEmbeddingAccessPolicySetting, bool) { + var e AibiDashboardEmbeddingAccessPolicySetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []AibiDashboardEmbeddingAccessPolicySetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateAibiDashboardEmbeddingAccessPolicySettingRequest. +func (o *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) SetSetting(ctx context.Context, v AibiDashboardEmbeddingAccessPolicySetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2266,7 +8851,7 @@ type UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []AibiDashboardEmbeddingApprovedDomainsSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) { @@ -2275,6 +8860,71 @@ func (newState *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncE func (newState *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(AibiDashboardEmbeddingApprovedDomainsSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: AibiDashboardEmbeddingApprovedDomainsSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest as +// a AibiDashboardEmbeddingApprovedDomainsSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) GetSetting(ctx context.Context) (AibiDashboardEmbeddingApprovedDomainsSetting, bool) { + var e AibiDashboardEmbeddingApprovedDomainsSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []AibiDashboardEmbeddingApprovedDomainsSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest. +func (o *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) SetSetting(ctx context.Context, v AibiDashboardEmbeddingApprovedDomainsSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateAutomaticClusterUpdateSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2286,7 +8936,7 @@ type UpdateAutomaticClusterUpdateSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []AutomaticClusterUpdateSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateAutomaticClusterUpdateSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateAutomaticClusterUpdateSettingRequest) { @@ -2295,6 +8945,71 @@ func (newState *UpdateAutomaticClusterUpdateSettingRequest) SyncEffectiveFieldsD func (newState *UpdateAutomaticClusterUpdateSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateAutomaticClusterUpdateSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAutomaticClusterUpdateSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAutomaticClusterUpdateSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(AutomaticClusterUpdateSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAutomaticClusterUpdateSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateAutomaticClusterUpdateSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAutomaticClusterUpdateSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: AutomaticClusterUpdateSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateAutomaticClusterUpdateSettingRequest as +// a AutomaticClusterUpdateSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAutomaticClusterUpdateSettingRequest) GetSetting(ctx context.Context) (AutomaticClusterUpdateSetting, bool) { + var e AutomaticClusterUpdateSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []AutomaticClusterUpdateSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateAutomaticClusterUpdateSettingRequest. +func (o *UpdateAutomaticClusterUpdateSettingRequest) SetSetting(ctx context.Context, v AutomaticClusterUpdateSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateComplianceSecurityProfileSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2306,7 +9021,7 @@ type UpdateComplianceSecurityProfileSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []ComplianceSecurityProfileSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateComplianceSecurityProfileSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateComplianceSecurityProfileSettingRequest) { @@ -2315,6 +9030,71 @@ func (newState *UpdateComplianceSecurityProfileSettingRequest) SyncEffectiveFiel func (newState *UpdateComplianceSecurityProfileSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateComplianceSecurityProfileSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateComplianceSecurityProfileSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateComplianceSecurityProfileSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(ComplianceSecurityProfileSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateComplianceSecurityProfileSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateComplianceSecurityProfileSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateComplianceSecurityProfileSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: ComplianceSecurityProfileSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateComplianceSecurityProfileSettingRequest as +// a ComplianceSecurityProfileSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateComplianceSecurityProfileSettingRequest) GetSetting(ctx context.Context) (ComplianceSecurityProfileSetting, bool) { + var e ComplianceSecurityProfileSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []ComplianceSecurityProfileSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateComplianceSecurityProfileSettingRequest. +func (o *UpdateComplianceSecurityProfileSettingRequest) SetSetting(ctx context.Context, v ComplianceSecurityProfileSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateCspEnablementAccountSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2326,7 +9106,7 @@ type UpdateCspEnablementAccountSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []CspEnablementAccountSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateCspEnablementAccountSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateCspEnablementAccountSettingRequest) { @@ -2335,6 +9115,71 @@ func (newState *UpdateCspEnablementAccountSettingRequest) SyncEffectiveFieldsDur func (newState *UpdateCspEnablementAccountSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateCspEnablementAccountSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCspEnablementAccountSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCspEnablementAccountSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(CspEnablementAccountSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCspEnablementAccountSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateCspEnablementAccountSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCspEnablementAccountSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: CspEnablementAccountSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateCspEnablementAccountSettingRequest as +// a CspEnablementAccountSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateCspEnablementAccountSettingRequest) GetSetting(ctx context.Context) (CspEnablementAccountSetting, bool) { + var e CspEnablementAccountSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []CspEnablementAccountSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateCspEnablementAccountSettingRequest. +func (o *UpdateCspEnablementAccountSettingRequest) SetSetting(ctx context.Context, v CspEnablementAccountSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateDefaultNamespaceSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2354,7 +9199,7 @@ type UpdateDefaultNamespaceSettingRequest struct { // assumed). This setting requires a restart of clusters and SQL warehouses // to take effect. Additionally, the default namespace only applies when // using Unity Catalog-enabled compute. - Setting []DefaultNamespaceSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateDefaultNamespaceSettingRequest) { @@ -2363,6 +9208,71 @@ func (newState *UpdateDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringC func (newState *UpdateDefaultNamespaceSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateDefaultNamespaceSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateDefaultNamespaceSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateDefaultNamespaceSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(DefaultNamespaceSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateDefaultNamespaceSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateDefaultNamespaceSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateDefaultNamespaceSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: DefaultNamespaceSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateDefaultNamespaceSettingRequest as +// a DefaultNamespaceSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateDefaultNamespaceSettingRequest) GetSetting(ctx context.Context) (DefaultNamespaceSetting, bool) { + var e DefaultNamespaceSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []DefaultNamespaceSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateDefaultNamespaceSettingRequest. +func (o *UpdateDefaultNamespaceSettingRequest) SetSetting(ctx context.Context, v DefaultNamespaceSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateDisableLegacyAccessRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2374,7 +9284,7 @@ type UpdateDisableLegacyAccessRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []DisableLegacyAccess `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateDisableLegacyAccessRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateDisableLegacyAccessRequest) { @@ -2383,6 +9293,71 @@ func (newState *UpdateDisableLegacyAccessRequest) SyncEffectiveFieldsDuringCreat func (newState *UpdateDisableLegacyAccessRequest) SyncEffectiveFieldsDuringRead(existingState UpdateDisableLegacyAccessRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateDisableLegacyAccessRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateDisableLegacyAccessRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(DisableLegacyAccess{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateDisableLegacyAccessRequest +// only implements ToObjectValue() and Type(). +func (o UpdateDisableLegacyAccessRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateDisableLegacyAccessRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: DisableLegacyAccess{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateDisableLegacyAccessRequest as +// a DisableLegacyAccess value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateDisableLegacyAccessRequest) GetSetting(ctx context.Context) (DisableLegacyAccess, bool) { + var e DisableLegacyAccess + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []DisableLegacyAccess + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateDisableLegacyAccessRequest. +func (o *UpdateDisableLegacyAccessRequest) SetSetting(ctx context.Context, v DisableLegacyAccess) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateDisableLegacyDbfsRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2394,7 +9369,7 @@ type UpdateDisableLegacyDbfsRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []DisableLegacyDbfs `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateDisableLegacyDbfsRequest) { @@ -2403,6 +9378,71 @@ func (newState *UpdateDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringCreateO func (newState *UpdateDisableLegacyDbfsRequest) SyncEffectiveFieldsDuringRead(existingState UpdateDisableLegacyDbfsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateDisableLegacyDbfsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateDisableLegacyDbfsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(DisableLegacyDbfs{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateDisableLegacyDbfsRequest +// only implements ToObjectValue() and Type(). +func (o UpdateDisableLegacyDbfsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateDisableLegacyDbfsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: DisableLegacyDbfs{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateDisableLegacyDbfsRequest as +// a DisableLegacyDbfs value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateDisableLegacyDbfsRequest) GetSetting(ctx context.Context) (DisableLegacyDbfs, bool) { + var e DisableLegacyDbfs + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []DisableLegacyDbfs + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateDisableLegacyDbfsRequest. +func (o *UpdateDisableLegacyDbfsRequest) SetSetting(ctx context.Context, v DisableLegacyDbfs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateDisableLegacyFeaturesRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2414,7 +9454,7 @@ type UpdateDisableLegacyFeaturesRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []DisableLegacyFeatures `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateDisableLegacyFeaturesRequest) { @@ -2423,6 +9463,71 @@ func (newState *UpdateDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringCre func (newState *UpdateDisableLegacyFeaturesRequest) SyncEffectiveFieldsDuringRead(existingState UpdateDisableLegacyFeaturesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateDisableLegacyFeaturesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateDisableLegacyFeaturesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(DisableLegacyFeatures{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateDisableLegacyFeaturesRequest +// only implements ToObjectValue() and Type(). +func (o UpdateDisableLegacyFeaturesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateDisableLegacyFeaturesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: DisableLegacyFeatures{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateDisableLegacyFeaturesRequest as +// a DisableLegacyFeatures value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateDisableLegacyFeaturesRequest) GetSetting(ctx context.Context) (DisableLegacyFeatures, bool) { + var e DisableLegacyFeatures + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []DisableLegacyFeatures + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateDisableLegacyFeaturesRequest. +func (o *UpdateDisableLegacyFeaturesRequest) SetSetting(ctx context.Context, v DisableLegacyFeatures) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateEnhancedSecurityMonitoringSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2434,7 +9539,7 @@ type UpdateEnhancedSecurityMonitoringSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []EnhancedSecurityMonitoringSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateEnhancedSecurityMonitoringSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateEnhancedSecurityMonitoringSettingRequest) { @@ -2443,6 +9548,71 @@ func (newState *UpdateEnhancedSecurityMonitoringSettingRequest) SyncEffectiveFie func (newState *UpdateEnhancedSecurityMonitoringSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateEnhancedSecurityMonitoringSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateEnhancedSecurityMonitoringSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateEnhancedSecurityMonitoringSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(EnhancedSecurityMonitoringSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateEnhancedSecurityMonitoringSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateEnhancedSecurityMonitoringSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateEnhancedSecurityMonitoringSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: EnhancedSecurityMonitoringSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateEnhancedSecurityMonitoringSettingRequest as +// a EnhancedSecurityMonitoringSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateEnhancedSecurityMonitoringSettingRequest) GetSetting(ctx context.Context) (EnhancedSecurityMonitoringSetting, bool) { + var e EnhancedSecurityMonitoringSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []EnhancedSecurityMonitoringSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateEnhancedSecurityMonitoringSettingRequest. +func (o *UpdateEnhancedSecurityMonitoringSettingRequest) SetSetting(ctx context.Context, v EnhancedSecurityMonitoringSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdateEsmEnablementAccountSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2454,7 +9624,7 @@ type UpdateEsmEnablementAccountSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []EsmEnablementAccountSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateEsmEnablementAccountSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateEsmEnablementAccountSettingRequest) { @@ -2463,6 +9633,71 @@ func (newState *UpdateEsmEnablementAccountSettingRequest) SyncEffectiveFieldsDur func (newState *UpdateEsmEnablementAccountSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateEsmEnablementAccountSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateEsmEnablementAccountSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateEsmEnablementAccountSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(EsmEnablementAccountSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateEsmEnablementAccountSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateEsmEnablementAccountSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateEsmEnablementAccountSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: EsmEnablementAccountSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateEsmEnablementAccountSettingRequest as +// a EsmEnablementAccountSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateEsmEnablementAccountSettingRequest) GetSetting(ctx context.Context) (EsmEnablementAccountSetting, bool) { + var e EsmEnablementAccountSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []EsmEnablementAccountSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateEsmEnablementAccountSettingRequest. +func (o *UpdateEsmEnablementAccountSettingRequest) SetSetting(ctx context.Context, v EsmEnablementAccountSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + // Details required to update an IP access list. type UpdateIpAccessList struct { // Specifies whether this IP access list is enabled. @@ -2470,7 +9705,7 @@ type UpdateIpAccessList struct { // The ID for the corresponding IP access list IpAccessListId types.String `tfsdk:"-"` - IpAddresses []types.String `tfsdk:"ip_addresses" tf:"optional"` + IpAddresses types.List `tfsdk:"ip_addresses" tf:"optional"` // Label for the IP access list. This **cannot** be empty. Label types.String `tfsdk:"label" tf:"optional"` // Type of IP access list. Valid values are as follows and are @@ -2488,10 +9723,79 @@ func (newState *UpdateIpAccessList) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateIpAccessList) SyncEffectiveFieldsDuringRead(existingState UpdateIpAccessList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateIpAccessList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateIpAccessList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateIpAccessList +// only implements ToObjectValue() and Type(). +func (o UpdateIpAccessList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + "ip_access_list_id": o.IpAccessListId, + "ip_addresses": o.IpAddresses, + "label": o.Label, + "list_type": o.ListType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateIpAccessList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + "ip_access_list_id": types.StringType, + "ip_addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + "label": types.StringType, + "list_type": types.StringType, + }, + } +} + +// GetIpAddresses returns the value of the IpAddresses field in UpdateIpAccessList as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateIpAccessList) GetIpAddresses(ctx context.Context) ([]types.String, bool) { + if o.IpAddresses.IsNull() || o.IpAddresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.IpAddresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetIpAddresses sets the value of the IpAddresses field in UpdateIpAccessList. +func (o *UpdateIpAccessList) SetIpAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.IpAddresses = types.ListValueMust(t, vs) +} + type UpdateNotificationDestinationRequest struct { // The configuration for the notification destination. Must wrap EXACTLY one // of the nested configs. - Config []Config `tfsdk:"config" tf:"optional,object"` + Config types.List `tfsdk:"config" tf:"optional,object"` // The display name for the notification destination. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // UUID identifying notification destination. @@ -2504,6 +9808,71 @@ func (newState *UpdateNotificationDestinationRequest) SyncEffectiveFieldsDuringC func (newState *UpdateNotificationDestinationRequest) SyncEffectiveFieldsDuringRead(existingState UpdateNotificationDestinationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateNotificationDestinationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateNotificationDestinationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "config": reflect.TypeOf(Config{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateNotificationDestinationRequest +// only implements ToObjectValue() and Type(). +func (o UpdateNotificationDestinationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "config": o.Config, + "display_name": o.DisplayName, + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateNotificationDestinationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "config": basetypes.ListType{ + ElemType: Config{}.Type(ctx), + }, + "display_name": types.StringType, + "id": types.StringType, + }, + } +} + +// GetConfig returns the value of the Config field in UpdateNotificationDestinationRequest as +// a Config value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateNotificationDestinationRequest) GetConfig(ctx context.Context) (Config, bool) { + var e Config + if o.Config.IsNull() || o.Config.IsUnknown() { + return e, false + } + var v []Config + d := o.Config.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfig sets the value of the Config field in UpdateNotificationDestinationRequest. +func (o *UpdateNotificationDestinationRequest) SetConfig(ctx context.Context, v Config) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config"] + o.Config = types.ListValueMust(t, vs) +} + // Details required to update a setting. type UpdatePersonalComputeSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2515,7 +9884,7 @@ type UpdatePersonalComputeSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []PersonalComputeSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdatePersonalComputeSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdatePersonalComputeSettingRequest) { @@ -2524,6 +9893,71 @@ func (newState *UpdatePersonalComputeSettingRequest) SyncEffectiveFieldsDuringCr func (newState *UpdatePersonalComputeSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdatePersonalComputeSettingRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePersonalComputeSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePersonalComputeSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(PersonalComputeSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePersonalComputeSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdatePersonalComputeSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePersonalComputeSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: PersonalComputeSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdatePersonalComputeSettingRequest as +// a PersonalComputeSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdatePersonalComputeSettingRequest) GetSetting(ctx context.Context) (PersonalComputeSetting, bool) { + var e PersonalComputeSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []PersonalComputeSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdatePersonalComputeSettingRequest. +func (o *UpdatePersonalComputeSettingRequest) SetSetting(ctx context.Context, v PersonalComputeSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} + type UpdateResponse struct { } @@ -2533,6 +9967,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Details required to update a setting. type UpdateRestrictWorkspaceAdminsSettingRequest struct { // This should always be set to true for Settings API. Added for AIP @@ -2544,7 +10005,7 @@ type UpdateRestrictWorkspaceAdminsSettingRequest struct { // the field mask, use comma as the separator (no space). FieldMask types.String `tfsdk:"field_mask" tf:""` - Setting []RestrictWorkspaceAdminsSetting `tfsdk:"setting" tf:"object"` + Setting types.List `tfsdk:"setting" tf:"object"` } func (newState *UpdateRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateRestrictWorkspaceAdminsSettingRequest) { @@ -2552,3 +10013,68 @@ func (newState *UpdateRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFields func (newState *UpdateRestrictWorkspaceAdminsSettingRequest) SyncEffectiveFieldsDuringRead(existingState UpdateRestrictWorkspaceAdminsSettingRequest) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRestrictWorkspaceAdminsSettingRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRestrictWorkspaceAdminsSettingRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "setting": reflect.TypeOf(RestrictWorkspaceAdminsSetting{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRestrictWorkspaceAdminsSettingRequest +// only implements ToObjectValue() and Type(). +func (o UpdateRestrictWorkspaceAdminsSettingRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allow_missing": o.AllowMissing, + "field_mask": o.FieldMask, + "setting": o.Setting, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRestrictWorkspaceAdminsSettingRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allow_missing": types.BoolType, + "field_mask": types.StringType, + "setting": basetypes.ListType{ + ElemType: RestrictWorkspaceAdminsSetting{}.Type(ctx), + }, + }, + } +} + +// GetSetting returns the value of the Setting field in UpdateRestrictWorkspaceAdminsSettingRequest as +// a RestrictWorkspaceAdminsSetting value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRestrictWorkspaceAdminsSettingRequest) GetSetting(ctx context.Context) (RestrictWorkspaceAdminsSetting, bool) { + var e RestrictWorkspaceAdminsSetting + if o.Setting.IsNull() || o.Setting.IsUnknown() { + return e, false + } + var v []RestrictWorkspaceAdminsSetting + d := o.Setting.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSetting sets the value of the Setting field in UpdateRestrictWorkspaceAdminsSettingRequest. +func (o *UpdateRestrictWorkspaceAdminsSettingRequest) SetSetting(ctx context.Context, v RestrictWorkspaceAdminsSetting) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["setting"] + o.Setting = types.ListValueMust(t, vs) +} diff --git a/internal/service/sharing_tf/model.go b/internal/service/sharing_tf/model.go index 6de053a93..9b7d073b3 100755 --- a/internal/service/sharing_tf/model.go +++ b/internal/service/sharing_tf/model.go @@ -11,8 +11,15 @@ We use go-native types for lists and maps intentionally for the ease for convert package sharing_tf import ( - "github.com/databricks/databricks-sdk-go/service/catalog" + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/databricks/terraform-provider-databricks/internal/service/catalog_tf" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type CreateProvider struct { @@ -33,6 +40,43 @@ func (newState *CreateProvider) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateProvider) SyncEffectiveFieldsDuringRead(existingState CreateProvider) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateProvider. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateProvider) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateProvider +// only implements ToObjectValue() and Type(). +func (o CreateProvider) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "authentication_type": o.AuthenticationType, + "comment": o.Comment, + "name": o.Name, + "recipient_profile_str": o.RecipientProfileStr, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateProvider) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "authentication_type": types.StringType, + "comment": types.StringType, + "name": types.StringType, + "recipient_profile_str": types.StringType, + }, + } +} + type CreateRecipient struct { // The delta sharing authentication type. AuthenticationType types.String `tfsdk:"authentication_type" tf:""` @@ -46,13 +90,13 @@ type CreateRecipient struct { // Expiration timestamp of the token, in epoch milliseconds. ExpirationTime types.Int64 `tfsdk:"expiration_time" tf:"optional"` // IP Access List - IpAccessList []IpAccessList `tfsdk:"ip_access_list" tf:"optional,object"` + IpAccessList types.List `tfsdk:"ip_access_list" tf:"optional,object"` // Name of Recipient. Name types.String `tfsdk:"name" tf:""` // Username of the recipient owner. Owner types.String `tfsdk:"owner" tf:"optional"` // Recipient properties as map of string key-value pairs. - PropertiesKvpairs []SecurablePropertiesKvPairs `tfsdk:"properties_kvpairs" tf:"optional,object"` + PropertiesKvpairs types.List `tfsdk:"properties_kvpairs" tf:"optional,object"` // The one-time sharing code provided by the data recipient. This field is // required when the __authentication_type__ is **DATABRICKS**. SharingCode types.String `tfsdk:"sharing_code" tf:"optional"` @@ -64,6 +108,112 @@ func (newState *CreateRecipient) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cr func (newState *CreateRecipient) SyncEffectiveFieldsDuringRead(existingState CreateRecipient) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRecipient. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRecipient) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_list": reflect.TypeOf(IpAccessList{}), + "properties_kvpairs": reflect.TypeOf(SecurablePropertiesKvPairs{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRecipient +// only implements ToObjectValue() and Type(). +func (o CreateRecipient) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "authentication_type": o.AuthenticationType, + "comment": o.Comment, + "data_recipient_global_metastore_id": o.DataRecipientGlobalMetastoreId, + "expiration_time": o.ExpirationTime, + "ip_access_list": o.IpAccessList, + "name": o.Name, + "owner": o.Owner, + "properties_kvpairs": o.PropertiesKvpairs, + "sharing_code": o.SharingCode, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRecipient) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "authentication_type": types.StringType, + "comment": types.StringType, + "data_recipient_global_metastore_id": types.StringType, + "expiration_time": types.Int64Type, + "ip_access_list": basetypes.ListType{ + ElemType: IpAccessList{}.Type(ctx), + }, + "name": types.StringType, + "owner": types.StringType, + "properties_kvpairs": basetypes.ListType{ + ElemType: SecurablePropertiesKvPairs{}.Type(ctx), + }, + "sharing_code": types.StringType, + }, + } +} + +// GetIpAccessList returns the value of the IpAccessList field in CreateRecipient as +// a IpAccessList value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRecipient) GetIpAccessList(ctx context.Context) (IpAccessList, bool) { + var e IpAccessList + if o.IpAccessList.IsNull() || o.IpAccessList.IsUnknown() { + return e, false + } + var v []IpAccessList + d := o.IpAccessList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIpAccessList sets the value of the IpAccessList field in CreateRecipient. +func (o *CreateRecipient) SetIpAccessList(ctx context.Context, v IpAccessList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_list"] + o.IpAccessList = types.ListValueMust(t, vs) +} + +// GetPropertiesKvpairs returns the value of the PropertiesKvpairs field in CreateRecipient as +// a SecurablePropertiesKvPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRecipient) GetPropertiesKvpairs(ctx context.Context) (SecurablePropertiesKvPairs, bool) { + var e SecurablePropertiesKvPairs + if o.PropertiesKvpairs.IsNull() || o.PropertiesKvpairs.IsUnknown() { + return e, false + } + var v []SecurablePropertiesKvPairs + d := o.PropertiesKvpairs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPropertiesKvpairs sets the value of the PropertiesKvpairs field in CreateRecipient. +func (o *CreateRecipient) SetPropertiesKvpairs(ctx context.Context, v SecurablePropertiesKvPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties_kvpairs"] + o.PropertiesKvpairs = types.ListValueMust(t, vs) +} + type CreateShare struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -79,6 +229,41 @@ func (newState *CreateShare) SyncEffectiveFieldsDuringCreateOrUpdate(plan Create func (newState *CreateShare) SyncEffectiveFieldsDuringRead(existingState CreateShare) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateShare. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateShare) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateShare +// only implements ToObjectValue() and Type(). +func (o CreateShare) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "storage_root": o.StorageRoot, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateShare) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "storage_root": types.StringType, + }, + } +} + // Delete a provider type DeleteProviderRequest struct { // Name of the provider. @@ -91,6 +276,37 @@ func (newState *DeleteProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteProviderRequest) SyncEffectiveFieldsDuringRead(existingState DeleteProviderRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteProviderRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteProviderRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteProviderRequest +// only implements ToObjectValue() and Type(). +func (o DeleteProviderRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteProviderRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Delete a share recipient type DeleteRecipientRequest struct { // Name of the recipient. @@ -103,6 +319,37 @@ func (newState *DeleteRecipientRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteRecipientRequest) SyncEffectiveFieldsDuringRead(existingState DeleteRecipientRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRecipientRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRecipientRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRecipientRequest +// only implements ToObjectValue() and Type(). +func (o DeleteRecipientRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRecipientRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -112,6 +359,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a share type DeleteShareRequest struct { // The name of the share. @@ -124,6 +398,37 @@ func (newState *DeleteShareRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteShareRequest) SyncEffectiveFieldsDuringRead(existingState DeleteShareRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteShareRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteShareRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteShareRequest +// only implements ToObjectValue() and Type(). +func (o DeleteShareRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteShareRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get a share activation URL type GetActivationUrlInfoRequest struct { // The one time activation url. It also accepts activation token. @@ -136,6 +441,37 @@ func (newState *GetActivationUrlInfoRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *GetActivationUrlInfoRequest) SyncEffectiveFieldsDuringRead(existingState GetActivationUrlInfoRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetActivationUrlInfoRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetActivationUrlInfoRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetActivationUrlInfoRequest +// only implements ToObjectValue() and Type(). +func (o GetActivationUrlInfoRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activation_url": o.ActivationUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetActivationUrlInfoRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activation_url": types.StringType, + }, + } +} + type GetActivationUrlInfoResponse struct { } @@ -145,6 +481,33 @@ func (newState *GetActivationUrlInfoResponse) SyncEffectiveFieldsDuringCreateOrU func (newState *GetActivationUrlInfoResponse) SyncEffectiveFieldsDuringRead(existingState GetActivationUrlInfoResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetActivationUrlInfoResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetActivationUrlInfoResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetActivationUrlInfoResponse +// only implements ToObjectValue() and Type(). +func (o GetActivationUrlInfoResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o GetActivationUrlInfoResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Get a provider type GetProviderRequest struct { // Name of the provider. @@ -157,6 +520,37 @@ func (newState *GetProviderRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetProviderRequest) SyncEffectiveFieldsDuringRead(existingState GetProviderRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetProviderRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetProviderRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetProviderRequest +// only implements ToObjectValue() and Type(). +func (o GetProviderRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetProviderRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + // Get a share recipient type GetRecipientRequest struct { // Name of the recipient. @@ -169,13 +563,44 @@ func (newState *GetRecipientRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetRecipientRequest) SyncEffectiveFieldsDuringRead(existingState GetRecipientRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRecipientRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRecipientRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRecipientRequest +// only implements ToObjectValue() and Type(). +func (o GetRecipientRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRecipientRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type GetRecipientSharePermissionsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of data share permissions for a recipient. - PermissionsOut []ShareToPrivilegeAssignment `tfsdk:"permissions_out" tf:"optional"` + PermissionsOut types.List `tfsdk:"permissions_out" tf:"optional"` } func (newState *GetRecipientSharePermissionsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetRecipientSharePermissionsResponse) { @@ -184,6 +609,69 @@ func (newState *GetRecipientSharePermissionsResponse) SyncEffectiveFieldsDuringC func (newState *GetRecipientSharePermissionsResponse) SyncEffectiveFieldsDuringRead(existingState GetRecipientSharePermissionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRecipientSharePermissionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRecipientSharePermissionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permissions_out": reflect.TypeOf(ShareToPrivilegeAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRecipientSharePermissionsResponse +// only implements ToObjectValue() and Type(). +func (o GetRecipientSharePermissionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "permissions_out": o.PermissionsOut, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRecipientSharePermissionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "permissions_out": basetypes.ListType{ + ElemType: ShareToPrivilegeAssignment{}.Type(ctx), + }, + }, + } +} + +// GetPermissionsOut returns the value of the PermissionsOut field in GetRecipientSharePermissionsResponse as +// a slice of ShareToPrivilegeAssignment values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetRecipientSharePermissionsResponse) GetPermissionsOut(ctx context.Context) ([]ShareToPrivilegeAssignment, bool) { + if o.PermissionsOut.IsNull() || o.PermissionsOut.IsUnknown() { + return nil, false + } + var v []ShareToPrivilegeAssignment + d := o.PermissionsOut.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionsOut sets the value of the PermissionsOut field in GetRecipientSharePermissionsResponse. +func (o *GetRecipientSharePermissionsResponse) SetPermissionsOut(ctx context.Context, v []ShareToPrivilegeAssignment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permissions_out"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionsOut = types.ListValueMust(t, vs) +} + // Get a share type GetShareRequest struct { // Query for data to include in the share. @@ -198,9 +686,42 @@ func (newState *GetShareRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetShareRequest) SyncEffectiveFieldsDuringRead(existingState GetShareRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetShareRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetShareRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetShareRequest +// only implements ToObjectValue() and Type(). +func (o GetShareRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_shared_data": o.IncludeSharedData, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetShareRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "include_shared_data": types.BoolType, + "name": types.StringType, + }, + } +} + type IpAccessList struct { // Allowed IP Addresses in CIDR notation. Limit of 100. - AllowedIpAddresses []types.String `tfsdk:"allowed_ip_addresses" tf:"optional"` + AllowedIpAddresses types.List `tfsdk:"allowed_ip_addresses" tf:"optional"` } func (newState *IpAccessList) SyncEffectiveFieldsDuringCreateOrUpdate(plan IpAccessList) { @@ -209,13 +730,74 @@ func (newState *IpAccessList) SyncEffectiveFieldsDuringCreateOrUpdate(plan IpAcc func (newState *IpAccessList) SyncEffectiveFieldsDuringRead(existingState IpAccessList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in IpAccessList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a IpAccessList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "allowed_ip_addresses": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, IpAccessList +// only implements ToObjectValue() and Type(). +func (o IpAccessList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "allowed_ip_addresses": o.AllowedIpAddresses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o IpAccessList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "allowed_ip_addresses": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetAllowedIpAddresses returns the value of the AllowedIpAddresses field in IpAccessList as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *IpAccessList) GetAllowedIpAddresses(ctx context.Context) ([]types.String, bool) { + if o.AllowedIpAddresses.IsNull() || o.AllowedIpAddresses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.AllowedIpAddresses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllowedIpAddresses sets the value of the AllowedIpAddresses field in IpAccessList. +func (o *IpAccessList) SetAllowedIpAddresses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["allowed_ip_addresses"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllowedIpAddresses = types.ListValueMust(t, vs) +} + type ListProviderSharesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of provider shares. - Shares []ProviderShare `tfsdk:"shares" tf:"optional"` + Shares types.List `tfsdk:"shares" tf:"optional"` } func (newState *ListProviderSharesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListProviderSharesResponse) { @@ -224,6 +806,69 @@ func (newState *ListProviderSharesResponse) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ListProviderSharesResponse) SyncEffectiveFieldsDuringRead(existingState ListProviderSharesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListProviderSharesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListProviderSharesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "shares": reflect.TypeOf(ProviderShare{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListProviderSharesResponse +// only implements ToObjectValue() and Type(). +func (o ListProviderSharesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "shares": o.Shares, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListProviderSharesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "shares": basetypes.ListType{ + ElemType: ProviderShare{}.Type(ctx), + }, + }, + } +} + +// GetShares returns the value of the Shares field in ListProviderSharesResponse as +// a slice of ProviderShare values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListProviderSharesResponse) GetShares(ctx context.Context) ([]ProviderShare, bool) { + if o.Shares.IsNull() || o.Shares.IsUnknown() { + return nil, false + } + var v []ProviderShare + d := o.Shares.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetShares sets the value of the Shares field in ListProviderSharesResponse. +func (o *ListProviderSharesResponse) SetShares(ctx context.Context, v []ProviderShare) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["shares"] + t = t.(attr.TypeWithElementType).ElementType() + o.Shares = types.ListValueMust(t, vs) +} + // List providers type ListProvidersRequest struct { // If not provided, all providers will be returned. If no providers exist @@ -249,13 +894,48 @@ func (newState *ListProvidersRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListProvidersRequest) SyncEffectiveFieldsDuringRead(existingState ListProvidersRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListProvidersRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListProvidersRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListProvidersRequest +// only implements ToObjectValue() and Type(). +func (o ListProvidersRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_provider_global_metastore_id": o.DataProviderGlobalMetastoreId, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListProvidersRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_provider_global_metastore_id": types.StringType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListProvidersResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of provider information objects. - Providers []ProviderInfo `tfsdk:"providers" tf:"optional"` + Providers types.List `tfsdk:"providers" tf:"optional"` } func (newState *ListProvidersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListProvidersResponse) { @@ -264,6 +944,69 @@ func (newState *ListProvidersResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListProvidersResponse) SyncEffectiveFieldsDuringRead(existingState ListProvidersResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListProvidersResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListProvidersResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "providers": reflect.TypeOf(ProviderInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListProvidersResponse +// only implements ToObjectValue() and Type(). +func (o ListProvidersResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "providers": o.Providers, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListProvidersResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "providers": basetypes.ListType{ + ElemType: ProviderInfo{}.Type(ctx), + }, + }, + } +} + +// GetProviders returns the value of the Providers field in ListProvidersResponse as +// a slice of ProviderInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListProvidersResponse) GetProviders(ctx context.Context) ([]ProviderInfo, bool) { + if o.Providers.IsNull() || o.Providers.IsUnknown() { + return nil, false + } + var v []ProviderInfo + d := o.Providers.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProviders sets the value of the Providers field in ListProvidersResponse. +func (o *ListProvidersResponse) SetProviders(ctx context.Context, v []ProviderInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["providers"] + t = t.(attr.TypeWithElementType).ElementType() + o.Providers = types.ListValueMust(t, vs) +} + // List share recipients type ListRecipientsRequest struct { // If not provided, all recipients will be returned. If no recipients exist @@ -289,13 +1032,48 @@ func (newState *ListRecipientsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListRecipientsRequest) SyncEffectiveFieldsDuringRead(existingState ListRecipientsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRecipientsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRecipientsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRecipientsRequest +// only implements ToObjectValue() and Type(). +func (o ListRecipientsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_recipient_global_metastore_id": o.DataRecipientGlobalMetastoreId, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRecipientsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_recipient_global_metastore_id": types.StringType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListRecipientsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of recipient information objects. - Recipients []RecipientInfo `tfsdk:"recipients" tf:"optional"` + Recipients types.List `tfsdk:"recipients" tf:"optional"` } func (newState *ListRecipientsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListRecipientsResponse) { @@ -304,6 +1082,69 @@ func (newState *ListRecipientsResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListRecipientsResponse) SyncEffectiveFieldsDuringRead(existingState ListRecipientsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListRecipientsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListRecipientsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "recipients": reflect.TypeOf(RecipientInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListRecipientsResponse +// only implements ToObjectValue() and Type(). +func (o ListRecipientsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "recipients": o.Recipients, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListRecipientsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "recipients": basetypes.ListType{ + ElemType: RecipientInfo{}.Type(ctx), + }, + }, + } +} + +// GetRecipients returns the value of the Recipients field in ListRecipientsResponse as +// a slice of RecipientInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListRecipientsResponse) GetRecipients(ctx context.Context) ([]RecipientInfo, bool) { + if o.Recipients.IsNull() || o.Recipients.IsUnknown() { + return nil, false + } + var v []RecipientInfo + d := o.Recipients.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRecipients sets the value of the Recipients field in ListRecipientsResponse. +func (o *ListRecipientsResponse) SetRecipients(ctx context.Context, v []RecipientInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["recipients"] + t = t.(attr.TypeWithElementType).ElementType() + o.Recipients = types.ListValueMust(t, vs) +} + // List shares by Provider type ListSharesRequest struct { // Maximum number of shares to return. - when set to 0, the page length is @@ -328,13 +1169,48 @@ func (newState *ListSharesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListSharesRequest) SyncEffectiveFieldsDuringRead(existingState ListSharesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSharesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSharesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSharesRequest +// only implements ToObjectValue() and Type(). +func (o ListSharesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "name": o.Name, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSharesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "name": types.StringType, + "page_token": types.StringType, + }, + } +} + type ListSharesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // An array of data share information objects. - Shares []ShareInfo `tfsdk:"shares" tf:"optional"` + Shares types.List `tfsdk:"shares" tf:"optional"` } func (newState *ListSharesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListSharesResponse) { @@ -343,9 +1219,72 @@ func (newState *ListSharesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListSharesResponse) SyncEffectiveFieldsDuringRead(existingState ListSharesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSharesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSharesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "shares": reflect.TypeOf(ShareInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSharesResponse +// only implements ToObjectValue() and Type(). +func (o ListSharesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "shares": o.Shares, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSharesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "shares": basetypes.ListType{ + ElemType: ShareInfo{}.Type(ctx), + }, + }, + } +} + +// GetShares returns the value of the Shares field in ListSharesResponse as +// a slice of ShareInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListSharesResponse) GetShares(ctx context.Context) ([]ShareInfo, bool) { + if o.Shares.IsNull() || o.Shares.IsUnknown() { + return nil, false + } + var v []ShareInfo + d := o.Shares.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetShares sets the value of the Shares field in ListSharesResponse. +func (o *ListSharesResponse) SetShares(ctx context.Context, v []ShareInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["shares"] + t = t.(attr.TypeWithElementType).ElementType() + o.Shares = types.ListValueMust(t, vs) +} + type Partition struct { // An array of partition values. - Values []PartitionValue `tfsdk:"value" tf:"optional"` + Values types.List `tfsdk:"value" tf:"optional"` } func (newState *Partition) SyncEffectiveFieldsDuringCreateOrUpdate(plan Partition) { @@ -354,9 +1293,70 @@ func (newState *Partition) SyncEffectiveFieldsDuringCreateOrUpdate(plan Partitio func (newState *Partition) SyncEffectiveFieldsDuringRead(existingState Partition) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Partition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Partition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "value": reflect.TypeOf(PartitionValue{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Partition +// only implements ToObjectValue() and Type(). +func (o Partition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Partition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": basetypes.ListType{ + ElemType: PartitionValue{}.Type(ctx), + }, + }, + } +} + +// GetValues returns the value of the Values field in Partition as +// a slice of PartitionValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *Partition) GetValues(ctx context.Context) ([]PartitionValue, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []PartitionValue + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in Partition. +func (o *Partition) SetValues(ctx context.Context, v []PartitionValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["value"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type PartitionSpecificationPartition struct { // An array of partition values. - Values []PartitionValue `tfsdk:"value" tf:"optional"` + Values types.List `tfsdk:"value" tf:"optional"` } func (newState *PartitionSpecificationPartition) SyncEffectiveFieldsDuringCreateOrUpdate(plan PartitionSpecificationPartition) { @@ -365,6 +1365,67 @@ func (newState *PartitionSpecificationPartition) SyncEffectiveFieldsDuringCreate func (newState *PartitionSpecificationPartition) SyncEffectiveFieldsDuringRead(existingState PartitionSpecificationPartition) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PartitionSpecificationPartition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PartitionSpecificationPartition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "value": reflect.TypeOf(PartitionValue{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PartitionSpecificationPartition +// only implements ToObjectValue() and Type(). +func (o PartitionSpecificationPartition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PartitionSpecificationPartition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": basetypes.ListType{ + ElemType: PartitionValue{}.Type(ctx), + }, + }, + } +} + +// GetValues returns the value of the Values field in PartitionSpecificationPartition as +// a slice of PartitionValue values. +// If the field is unknown or null, the boolean return value is false. +func (o *PartitionSpecificationPartition) GetValues(ctx context.Context) ([]PartitionValue, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []PartitionValue + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in PartitionSpecificationPartition. +func (o *PartitionSpecificationPartition) SetValues(ctx context.Context, v []PartitionValue) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["value"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type PartitionValue struct { // The name of the partition column. Name types.String `tfsdk:"name" tf:"optional"` @@ -386,11 +1447,48 @@ func (newState *PartitionValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan Par func (newState *PartitionValue) SyncEffectiveFieldsDuringRead(existingState PartitionValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PartitionValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PartitionValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PartitionValue +// only implements ToObjectValue() and Type(). +func (o PartitionValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "op": o.Op, + "recipient_property_key": o.RecipientPropertyKey, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PartitionValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "op": types.StringType, + "recipient_property_key": types.StringType, + "value": types.StringType, + }, + } +} + type PrivilegeAssignment struct { // The principal (user email address or group name). Principal types.String `tfsdk:"principal" tf:"optional"` // The privileges assigned to the principal. - Privileges []types.String `tfsdk:"privileges" tf:"optional"` + Privileges types.List `tfsdk:"privileges" tf:"optional"` } func (newState *PrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(plan PrivilegeAssignment) { @@ -399,6 +1497,69 @@ func (newState *PrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *PrivilegeAssignment) SyncEffectiveFieldsDuringRead(existingState PrivilegeAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PrivilegeAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PrivilegeAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "privileges": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PrivilegeAssignment +// only implements ToObjectValue() and Type(). +func (o PrivilegeAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principal": o.Principal, + "privileges": o.Privileges, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PrivilegeAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principal": types.StringType, + "privileges": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPrivileges returns the value of the Privileges field in PrivilegeAssignment as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *PrivilegeAssignment) GetPrivileges(ctx context.Context) ([]types.String, bool) { + if o.Privileges.IsNull() || o.Privileges.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Privileges.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrivileges sets the value of the Privileges field in PrivilegeAssignment. +func (o *PrivilegeAssignment) SetPrivileges(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["privileges"] + t = t.(attr.TypeWithElementType).ElementType() + o.Privileges = types.ListValueMust(t, vs) +} + type ProviderInfo struct { // The delta sharing authentication type. AuthenticationType types.String `tfsdk:"authentication_type" tf:"optional"` @@ -424,7 +1585,7 @@ type ProviderInfo struct { Owner types.String `tfsdk:"owner" tf:"optional"` // The recipient profile. This field is only present when the // authentication_type is `TOKEN`. - RecipientProfile []RecipientProfile `tfsdk:"recipient_profile" tf:"optional,object"` + RecipientProfile types.List `tfsdk:"recipient_profile" tf:"optional,object"` // This field is only present when the authentication_type is `TOKEN` or not // provided. RecipientProfileStr types.String `tfsdk:"recipient_profile_str" tf:"optional"` @@ -443,6 +1604,93 @@ func (newState *ProviderInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Provi func (newState *ProviderInfo) SyncEffectiveFieldsDuringRead(existingState ProviderInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ProviderInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ProviderInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "recipient_profile": reflect.TypeOf(RecipientProfile{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ProviderInfo +// only implements ToObjectValue() and Type(). +func (o ProviderInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "authentication_type": o.AuthenticationType, + "cloud": o.Cloud, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "data_provider_global_metastore_id": o.DataProviderGlobalMetastoreId, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "recipient_profile": o.RecipientProfile, + "recipient_profile_str": o.RecipientProfileStr, + "region": o.Region, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ProviderInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "authentication_type": types.StringType, + "cloud": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "data_provider_global_metastore_id": types.StringType, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "recipient_profile": basetypes.ListType{ + ElemType: RecipientProfile{}.Type(ctx), + }, + "recipient_profile_str": types.StringType, + "region": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetRecipientProfile returns the value of the RecipientProfile field in ProviderInfo as +// a RecipientProfile value. +// If the field is unknown or null, the boolean return value is false. +func (o *ProviderInfo) GetRecipientProfile(ctx context.Context) (RecipientProfile, bool) { + var e RecipientProfile + if o.RecipientProfile.IsNull() || o.RecipientProfile.IsUnknown() { + return e, false + } + var v []RecipientProfile + d := o.RecipientProfile.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetRecipientProfile sets the value of the RecipientProfile field in ProviderInfo. +func (o *ProviderInfo) SetRecipientProfile(ctx context.Context, v RecipientProfile) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["recipient_profile"] + o.RecipientProfile = types.ListValueMust(t, vs) +} + type ProviderShare struct { // The name of the Provider Share. Name types.String `tfsdk:"name" tf:"optional"` @@ -454,6 +1702,37 @@ func (newState *ProviderShare) SyncEffectiveFieldsDuringCreateOrUpdate(plan Prov func (newState *ProviderShare) SyncEffectiveFieldsDuringRead(existingState ProviderShare) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ProviderShare. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ProviderShare) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ProviderShare +// only implements ToObjectValue() and Type(). +func (o ProviderShare) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ProviderShare) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type RecipientInfo struct { // A boolean status field showing whether the Recipient's activation URL has // been exercised or not. @@ -478,7 +1757,7 @@ type RecipientInfo struct { // __cloud__:__region__:__metastore-uuid__. DataRecipientGlobalMetastoreId types.String `tfsdk:"data_recipient_global_metastore_id" tf:"optional"` // IP Access List - IpAccessList []IpAccessList `tfsdk:"ip_access_list" tf:"optional,object"` + IpAccessList types.List `tfsdk:"ip_access_list" tf:"optional,object"` // Unique identifier of recipient's Unity Catalog metastore. This field is // only present when the __authentication_type__ is **DATABRICKS** MetastoreId types.String `tfsdk:"metastore_id" tf:"optional"` @@ -487,7 +1766,7 @@ type RecipientInfo struct { // Username of the recipient owner. Owner types.String `tfsdk:"owner" tf:"optional"` // Recipient properties as map of string key-value pairs. - PropertiesKvpairs []SecurablePropertiesKvPairs `tfsdk:"properties_kvpairs" tf:"optional,object"` + PropertiesKvpairs types.List `tfsdk:"properties_kvpairs" tf:"optional,object"` // Cloud region of the recipient's Unity Catalog Metstore. This field is // only present when the __authentication_type__ is **DATABRICKS**. Region types.String `tfsdk:"region" tf:"optional"` @@ -495,7 +1774,7 @@ type RecipientInfo struct { // only present when the __authentication_type__ is **DATABRICKS**. SharingCode types.String `tfsdk:"sharing_code" tf:"optional"` // This field is only present when the __authentication_type__ is **TOKEN**. - Tokens []RecipientTokenInfo `tfsdk:"tokens" tf:"optional"` + Tokens types.List `tfsdk:"tokens" tf:"optional"` // Time at which the recipient was updated, in epoch milliseconds. UpdatedAt types.Int64 `tfsdk:"updated_at" tf:"optional"` // Username of recipient updater. @@ -508,6 +1787,159 @@ func (newState *RecipientInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Reci func (newState *RecipientInfo) SyncEffectiveFieldsDuringRead(existingState RecipientInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RecipientInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RecipientInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_list": reflect.TypeOf(IpAccessList{}), + "properties_kvpairs": reflect.TypeOf(SecurablePropertiesKvPairs{}), + "tokens": reflect.TypeOf(RecipientTokenInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RecipientInfo +// only implements ToObjectValue() and Type(). +func (o RecipientInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activated": o.Activated, + "activation_url": o.ActivationUrl, + "authentication_type": o.AuthenticationType, + "cloud": o.Cloud, + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "data_recipient_global_metastore_id": o.DataRecipientGlobalMetastoreId, + "ip_access_list": o.IpAccessList, + "metastore_id": o.MetastoreId, + "name": o.Name, + "owner": o.Owner, + "properties_kvpairs": o.PropertiesKvpairs, + "region": o.Region, + "sharing_code": o.SharingCode, + "tokens": o.Tokens, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RecipientInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activated": types.BoolType, + "activation_url": types.StringType, + "authentication_type": types.StringType, + "cloud": types.StringType, + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "data_recipient_global_metastore_id": types.StringType, + "ip_access_list": basetypes.ListType{ + ElemType: IpAccessList{}.Type(ctx), + }, + "metastore_id": types.StringType, + "name": types.StringType, + "owner": types.StringType, + "properties_kvpairs": basetypes.ListType{ + ElemType: SecurablePropertiesKvPairs{}.Type(ctx), + }, + "region": types.StringType, + "sharing_code": types.StringType, + "tokens": basetypes.ListType{ + ElemType: RecipientTokenInfo{}.Type(ctx), + }, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetIpAccessList returns the value of the IpAccessList field in RecipientInfo as +// a IpAccessList value. +// If the field is unknown or null, the boolean return value is false. +func (o *RecipientInfo) GetIpAccessList(ctx context.Context) (IpAccessList, bool) { + var e IpAccessList + if o.IpAccessList.IsNull() || o.IpAccessList.IsUnknown() { + return e, false + } + var v []IpAccessList + d := o.IpAccessList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIpAccessList sets the value of the IpAccessList field in RecipientInfo. +func (o *RecipientInfo) SetIpAccessList(ctx context.Context, v IpAccessList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_list"] + o.IpAccessList = types.ListValueMust(t, vs) +} + +// GetPropertiesKvpairs returns the value of the PropertiesKvpairs field in RecipientInfo as +// a SecurablePropertiesKvPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *RecipientInfo) GetPropertiesKvpairs(ctx context.Context) (SecurablePropertiesKvPairs, bool) { + var e SecurablePropertiesKvPairs + if o.PropertiesKvpairs.IsNull() || o.PropertiesKvpairs.IsUnknown() { + return e, false + } + var v []SecurablePropertiesKvPairs + d := o.PropertiesKvpairs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPropertiesKvpairs sets the value of the PropertiesKvpairs field in RecipientInfo. +func (o *RecipientInfo) SetPropertiesKvpairs(ctx context.Context, v SecurablePropertiesKvPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties_kvpairs"] + o.PropertiesKvpairs = types.ListValueMust(t, vs) +} + +// GetTokens returns the value of the Tokens field in RecipientInfo as +// a slice of RecipientTokenInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *RecipientInfo) GetTokens(ctx context.Context) ([]RecipientTokenInfo, bool) { + if o.Tokens.IsNull() || o.Tokens.IsUnknown() { + return nil, false + } + var v []RecipientTokenInfo + d := o.Tokens.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTokens sets the value of the Tokens field in RecipientInfo. +func (o *RecipientInfo) SetTokens(ctx context.Context, v []RecipientTokenInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tokens"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tokens = types.ListValueMust(t, vs) +} + type RecipientProfile struct { // The token used to authorize the recipient. BearerToken types.String `tfsdk:"bearer_token" tf:"optional"` @@ -523,6 +1955,41 @@ func (newState *RecipientProfile) SyncEffectiveFieldsDuringCreateOrUpdate(plan R func (newState *RecipientProfile) SyncEffectiveFieldsDuringRead(existingState RecipientProfile) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RecipientProfile. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RecipientProfile) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RecipientProfile +// only implements ToObjectValue() and Type(). +func (o RecipientProfile) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bearer_token": o.BearerToken, + "endpoint": o.Endpoint, + "share_credentials_version": o.ShareCredentialsVersion, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RecipientProfile) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bearer_token": types.StringType, + "endpoint": types.StringType, + "share_credentials_version": types.Int64Type, + }, + } +} + type RecipientTokenInfo struct { // Full activation URL to retrieve the access token. It will be empty if the // token is already retrieved. @@ -547,6 +2014,49 @@ func (newState *RecipientTokenInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *RecipientTokenInfo) SyncEffectiveFieldsDuringRead(existingState RecipientTokenInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RecipientTokenInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RecipientTokenInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RecipientTokenInfo +// only implements ToObjectValue() and Type(). +func (o RecipientTokenInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activation_url": o.ActivationUrl, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "expiration_time": o.ExpirationTime, + "id": o.Id, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RecipientTokenInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activation_url": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "expiration_time": types.Int64Type, + "id": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + // Get an access token type RetrieveTokenRequest struct { // The one time activation url. It also accepts activation token. @@ -559,6 +2069,37 @@ func (newState *RetrieveTokenRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *RetrieveTokenRequest) SyncEffectiveFieldsDuringRead(existingState RetrieveTokenRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RetrieveTokenRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RetrieveTokenRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RetrieveTokenRequest +// only implements ToObjectValue() and Type(). +func (o RetrieveTokenRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "activation_url": o.ActivationUrl, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RetrieveTokenRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "activation_url": types.StringType, + }, + } +} + type RetrieveTokenResponse struct { // The token used to authorize the recipient. BearerToken types.String `tfsdk:"bearerToken" tf:"optional"` @@ -576,6 +2117,43 @@ func (newState *RetrieveTokenResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *RetrieveTokenResponse) SyncEffectiveFieldsDuringRead(existingState RetrieveTokenResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RetrieveTokenResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RetrieveTokenResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RetrieveTokenResponse +// only implements ToObjectValue() and Type(). +func (o RetrieveTokenResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bearerToken": o.BearerToken, + "endpoint": o.Endpoint, + "expirationTime": o.ExpirationTime, + "shareCredentialsVersion": o.ShareCredentialsVersion, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RetrieveTokenResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bearerToken": types.StringType, + "endpoint": types.StringType, + "expirationTime": types.StringType, + "shareCredentialsVersion": types.Int64Type, + }, + } +} + type RotateRecipientToken struct { // The expiration time of the bearer token in ISO 8601 format. This will set // the expiration_time of existing token only to a smaller timestamp, it @@ -592,11 +2170,44 @@ func (newState *RotateRecipientToken) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *RotateRecipientToken) SyncEffectiveFieldsDuringRead(existingState RotateRecipientToken) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RotateRecipientToken. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RotateRecipientToken) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RotateRecipientToken +// only implements ToObjectValue() and Type(). +func (o RotateRecipientToken) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "existing_token_expire_in_seconds": o.ExistingTokenExpireInSeconds, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RotateRecipientToken) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "existing_token_expire_in_seconds": types.Int64Type, + "name": types.StringType, + }, + } +} + // An object with __properties__ containing map of key-value properties attached // to the securable. type SecurablePropertiesKvPairs struct { // A map of key-value properties attached to the securable. - Properties map[string]types.String `tfsdk:"properties" tf:""` + Properties types.Map `tfsdk:"properties" tf:""` } func (newState *SecurablePropertiesKvPairs) SyncEffectiveFieldsDuringCreateOrUpdate(plan SecurablePropertiesKvPairs) { @@ -605,6 +2216,67 @@ func (newState *SecurablePropertiesKvPairs) SyncEffectiveFieldsDuringCreateOrUpd func (newState *SecurablePropertiesKvPairs) SyncEffectiveFieldsDuringRead(existingState SecurablePropertiesKvPairs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SecurablePropertiesKvPairs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SecurablePropertiesKvPairs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "properties": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SecurablePropertiesKvPairs +// only implements ToObjectValue() and Type(). +func (o SecurablePropertiesKvPairs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "properties": o.Properties, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SecurablePropertiesKvPairs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "properties": basetypes.MapType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetProperties returns the value of the Properties field in SecurablePropertiesKvPairs as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SecurablePropertiesKvPairs) GetProperties(ctx context.Context) (map[string]types.String, bool) { + if o.Properties.IsNull() || o.Properties.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Properties.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetProperties sets the value of the Properties field in SecurablePropertiesKvPairs. +func (o *SecurablePropertiesKvPairs) SetProperties(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties"] + t = t.(attr.TypeWithElementType).ElementType() + o.Properties = types.MapValueMust(t, vs) +} + type ShareInfo struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -615,7 +2287,7 @@ type ShareInfo struct { // Name of the share. Name types.String `tfsdk:"name" tf:"optional"` // A list of shared data objects within the share. - Objects []SharedDataObject `tfsdk:"object" tf:"optional"` + Objects types.List `tfsdk:"object" tf:"optional"` // Username of current owner of share. Owner types.String `tfsdk:"owner" tf:"computed,optional"` // Storage Location URL (full path) for the share. @@ -634,6 +2306,85 @@ func (newState *ShareInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ShareInf func (newState *ShareInfo) SyncEffectiveFieldsDuringRead(existingState ShareInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ShareInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ShareInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "object": reflect.TypeOf(SharedDataObject{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ShareInfo +// only implements ToObjectValue() and Type(). +func (o ShareInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "created_at": o.CreatedAt, + "created_by": o.CreatedBy, + "name": o.Name, + "object": o.Objects, + "owner": o.Owner, + "storage_location": o.StorageLocation, + "storage_root": o.StorageRoot, + "updated_at": o.UpdatedAt, + "updated_by": o.UpdatedBy, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ShareInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "created_at": types.Int64Type, + "created_by": types.StringType, + "name": types.StringType, + "object": basetypes.ListType{ + ElemType: SharedDataObject{}.Type(ctx), + }, + "owner": types.StringType, + "storage_location": types.StringType, + "storage_root": types.StringType, + "updated_at": types.Int64Type, + "updated_by": types.StringType, + }, + } +} + +// GetObjects returns the value of the Objects field in ShareInfo as +// a slice of SharedDataObject values. +// If the field is unknown or null, the boolean return value is false. +func (o *ShareInfo) GetObjects(ctx context.Context) ([]SharedDataObject, bool) { + if o.Objects.IsNull() || o.Objects.IsUnknown() { + return nil, false + } + var v []SharedDataObject + d := o.Objects.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetObjects sets the value of the Objects field in ShareInfo. +func (o *ShareInfo) SetObjects(ctx context.Context, v []SharedDataObject) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["object"] + t = t.(attr.TypeWithElementType).ElementType() + o.Objects = types.ListValueMust(t, vs) +} + // Get recipient share permissions type SharePermissionsRequest struct { // Maximum number of permissions to return. - when set to 0, the page length @@ -658,9 +2409,44 @@ func (newState *SharePermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *SharePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState SharePermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SharePermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SharePermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SharePermissionsRequest +// only implements ToObjectValue() and Type(). +func (o SharePermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "max_results": o.MaxResults, + "name": o.Name, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SharePermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "max_results": types.Int64Type, + "name": types.StringType, + "page_token": types.StringType, + }, + } +} + type ShareToPrivilegeAssignment struct { // The privileges assigned to the principal. - PrivilegeAssignments []PrivilegeAssignment `tfsdk:"privilege_assignments" tf:"optional"` + PrivilegeAssignments types.List `tfsdk:"privilege_assignments" tf:"optional"` // The share name. ShareName types.String `tfsdk:"share_name" tf:"optional"` } @@ -671,6 +2457,69 @@ func (newState *ShareToPrivilegeAssignment) SyncEffectiveFieldsDuringCreateOrUpd func (newState *ShareToPrivilegeAssignment) SyncEffectiveFieldsDuringRead(existingState ShareToPrivilegeAssignment) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ShareToPrivilegeAssignment. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ShareToPrivilegeAssignment) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "privilege_assignments": reflect.TypeOf(PrivilegeAssignment{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ShareToPrivilegeAssignment +// only implements ToObjectValue() and Type(). +func (o ShareToPrivilegeAssignment) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "privilege_assignments": o.PrivilegeAssignments, + "share_name": o.ShareName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ShareToPrivilegeAssignment) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "privilege_assignments": basetypes.ListType{ + ElemType: PrivilegeAssignment{}.Type(ctx), + }, + "share_name": types.StringType, + }, + } +} + +// GetPrivilegeAssignments returns the value of the PrivilegeAssignments field in ShareToPrivilegeAssignment as +// a slice of PrivilegeAssignment values. +// If the field is unknown or null, the boolean return value is false. +func (o *ShareToPrivilegeAssignment) GetPrivilegeAssignments(ctx context.Context) ([]PrivilegeAssignment, bool) { + if o.PrivilegeAssignments.IsNull() || o.PrivilegeAssignments.IsUnknown() { + return nil, false + } + var v []PrivilegeAssignment + d := o.PrivilegeAssignments.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrivilegeAssignments sets the value of the PrivilegeAssignments field in ShareToPrivilegeAssignment. +func (o *ShareToPrivilegeAssignment) SetPrivilegeAssignments(ctx context.Context, v []PrivilegeAssignment) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["privilege_assignments"] + t = t.(attr.TypeWithElementType).ElementType() + o.PrivilegeAssignments = types.ListValueMust(t, vs) +} + type SharedDataObject struct { // The time when this data object is added to the share, in epoch // milliseconds. @@ -699,7 +2548,7 @@ type SharedDataObject struct { // `..`. Name types.String `tfsdk:"name" tf:""` // Array of partitions for the shared data. - Partitions []Partition `tfsdk:"partition" tf:"optional"` + Partitions types.List `tfsdk:"partition" tf:"optional"` // A user-provided new name for the data object within the share. If this // new name is not provided, the object's original name will be used as the // `shared_as` name. The `shared_as` name must be unique within a share. For @@ -755,11 +2604,104 @@ func (newState *SharedDataObject) SyncEffectiveFieldsDuringRead(existingState Sh } } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SharedDataObject. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SharedDataObject) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "partition": reflect.TypeOf(Partition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SharedDataObject +// only implements ToObjectValue() and Type(). +func (o SharedDataObject) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "added_at": o.AddedAt, + "added_by": o.AddedBy, + "cdf_enabled": o.CdfEnabled, + "effective_cdf_enabled": o.EffectiveCdfEnabled, + "comment": o.Comment, + "content": o.Content, + "data_object_type": o.DataObjectType, + "history_data_sharing_status": o.HistoryDataSharingStatus, + "effective_history_data_sharing_status": o.EffectiveHistoryDataSharingStatus, + "name": o.Name, + "partition": o.Partitions, + "shared_as": o.SharedAs, + "effective_shared_as": o.EffectiveSharedAs, + "start_version": o.StartVersion, + "effective_start_version": o.EffectiveStartVersion, + "status": o.Status, + "string_shared_as": o.StringSharedAs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SharedDataObject) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "added_at": types.Int64Type, + "added_by": types.StringType, + "cdf_enabled": types.BoolType, + "effective_cdf_enabled": types.BoolType, + "comment": types.StringType, + "content": types.StringType, + "data_object_type": types.StringType, + "history_data_sharing_status": types.StringType, + "effective_history_data_sharing_status": types.StringType, + "name": types.StringType, + "partition": basetypes.ListType{ + ElemType: Partition{}.Type(ctx), + }, + "shared_as": types.StringType, + "effective_shared_as": types.StringType, + "start_version": types.Int64Type, + "effective_start_version": types.Int64Type, + "status": types.StringType, + "string_shared_as": types.StringType, + }, + } +} + +// GetPartitions returns the value of the Partitions field in SharedDataObject as +// a slice of Partition values. +// If the field is unknown or null, the boolean return value is false. +func (o *SharedDataObject) GetPartitions(ctx context.Context) ([]Partition, bool) { + if o.Partitions.IsNull() || o.Partitions.IsUnknown() { + return nil, false + } + var v []Partition + d := o.Partitions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPartitions sets the value of the Partitions field in SharedDataObject. +func (o *SharedDataObject) SetPartitions(ctx context.Context, v []Partition) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["partition"] + t = t.(attr.TypeWithElementType).ElementType() + o.Partitions = types.ListValueMust(t, vs) +} + type SharedDataObjectUpdate struct { // One of: **ADD**, **REMOVE**, **UPDATE**. Action types.String `tfsdk:"action" tf:"optional"` // The data object that is being added, removed, or updated. - DataObject []SharedDataObject `tfsdk:"data_object" tf:"optional,object"` + DataObject types.List `tfsdk:"data_object" tf:"optional,object"` } func (newState *SharedDataObjectUpdate) SyncEffectiveFieldsDuringCreateOrUpdate(plan SharedDataObjectUpdate) { @@ -768,6 +2710,69 @@ func (newState *SharedDataObjectUpdate) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *SharedDataObjectUpdate) SyncEffectiveFieldsDuringRead(existingState SharedDataObjectUpdate) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SharedDataObjectUpdate. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SharedDataObjectUpdate) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data_object": reflect.TypeOf(SharedDataObject{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SharedDataObjectUpdate +// only implements ToObjectValue() and Type(). +func (o SharedDataObjectUpdate) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "action": o.Action, + "data_object": o.DataObject, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SharedDataObjectUpdate) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "action": types.StringType, + "data_object": basetypes.ListType{ + ElemType: SharedDataObject{}.Type(ctx), + }, + }, + } +} + +// GetDataObject returns the value of the DataObject field in SharedDataObjectUpdate as +// a SharedDataObject value. +// If the field is unknown or null, the boolean return value is false. +func (o *SharedDataObjectUpdate) GetDataObject(ctx context.Context) (SharedDataObject, bool) { + var e SharedDataObject + if o.DataObject.IsNull() || o.DataObject.IsUnknown() { + return e, false + } + var v []SharedDataObject + d := o.DataObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDataObject sets the value of the DataObject field in SharedDataObjectUpdate. +func (o *SharedDataObjectUpdate) SetDataObject(ctx context.Context, v SharedDataObject) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_object"] + o.DataObject = types.ListValueMust(t, vs) +} + type UpdatePermissionsResponse struct { } @@ -777,6 +2782,33 @@ func (newState *UpdatePermissionsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UpdatePermissionsResponse) SyncEffectiveFieldsDuringRead(existingState UpdatePermissionsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdatePermissionsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdatePermissionsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdatePermissionsResponse +// only implements ToObjectValue() and Type(). +func (o UpdatePermissionsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdatePermissionsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateProvider struct { // Description about the provider. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -797,13 +2829,52 @@ func (newState *UpdateProvider) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateProvider) SyncEffectiveFieldsDuringRead(existingState UpdateProvider) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateProvider. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateProvider) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateProvider +// only implements ToObjectValue() and Type(). +func (o UpdateProvider) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + "recipient_profile_str": o.RecipientProfileStr, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateProvider) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "recipient_profile_str": types.StringType, + }, + } +} + type UpdateRecipient struct { // Description about the recipient. Comment types.String `tfsdk:"comment" tf:"optional"` // Expiration timestamp of the token, in epoch milliseconds. ExpirationTime types.Int64 `tfsdk:"expiration_time" tf:"optional"` // IP Access List - IpAccessList []IpAccessList `tfsdk:"ip_access_list" tf:"optional,object"` + IpAccessList types.List `tfsdk:"ip_access_list" tf:"optional,object"` // Name of the recipient. Name types.String `tfsdk:"-"` // New name for the recipient. @@ -814,7 +2885,7 @@ type UpdateRecipient struct { // update request, the specified properties will override the existing // properties. To add and remove properties, one would need to perform a // read-modify-write. - PropertiesKvpairs []SecurablePropertiesKvPairs `tfsdk:"properties_kvpairs" tf:"optional,object"` + PropertiesKvpairs types.List `tfsdk:"properties_kvpairs" tf:"optional,object"` } func (newState *UpdateRecipient) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateRecipient) { @@ -823,6 +2894,108 @@ func (newState *UpdateRecipient) SyncEffectiveFieldsDuringCreateOrUpdate(plan Up func (newState *UpdateRecipient) SyncEffectiveFieldsDuringRead(existingState UpdateRecipient) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRecipient. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRecipient) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "ip_access_list": reflect.TypeOf(IpAccessList{}), + "properties_kvpairs": reflect.TypeOf(SecurablePropertiesKvPairs{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRecipient +// only implements ToObjectValue() and Type(). +func (o UpdateRecipient) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "expiration_time": o.ExpirationTime, + "ip_access_list": o.IpAccessList, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + "properties_kvpairs": o.PropertiesKvpairs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRecipient) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "expiration_time": types.Int64Type, + "ip_access_list": basetypes.ListType{ + ElemType: IpAccessList{}.Type(ctx), + }, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "properties_kvpairs": basetypes.ListType{ + ElemType: SecurablePropertiesKvPairs{}.Type(ctx), + }, + }, + } +} + +// GetIpAccessList returns the value of the IpAccessList field in UpdateRecipient as +// a IpAccessList value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRecipient) GetIpAccessList(ctx context.Context) (IpAccessList, bool) { + var e IpAccessList + if o.IpAccessList.IsNull() || o.IpAccessList.IsUnknown() { + return e, false + } + var v []IpAccessList + d := o.IpAccessList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetIpAccessList sets the value of the IpAccessList field in UpdateRecipient. +func (o *UpdateRecipient) SetIpAccessList(ctx context.Context, v IpAccessList) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["ip_access_list"] + o.IpAccessList = types.ListValueMust(t, vs) +} + +// GetPropertiesKvpairs returns the value of the PropertiesKvpairs field in UpdateRecipient as +// a SecurablePropertiesKvPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRecipient) GetPropertiesKvpairs(ctx context.Context) (SecurablePropertiesKvPairs, bool) { + var e SecurablePropertiesKvPairs + if o.PropertiesKvpairs.IsNull() || o.PropertiesKvpairs.IsUnknown() { + return e, false + } + var v []SecurablePropertiesKvPairs + d := o.PropertiesKvpairs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPropertiesKvpairs sets the value of the PropertiesKvpairs field in UpdateRecipient. +func (o *UpdateRecipient) SetPropertiesKvpairs(ctx context.Context, v SecurablePropertiesKvPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["properties_kvpairs"] + o.PropertiesKvpairs = types.ListValueMust(t, vs) +} + type UpdateResponse struct { } @@ -832,6 +3005,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateShare struct { // User-provided free-form text description. Comment types.String `tfsdk:"comment" tf:"optional"` @@ -844,7 +3044,7 @@ type UpdateShare struct { // Storage root URL for the share. StorageRoot types.String `tfsdk:"storage_root" tf:"optional"` // Array of shared data object updates. - Updates []SharedDataObjectUpdate `tfsdk:"updates" tf:"optional"` + Updates types.List `tfsdk:"updates" tf:"optional"` } func (newState *UpdateShare) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateShare) { @@ -853,9 +3053,80 @@ func (newState *UpdateShare) SyncEffectiveFieldsDuringCreateOrUpdate(plan Update func (newState *UpdateShare) SyncEffectiveFieldsDuringRead(existingState UpdateShare) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateShare. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateShare) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "updates": reflect.TypeOf(SharedDataObjectUpdate{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateShare +// only implements ToObjectValue() and Type(). +func (o UpdateShare) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "comment": o.Comment, + "name": o.Name, + "new_name": o.NewName, + "owner": o.Owner, + "storage_root": o.StorageRoot, + "updates": o.Updates, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateShare) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "comment": types.StringType, + "name": types.StringType, + "new_name": types.StringType, + "owner": types.StringType, + "storage_root": types.StringType, + "updates": basetypes.ListType{ + ElemType: SharedDataObjectUpdate{}.Type(ctx), + }, + }, + } +} + +// GetUpdates returns the value of the Updates field in UpdateShare as +// a slice of SharedDataObjectUpdate values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateShare) GetUpdates(ctx context.Context) ([]SharedDataObjectUpdate, bool) { + if o.Updates.IsNull() || o.Updates.IsUnknown() { + return nil, false + } + var v []SharedDataObjectUpdate + d := o.Updates.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUpdates sets the value of the Updates field in UpdateShare. +func (o *UpdateShare) SetUpdates(ctx context.Context, v []SharedDataObjectUpdate) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["updates"] + t = t.(attr.TypeWithElementType).ElementType() + o.Updates = types.ListValueMust(t, vs) +} + type UpdateSharePermissions struct { // Array of permission changes. - Changes catalog.PermissionsChange `tfsdk:"changes" tf:"optional"` + Changes types.List `tfsdk:"changes" tf:"optional"` // Maximum number of permissions to return. - when set to 0, the page length // is set to a server configured value (recommended); - when set to a value // greater than 0, the page length is the minimum of this value and a server @@ -877,3 +3148,70 @@ func (newState *UpdateSharePermissions) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *UpdateSharePermissions) SyncEffectiveFieldsDuringRead(existingState UpdateSharePermissions) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateSharePermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateSharePermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "changes": reflect.TypeOf(catalog_tf.PermissionsChange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateSharePermissions +// only implements ToObjectValue() and Type(). +func (o UpdateSharePermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "changes": o.Changes, + "max_results": o.MaxResults, + "name": o.Name, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateSharePermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "changes": basetypes.ListType{ + ElemType: catalog_tf.PermissionsChange{}.Type(ctx), + }, + "max_results": types.Int64Type, + "name": types.StringType, + "page_token": types.StringType, + }, + } +} + +// GetChanges returns the value of the Changes field in UpdateSharePermissions as +// a slice of catalog_tf.PermissionsChange values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateSharePermissions) GetChanges(ctx context.Context) ([]catalog_tf.PermissionsChange, bool) { + if o.Changes.IsNull() || o.Changes.IsUnknown() { + return nil, false + } + var v []catalog_tf.PermissionsChange + d := o.Changes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChanges sets the value of the Changes field in UpdateSharePermissions. +func (o *UpdateSharePermissions) SetChanges(ctx context.Context, v []catalog_tf.PermissionsChange) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["changes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Changes = types.ListValueMust(t, vs) +} diff --git a/internal/service/sql_tf/model.go b/internal/service/sql_tf/model.go index b961f1790..9fe1288aa 100755 --- a/internal/service/sql_tf/model.go +++ b/internal/service/sql_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package sql_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AccessControl struct { @@ -29,9 +36,44 @@ func (newState *AccessControl) SyncEffectiveFieldsDuringCreateOrUpdate(plan Acce func (newState *AccessControl) SyncEffectiveFieldsDuringRead(existingState AccessControl) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AccessControl. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AccessControl) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AccessControl +// only implements ToObjectValue() and Type(). +func (o AccessControl) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AccessControl) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "user_name": types.StringType, + }, + } +} + type Alert struct { // Trigger conditions of the alert. - Condition []AlertCondition `tfsdk:"condition" tf:"optional,object"` + Condition types.List `tfsdk:"condition" tf:"optional,object"` // The timestamp indicating when the alert was created. CreateTime types.String `tfsdk:"create_time" tf:"optional"` // Custom body of alert notification, if it exists. See [here] for custom @@ -81,6 +123,95 @@ func (newState *Alert) SyncEffectiveFieldsDuringCreateOrUpdate(plan Alert) { func (newState *Alert) SyncEffectiveFieldsDuringRead(existingState Alert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Alert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Alert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition": reflect.TypeOf(AlertCondition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Alert +// only implements ToObjectValue() and Type(). +func (o Alert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition": o.Condition, + "create_time": o.CreateTime, + "custom_body": o.CustomBody, + "custom_subject": o.CustomSubject, + "display_name": o.DisplayName, + "id": o.Id, + "lifecycle_state": o.LifecycleState, + "notify_on_ok": o.NotifyOnOk, + "owner_user_name": o.OwnerUserName, + "parent_path": o.ParentPath, + "query_id": o.QueryId, + "seconds_to_retrigger": o.SecondsToRetrigger, + "state": o.State, + "trigger_time": o.TriggerTime, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Alert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition": basetypes.ListType{ + ElemType: AlertCondition{}.Type(ctx), + }, + "create_time": types.StringType, + "custom_body": types.StringType, + "custom_subject": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + "lifecycle_state": types.StringType, + "notify_on_ok": types.BoolType, + "owner_user_name": types.StringType, + "parent_path": types.StringType, + "query_id": types.StringType, + "seconds_to_retrigger": types.Int64Type, + "state": types.StringType, + "trigger_time": types.StringType, + "update_time": types.StringType, + }, + } +} + +// GetCondition returns the value of the Condition field in Alert as +// a AlertCondition value. +// If the field is unknown or null, the boolean return value is false. +func (o *Alert) GetCondition(ctx context.Context) (AlertCondition, bool) { + var e AlertCondition + if o.Condition.IsNull() || o.Condition.IsUnknown() { + return e, false + } + var v []AlertCondition + d := o.Condition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCondition sets the value of the Condition field in Alert. +func (o *Alert) SetCondition(ctx context.Context, v AlertCondition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition"] + o.Condition = types.ListValueMust(t, vs) +} + type AlertCondition struct { // Alert state if result is empty. EmptyResultState types.String `tfsdk:"empty_result_state" tf:"optional"` @@ -88,9 +219,9 @@ type AlertCondition struct { Op types.String `tfsdk:"op" tf:"optional"` // Name of the column from the query result to use for comparison in alert // evaluation. - Operand []AlertConditionOperand `tfsdk:"operand" tf:"optional,object"` + Operand types.List `tfsdk:"operand" tf:"optional,object"` // Threshold value used for comparison in alert evaluation. - Threshold []AlertConditionThreshold `tfsdk:"threshold" tf:"optional,object"` + Threshold types.List `tfsdk:"threshold" tf:"optional,object"` } func (newState *AlertCondition) SyncEffectiveFieldsDuringCreateOrUpdate(plan AlertCondition) { @@ -99,8 +230,104 @@ func (newState *AlertCondition) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ale func (newState *AlertCondition) SyncEffectiveFieldsDuringRead(existingState AlertCondition) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertCondition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertCondition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "operand": reflect.TypeOf(AlertConditionOperand{}), + "threshold": reflect.TypeOf(AlertConditionThreshold{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertCondition +// only implements ToObjectValue() and Type(). +func (o AlertCondition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "empty_result_state": o.EmptyResultState, + "op": o.Op, + "operand": o.Operand, + "threshold": o.Threshold, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertCondition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "empty_result_state": types.StringType, + "op": types.StringType, + "operand": basetypes.ListType{ + ElemType: AlertConditionOperand{}.Type(ctx), + }, + "threshold": basetypes.ListType{ + ElemType: AlertConditionThreshold{}.Type(ctx), + }, + }, + } +} + +// GetOperand returns the value of the Operand field in AlertCondition as +// a AlertConditionOperand value. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertCondition) GetOperand(ctx context.Context) (AlertConditionOperand, bool) { + var e AlertConditionOperand + if o.Operand.IsNull() || o.Operand.IsUnknown() { + return e, false + } + var v []AlertConditionOperand + d := o.Operand.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOperand sets the value of the Operand field in AlertCondition. +func (o *AlertCondition) SetOperand(ctx context.Context, v AlertConditionOperand) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["operand"] + o.Operand = types.ListValueMust(t, vs) +} + +// GetThreshold returns the value of the Threshold field in AlertCondition as +// a AlertConditionThreshold value. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertCondition) GetThreshold(ctx context.Context) (AlertConditionThreshold, bool) { + var e AlertConditionThreshold + if o.Threshold.IsNull() || o.Threshold.IsUnknown() { + return e, false + } + var v []AlertConditionThreshold + d := o.Threshold.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetThreshold sets the value of the Threshold field in AlertCondition. +func (o *AlertCondition) SetThreshold(ctx context.Context, v AlertConditionThreshold) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["threshold"] + o.Threshold = types.ListValueMust(t, vs) +} + type AlertConditionOperand struct { - Column []AlertOperandColumn `tfsdk:"column" tf:"optional,object"` + Column types.List `tfsdk:"column" tf:"optional,object"` } func (newState *AlertConditionOperand) SyncEffectiveFieldsDuringCreateOrUpdate(plan AlertConditionOperand) { @@ -109,8 +336,69 @@ func (newState *AlertConditionOperand) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *AlertConditionOperand) SyncEffectiveFieldsDuringRead(existingState AlertConditionOperand) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertConditionOperand. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertConditionOperand) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "column": reflect.TypeOf(AlertOperandColumn{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertConditionOperand +// only implements ToObjectValue() and Type(). +func (o AlertConditionOperand) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "column": o.Column, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertConditionOperand) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "column": basetypes.ListType{ + ElemType: AlertOperandColumn{}.Type(ctx), + }, + }, + } +} + +// GetColumn returns the value of the Column field in AlertConditionOperand as +// a AlertOperandColumn value. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertConditionOperand) GetColumn(ctx context.Context) (AlertOperandColumn, bool) { + var e AlertOperandColumn + if o.Column.IsNull() || o.Column.IsUnknown() { + return e, false + } + var v []AlertOperandColumn + d := o.Column.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetColumn sets the value of the Column field in AlertConditionOperand. +func (o *AlertConditionOperand) SetColumn(ctx context.Context, v AlertOperandColumn) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["column"] + o.Column = types.ListValueMust(t, vs) +} + type AlertConditionThreshold struct { - Value []AlertOperandValue `tfsdk:"value" tf:"optional,object"` + Value types.List `tfsdk:"value" tf:"optional,object"` } func (newState *AlertConditionThreshold) SyncEffectiveFieldsDuringCreateOrUpdate(plan AlertConditionThreshold) { @@ -119,6 +407,67 @@ func (newState *AlertConditionThreshold) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *AlertConditionThreshold) SyncEffectiveFieldsDuringRead(existingState AlertConditionThreshold) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertConditionThreshold. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertConditionThreshold) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "value": reflect.TypeOf(AlertOperandValue{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertConditionThreshold +// only implements ToObjectValue() and Type(). +func (o AlertConditionThreshold) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertConditionThreshold) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": basetypes.ListType{ + ElemType: AlertOperandValue{}.Type(ctx), + }, + }, + } +} + +// GetValue returns the value of the Value field in AlertConditionThreshold as +// a AlertOperandValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertConditionThreshold) GetValue(ctx context.Context) (AlertOperandValue, bool) { + var e AlertOperandValue + if o.Value.IsNull() || o.Value.IsUnknown() { + return e, false + } + var v []AlertOperandValue + d := o.Value.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetValue sets the value of the Value field in AlertConditionThreshold. +func (o *AlertConditionThreshold) SetValue(ctx context.Context, v AlertOperandValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["value"] + o.Value = types.ListValueMust(t, vs) +} + type AlertOperandColumn struct { Name types.String `tfsdk:"name" tf:"optional"` } @@ -129,6 +478,37 @@ func (newState *AlertOperandColumn) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AlertOperandColumn) SyncEffectiveFieldsDuringRead(existingState AlertOperandColumn) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertOperandColumn. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertOperandColumn) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertOperandColumn +// only implements ToObjectValue() and Type(). +func (o AlertOperandColumn) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertOperandColumn) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type AlertOperandValue struct { BoolValue types.Bool `tfsdk:"bool_value" tf:"optional"` @@ -143,6 +523,41 @@ func (newState *AlertOperandValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *AlertOperandValue) SyncEffectiveFieldsDuringRead(existingState AlertOperandValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertOperandValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertOperandValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertOperandValue +// only implements ToObjectValue() and Type(). +func (o AlertOperandValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bool_value": o.BoolValue, + "double_value": o.DoubleValue, + "string_value": o.StringValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertOperandValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bool_value": types.BoolType, + "double_value": types.Float64Type, + "string_value": types.StringType, + }, + } +} + // Alert configuration options. type AlertOptions struct { // Name of column in the query result to compare in alert evaluation. @@ -168,7 +583,7 @@ type AlertOptions struct { Op types.String `tfsdk:"op" tf:""` // Value used to compare in alert evaluation. Supported types include // strings (eg. 'foobar'), floats (eg. 123.4), and booleans (true). - Value any `tfsdk:"value" tf:""` + Value types.Object `tfsdk:"value" tf:""` } func (newState *AlertOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan AlertOptions) { @@ -177,6 +592,49 @@ func (newState *AlertOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan Alert func (newState *AlertOptions) SyncEffectiveFieldsDuringRead(existingState AlertOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertOptions +// only implements ToObjectValue() and Type(). +func (o AlertOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "column": o.Column, + "custom_body": o.CustomBody, + "custom_subject": o.CustomSubject, + "empty_result_state": o.EmptyResultState, + "muted": o.Muted, + "op": o.Op, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "column": types.StringType, + "custom_body": types.StringType, + "custom_subject": types.StringType, + "empty_result_state": types.StringType, + "muted": types.BoolType, + "op": types.StringType, + "value": types.ObjectType{}, + }, + } +} + type AlertQuery struct { // The timestamp when this query was created. CreatedAt types.String `tfsdk:"created_at" tf:"optional"` @@ -208,11 +666,11 @@ type AlertQuery struct { // on the query page. Name types.String `tfsdk:"name" tf:"optional"` - Options []QueryOptions `tfsdk:"options" tf:"optional,object"` + Options types.List `tfsdk:"options" tf:"optional,object"` // The text of the query to be run. Query types.String `tfsdk:"query" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // The timestamp at which this query was last updated. UpdatedAt types.String `tfsdk:"updated_at" tf:"optional"` // The ID of the user who owns the query. @@ -225,6 +683,120 @@ func (newState *AlertQuery) SyncEffectiveFieldsDuringCreateOrUpdate(plan AlertQu func (newState *AlertQuery) SyncEffectiveFieldsDuringRead(existingState AlertQuery) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AlertQuery. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AlertQuery) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(QueryOptions{}), + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AlertQuery +// only implements ToObjectValue() and Type(). +func (o AlertQuery) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "data_source_id": o.DataSourceId, + "description": o.Description, + "id": o.Id, + "is_archived": o.IsArchived, + "is_draft": o.IsDraft, + "is_safe": o.IsSafe, + "name": o.Name, + "options": o.Options, + "query": o.Query, + "tags": o.Tags, + "updated_at": o.UpdatedAt, + "user_id": o.UserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AlertQuery) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.StringType, + "data_source_id": types.StringType, + "description": types.StringType, + "id": types.StringType, + "is_archived": types.BoolType, + "is_draft": types.BoolType, + "is_safe": types.BoolType, + "name": types.StringType, + "options": basetypes.ListType{ + ElemType: QueryOptions{}.Type(ctx), + }, + "query": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "updated_at": types.StringType, + "user_id": types.Int64Type, + }, + } +} + +// GetOptions returns the value of the Options field in AlertQuery as +// a QueryOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertQuery) GetOptions(ctx context.Context) (QueryOptions, bool) { + var e QueryOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []QueryOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in AlertQuery. +func (o *AlertQuery) SetOptions(ctx context.Context, v QueryOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in AlertQuery as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *AlertQuery) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in AlertQuery. +func (o *AlertQuery) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + // Describes metadata for a particular chunk, within a result set; this // structure is used both within a manifest, and when fetching individual chunk // data or links. @@ -246,6 +818,43 @@ func (newState *BaseChunkInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Base func (newState *BaseChunkInfo) SyncEffectiveFieldsDuringRead(existingState BaseChunkInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in BaseChunkInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a BaseChunkInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, BaseChunkInfo +// only implements ToObjectValue() and Type(). +func (o BaseChunkInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "byte_count": o.ByteCount, + "chunk_index": o.ChunkIndex, + "row_count": o.RowCount, + "row_offset": o.RowOffset, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o BaseChunkInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "byte_count": types.Int64Type, + "chunk_index": types.Int64Type, + "row_count": types.Int64Type, + "row_offset": types.Int64Type, + }, + } +} + // Cancel statement execution type CancelExecutionRequest struct { // The statement ID is returned upon successfully submitting a SQL @@ -259,6 +868,37 @@ func (newState *CancelExecutionRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CancelExecutionRequest) SyncEffectiveFieldsDuringRead(existingState CancelExecutionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelExecutionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelExecutionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelExecutionRequest +// only implements ToObjectValue() and Type(). +func (o CancelExecutionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "statement_id": o.StatementId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelExecutionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "statement_id": types.StringType, + }, + } +} + type CancelExecutionResponse struct { } @@ -268,6 +908,33 @@ func (newState *CancelExecutionResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CancelExecutionResponse) SyncEffectiveFieldsDuringRead(existingState CancelExecutionResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CancelExecutionResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CancelExecutionResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CancelExecutionResponse +// only implements ToObjectValue() and Type(). +func (o CancelExecutionResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CancelExecutionResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Configures the channel name and DBSQL version of the warehouse. // CHANNEL_NAME_CUSTOM should be chosen only when `dbsql_version` is specified. type Channel struct { @@ -282,6 +949,39 @@ func (newState *Channel) SyncEffectiveFieldsDuringCreateOrUpdate(plan Channel) { func (newState *Channel) SyncEffectiveFieldsDuringRead(existingState Channel) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Channel. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Channel) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Channel +// only implements ToObjectValue() and Type(). +func (o Channel) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbsql_version": o.DbsqlVersion, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Channel) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbsql_version": types.StringType, + "name": types.StringType, + }, + } +} + // Details about a Channel. type ChannelInfo struct { // DB SQL Version the Channel is mapped to. @@ -296,6 +996,39 @@ func (newState *ChannelInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Channe func (newState *ChannelInfo) SyncEffectiveFieldsDuringRead(existingState ChannelInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ChannelInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ChannelInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ChannelInfo +// only implements ToObjectValue() and Type(). +func (o ChannelInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dbsql_version": o.DbsqlVersion, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ChannelInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dbsql_version": types.StringType, + "name": types.StringType, + }, + } +} + type ColumnInfo struct { // The name of the column. Name types.String `tfsdk:"name" tf:"optional"` @@ -322,11 +1055,54 @@ func (newState *ColumnInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ColumnI func (newState *ColumnInfo) SyncEffectiveFieldsDuringRead(existingState ColumnInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ColumnInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ColumnInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ColumnInfo +// only implements ToObjectValue() and Type(). +func (o ColumnInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "position": o.Position, + "type_interval_type": o.TypeIntervalType, + "type_name": o.TypeName, + "type_precision": o.TypePrecision, + "type_scale": o.TypeScale, + "type_text": o.TypeText, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ColumnInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "position": types.Int64Type, + "type_interval_type": types.StringType, + "type_name": types.StringType, + "type_precision": types.Int64Type, + "type_scale": types.Int64Type, + "type_text": types.StringType, + }, + } +} + type CreateAlert struct { // Name of the alert. Name types.String `tfsdk:"name" tf:""` // Alert configuration options. - Options []AlertOptions `tfsdk:"options" tf:"object"` + Options types.List `tfsdk:"options" tf:"object"` // The identifier of the workspace folder containing the object. Parent types.String `tfsdk:"parent" tf:"optional"` // Query ID. @@ -343,8 +1119,77 @@ func (newState *CreateAlert) SyncEffectiveFieldsDuringCreateOrUpdate(plan Create func (newState *CreateAlert) SyncEffectiveFieldsDuringRead(existingState CreateAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(AlertOptions{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAlert +// only implements ToObjectValue() and Type(). +func (o CreateAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "options": o.Options, + "parent": o.Parent, + "query_id": o.QueryId, + "rearm": o.Rearm, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "options": basetypes.ListType{ + ElemType: AlertOptions{}.Type(ctx), + }, + "parent": types.StringType, + "query_id": types.StringType, + "rearm": types.Int64Type, + }, + } +} + +// GetOptions returns the value of the Options field in CreateAlert as +// a AlertOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateAlert) GetOptions(ctx context.Context) (AlertOptions, bool) { + var e AlertOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []AlertOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in CreateAlert. +func (o *CreateAlert) SetOptions(ctx context.Context, v AlertOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + type CreateAlertRequest struct { - Alert []CreateAlertRequestAlert `tfsdk:"alert" tf:"optional,object"` + Alert types.List `tfsdk:"alert" tf:"optional,object"` } func (newState *CreateAlertRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateAlertRequest) { @@ -353,9 +1198,70 @@ func (newState *CreateAlertRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateAlertRequest) SyncEffectiveFieldsDuringRead(existingState CreateAlertRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAlertRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAlertRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert": reflect.TypeOf(CreateAlertRequestAlert{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAlertRequest +// only implements ToObjectValue() and Type(). +func (o CreateAlertRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert": o.Alert, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAlertRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert": basetypes.ListType{ + ElemType: CreateAlertRequestAlert{}.Type(ctx), + }, + }, + } +} + +// GetAlert returns the value of the Alert field in CreateAlertRequest as +// a CreateAlertRequestAlert value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateAlertRequest) GetAlert(ctx context.Context) (CreateAlertRequestAlert, bool) { + var e CreateAlertRequestAlert + if o.Alert.IsNull() || o.Alert.IsUnknown() { + return e, false + } + var v []CreateAlertRequestAlert + d := o.Alert.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAlert sets the value of the Alert field in CreateAlertRequest. +func (o *CreateAlertRequest) SetAlert(ctx context.Context, v CreateAlertRequestAlert) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert"] + o.Alert = types.ListValueMust(t, vs) +} + type CreateAlertRequestAlert struct { // Trigger conditions of the alert. - Condition []AlertCondition `tfsdk:"condition" tf:"optional,object"` + Condition types.List `tfsdk:"condition" tf:"optional,object"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // @@ -387,8 +1293,83 @@ func (newState *CreateAlertRequestAlert) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateAlertRequestAlert) SyncEffectiveFieldsDuringRead(existingState CreateAlertRequestAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAlertRequestAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAlertRequestAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition": reflect.TypeOf(AlertCondition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAlertRequestAlert +// only implements ToObjectValue() and Type(). +func (o CreateAlertRequestAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition": o.Condition, + "custom_body": o.CustomBody, + "custom_subject": o.CustomSubject, + "display_name": o.DisplayName, + "notify_on_ok": o.NotifyOnOk, + "parent_path": o.ParentPath, + "query_id": o.QueryId, + "seconds_to_retrigger": o.SecondsToRetrigger, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAlertRequestAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition": basetypes.ListType{ + ElemType: AlertCondition{}.Type(ctx), + }, + "custom_body": types.StringType, + "custom_subject": types.StringType, + "display_name": types.StringType, + "notify_on_ok": types.BoolType, + "parent_path": types.StringType, + "query_id": types.StringType, + "seconds_to_retrigger": types.Int64Type, + }, + } +} + +// GetCondition returns the value of the Condition field in CreateAlertRequestAlert as +// a AlertCondition value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateAlertRequestAlert) GetCondition(ctx context.Context) (AlertCondition, bool) { + var e AlertCondition + if o.Condition.IsNull() || o.Condition.IsUnknown() { + return e, false + } + var v []AlertCondition + d := o.Condition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCondition sets the value of the Condition field in CreateAlertRequestAlert. +func (o *CreateAlertRequestAlert) SetCondition(ctx context.Context, v AlertCondition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition"] + o.Condition = types.ListValueMust(t, vs) +} + type CreateQueryRequest struct { - Query []CreateQueryRequestQuery `tfsdk:"query" tf:"optional,object"` + Query types.List `tfsdk:"query" tf:"optional,object"` } func (newState *CreateQueryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateQueryRequest) { @@ -397,6 +1378,67 @@ func (newState *CreateQueryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateQueryRequest) SyncEffectiveFieldsDuringRead(existingState CreateQueryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateQueryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateQueryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "query": reflect.TypeOf(CreateQueryRequestQuery{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateQueryRequest +// only implements ToObjectValue() and Type(). +func (o CreateQueryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query": o.Query, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateQueryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query": basetypes.ListType{ + ElemType: CreateQueryRequestQuery{}.Type(ctx), + }, + }, + } +} + +// GetQuery returns the value of the Query field in CreateQueryRequest as +// a CreateQueryRequestQuery value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateQueryRequest) GetQuery(ctx context.Context) (CreateQueryRequestQuery, bool) { + var e CreateQueryRequestQuery + if o.Query.IsNull() || o.Query.IsUnknown() { + return e, false + } + var v []CreateQueryRequestQuery + d := o.Query.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuery sets the value of the Query field in CreateQueryRequest. +func (o *CreateQueryRequest) SetQuery(ctx context.Context, v CreateQueryRequestQuery) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query"] + o.Query = types.ListValueMust(t, vs) +} + type CreateQueryRequestQuery struct { // Whether to apply a 1000 row limit to the query result. ApplyAutoLimit types.Bool `tfsdk:"apply_auto_limit" tf:"optional"` @@ -409,7 +1451,7 @@ type CreateQueryRequestQuery struct { // and on the query page. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // List of query parameter definitions. - Parameters []QueryParameter `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // Workspace path of the workspace folder containing the object. ParentPath types.String `tfsdk:"parent_path" tf:"optional"` // Text of the query to be run. @@ -419,7 +1461,7 @@ type CreateQueryRequestQuery struct { // Name of the schema where this query will be executed. Schema types.String `tfsdk:"schema" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // ID of the SQL warehouse attached to the query. WarehouseId types.String `tfsdk:"warehouse_id" tf:"optional"` } @@ -430,6 +1472,116 @@ func (newState *CreateQueryRequestQuery) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateQueryRequestQuery) SyncEffectiveFieldsDuringRead(existingState CreateQueryRequestQuery) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateQueryRequestQuery. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateQueryRequestQuery) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(QueryParameter{}), + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateQueryRequestQuery +// only implements ToObjectValue() and Type(). +func (o CreateQueryRequestQuery) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_auto_limit": o.ApplyAutoLimit, + "catalog": o.Catalog, + "description": o.Description, + "display_name": o.DisplayName, + "parameters": o.Parameters, + "parent_path": o.ParentPath, + "query_text": o.QueryText, + "run_as_mode": o.RunAsMode, + "schema": o.Schema, + "tags": o.Tags, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateQueryRequestQuery) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_auto_limit": types.BoolType, + "catalog": types.StringType, + "description": types.StringType, + "display_name": types.StringType, + "parameters": basetypes.ListType{ + ElemType: QueryParameter{}.Type(ctx), + }, + "parent_path": types.StringType, + "query_text": types.StringType, + "run_as_mode": types.StringType, + "schema": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in CreateQueryRequestQuery as +// a slice of QueryParameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateQueryRequestQuery) GetParameters(ctx context.Context) ([]QueryParameter, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []QueryParameter + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in CreateQueryRequestQuery. +func (o *CreateQueryRequestQuery) SetParameters(ctx context.Context, v []QueryParameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in CreateQueryRequestQuery as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateQueryRequestQuery) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in CreateQueryRequestQuery. +func (o *CreateQueryRequestQuery) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + // Add visualization to a query type CreateQueryVisualizationsLegacyRequest struct { // A short description of this visualization. This is not displayed in the @@ -441,11 +1593,11 @@ type CreateQueryVisualizationsLegacyRequest struct { // The options object varies widely from one visualization type to the next // and is unsupported. Databricks does not recommend modifying visualization // settings in JSON. - Options any `tfsdk:"options" tf:""` + Options types.Object `tfsdk:"options" tf:""` // The identifier returned by :method:queries/create QueryId types.String `tfsdk:"query_id" tf:""` // The type of visualization: chart, table, pivot table, and so on. - Type types.String `tfsdk:"type" tf:""` + Type_ types.String `tfsdk:"type" tf:""` } func (newState *CreateQueryVisualizationsLegacyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateQueryVisualizationsLegacyRequest) { @@ -454,8 +1606,47 @@ func (newState *CreateQueryVisualizationsLegacyRequest) SyncEffectiveFieldsDurin func (newState *CreateQueryVisualizationsLegacyRequest) SyncEffectiveFieldsDuringRead(existingState CreateQueryVisualizationsLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateQueryVisualizationsLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateQueryVisualizationsLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateQueryVisualizationsLegacyRequest +// only implements ToObjectValue() and Type(). +func (o CreateQueryVisualizationsLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "name": o.Name, + "options": o.Options, + "query_id": o.QueryId, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateQueryVisualizationsLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "name": types.StringType, + "options": types.ObjectType{}, + "query_id": types.StringType, + "type": types.StringType, + }, + } +} + type CreateVisualizationRequest struct { - Visualization []CreateVisualizationRequestVisualization `tfsdk:"visualization" tf:"optional,object"` + Visualization types.List `tfsdk:"visualization" tf:"optional,object"` } func (newState *CreateVisualizationRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateVisualizationRequest) { @@ -464,6 +1655,67 @@ func (newState *CreateVisualizationRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *CreateVisualizationRequest) SyncEffectiveFieldsDuringRead(existingState CreateVisualizationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateVisualizationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateVisualizationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "visualization": reflect.TypeOf(CreateVisualizationRequestVisualization{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateVisualizationRequest +// only implements ToObjectValue() and Type(). +func (o CreateVisualizationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "visualization": o.Visualization, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateVisualizationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "visualization": basetypes.ListType{ + ElemType: CreateVisualizationRequestVisualization{}.Type(ctx), + }, + }, + } +} + +// GetVisualization returns the value of the Visualization field in CreateVisualizationRequest as +// a CreateVisualizationRequestVisualization value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateVisualizationRequest) GetVisualization(ctx context.Context) (CreateVisualizationRequestVisualization, bool) { + var e CreateVisualizationRequestVisualization + if o.Visualization.IsNull() || o.Visualization.IsUnknown() { + return e, false + } + var v []CreateVisualizationRequestVisualization + d := o.Visualization.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVisualization sets the value of the Visualization field in CreateVisualizationRequest. +func (o *CreateVisualizationRequest) SetVisualization(ctx context.Context, v CreateVisualizationRequestVisualization) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["visualization"] + o.Visualization = types.ListValueMust(t, vs) +} + type CreateVisualizationRequestVisualization struct { // The display name of the visualization. DisplayName types.String `tfsdk:"display_name" tf:"optional"` @@ -478,7 +1730,7 @@ type CreateVisualizationRequestVisualization struct { // visualization query plan directly. SerializedQueryPlan types.String `tfsdk:"serialized_query_plan" tf:"optional"` // The type of visualization: counter, table, funnel, and so on. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *CreateVisualizationRequestVisualization) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateVisualizationRequestVisualization) { @@ -487,6 +1739,45 @@ func (newState *CreateVisualizationRequestVisualization) SyncEffectiveFieldsDuri func (newState *CreateVisualizationRequestVisualization) SyncEffectiveFieldsDuringRead(existingState CreateVisualizationRequestVisualization) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateVisualizationRequestVisualization. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateVisualizationRequestVisualization) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateVisualizationRequestVisualization +// only implements ToObjectValue() and Type(). +func (o CreateVisualizationRequestVisualization) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display_name": o.DisplayName, + "query_id": o.QueryId, + "serialized_options": o.SerializedOptions, + "serialized_query_plan": o.SerializedQueryPlan, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateVisualizationRequestVisualization) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display_name": types.StringType, + "query_id": types.StringType, + "serialized_options": types.StringType, + "serialized_query_plan": types.StringType, + "type": types.StringType, + }, + } +} + type CreateWarehouseRequest struct { // The amount of time in minutes that a SQL warehouse must be idle (i.e., no // RUNNING queries) before it is automatically stopped. @@ -498,7 +1789,7 @@ type CreateWarehouseRequest struct { // Defaults to 120 mins AutoStopMins types.Int64 `tfsdk:"auto_stop_mins" tf:"optional"` // Channel Details - Channel []Channel `tfsdk:"channel" tf:"optional,object"` + Channel types.List `tfsdk:"channel" tf:"optional,object"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to // increase the number of concurrent queries, please tune max_num_clusters. @@ -544,7 +1835,7 @@ type CreateWarehouseRequest struct { // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - Tags []EndpointTags `tfsdk:"tags" tf:"optional,object"` + Tags types.List `tfsdk:"tags" tf:"optional,object"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. @@ -557,6 +1848,120 @@ func (newState *CreateWarehouseRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *CreateWarehouseRequest) SyncEffectiveFieldsDuringRead(existingState CreateWarehouseRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateWarehouseRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateWarehouseRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel": reflect.TypeOf(Channel{}), + "tags": reflect.TypeOf(EndpointTags{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateWarehouseRequest +// only implements ToObjectValue() and Type(). +func (o CreateWarehouseRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_stop_mins": o.AutoStopMins, + "channel": o.Channel, + "cluster_size": o.ClusterSize, + "creator_name": o.CreatorName, + "enable_photon": o.EnablePhoton, + "enable_serverless_compute": o.EnableServerlessCompute, + "instance_profile_arn": o.InstanceProfileArn, + "max_num_clusters": o.MaxNumClusters, + "min_num_clusters": o.MinNumClusters, + "name": o.Name, + "spot_instance_policy": o.SpotInstancePolicy, + "tags": o.Tags, + "warehouse_type": o.WarehouseType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateWarehouseRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_stop_mins": types.Int64Type, + "channel": basetypes.ListType{ + ElemType: Channel{}.Type(ctx), + }, + "cluster_size": types.StringType, + "creator_name": types.StringType, + "enable_photon": types.BoolType, + "enable_serverless_compute": types.BoolType, + "instance_profile_arn": types.StringType, + "max_num_clusters": types.Int64Type, + "min_num_clusters": types.Int64Type, + "name": types.StringType, + "spot_instance_policy": types.StringType, + "tags": basetypes.ListType{ + ElemType: EndpointTags{}.Type(ctx), + }, + "warehouse_type": types.StringType, + }, + } +} + +// GetChannel returns the value of the Channel field in CreateWarehouseRequest as +// a Channel value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWarehouseRequest) GetChannel(ctx context.Context) (Channel, bool) { + var e Channel + if o.Channel.IsNull() || o.Channel.IsUnknown() { + return e, false + } + var v []Channel + d := o.Channel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannel sets the value of the Channel field in CreateWarehouseRequest. +func (o *CreateWarehouseRequest) SetChannel(ctx context.Context, v Channel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel"] + o.Channel = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in CreateWarehouseRequest as +// a EndpointTags value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWarehouseRequest) GetTags(ctx context.Context) (EndpointTags, bool) { + var e EndpointTags + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return e, false + } + var v []EndpointTags + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTags sets the value of the Tags field in CreateWarehouseRequest. +func (o *CreateWarehouseRequest) SetTags(ctx context.Context, v EndpointTags) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + o.Tags = types.ListValueMust(t, vs) +} + type CreateWarehouseResponse struct { // Id for the SQL warehouse. This value is unique across all SQL warehouses. Id types.String `tfsdk:"id" tf:"optional"` @@ -568,13 +1973,44 @@ func (newState *CreateWarehouseResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *CreateWarehouseResponse) SyncEffectiveFieldsDuringRead(existingState CreateWarehouseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateWarehouseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateWarehouseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateWarehouseResponse +// only implements ToObjectValue() and Type(). +func (o CreateWarehouseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateWarehouseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type CreateWidget struct { // Dashboard ID returned by :method:dashboards/create. DashboardId types.String `tfsdk:"dashboard_id" tf:""` // Widget ID returned by :method:dashboardwidgets/create Id types.String `tfsdk:"-"` - Options []WidgetOptions `tfsdk:"options" tf:"object"` + Options types.List `tfsdk:"options" tf:"object"` // If this is a textbox widget, the application displays this text. This // field is ignored if the widget contains a visualization in the // `visualization` field. @@ -591,6 +2027,77 @@ func (newState *CreateWidget) SyncEffectiveFieldsDuringCreateOrUpdate(plan Creat func (newState *CreateWidget) SyncEffectiveFieldsDuringRead(existingState CreateWidget) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateWidget. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateWidget) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(WidgetOptions{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateWidget +// only implements ToObjectValue() and Type(). +func (o CreateWidget) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "id": o.Id, + "options": o.Options, + "text": o.Text, + "visualization_id": o.VisualizationId, + "width": o.Width, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateWidget) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "id": types.StringType, + "options": basetypes.ListType{ + ElemType: WidgetOptions{}.Type(ctx), + }, + "text": types.StringType, + "visualization_id": types.StringType, + "width": types.Int64Type, + }, + } +} + +// GetOptions returns the value of the Options field in CreateWidget as +// a WidgetOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateWidget) GetOptions(ctx context.Context) (WidgetOptions, bool) { + var e WidgetOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []WidgetOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in CreateWidget. +func (o *CreateWidget) SetOptions(ctx context.Context, v WidgetOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + // A JSON representing a dashboard containing widgets of visualizations and text // boxes. type Dashboard struct { @@ -619,7 +2126,7 @@ type Dashboard struct { // the dashboard page. Name types.String `tfsdk:"name" tf:"optional"` - Options []DashboardOptions `tfsdk:"options" tf:"optional,object"` + Options types.List `tfsdk:"options" tf:"optional,object"` // The identifier of the workspace folder containing the object. Parent types.String `tfsdk:"parent" tf:"optional"` // * `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * @@ -629,15 +2136,15 @@ type Dashboard struct { // spaces. Appears in the URL for this query. Slug types.String `tfsdk:"slug" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // Timestamp when this dashboard was last updated. UpdatedAt types.String `tfsdk:"updated_at" tf:"optional"` - User []User `tfsdk:"user" tf:"optional,object"` + User types.List `tfsdk:"user" tf:"optional,object"` // The ID of the user who owns the dashboard. UserId types.Int64 `tfsdk:"user_id" tf:"optional"` - Widgets []Widget `tfsdk:"widgets" tf:"optional"` + Widgets types.List `tfsdk:"widgets" tf:"optional"` } func (newState *Dashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dashboard) { @@ -646,6 +2153,186 @@ func (newState *Dashboard) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dashboar func (newState *Dashboard) SyncEffectiveFieldsDuringRead(existingState Dashboard) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Dashboard. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Dashboard) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(DashboardOptions{}), + "tags": reflect.TypeOf(types.String{}), + "user": reflect.TypeOf(User{}), + "widgets": reflect.TypeOf(Widget{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Dashboard +// only implements ToObjectValue() and Type(). +func (o Dashboard) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "can_edit": o.CanEdit, + "created_at": o.CreatedAt, + "dashboard_filters_enabled": o.DashboardFiltersEnabled, + "id": o.Id, + "is_archived": o.IsArchived, + "is_draft": o.IsDraft, + "is_favorite": o.IsFavorite, + "name": o.Name, + "options": o.Options, + "parent": o.Parent, + "permission_tier": o.PermissionTier, + "slug": o.Slug, + "tags": o.Tags, + "updated_at": o.UpdatedAt, + "user": o.User, + "user_id": o.UserId, + "widgets": o.Widgets, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Dashboard) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "can_edit": types.BoolType, + "created_at": types.StringType, + "dashboard_filters_enabled": types.BoolType, + "id": types.StringType, + "is_archived": types.BoolType, + "is_draft": types.BoolType, + "is_favorite": types.BoolType, + "name": types.StringType, + "options": basetypes.ListType{ + ElemType: DashboardOptions{}.Type(ctx), + }, + "parent": types.StringType, + "permission_tier": types.StringType, + "slug": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "updated_at": types.StringType, + "user": basetypes.ListType{ + ElemType: User{}.Type(ctx), + }, + "user_id": types.Int64Type, + "widgets": basetypes.ListType{ + ElemType: Widget{}.Type(ctx), + }, + }, + } +} + +// GetOptions returns the value of the Options field in Dashboard as +// a DashboardOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *Dashboard) GetOptions(ctx context.Context) (DashboardOptions, bool) { + var e DashboardOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []DashboardOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in Dashboard. +func (o *Dashboard) SetOptions(ctx context.Context, v DashboardOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in Dashboard as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Dashboard) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in Dashboard. +func (o *Dashboard) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + +// GetUser returns the value of the User field in Dashboard as +// a User value. +// If the field is unknown or null, the boolean return value is false. +func (o *Dashboard) GetUser(ctx context.Context) (User, bool) { + var e User + if o.User.IsNull() || o.User.IsUnknown() { + return e, false + } + var v []User + d := o.User.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUser sets the value of the User field in Dashboard. +func (o *Dashboard) SetUser(ctx context.Context, v User) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["user"] + o.User = types.ListValueMust(t, vs) +} + +// GetWidgets returns the value of the Widgets field in Dashboard as +// a slice of Widget values. +// If the field is unknown or null, the boolean return value is false. +func (o *Dashboard) GetWidgets(ctx context.Context) ([]Widget, bool) { + if o.Widgets.IsNull() || o.Widgets.IsUnknown() { + return nil, false + } + var v []Widget + d := o.Widgets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWidgets sets the value of the Widgets field in Dashboard. +func (o *Dashboard) SetWidgets(ctx context.Context, v []Widget) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["widgets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Widgets = types.ListValueMust(t, vs) +} + type DashboardEditContent struct { DashboardId types.String `tfsdk:"-"` // The title of this dashboard that appears in list views and at the top of @@ -656,7 +2343,7 @@ type DashboardEditContent struct { // owner" behavior) RunAsRole types.String `tfsdk:"run_as_role" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *DashboardEditContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan DashboardEditContent) { @@ -665,6 +2352,73 @@ func (newState *DashboardEditContent) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DashboardEditContent) SyncEffectiveFieldsDuringRead(existingState DashboardEditContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DashboardEditContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DashboardEditContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DashboardEditContent +// only implements ToObjectValue() and Type(). +func (o DashboardEditContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + "name": o.Name, + "run_as_role": o.RunAsRole, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DashboardEditContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + "name": types.StringType, + "run_as_role": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetTags returns the value of the Tags field in DashboardEditContent as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DashboardEditContent) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in DashboardEditContent. +func (o *DashboardEditContent) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type DashboardOptions struct { // The timestamp when this dashboard was moved to trash. Only present when // the `is_archived` property is `true`. Trashed items are deleted after @@ -678,6 +2432,37 @@ func (newState *DashboardOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan D func (newState *DashboardOptions) SyncEffectiveFieldsDuringRead(existingState DashboardOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DashboardOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DashboardOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DashboardOptions +// only implements ToObjectValue() and Type(). +func (o DashboardOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "moved_to_trash_at": o.MovedToTrashAt, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DashboardOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "moved_to_trash_at": types.StringType, + }, + } +} + type DashboardPostContent struct { // Indicates whether the dashboard filters are enabled DashboardFiltersEnabled types.Bool `tfsdk:"dashboard_filters_enabled" tf:"optional"` @@ -694,7 +2479,7 @@ type DashboardPostContent struct { // owner" behavior) RunAsRole types.String `tfsdk:"run_as_role" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *DashboardPostContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan DashboardPostContent) { @@ -703,6 +2488,77 @@ func (newState *DashboardPostContent) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DashboardPostContent) SyncEffectiveFieldsDuringRead(existingState DashboardPostContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DashboardPostContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DashboardPostContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DashboardPostContent +// only implements ToObjectValue() and Type(). +func (o DashboardPostContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_filters_enabled": o.DashboardFiltersEnabled, + "is_favorite": o.IsFavorite, + "name": o.Name, + "parent": o.Parent, + "run_as_role": o.RunAsRole, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DashboardPostContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_filters_enabled": types.BoolType, + "is_favorite": types.BoolType, + "name": types.StringType, + "parent": types.StringType, + "run_as_role": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetTags returns the value of the Tags field in DashboardPostContent as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DashboardPostContent) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in DashboardPostContent. +func (o *DashboardPostContent) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + // A JSON object representing a DBSQL data source / SQL warehouse. type DataSource struct { // Data source ID maps to the ID of the data source used by the resource and @@ -723,7 +2579,7 @@ type DataSource struct { Syntax types.String `tfsdk:"syntax" tf:"optional"` // The type of data source. For SQL warehouses, this will be // `databricks_internal`. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` // Reserved for internal use. ViewOnly types.Bool `tfsdk:"view_only" tf:"optional"` // The ID of the associated SQL warehouse, if this data source is backed by @@ -737,6 +2593,53 @@ func (newState *DataSource) SyncEffectiveFieldsDuringCreateOrUpdate(plan DataSou func (newState *DataSource) SyncEffectiveFieldsDuringRead(existingState DataSource) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DataSource. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DataSource) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DataSource +// only implements ToObjectValue() and Type(). +func (o DataSource) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "name": o.Name, + "pause_reason": o.PauseReason, + "paused": o.Paused, + "supports_auto_limit": o.SupportsAutoLimit, + "syntax": o.Syntax, + "type": o.Type_, + "view_only": o.ViewOnly, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DataSource) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "name": types.StringType, + "pause_reason": types.StringType, + "paused": types.Int64Type, + "supports_auto_limit": types.BoolType, + "syntax": types.StringType, + "type": types.StringType, + "view_only": types.BoolType, + "warehouse_id": types.StringType, + }, + } +} + type DateRange struct { End types.String `tfsdk:"end" tf:""` @@ -749,9 +2652,42 @@ func (newState *DateRange) SyncEffectiveFieldsDuringCreateOrUpdate(plan DateRang func (newState *DateRange) SyncEffectiveFieldsDuringRead(existingState DateRange) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DateRange. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DateRange) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DateRange +// only implements ToObjectValue() and Type(). +func (o DateRange) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end": o.End, + "start": o.Start, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DateRange) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end": types.StringType, + "start": types.StringType, + }, + } +} + type DateRangeValue struct { // Manually specified date-time range value. - DateRangeValue []DateRange `tfsdk:"date_range_value" tf:"optional,object"` + DateRangeValue types.List `tfsdk:"date_range_value" tf:"optional,object"` // Dynamic date-time range value based on current date-time. DynamicDateRangeValue types.String `tfsdk:"dynamic_date_range_value" tf:"optional"` // Date-time precision to format the value into when the query is run. @@ -767,6 +2703,73 @@ func (newState *DateRangeValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan Dat func (newState *DateRangeValue) SyncEffectiveFieldsDuringRead(existingState DateRangeValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DateRangeValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DateRangeValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "date_range_value": reflect.TypeOf(DateRange{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DateRangeValue +// only implements ToObjectValue() and Type(). +func (o DateRangeValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "date_range_value": o.DateRangeValue, + "dynamic_date_range_value": o.DynamicDateRangeValue, + "precision": o.Precision, + "start_day_of_week": o.StartDayOfWeek, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DateRangeValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "date_range_value": basetypes.ListType{ + ElemType: DateRange{}.Type(ctx), + }, + "dynamic_date_range_value": types.StringType, + "precision": types.StringType, + "start_day_of_week": types.Int64Type, + }, + } +} + +// GetDateRangeValue returns the value of the DateRangeValue field in DateRangeValue as +// a DateRange value. +// If the field is unknown or null, the boolean return value is false. +func (o *DateRangeValue) GetDateRangeValue(ctx context.Context) (DateRange, bool) { + var e DateRange + if o.DateRangeValue.IsNull() || o.DateRangeValue.IsUnknown() { + return e, false + } + var v []DateRange + d := o.DateRangeValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDateRangeValue sets the value of the DateRangeValue field in DateRangeValue. +func (o *DateRangeValue) SetDateRangeValue(ctx context.Context, v DateRange) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["date_range_value"] + o.DateRangeValue = types.ListValueMust(t, vs) +} + type DateValue struct { // Manually specified date-time value. DateValue types.String `tfsdk:"date_value" tf:"optional"` @@ -783,6 +2786,41 @@ func (newState *DateValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan DateValu func (newState *DateValue) SyncEffectiveFieldsDuringRead(existingState DateValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DateValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DateValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DateValue +// only implements ToObjectValue() and Type(). +func (o DateValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "date_value": o.DateValue, + "dynamic_date_value": o.DynamicDateValue, + "precision": o.Precision, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DateValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "date_value": types.StringType, + "dynamic_date_value": types.StringType, + "precision": types.StringType, + }, + } +} + // Delete an alert type DeleteAlertsLegacyRequest struct { AlertId types.String `tfsdk:"-"` @@ -794,6 +2832,37 @@ func (newState *DeleteAlertsLegacyRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteAlertsLegacyRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAlertsLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAlertsLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAlertsLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAlertsLegacyRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAlertsLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_id": o.AlertId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAlertsLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_id": types.StringType, + }, + } +} + // Remove a dashboard type DeleteDashboardRequest struct { DashboardId types.String `tfsdk:"-"` @@ -805,6 +2874,37 @@ func (newState *DeleteDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteDashboardRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDashboardRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + // Remove widget type DeleteDashboardWidgetRequest struct { // Widget ID returned by :method:dashboardwidgets/create @@ -817,6 +2917,37 @@ func (newState *DeleteDashboardWidgetRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteDashboardWidgetRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDashboardWidgetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDashboardWidgetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDashboardWidgetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDashboardWidgetRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDashboardWidgetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDashboardWidgetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a query type DeleteQueriesLegacyRequest struct { QueryId types.String `tfsdk:"-"` @@ -828,6 +2959,37 @@ func (newState *DeleteQueriesLegacyRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteQueriesLegacyRequest) SyncEffectiveFieldsDuringRead(existingState DeleteQueriesLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteQueriesLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteQueriesLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteQueriesLegacyRequest +// only implements ToObjectValue() and Type(). +func (o DeleteQueriesLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query_id": o.QueryId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteQueriesLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query_id": types.StringType, + }, + } +} + // Remove visualization type DeleteQueryVisualizationsLegacyRequest struct { // Widget ID returned by :method:queryvizualisations/create @@ -840,6 +3002,37 @@ func (newState *DeleteQueryVisualizationsLegacyRequest) SyncEffectiveFieldsDurin func (newState *DeleteQueryVisualizationsLegacyRequest) SyncEffectiveFieldsDuringRead(existingState DeleteQueryVisualizationsLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteQueryVisualizationsLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteQueryVisualizationsLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteQueryVisualizationsLegacyRequest +// only implements ToObjectValue() and Type(). +func (o DeleteQueryVisualizationsLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteQueryVisualizationsLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteResponse struct { } @@ -849,6 +3042,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Remove a visualization type DeleteVisualizationRequest struct { Id types.String `tfsdk:"-"` @@ -860,6 +3080,37 @@ func (newState *DeleteVisualizationRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *DeleteVisualizationRequest) SyncEffectiveFieldsDuringRead(existingState DeleteVisualizationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteVisualizationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteVisualizationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteVisualizationRequest +// only implements ToObjectValue() and Type(). +func (o DeleteVisualizationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteVisualizationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a warehouse type DeleteWarehouseRequest struct { // Required. Id of the SQL warehouse. @@ -872,6 +3123,37 @@ func (newState *DeleteWarehouseRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteWarehouseRequest) SyncEffectiveFieldsDuringRead(existingState DeleteWarehouseRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWarehouseRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWarehouseRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWarehouseRequest +// only implements ToObjectValue() and Type(). +func (o DeleteWarehouseRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWarehouseRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type DeleteWarehouseResponse struct { } @@ -881,12 +3163,39 @@ func (newState *DeleteWarehouseResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *DeleteWarehouseResponse) SyncEffectiveFieldsDuringRead(existingState DeleteWarehouseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteWarehouseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteWarehouseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteWarehouseResponse +// only implements ToObjectValue() and Type(). +func (o DeleteWarehouseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteWarehouseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EditAlert struct { AlertId types.String `tfsdk:"-"` // Name of the alert. Name types.String `tfsdk:"name" tf:""` // Alert configuration options. - Options []AlertOptions `tfsdk:"options" tf:"object"` + Options types.List `tfsdk:"options" tf:"object"` // Query ID. QueryId types.String `tfsdk:"query_id" tf:""` // Number of seconds after being triggered before the alert rearms itself @@ -901,6 +3210,75 @@ func (newState *EditAlert) SyncEffectiveFieldsDuringCreateOrUpdate(plan EditAler func (newState *EditAlert) SyncEffectiveFieldsDuringRead(existingState EditAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(AlertOptions{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditAlert +// only implements ToObjectValue() and Type(). +func (o EditAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_id": o.AlertId, + "name": o.Name, + "options": o.Options, + "query_id": o.QueryId, + "rearm": o.Rearm, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EditAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_id": types.StringType, + "name": types.StringType, + "options": basetypes.ListType{ + ElemType: AlertOptions{}.Type(ctx), + }, + "query_id": types.StringType, + "rearm": types.Int64Type, + }, + } +} + +// GetOptions returns the value of the Options field in EditAlert as +// a AlertOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditAlert) GetOptions(ctx context.Context) (AlertOptions, bool) { + var e AlertOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []AlertOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in EditAlert. +func (o *EditAlert) SetOptions(ctx context.Context, v AlertOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + type EditWarehouseRequest struct { // The amount of time in minutes that a SQL warehouse must be idle (i.e., no // RUNNING queries) before it is automatically stopped. @@ -910,7 +3288,7 @@ type EditWarehouseRequest struct { // Defaults to 120 mins AutoStopMins types.Int64 `tfsdk:"auto_stop_mins" tf:"optional"` // Channel Details - Channel []Channel `tfsdk:"channel" tf:"optional,object"` + Channel types.List `tfsdk:"channel" tf:"optional,object"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to // increase the number of concurrent queries, please tune max_num_clusters. @@ -958,7 +3336,7 @@ type EditWarehouseRequest struct { // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - Tags []EndpointTags `tfsdk:"tags" tf:"optional,object"` + Tags types.List `tfsdk:"tags" tf:"optional,object"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. @@ -971,6 +3349,122 @@ func (newState *EditWarehouseRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *EditWarehouseRequest) SyncEffectiveFieldsDuringRead(existingState EditWarehouseRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditWarehouseRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditWarehouseRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel": reflect.TypeOf(Channel{}), + "tags": reflect.TypeOf(EndpointTags{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditWarehouseRequest +// only implements ToObjectValue() and Type(). +func (o EditWarehouseRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_stop_mins": o.AutoStopMins, + "channel": o.Channel, + "cluster_size": o.ClusterSize, + "creator_name": o.CreatorName, + "enable_photon": o.EnablePhoton, + "enable_serverless_compute": o.EnableServerlessCompute, + "id": o.Id, + "instance_profile_arn": o.InstanceProfileArn, + "max_num_clusters": o.MaxNumClusters, + "min_num_clusters": o.MinNumClusters, + "name": o.Name, + "spot_instance_policy": o.SpotInstancePolicy, + "tags": o.Tags, + "warehouse_type": o.WarehouseType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EditWarehouseRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_stop_mins": types.Int64Type, + "channel": basetypes.ListType{ + ElemType: Channel{}.Type(ctx), + }, + "cluster_size": types.StringType, + "creator_name": types.StringType, + "enable_photon": types.BoolType, + "enable_serverless_compute": types.BoolType, + "id": types.StringType, + "instance_profile_arn": types.StringType, + "max_num_clusters": types.Int64Type, + "min_num_clusters": types.Int64Type, + "name": types.StringType, + "spot_instance_policy": types.StringType, + "tags": basetypes.ListType{ + ElemType: EndpointTags{}.Type(ctx), + }, + "warehouse_type": types.StringType, + }, + } +} + +// GetChannel returns the value of the Channel field in EditWarehouseRequest as +// a Channel value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditWarehouseRequest) GetChannel(ctx context.Context) (Channel, bool) { + var e Channel + if o.Channel.IsNull() || o.Channel.IsUnknown() { + return e, false + } + var v []Channel + d := o.Channel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannel sets the value of the Channel field in EditWarehouseRequest. +func (o *EditWarehouseRequest) SetChannel(ctx context.Context, v Channel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel"] + o.Channel = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in EditWarehouseRequest as +// a EndpointTags value. +// If the field is unknown or null, the boolean return value is false. +func (o *EditWarehouseRequest) GetTags(ctx context.Context) (EndpointTags, bool) { + var e EndpointTags + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return e, false + } + var v []EndpointTags + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTags sets the value of the Tags field in EditWarehouseRequest. +func (o *EditWarehouseRequest) SetTags(ctx context.Context, v EndpointTags) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + o.Tags = types.ListValueMust(t, vs) +} + type EditWarehouseResponse struct { } @@ -980,6 +3474,33 @@ func (newState *EditWarehouseResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *EditWarehouseResponse) SyncEffectiveFieldsDuringRead(existingState EditWarehouseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EditWarehouseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EditWarehouseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EditWarehouseResponse +// only implements ToObjectValue() and Type(). +func (o EditWarehouseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o EditWarehouseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Represents an empty message, similar to google.protobuf.Empty, which is not // available in the firm right now. type Empty struct { @@ -991,6 +3512,33 @@ func (newState *Empty) SyncEffectiveFieldsDuringCreateOrUpdate(plan Empty) { func (newState *Empty) SyncEffectiveFieldsDuringRead(existingState Empty) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Empty. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Empty) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Empty +// only implements ToObjectValue() and Type(). +func (o Empty) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o Empty) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type EndpointConfPair struct { Key types.String `tfsdk:"key" tf:"optional"` @@ -1003,12 +3551,45 @@ func (newState *EndpointConfPair) SyncEffectiveFieldsDuringCreateOrUpdate(plan E func (newState *EndpointConfPair) SyncEffectiveFieldsDuringRead(existingState EndpointConfPair) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointConfPair. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointConfPair) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointConfPair +// only implements ToObjectValue() and Type(). +func (o EndpointConfPair) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointConfPair) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type EndpointHealth struct { // Details about errors that are causing current degraded/failed status. Details types.String `tfsdk:"details" tf:"optional"` // The reason for failure to bring up clusters for this warehouse. This is // available when status is 'FAILED' and sometimes when it is DEGRADED. - FailureReason []TerminationReason `tfsdk:"failure_reason" tf:"optional,object"` + FailureReason types.List `tfsdk:"failure_reason" tf:"optional,object"` // Deprecated. split into summary and details for security Message types.String `tfsdk:"message" tf:"optional"` // Health status of the warehouse. @@ -1024,6 +3605,75 @@ func (newState *EndpointHealth) SyncEffectiveFieldsDuringCreateOrUpdate(plan End func (newState *EndpointHealth) SyncEffectiveFieldsDuringRead(existingState EndpointHealth) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointHealth. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointHealth) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "failure_reason": reflect.TypeOf(TerminationReason{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointHealth +// only implements ToObjectValue() and Type(). +func (o EndpointHealth) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "details": o.Details, + "failure_reason": o.FailureReason, + "message": o.Message, + "status": o.Status, + "summary": o.Summary, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointHealth) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "details": types.StringType, + "failure_reason": basetypes.ListType{ + ElemType: TerminationReason{}.Type(ctx), + }, + "message": types.StringType, + "status": types.StringType, + "summary": types.StringType, + }, + } +} + +// GetFailureReason returns the value of the FailureReason field in EndpointHealth as +// a TerminationReason value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointHealth) GetFailureReason(ctx context.Context) (TerminationReason, bool) { + var e TerminationReason + if o.FailureReason.IsNull() || o.FailureReason.IsUnknown() { + return e, false + } + var v []TerminationReason + d := o.FailureReason.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFailureReason sets the value of the FailureReason field in EndpointHealth. +func (o *EndpointHealth) SetFailureReason(ctx context.Context, v TerminationReason) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["failure_reason"] + o.FailureReason = types.ListValueMust(t, vs) +} + type EndpointInfo struct { // The amount of time in minutes that a SQL warehouse must be idle (i.e., no // RUNNING queries) before it is automatically stopped. @@ -1033,7 +3683,7 @@ type EndpointInfo struct { // Defaults to 120 mins AutoStopMins types.Int64 `tfsdk:"auto_stop_mins" tf:"optional"` // Channel Details - Channel []Channel `tfsdk:"channel" tf:"optional,object"` + Channel types.List `tfsdk:"channel" tf:"optional,object"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to // increase the number of concurrent queries, please tune max_num_clusters. @@ -1051,7 +3701,7 @@ type EndpointInfo struct { EnableServerlessCompute types.Bool `tfsdk:"enable_serverless_compute" tf:"optional"` // Optional health status. Assume the warehouse is healthy if this field is // not set. - Health []EndpointHealth `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // unique identifier for warehouse Id types.String `tfsdk:"id" tf:"optional"` // Deprecated. Instance profile used to pass IAM role to the cluster @@ -1085,7 +3735,7 @@ type EndpointInfo struct { // current number of clusters running for the service NumClusters types.Int64 `tfsdk:"num_clusters" tf:"optional"` // ODBC parameters for the SQL warehouse - OdbcParams []OdbcParams `tfsdk:"odbc_params" tf:"optional,object"` + OdbcParams types.List `tfsdk:"odbc_params" tf:"optional,object"` // Configurations whether the warehouse should use spot instances. SpotInstancePolicy types.String `tfsdk:"spot_instance_policy" tf:"optional"` // State of the warehouse @@ -1094,7 +3744,7 @@ type EndpointInfo struct { // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - Tags []EndpointTags `tfsdk:"tags" tf:"optional,object"` + Tags types.List `tfsdk:"tags" tf:"optional,object"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. @@ -1107,6 +3757,192 @@ func (newState *EndpointInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Endpo func (newState *EndpointInfo) SyncEffectiveFieldsDuringRead(existingState EndpointInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel": reflect.TypeOf(Channel{}), + "health": reflect.TypeOf(EndpointHealth{}), + "odbc_params": reflect.TypeOf(OdbcParams{}), + "tags": reflect.TypeOf(EndpointTags{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointInfo +// only implements ToObjectValue() and Type(). +func (o EndpointInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_stop_mins": o.AutoStopMins, + "channel": o.Channel, + "cluster_size": o.ClusterSize, + "creator_name": o.CreatorName, + "enable_photon": o.EnablePhoton, + "enable_serverless_compute": o.EnableServerlessCompute, + "health": o.Health, + "id": o.Id, + "instance_profile_arn": o.InstanceProfileArn, + "jdbc_url": o.JdbcUrl, + "max_num_clusters": o.MaxNumClusters, + "min_num_clusters": o.MinNumClusters, + "name": o.Name, + "num_active_sessions": o.NumActiveSessions, + "num_clusters": o.NumClusters, + "odbc_params": o.OdbcParams, + "spot_instance_policy": o.SpotInstancePolicy, + "state": o.State, + "tags": o.Tags, + "warehouse_type": o.WarehouseType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_stop_mins": types.Int64Type, + "channel": basetypes.ListType{ + ElemType: Channel{}.Type(ctx), + }, + "cluster_size": types.StringType, + "creator_name": types.StringType, + "enable_photon": types.BoolType, + "enable_serverless_compute": types.BoolType, + "health": basetypes.ListType{ + ElemType: EndpointHealth{}.Type(ctx), + }, + "id": types.StringType, + "instance_profile_arn": types.StringType, + "jdbc_url": types.StringType, + "max_num_clusters": types.Int64Type, + "min_num_clusters": types.Int64Type, + "name": types.StringType, + "num_active_sessions": types.Int64Type, + "num_clusters": types.Int64Type, + "odbc_params": basetypes.ListType{ + ElemType: OdbcParams{}.Type(ctx), + }, + "spot_instance_policy": types.StringType, + "state": types.StringType, + "tags": basetypes.ListType{ + ElemType: EndpointTags{}.Type(ctx), + }, + "warehouse_type": types.StringType, + }, + } +} + +// GetChannel returns the value of the Channel field in EndpointInfo as +// a Channel value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointInfo) GetChannel(ctx context.Context) (Channel, bool) { + var e Channel + if o.Channel.IsNull() || o.Channel.IsUnknown() { + return e, false + } + var v []Channel + d := o.Channel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannel sets the value of the Channel field in EndpointInfo. +func (o *EndpointInfo) SetChannel(ctx context.Context, v Channel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel"] + o.Channel = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in EndpointInfo as +// a EndpointHealth value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointInfo) GetHealth(ctx context.Context) (EndpointHealth, bool) { + var e EndpointHealth + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []EndpointHealth + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in EndpointInfo. +func (o *EndpointInfo) SetHealth(ctx context.Context, v EndpointHealth) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetOdbcParams returns the value of the OdbcParams field in EndpointInfo as +// a OdbcParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointInfo) GetOdbcParams(ctx context.Context) (OdbcParams, bool) { + var e OdbcParams + if o.OdbcParams.IsNull() || o.OdbcParams.IsUnknown() { + return e, false + } + var v []OdbcParams + d := o.OdbcParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOdbcParams sets the value of the OdbcParams field in EndpointInfo. +func (o *EndpointInfo) SetOdbcParams(ctx context.Context, v OdbcParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["odbc_params"] + o.OdbcParams = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in EndpointInfo as +// a EndpointTags value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointInfo) GetTags(ctx context.Context) (EndpointTags, bool) { + var e EndpointTags + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return e, false + } + var v []EndpointTags + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTags sets the value of the Tags field in EndpointInfo. +func (o *EndpointInfo) SetTags(ctx context.Context, v EndpointTags) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + o.Tags = types.ListValueMust(t, vs) +} + type EndpointTagPair struct { Key types.String `tfsdk:"key" tf:"optional"` @@ -1119,8 +3955,41 @@ func (newState *EndpointTagPair) SyncEffectiveFieldsDuringCreateOrUpdate(plan En func (newState *EndpointTagPair) SyncEffectiveFieldsDuringRead(existingState EndpointTagPair) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointTagPair. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointTagPair) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointTagPair +// only implements ToObjectValue() and Type(). +func (o EndpointTagPair) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointTagPair) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + type EndpointTags struct { - CustomTags []EndpointTagPair `tfsdk:"custom_tags" tf:"optional"` + CustomTags types.List `tfsdk:"custom_tags" tf:"optional"` } func (newState *EndpointTags) SyncEffectiveFieldsDuringCreateOrUpdate(plan EndpointTags) { @@ -1129,13 +3998,74 @@ func (newState *EndpointTags) SyncEffectiveFieldsDuringCreateOrUpdate(plan Endpo func (newState *EndpointTags) SyncEffectiveFieldsDuringRead(existingState EndpointTags) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointTags. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointTags) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "custom_tags": reflect.TypeOf(EndpointTagPair{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointTags +// only implements ToObjectValue() and Type(). +func (o EndpointTags) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "custom_tags": o.CustomTags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointTags) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "custom_tags": basetypes.ListType{ + ElemType: EndpointTagPair{}.Type(ctx), + }, + }, + } +} + +// GetCustomTags returns the value of the CustomTags field in EndpointTags as +// a slice of EndpointTagPair values. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointTags) GetCustomTags(ctx context.Context) ([]EndpointTagPair, bool) { + if o.CustomTags.IsNull() || o.CustomTags.IsUnknown() { + return nil, false + } + var v []EndpointTagPair + d := o.CustomTags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCustomTags sets the value of the CustomTags field in EndpointTags. +func (o *EndpointTags) SetCustomTags(ctx context.Context, v []EndpointTagPair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["custom_tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.CustomTags = types.ListValueMust(t, vs) +} + type EnumValue struct { // List of valid query parameter values, newline delimited. EnumOptions types.String `tfsdk:"enum_options" tf:"optional"` // If specified, allows multiple values to be selected for this parameter. - MultiValuesOptions []MultiValuesOptions `tfsdk:"multi_values_options" tf:"optional,object"` + MultiValuesOptions types.List `tfsdk:"multi_values_options" tf:"optional,object"` // List of selected query parameter values. - Values []types.String `tfsdk:"values" tf:"optional"` + Values types.List `tfsdk:"values" tf:"optional"` } func (newState *EnumValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan EnumValue) { @@ -1144,6 +4074,100 @@ func (newState *EnumValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan EnumValu func (newState *EnumValue) SyncEffectiveFieldsDuringRead(existingState EnumValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EnumValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EnumValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "multi_values_options": reflect.TypeOf(MultiValuesOptions{}), + "values": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EnumValue +// only implements ToObjectValue() and Type(). +func (o EnumValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enum_options": o.EnumOptions, + "multi_values_options": o.MultiValuesOptions, + "values": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EnumValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enum_options": types.StringType, + "multi_values_options": basetypes.ListType{ + ElemType: MultiValuesOptions{}.Type(ctx), + }, + "values": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetMultiValuesOptions returns the value of the MultiValuesOptions field in EnumValue as +// a MultiValuesOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *EnumValue) GetMultiValuesOptions(ctx context.Context) (MultiValuesOptions, bool) { + var e MultiValuesOptions + if o.MultiValuesOptions.IsNull() || o.MultiValuesOptions.IsUnknown() { + return e, false + } + var v []MultiValuesOptions + d := o.MultiValuesOptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMultiValuesOptions sets the value of the MultiValuesOptions field in EnumValue. +func (o *EnumValue) SetMultiValuesOptions(ctx context.Context, v MultiValuesOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["multi_values_options"] + o.MultiValuesOptions = types.ListValueMust(t, vs) +} + +// GetValues returns the value of the Values field in EnumValue as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *EnumValue) GetValues(ctx context.Context) ([]types.String, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in EnumValue. +func (o *EnumValue) SetValues(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["values"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type ExecuteStatementRequest struct { // Applies the given byte limit to the statement's result size. Byte counts // are based on internal data representations and might not match the final @@ -1235,7 +4259,7 @@ type ExecuteStatementRequest struct { // // [Parameter markers]: https://docs.databricks.com/sql/language-manual/sql-ref-parameter-marker.html // [`cast` function]: https://docs.databricks.com/sql/language-manual/functions/cast.html - Parameters []StatementParameterListItem `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // Applies the given row limit to the statement's result set, but unlike the // `LIMIT` clause in SQL, it also sets the `truncated` field in the response // to indicate whether the result was trimmed due to the limit or not. @@ -1276,6 +4300,87 @@ func (newState *ExecuteStatementRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ExecuteStatementRequest) SyncEffectiveFieldsDuringRead(existingState ExecuteStatementRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExecuteStatementRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExecuteStatementRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(StatementParameterListItem{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExecuteStatementRequest +// only implements ToObjectValue() and Type(). +func (o ExecuteStatementRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "byte_limit": o.ByteLimit, + "catalog": o.Catalog, + "disposition": o.Disposition, + "format": o.Format, + "on_wait_timeout": o.OnWaitTimeout, + "parameters": o.Parameters, + "row_limit": o.RowLimit, + "schema": o.Schema, + "statement": o.Statement, + "wait_timeout": o.WaitTimeout, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExecuteStatementRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "byte_limit": types.Int64Type, + "catalog": types.StringType, + "disposition": types.StringType, + "format": types.StringType, + "on_wait_timeout": types.StringType, + "parameters": basetypes.ListType{ + ElemType: StatementParameterListItem{}.Type(ctx), + }, + "row_limit": types.Int64Type, + "schema": types.StringType, + "statement": types.StringType, + "wait_timeout": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in ExecuteStatementRequest as +// a slice of StatementParameterListItem values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExecuteStatementRequest) GetParameters(ctx context.Context) ([]StatementParameterListItem, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []StatementParameterListItem + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in ExecuteStatementRequest. +func (o *ExecuteStatementRequest) SetParameters(ctx context.Context, v []StatementParameterListItem) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type ExternalLink struct { // The number of bytes in the result chunk. This field is not available when // using `INLINE` disposition. @@ -1293,7 +4398,7 @@ type ExternalLink struct { // typically used to pass a decryption key to the external service. The // values of these headers should be considered sensitive and the client // should not expose these values in a log. - HttpHeaders map[string]types.String `tfsdk:"http_headers" tf:"optional"` + HttpHeaders types.Map `tfsdk:"http_headers" tf:"optional"` // When fetching, provides the `chunk_index` for the _next_ chunk. If // absent, indicates there are no more chunks. The next chunk can be fetched // with a :method:statementexecution/getStatementResultChunkN request. @@ -1315,6 +4420,83 @@ func (newState *ExternalLink) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exter func (newState *ExternalLink) SyncEffectiveFieldsDuringRead(existingState ExternalLink) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExternalLink. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExternalLink) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "http_headers": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExternalLink +// only implements ToObjectValue() and Type(). +func (o ExternalLink) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "byte_count": o.ByteCount, + "chunk_index": o.ChunkIndex, + "expiration": o.Expiration, + "external_link": o.ExternalLink, + "http_headers": o.HttpHeaders, + "next_chunk_index": o.NextChunkIndex, + "next_chunk_internal_link": o.NextChunkInternalLink, + "row_count": o.RowCount, + "row_offset": o.RowOffset, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExternalLink) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "byte_count": types.Int64Type, + "chunk_index": types.Int64Type, + "expiration": types.StringType, + "external_link": types.StringType, + "http_headers": basetypes.MapType{ + ElemType: types.StringType, + }, + "next_chunk_index": types.Int64Type, + "next_chunk_internal_link": types.StringType, + "row_count": types.Int64Type, + "row_offset": types.Int64Type, + }, + } +} + +// GetHttpHeaders returns the value of the HttpHeaders field in ExternalLink as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ExternalLink) GetHttpHeaders(ctx context.Context) (map[string]types.String, bool) { + if o.HttpHeaders.IsNull() || o.HttpHeaders.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.HttpHeaders.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetHttpHeaders sets the value of the HttpHeaders field in ExternalLink. +func (o *ExternalLink) SetHttpHeaders(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["http_headers"] + t = t.(attr.TypeWithElementType).ElementType() + o.HttpHeaders = types.MapValueMust(t, vs) +} + // Get an alert type GetAlertRequest struct { Id types.String `tfsdk:"-"` @@ -1326,6 +4508,37 @@ func (newState *GetAlertRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetAlertRequest) SyncEffectiveFieldsDuringRead(existingState GetAlertRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAlertRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAlertRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAlertRequest +// only implements ToObjectValue() and Type(). +func (o GetAlertRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAlertRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Get an alert type GetAlertsLegacyRequest struct { AlertId types.String `tfsdk:"-"` @@ -1337,6 +4550,37 @@ func (newState *GetAlertsLegacyRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetAlertsLegacyRequest) SyncEffectiveFieldsDuringRead(existingState GetAlertsLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAlertsLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAlertsLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAlertsLegacyRequest +// only implements ToObjectValue() and Type(). +func (o GetAlertsLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert_id": o.AlertId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAlertsLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert_id": types.StringType, + }, + } +} + // Retrieve a definition type GetDashboardRequest struct { DashboardId types.String `tfsdk:"-"` @@ -1348,6 +4592,37 @@ func (newState *GetDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetDashboardRequest) SyncEffectiveFieldsDuringRead(existingState GetDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDashboardRequest +// only implements ToObjectValue() and Type(). +func (o GetDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + // Get object ACL type GetDbsqlPermissionRequest struct { // Object ID. An ACL is returned for the object with this UUID. @@ -1362,6 +4637,39 @@ func (newState *GetDbsqlPermissionRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GetDbsqlPermissionRequest) SyncEffectiveFieldsDuringRead(existingState GetDbsqlPermissionRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetDbsqlPermissionRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetDbsqlPermissionRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetDbsqlPermissionRequest +// only implements ToObjectValue() and Type(). +func (o GetDbsqlPermissionRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "objectId": o.ObjectId, + "objectType": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetDbsqlPermissionRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "objectId": types.StringType, + "objectType": types.StringType, + }, + } +} + // Get a query definition. type GetQueriesLegacyRequest struct { QueryId types.String `tfsdk:"-"` @@ -1373,6 +4681,37 @@ func (newState *GetQueriesLegacyRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *GetQueriesLegacyRequest) SyncEffectiveFieldsDuringRead(existingState GetQueriesLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetQueriesLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetQueriesLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetQueriesLegacyRequest +// only implements ToObjectValue() and Type(). +func (o GetQueriesLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query_id": o.QueryId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetQueriesLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query_id": types.StringType, + }, + } +} + // Get a query type GetQueryRequest struct { Id types.String `tfsdk:"-"` @@ -1384,8 +4723,39 @@ func (newState *GetQueryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetQueryRequest) SyncEffectiveFieldsDuringRead(existingState GetQueryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetQueryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetQueryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetQueryRequest +// only implements ToObjectValue() and Type(). +func (o GetQueryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetQueryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetResponse struct { - AccessControlList []AccessControl `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // An object's type and UUID, separated by a forward slash (/) character. ObjectId types.String `tfsdk:"object_id" tf:"optional"` // A singular noun object type. @@ -1398,6 +4768,71 @@ func (newState *GetResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetRes func (newState *GetResponse) SyncEffectiveFieldsDuringRead(existingState GetResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AccessControl{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetResponse +// only implements ToObjectValue() and Type(). +func (o GetResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AccessControl{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in GetResponse as +// a slice of AccessControl values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetResponse) GetAccessControlList(ctx context.Context) ([]AccessControl, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AccessControl + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in GetResponse. +func (o *GetResponse) SetAccessControlList(ctx context.Context, v []AccessControl) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + // Get status, manifest, and result first chunk type GetStatementRequest struct { // The statement ID is returned upon successfully submitting a SQL @@ -1411,6 +4846,37 @@ func (newState *GetStatementRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetStatementRequest) SyncEffectiveFieldsDuringRead(existingState GetStatementRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStatementRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStatementRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStatementRequest +// only implements ToObjectValue() and Type(). +func (o GetStatementRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "statement_id": o.StatementId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStatementRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "statement_id": types.StringType, + }, + } +} + // Get result chunk by index type GetStatementResultChunkNRequest struct { ChunkIndex types.Int64 `tfsdk:"-"` @@ -1425,6 +4891,39 @@ func (newState *GetStatementResultChunkNRequest) SyncEffectiveFieldsDuringCreate func (newState *GetStatementResultChunkNRequest) SyncEffectiveFieldsDuringRead(existingState GetStatementResultChunkNRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStatementResultChunkNRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStatementResultChunkNRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStatementResultChunkNRequest +// only implements ToObjectValue() and Type(). +func (o GetStatementResultChunkNRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "chunk_index": o.ChunkIndex, + "statement_id": o.StatementId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStatementResultChunkNRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "chunk_index": types.Int64Type, + "statement_id": types.StringType, + }, + } +} + // Get SQL warehouse permission levels type GetWarehousePermissionLevelsRequest struct { // The SQL warehouse for which to get or manage permissions. @@ -1437,9 +4936,40 @@ func (newState *GetWarehousePermissionLevelsRequest) SyncEffectiveFieldsDuringCr func (newState *GetWarehousePermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetWarehousePermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWarehousePermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWarehousePermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWarehousePermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetWarehousePermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWarehousePermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "warehouse_id": types.StringType, + }, + } +} + type GetWarehousePermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []WarehousePermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetWarehousePermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetWarehousePermissionLevelsResponse) { @@ -1448,16 +4978,108 @@ func (newState *GetWarehousePermissionLevelsResponse) SyncEffectiveFieldsDuringC func (newState *GetWarehousePermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetWarehousePermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWarehousePermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWarehousePermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(WarehousePermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWarehousePermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetWarehousePermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWarehousePermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: WarehousePermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetWarehousePermissionLevelsResponse as +// a slice of WarehousePermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWarehousePermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]WarehousePermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []WarehousePermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetWarehousePermissionLevelsResponse. +func (o *GetWarehousePermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []WarehousePermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get SQL warehouse permissions type GetWarehousePermissionsRequest struct { // The SQL warehouse for which to get or manage permissions. WarehouseId types.String `tfsdk:"-"` } -func (newState *GetWarehousePermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetWarehousePermissionsRequest) { +func (newState *GetWarehousePermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetWarehousePermissionsRequest) { +} + +func (newState *GetWarehousePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetWarehousePermissionsRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWarehousePermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWarehousePermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWarehousePermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetWarehousePermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "warehouse_id": o.WarehouseId, + }) } -func (newState *GetWarehousePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetWarehousePermissionsRequest) { +// Type implements basetypes.ObjectValuable. +func (o GetWarehousePermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "warehouse_id": types.StringType, + }, + } } // Get warehouse info @@ -1472,6 +5094,37 @@ func (newState *GetWarehouseRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *GetWarehouseRequest) SyncEffectiveFieldsDuringRead(existingState GetWarehouseRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWarehouseRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWarehouseRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWarehouseRequest +// only implements ToObjectValue() and Type(). +func (o GetWarehouseRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWarehouseRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type GetWarehouseResponse struct { // The amount of time in minutes that a SQL warehouse must be idle (i.e., no // RUNNING queries) before it is automatically stopped. @@ -1481,7 +5134,7 @@ type GetWarehouseResponse struct { // Defaults to 120 mins AutoStopMins types.Int64 `tfsdk:"auto_stop_mins" tf:"optional"` // Channel Details - Channel []Channel `tfsdk:"channel" tf:"optional,object"` + Channel types.List `tfsdk:"channel" tf:"optional,object"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to // increase the number of concurrent queries, please tune max_num_clusters. @@ -1499,7 +5152,7 @@ type GetWarehouseResponse struct { EnableServerlessCompute types.Bool `tfsdk:"enable_serverless_compute" tf:"optional"` // Optional health status. Assume the warehouse is healthy if this field is // not set. - Health []EndpointHealth `tfsdk:"health" tf:"optional,object"` + Health types.List `tfsdk:"health" tf:"optional,object"` // unique identifier for warehouse Id types.String `tfsdk:"id" tf:"optional"` // Deprecated. Instance profile used to pass IAM role to the cluster @@ -1533,7 +5186,7 @@ type GetWarehouseResponse struct { // current number of clusters running for the service NumClusters types.Int64 `tfsdk:"num_clusters" tf:"optional"` // ODBC parameters for the SQL warehouse - OdbcParams []OdbcParams `tfsdk:"odbc_params" tf:"optional,object"` + OdbcParams types.List `tfsdk:"odbc_params" tf:"optional,object"` // Configurations whether the warehouse should use spot instances. SpotInstancePolicy types.String `tfsdk:"spot_instance_policy" tf:"optional"` // State of the warehouse @@ -1542,7 +5195,7 @@ type GetWarehouseResponse struct { // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - Tags []EndpointTags `tfsdk:"tags" tf:"optional,object"` + Tags types.List `tfsdk:"tags" tf:"optional,object"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. @@ -1555,23 +5208,209 @@ func (newState *GetWarehouseResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *GetWarehouseResponse) SyncEffectiveFieldsDuringRead(existingState GetWarehouseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWarehouseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWarehouseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel": reflect.TypeOf(Channel{}), + "health": reflect.TypeOf(EndpointHealth{}), + "odbc_params": reflect.TypeOf(OdbcParams{}), + "tags": reflect.TypeOf(EndpointTags{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWarehouseResponse +// only implements ToObjectValue() and Type(). +func (o GetWarehouseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "auto_stop_mins": o.AutoStopMins, + "channel": o.Channel, + "cluster_size": o.ClusterSize, + "creator_name": o.CreatorName, + "enable_photon": o.EnablePhoton, + "enable_serverless_compute": o.EnableServerlessCompute, + "health": o.Health, + "id": o.Id, + "instance_profile_arn": o.InstanceProfileArn, + "jdbc_url": o.JdbcUrl, + "max_num_clusters": o.MaxNumClusters, + "min_num_clusters": o.MinNumClusters, + "name": o.Name, + "num_active_sessions": o.NumActiveSessions, + "num_clusters": o.NumClusters, + "odbc_params": o.OdbcParams, + "spot_instance_policy": o.SpotInstancePolicy, + "state": o.State, + "tags": o.Tags, + "warehouse_type": o.WarehouseType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWarehouseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "auto_stop_mins": types.Int64Type, + "channel": basetypes.ListType{ + ElemType: Channel{}.Type(ctx), + }, + "cluster_size": types.StringType, + "creator_name": types.StringType, + "enable_photon": types.BoolType, + "enable_serverless_compute": types.BoolType, + "health": basetypes.ListType{ + ElemType: EndpointHealth{}.Type(ctx), + }, + "id": types.StringType, + "instance_profile_arn": types.StringType, + "jdbc_url": types.StringType, + "max_num_clusters": types.Int64Type, + "min_num_clusters": types.Int64Type, + "name": types.StringType, + "num_active_sessions": types.Int64Type, + "num_clusters": types.Int64Type, + "odbc_params": basetypes.ListType{ + ElemType: OdbcParams{}.Type(ctx), + }, + "spot_instance_policy": types.StringType, + "state": types.StringType, + "tags": basetypes.ListType{ + ElemType: EndpointTags{}.Type(ctx), + }, + "warehouse_type": types.StringType, + }, + } +} + +// GetChannel returns the value of the Channel field in GetWarehouseResponse as +// a Channel value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWarehouseResponse) GetChannel(ctx context.Context) (Channel, bool) { + var e Channel + if o.Channel.IsNull() || o.Channel.IsUnknown() { + return e, false + } + var v []Channel + d := o.Channel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannel sets the value of the Channel field in GetWarehouseResponse. +func (o *GetWarehouseResponse) SetChannel(ctx context.Context, v Channel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel"] + o.Channel = types.ListValueMust(t, vs) +} + +// GetHealth returns the value of the Health field in GetWarehouseResponse as +// a EndpointHealth value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWarehouseResponse) GetHealth(ctx context.Context) (EndpointHealth, bool) { + var e EndpointHealth + if o.Health.IsNull() || o.Health.IsUnknown() { + return e, false + } + var v []EndpointHealth + d := o.Health.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetHealth sets the value of the Health field in GetWarehouseResponse. +func (o *GetWarehouseResponse) SetHealth(ctx context.Context, v EndpointHealth) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["health"] + o.Health = types.ListValueMust(t, vs) +} + +// GetOdbcParams returns the value of the OdbcParams field in GetWarehouseResponse as +// a OdbcParams value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWarehouseResponse) GetOdbcParams(ctx context.Context) (OdbcParams, bool) { + var e OdbcParams + if o.OdbcParams.IsNull() || o.OdbcParams.IsUnknown() { + return e, false + } + var v []OdbcParams + d := o.OdbcParams.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOdbcParams sets the value of the OdbcParams field in GetWarehouseResponse. +func (o *GetWarehouseResponse) SetOdbcParams(ctx context.Context, v OdbcParams) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["odbc_params"] + o.OdbcParams = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in GetWarehouseResponse as +// a EndpointTags value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWarehouseResponse) GetTags(ctx context.Context) (EndpointTags, bool) { + var e EndpointTags + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return e, false + } + var v []EndpointTags + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTags sets the value of the Tags field in GetWarehouseResponse. +func (o *GetWarehouseResponse) SetTags(ctx context.Context, v EndpointTags) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + o.Tags = types.ListValueMust(t, vs) +} + type GetWorkspaceWarehouseConfigResponse struct { // Optional: Channel selection details - Channel []Channel `tfsdk:"channel" tf:"optional,object"` + Channel types.List `tfsdk:"channel" tf:"optional,object"` // Deprecated: Use sql_configuration_parameters - ConfigParam []RepeatedEndpointConfPairs `tfsdk:"config_param" tf:"optional,object"` + ConfigParam types.List `tfsdk:"config_param" tf:"optional,object"` // Spark confs for external hive metastore configuration JSON serialized // size must be less than <= 512K - DataAccessConfig []EndpointConfPair `tfsdk:"data_access_config" tf:"optional"` + DataAccessConfig types.List `tfsdk:"data_access_config" tf:"optional"` // List of Warehouse Types allowed in this workspace (limits allowed value // of the type field in CreateWarehouse and EditWarehouse). Note: Some types // cannot be disabled, they don't need to be specified in // SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing // warehouses to be converted to another type. Used by frontend to save // specific type availability in the warehouse create and edit form UI. - EnabledWarehouseTypes []WarehouseTypePair `tfsdk:"enabled_warehouse_types" tf:"optional"` + EnabledWarehouseTypes types.List `tfsdk:"enabled_warehouse_types" tf:"optional"` // Deprecated: Use sql_configuration_parameters - GlobalParam []RepeatedEndpointConfPairs `tfsdk:"global_param" tf:"optional,object"` + GlobalParam types.List `tfsdk:"global_param" tf:"optional,object"` // GCP only: Google Service Account used to pass to cluster to access Google // Cloud Storage GoogleServiceAccount types.String `tfsdk:"google_service_account" tf:"optional"` @@ -1580,7 +5419,7 @@ type GetWorkspaceWarehouseConfigResponse struct { // Security policy for warehouses SecurityPolicy types.String `tfsdk:"security_policy" tf:"optional"` // SQL configuration parameters - SqlConfigurationParameters []RepeatedEndpointConfPairs `tfsdk:"sql_configuration_parameters" tf:"optional,object"` + SqlConfigurationParameters types.List `tfsdk:"sql_configuration_parameters" tf:"optional,object"` } func (newState *GetWorkspaceWarehouseConfigResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetWorkspaceWarehouseConfigResponse) { @@ -1589,6 +5428,228 @@ func (newState *GetWorkspaceWarehouseConfigResponse) SyncEffectiveFieldsDuringCr func (newState *GetWorkspaceWarehouseConfigResponse) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceWarehouseConfigResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceWarehouseConfigResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceWarehouseConfigResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel": reflect.TypeOf(Channel{}), + "config_param": reflect.TypeOf(RepeatedEndpointConfPairs{}), + "data_access_config": reflect.TypeOf(EndpointConfPair{}), + "enabled_warehouse_types": reflect.TypeOf(WarehouseTypePair{}), + "global_param": reflect.TypeOf(RepeatedEndpointConfPairs{}), + "sql_configuration_parameters": reflect.TypeOf(RepeatedEndpointConfPairs{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceWarehouseConfigResponse +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceWarehouseConfigResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "channel": o.Channel, + "config_param": o.ConfigParam, + "data_access_config": o.DataAccessConfig, + "enabled_warehouse_types": o.EnabledWarehouseTypes, + "global_param": o.GlobalParam, + "google_service_account": o.GoogleServiceAccount, + "instance_profile_arn": o.InstanceProfileArn, + "security_policy": o.SecurityPolicy, + "sql_configuration_parameters": o.SqlConfigurationParameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceWarehouseConfigResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "channel": basetypes.ListType{ + ElemType: Channel{}.Type(ctx), + }, + "config_param": basetypes.ListType{ + ElemType: RepeatedEndpointConfPairs{}.Type(ctx), + }, + "data_access_config": basetypes.ListType{ + ElemType: EndpointConfPair{}.Type(ctx), + }, + "enabled_warehouse_types": basetypes.ListType{ + ElemType: WarehouseTypePair{}.Type(ctx), + }, + "global_param": basetypes.ListType{ + ElemType: RepeatedEndpointConfPairs{}.Type(ctx), + }, + "google_service_account": types.StringType, + "instance_profile_arn": types.StringType, + "security_policy": types.StringType, + "sql_configuration_parameters": basetypes.ListType{ + ElemType: RepeatedEndpointConfPairs{}.Type(ctx), + }, + }, + } +} + +// GetChannel returns the value of the Channel field in GetWorkspaceWarehouseConfigResponse as +// a Channel value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceWarehouseConfigResponse) GetChannel(ctx context.Context) (Channel, bool) { + var e Channel + if o.Channel.IsNull() || o.Channel.IsUnknown() { + return e, false + } + var v []Channel + d := o.Channel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannel sets the value of the Channel field in GetWorkspaceWarehouseConfigResponse. +func (o *GetWorkspaceWarehouseConfigResponse) SetChannel(ctx context.Context, v Channel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel"] + o.Channel = types.ListValueMust(t, vs) +} + +// GetConfigParam returns the value of the ConfigParam field in GetWorkspaceWarehouseConfigResponse as +// a RepeatedEndpointConfPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceWarehouseConfigResponse) GetConfigParam(ctx context.Context) (RepeatedEndpointConfPairs, bool) { + var e RepeatedEndpointConfPairs + if o.ConfigParam.IsNull() || o.ConfigParam.IsUnknown() { + return e, false + } + var v []RepeatedEndpointConfPairs + d := o.ConfigParam.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfigParam sets the value of the ConfigParam field in GetWorkspaceWarehouseConfigResponse. +func (o *GetWorkspaceWarehouseConfigResponse) SetConfigParam(ctx context.Context, v RepeatedEndpointConfPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config_param"] + o.ConfigParam = types.ListValueMust(t, vs) +} + +// GetDataAccessConfig returns the value of the DataAccessConfig field in GetWorkspaceWarehouseConfigResponse as +// a slice of EndpointConfPair values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceWarehouseConfigResponse) GetDataAccessConfig(ctx context.Context) ([]EndpointConfPair, bool) { + if o.DataAccessConfig.IsNull() || o.DataAccessConfig.IsUnknown() { + return nil, false + } + var v []EndpointConfPair + d := o.DataAccessConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDataAccessConfig sets the value of the DataAccessConfig field in GetWorkspaceWarehouseConfigResponse. +func (o *GetWorkspaceWarehouseConfigResponse) SetDataAccessConfig(ctx context.Context, v []EndpointConfPair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_access_config"] + t = t.(attr.TypeWithElementType).ElementType() + o.DataAccessConfig = types.ListValueMust(t, vs) +} + +// GetEnabledWarehouseTypes returns the value of the EnabledWarehouseTypes field in GetWorkspaceWarehouseConfigResponse as +// a slice of WarehouseTypePair values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceWarehouseConfigResponse) GetEnabledWarehouseTypes(ctx context.Context) ([]WarehouseTypePair, bool) { + if o.EnabledWarehouseTypes.IsNull() || o.EnabledWarehouseTypes.IsUnknown() { + return nil, false + } + var v []WarehouseTypePair + d := o.EnabledWarehouseTypes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnabledWarehouseTypes sets the value of the EnabledWarehouseTypes field in GetWorkspaceWarehouseConfigResponse. +func (o *GetWorkspaceWarehouseConfigResponse) SetEnabledWarehouseTypes(ctx context.Context, v []WarehouseTypePair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["enabled_warehouse_types"] + t = t.(attr.TypeWithElementType).ElementType() + o.EnabledWarehouseTypes = types.ListValueMust(t, vs) +} + +// GetGlobalParam returns the value of the GlobalParam field in GetWorkspaceWarehouseConfigResponse as +// a RepeatedEndpointConfPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceWarehouseConfigResponse) GetGlobalParam(ctx context.Context) (RepeatedEndpointConfPairs, bool) { + var e RepeatedEndpointConfPairs + if o.GlobalParam.IsNull() || o.GlobalParam.IsUnknown() { + return e, false + } + var v []RepeatedEndpointConfPairs + d := o.GlobalParam.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGlobalParam sets the value of the GlobalParam field in GetWorkspaceWarehouseConfigResponse. +func (o *GetWorkspaceWarehouseConfigResponse) SetGlobalParam(ctx context.Context, v RepeatedEndpointConfPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["global_param"] + o.GlobalParam = types.ListValueMust(t, vs) +} + +// GetSqlConfigurationParameters returns the value of the SqlConfigurationParameters field in GetWorkspaceWarehouseConfigResponse as +// a RepeatedEndpointConfPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceWarehouseConfigResponse) GetSqlConfigurationParameters(ctx context.Context) (RepeatedEndpointConfPairs, bool) { + var e RepeatedEndpointConfPairs + if o.SqlConfigurationParameters.IsNull() || o.SqlConfigurationParameters.IsUnknown() { + return e, false + } + var v []RepeatedEndpointConfPairs + d := o.SqlConfigurationParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlConfigurationParameters sets the value of the SqlConfigurationParameters field in GetWorkspaceWarehouseConfigResponse. +func (o *GetWorkspaceWarehouseConfigResponse) SetSqlConfigurationParameters(ctx context.Context, v RepeatedEndpointConfPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_configuration_parameters"] + o.SqlConfigurationParameters = types.ListValueMust(t, vs) +} + type LegacyAlert struct { // Timestamp when the alert was created. CreatedAt types.String `tfsdk:"created_at" tf:"optional"` @@ -1599,11 +5660,11 @@ type LegacyAlert struct { // Name of the alert. Name types.String `tfsdk:"name" tf:"optional"` // Alert configuration options. - Options []AlertOptions `tfsdk:"options" tf:"optional,object"` + Options types.List `tfsdk:"options" tf:"optional,object"` // The identifier of the workspace folder containing the object. Parent types.String `tfsdk:"parent" tf:"optional"` - Query []AlertQuery `tfsdk:"query" tf:"optional,object"` + Query types.List `tfsdk:"query" tf:"optional,object"` // Number of seconds after being triggered before the alert rearms itself // and can be triggered again. If `null`, alert will never be triggered // again. @@ -1615,7 +5676,7 @@ type LegacyAlert struct { // Timestamp when the alert was last updated. UpdatedAt types.String `tfsdk:"updated_at" tf:"optional"` - User []User `tfsdk:"user" tf:"optional,object"` + User types.List `tfsdk:"user" tf:"optional,object"` } func (newState *LegacyAlert) SyncEffectiveFieldsDuringCreateOrUpdate(plan LegacyAlert) { @@ -1624,6 +5685,145 @@ func (newState *LegacyAlert) SyncEffectiveFieldsDuringCreateOrUpdate(plan Legacy func (newState *LegacyAlert) SyncEffectiveFieldsDuringRead(existingState LegacyAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LegacyAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LegacyAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(AlertOptions{}), + "query": reflect.TypeOf(AlertQuery{}), + "user": reflect.TypeOf(User{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LegacyAlert +// only implements ToObjectValue() and Type(). +func (o LegacyAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "id": o.Id, + "last_triggered_at": o.LastTriggeredAt, + "name": o.Name, + "options": o.Options, + "parent": o.Parent, + "query": o.Query, + "rearm": o.Rearm, + "state": o.State, + "updated_at": o.UpdatedAt, + "user": o.User, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LegacyAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.StringType, + "id": types.StringType, + "last_triggered_at": types.StringType, + "name": types.StringType, + "options": basetypes.ListType{ + ElemType: AlertOptions{}.Type(ctx), + }, + "parent": types.StringType, + "query": basetypes.ListType{ + ElemType: AlertQuery{}.Type(ctx), + }, + "rearm": types.Int64Type, + "state": types.StringType, + "updated_at": types.StringType, + "user": basetypes.ListType{ + ElemType: User{}.Type(ctx), + }, + }, + } +} + +// GetOptions returns the value of the Options field in LegacyAlert as +// a AlertOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyAlert) GetOptions(ctx context.Context) (AlertOptions, bool) { + var e AlertOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []AlertOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in LegacyAlert. +func (o *LegacyAlert) SetOptions(ctx context.Context, v AlertOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + +// GetQuery returns the value of the Query field in LegacyAlert as +// a AlertQuery value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyAlert) GetQuery(ctx context.Context) (AlertQuery, bool) { + var e AlertQuery + if o.Query.IsNull() || o.Query.IsUnknown() { + return e, false + } + var v []AlertQuery + d := o.Query.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuery sets the value of the Query field in LegacyAlert. +func (o *LegacyAlert) SetQuery(ctx context.Context, v AlertQuery) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query"] + o.Query = types.ListValueMust(t, vs) +} + +// GetUser returns the value of the User field in LegacyAlert as +// a User value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyAlert) GetUser(ctx context.Context) (User, bool) { + var e User + if o.User.IsNull() || o.User.IsUnknown() { + return e, false + } + var v []User + d := o.User.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUser sets the value of the User field in LegacyAlert. +func (o *LegacyAlert) SetUser(ctx context.Context, v User) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["user"] + o.User = types.ListValueMust(t, vs) +} + type LegacyQuery struct { // Describes whether the authenticated user is allowed to edit the // definition of this query. @@ -1658,7 +5858,7 @@ type LegacyQuery struct { // type parameters are handled safely. IsSafe types.Bool `tfsdk:"is_safe" tf:"optional"` - LastModifiedBy []User `tfsdk:"last_modified_by" tf:"optional,object"` + LastModifiedBy types.List `tfsdk:"last_modified_by" tf:"optional,object"` // The ID of the user who last saved changes to this query. LastModifiedById types.Int64 `tfsdk:"last_modified_by_id" tf:"optional"` // If there is a cached result for this query and user, this field includes @@ -1669,7 +5869,7 @@ type LegacyQuery struct { // on the query page. Name types.String `tfsdk:"name" tf:"optional"` - Options []QueryOptions `tfsdk:"options" tf:"optional,object"` + Options types.List `tfsdk:"options" tf:"optional,object"` // The identifier of the workspace folder containing the object. Parent types.String `tfsdk:"parent" tf:"optional"` // * `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * @@ -1684,15 +5884,15 @@ type LegacyQuery struct { // owner" behavior) RunAsRole types.String `tfsdk:"run_as_role" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // The timestamp at which this query was last updated. UpdatedAt types.String `tfsdk:"updated_at" tf:"optional"` - User []User `tfsdk:"user" tf:"optional,object"` + User types.List `tfsdk:"user" tf:"optional,object"` // The ID of the user who owns the query. UserId types.Int64 `tfsdk:"user_id" tf:"optional"` - Visualizations []LegacyVisualization `tfsdk:"visualizations" tf:"optional"` + Visualizations types.List `tfsdk:"visualizations" tf:"optional"` } func (newState *LegacyQuery) SyncEffectiveFieldsDuringCreateOrUpdate(plan LegacyQuery) { @@ -1701,6 +5901,229 @@ func (newState *LegacyQuery) SyncEffectiveFieldsDuringCreateOrUpdate(plan Legacy func (newState *LegacyQuery) SyncEffectiveFieldsDuringRead(existingState LegacyQuery) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LegacyQuery. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LegacyQuery) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "last_modified_by": reflect.TypeOf(User{}), + "options": reflect.TypeOf(QueryOptions{}), + "tags": reflect.TypeOf(types.String{}), + "user": reflect.TypeOf(User{}), + "visualizations": reflect.TypeOf(LegacyVisualization{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LegacyQuery +// only implements ToObjectValue() and Type(). +func (o LegacyQuery) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "can_edit": o.CanEdit, + "created_at": o.CreatedAt, + "data_source_id": o.DataSourceId, + "description": o.Description, + "id": o.Id, + "is_archived": o.IsArchived, + "is_draft": o.IsDraft, + "is_favorite": o.IsFavorite, + "is_safe": o.IsSafe, + "last_modified_by": o.LastModifiedBy, + "last_modified_by_id": o.LastModifiedById, + "latest_query_data_id": o.LatestQueryDataId, + "name": o.Name, + "options": o.Options, + "parent": o.Parent, + "permission_tier": o.PermissionTier, + "query": o.Query, + "query_hash": o.QueryHash, + "run_as_role": o.RunAsRole, + "tags": o.Tags, + "updated_at": o.UpdatedAt, + "user": o.User, + "user_id": o.UserId, + "visualizations": o.Visualizations, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LegacyQuery) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "can_edit": types.BoolType, + "created_at": types.StringType, + "data_source_id": types.StringType, + "description": types.StringType, + "id": types.StringType, + "is_archived": types.BoolType, + "is_draft": types.BoolType, + "is_favorite": types.BoolType, + "is_safe": types.BoolType, + "last_modified_by": basetypes.ListType{ + ElemType: User{}.Type(ctx), + }, + "last_modified_by_id": types.Int64Type, + "latest_query_data_id": types.StringType, + "name": types.StringType, + "options": basetypes.ListType{ + ElemType: QueryOptions{}.Type(ctx), + }, + "parent": types.StringType, + "permission_tier": types.StringType, + "query": types.StringType, + "query_hash": types.StringType, + "run_as_role": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "updated_at": types.StringType, + "user": basetypes.ListType{ + ElemType: User{}.Type(ctx), + }, + "user_id": types.Int64Type, + "visualizations": basetypes.ListType{ + ElemType: LegacyVisualization{}.Type(ctx), + }, + }, + } +} + +// GetLastModifiedBy returns the value of the LastModifiedBy field in LegacyQuery as +// a User value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyQuery) GetLastModifiedBy(ctx context.Context) (User, bool) { + var e User + if o.LastModifiedBy.IsNull() || o.LastModifiedBy.IsUnknown() { + return e, false + } + var v []User + d := o.LastModifiedBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetLastModifiedBy sets the value of the LastModifiedBy field in LegacyQuery. +func (o *LegacyQuery) SetLastModifiedBy(ctx context.Context, v User) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["last_modified_by"] + o.LastModifiedBy = types.ListValueMust(t, vs) +} + +// GetOptions returns the value of the Options field in LegacyQuery as +// a QueryOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyQuery) GetOptions(ctx context.Context) (QueryOptions, bool) { + var e QueryOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []QueryOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in LegacyQuery. +func (o *LegacyQuery) SetOptions(ctx context.Context, v QueryOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in LegacyQuery as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyQuery) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in LegacyQuery. +func (o *LegacyQuery) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + +// GetUser returns the value of the User field in LegacyQuery as +// a User value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyQuery) GetUser(ctx context.Context) (User, bool) { + var e User + if o.User.IsNull() || o.User.IsUnknown() { + return e, false + } + var v []User + d := o.User.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetUser sets the value of the User field in LegacyQuery. +func (o *LegacyQuery) SetUser(ctx context.Context, v User) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["user"] + o.User = types.ListValueMust(t, vs) +} + +// GetVisualizations returns the value of the Visualizations field in LegacyQuery as +// a slice of LegacyVisualization values. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyQuery) GetVisualizations(ctx context.Context) ([]LegacyVisualization, bool) { + if o.Visualizations.IsNull() || o.Visualizations.IsUnknown() { + return nil, false + } + var v []LegacyVisualization + d := o.Visualizations.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetVisualizations sets the value of the Visualizations field in LegacyQuery. +func (o *LegacyQuery) SetVisualizations(ctx context.Context, v []LegacyVisualization) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["visualizations"] + t = t.(attr.TypeWithElementType).ElementType() + o.Visualizations = types.ListValueMust(t, vs) +} + // The visualization description API changes frequently and is unsupported. You // can duplicate a visualization by copying description objects received _from // the API_ and then using them to create a new one with a POST request to the @@ -1719,11 +6142,11 @@ type LegacyVisualization struct { // The options object varies widely from one visualization type to the next // and is unsupported. Databricks does not recommend modifying visualization // settings in JSON. - Options any `tfsdk:"options" tf:"optional"` + Options types.Object `tfsdk:"options" tf:"optional"` - Query []LegacyQuery `tfsdk:"query" tf:"optional,object"` + Query types.List `tfsdk:"query" tf:"optional,object"` // The type of visualization: chart, table, pivot table, and so on. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` UpdatedAt types.String `tfsdk:"updated_at" tf:"optional"` } @@ -1734,6 +6157,81 @@ func (newState *LegacyVisualization) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *LegacyVisualization) SyncEffectiveFieldsDuringRead(existingState LegacyVisualization) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in LegacyVisualization. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a LegacyVisualization) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "query": reflect.TypeOf(LegacyQuery{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, LegacyVisualization +// only implements ToObjectValue() and Type(). +func (o LegacyVisualization) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "description": o.Description, + "id": o.Id, + "name": o.Name, + "options": o.Options, + "query": o.Query, + "type": o.Type_, + "updated_at": o.UpdatedAt, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o LegacyVisualization) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.StringType, + "description": types.StringType, + "id": types.StringType, + "name": types.StringType, + "options": types.ObjectType{}, + "query": basetypes.ListType{ + ElemType: LegacyQuery{}.Type(ctx), + }, + "type": types.StringType, + "updated_at": types.StringType, + }, + } +} + +// GetQuery returns the value of the Query field in LegacyVisualization as +// a LegacyQuery value. +// If the field is unknown or null, the boolean return value is false. +func (o *LegacyVisualization) GetQuery(ctx context.Context) (LegacyQuery, bool) { + var e LegacyQuery + if o.Query.IsNull() || o.Query.IsUnknown() { + return e, false + } + var v []LegacyQuery + d := o.Query.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuery sets the value of the Query field in LegacyVisualization. +func (o *LegacyVisualization) SetQuery(ctx context.Context, v LegacyQuery) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query"] + o.Query = types.ListValueMust(t, vs) +} + // List alerts type ListAlertsRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -1747,10 +6245,43 @@ func (newState *ListAlertsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListAlertsRequest) SyncEffectiveFieldsDuringRead(existingState ListAlertsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAlertsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAlertsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAlertsRequest +// only implements ToObjectValue() and Type(). +func (o ListAlertsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAlertsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListAlertsResponse struct { NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Results []ListAlertsResponseAlert `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ListAlertsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAlertsResponse) { @@ -1759,9 +6290,72 @@ func (newState *ListAlertsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListAlertsResponse) SyncEffectiveFieldsDuringRead(existingState ListAlertsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAlertsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAlertsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(ListAlertsResponseAlert{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAlertsResponse +// only implements ToObjectValue() and Type(). +func (o ListAlertsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAlertsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "results": basetypes.ListType{ + ElemType: ListAlertsResponseAlert{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ListAlertsResponse as +// a slice of ListAlertsResponseAlert values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAlertsResponse) GetResults(ctx context.Context) ([]ListAlertsResponseAlert, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []ListAlertsResponseAlert + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ListAlertsResponse. +func (o *ListAlertsResponse) SetResults(ctx context.Context, v []ListAlertsResponseAlert) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + type ListAlertsResponseAlert struct { // Trigger conditions of the alert. - Condition []AlertCondition `tfsdk:"condition" tf:"optional,object"` + Condition types.List `tfsdk:"condition" tf:"optional,object"` // The timestamp indicating when the alert was created. CreateTime types.String `tfsdk:"create_time" tf:"optional"` // Custom body of alert notification, if it exists. See [here] for custom @@ -1809,6 +6403,93 @@ func (newState *ListAlertsResponseAlert) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListAlertsResponseAlert) SyncEffectiveFieldsDuringRead(existingState ListAlertsResponseAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAlertsResponseAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAlertsResponseAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition": reflect.TypeOf(AlertCondition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAlertsResponseAlert +// only implements ToObjectValue() and Type(). +func (o ListAlertsResponseAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition": o.Condition, + "create_time": o.CreateTime, + "custom_body": o.CustomBody, + "custom_subject": o.CustomSubject, + "display_name": o.DisplayName, + "id": o.Id, + "lifecycle_state": o.LifecycleState, + "notify_on_ok": o.NotifyOnOk, + "owner_user_name": o.OwnerUserName, + "query_id": o.QueryId, + "seconds_to_retrigger": o.SecondsToRetrigger, + "state": o.State, + "trigger_time": o.TriggerTime, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAlertsResponseAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition": basetypes.ListType{ + ElemType: AlertCondition{}.Type(ctx), + }, + "create_time": types.StringType, + "custom_body": types.StringType, + "custom_subject": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + "lifecycle_state": types.StringType, + "notify_on_ok": types.BoolType, + "owner_user_name": types.StringType, + "query_id": types.StringType, + "seconds_to_retrigger": types.Int64Type, + "state": types.StringType, + "trigger_time": types.StringType, + "update_time": types.StringType, + }, + } +} + +// GetCondition returns the value of the Condition field in ListAlertsResponseAlert as +// a AlertCondition value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAlertsResponseAlert) GetCondition(ctx context.Context) (AlertCondition, bool) { + var e AlertCondition + if o.Condition.IsNull() || o.Condition.IsUnknown() { + return e, false + } + var v []AlertCondition + d := o.Condition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCondition sets the value of the Condition field in ListAlertsResponseAlert. +func (o *ListAlertsResponseAlert) SetCondition(ctx context.Context, v AlertCondition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition"] + o.Condition = types.ListValueMust(t, vs) +} + // Get dashboard objects type ListDashboardsRequest struct { // Name of dashboard attribute to order by. @@ -1827,6 +6508,43 @@ func (newState *ListDashboardsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListDashboardsRequest) SyncEffectiveFieldsDuringRead(existingState ListDashboardsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListDashboardsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListDashboardsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListDashboardsRequest +// only implements ToObjectValue() and Type(). +func (o ListDashboardsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "order": o.Order, + "page": o.Page, + "page_size": o.PageSize, + "q": o.Q, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListDashboardsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "order": types.StringType, + "page": types.Int64Type, + "page_size": types.Int64Type, + "q": types.StringType, + }, + } +} + // Get a list of queries type ListQueriesLegacyRequest struct { // Name of query attribute to order by. Default sort order is ascending. @@ -1858,6 +6576,43 @@ func (newState *ListQueriesLegacyRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListQueriesLegacyRequest) SyncEffectiveFieldsDuringRead(existingState ListQueriesLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQueriesLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQueriesLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQueriesLegacyRequest +// only implements ToObjectValue() and Type(). +func (o ListQueriesLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "order": o.Order, + "page": o.Page, + "page_size": o.PageSize, + "q": o.Q, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQueriesLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "order": types.StringType, + "page": types.Int64Type, + "page_size": types.Int64Type, + "q": types.StringType, + }, + } +} + // List queries type ListQueriesRequest struct { PageSize types.Int64 `tfsdk:"-"` @@ -1871,13 +6626,46 @@ func (newState *ListQueriesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListQueriesRequest) SyncEffectiveFieldsDuringRead(existingState ListQueriesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQueriesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQueriesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQueriesRequest +// only implements ToObjectValue() and Type(). +func (o ListQueriesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQueriesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListQueriesResponse struct { // Whether there is another page of results. HasNextPage types.Bool `tfsdk:"has_next_page" tf:"optional"` // A token that can be used to get the next page of results. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Res []QueryInfo `tfsdk:"res" tf:"optional"` + Res types.List `tfsdk:"res" tf:"optional"` } func (newState *ListQueriesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListQueriesResponse) { @@ -1886,10 +6674,75 @@ func (newState *ListQueriesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListQueriesResponse) SyncEffectiveFieldsDuringRead(existingState ListQueriesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQueriesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQueriesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "res": reflect.TypeOf(QueryInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQueriesResponse +// only implements ToObjectValue() and Type(). +func (o ListQueriesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "has_next_page": o.HasNextPage, + "next_page_token": o.NextPageToken, + "res": o.Res, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQueriesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "has_next_page": types.BoolType, + "next_page_token": types.StringType, + "res": basetypes.ListType{ + ElemType: QueryInfo{}.Type(ctx), + }, + }, + } +} + +// GetRes returns the value of the Res field in ListQueriesResponse as +// a slice of QueryInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListQueriesResponse) GetRes(ctx context.Context) ([]QueryInfo, bool) { + if o.Res.IsNull() || o.Res.IsUnknown() { + return nil, false + } + var v []QueryInfo + d := o.Res.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRes sets the value of the Res field in ListQueriesResponse. +func (o *ListQueriesResponse) SetRes(ctx context.Context, v []QueryInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["res"] + t = t.(attr.TypeWithElementType).ElementType() + o.Res = types.ListValueMust(t, vs) +} + // List Queries type ListQueryHistoryRequest struct { // A filter to limit query history results. This field is optional. - FilterBy []QueryFilter `tfsdk:"-"` + FilterBy types.List `tfsdk:"-"` // Whether to include the query metrics with each query. Only use this for a // small subset of queries (max_results). Defaults to false. IncludeMetrics types.Bool `tfsdk:"-"` @@ -1909,10 +6762,77 @@ func (newState *ListQueryHistoryRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListQueryHistoryRequest) SyncEffectiveFieldsDuringRead(existingState ListQueryHistoryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQueryHistoryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQueryHistoryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "filter_by": reflect.TypeOf(QueryFilter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQueryHistoryRequest +// only implements ToObjectValue() and Type(). +func (o ListQueryHistoryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "filter_by": o.FilterBy, + "include_metrics": o.IncludeMetrics, + "max_results": o.MaxResults, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQueryHistoryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "filter_by": basetypes.ListType{ + ElemType: QueryFilter{}.Type(ctx), + }, + "include_metrics": types.BoolType, + "max_results": types.Int64Type, + "page_token": types.StringType, + }, + } +} + +// GetFilterBy returns the value of the FilterBy field in ListQueryHistoryRequest as +// a QueryFilter value. +// If the field is unknown or null, the boolean return value is false. +func (o *ListQueryHistoryRequest) GetFilterBy(ctx context.Context) (QueryFilter, bool) { + var e QueryFilter + if o.FilterBy.IsNull() || o.FilterBy.IsUnknown() { + return e, false + } + var v []QueryFilter + d := o.FilterBy.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetFilterBy sets the value of the FilterBy field in ListQueryHistoryRequest. +func (o *ListQueryHistoryRequest) SetFilterBy(ctx context.Context, v QueryFilter) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["filter_by"] + o.FilterBy = types.ListValueMust(t, vs) +} + type ListQueryObjectsResponse struct { NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Results []ListQueryObjectsResponseQuery `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ListQueryObjectsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListQueryObjectsResponse) { @@ -1921,6 +6841,69 @@ func (newState *ListQueryObjectsResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *ListQueryObjectsResponse) SyncEffectiveFieldsDuringRead(existingState ListQueryObjectsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQueryObjectsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQueryObjectsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(ListQueryObjectsResponseQuery{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQueryObjectsResponse +// only implements ToObjectValue() and Type(). +func (o ListQueryObjectsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQueryObjectsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "results": basetypes.ListType{ + ElemType: ListQueryObjectsResponseQuery{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ListQueryObjectsResponse as +// a slice of ListQueryObjectsResponseQuery values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListQueryObjectsResponse) GetResults(ctx context.Context) ([]ListQueryObjectsResponseQuery, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []ListQueryObjectsResponseQuery + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ListQueryObjectsResponse. +func (o *ListQueryObjectsResponse) SetResults(ctx context.Context, v []ListQueryObjectsResponseQuery) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + type ListQueryObjectsResponseQuery struct { // Whether to apply a 1000 row limit to the query result. ApplyAutoLimit types.Bool `tfsdk:"apply_auto_limit" tf:"optional"` @@ -1943,7 +6926,7 @@ type ListQueryObjectsResponseQuery struct { // Username of the user that owns the query. OwnerUserName types.String `tfsdk:"owner_user_name" tf:"optional"` // List of query parameter definitions. - Parameters []QueryParameter `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // Text of the query to be run. QueryText types.String `tfsdk:"query_text" tf:"optional"` // Sets the "Run as" role for the object. @@ -1951,7 +6934,7 @@ type ListQueryObjectsResponseQuery struct { // Name of the schema where this query will be executed. Schema types.String `tfsdk:"schema" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // Timestamp when this query was last updated. UpdateTime types.String `tfsdk:"update_time" tf:"optional"` // ID of the SQL warehouse attached to the query. @@ -1964,6 +6947,126 @@ func (newState *ListQueryObjectsResponseQuery) SyncEffectiveFieldsDuringCreateOr func (newState *ListQueryObjectsResponseQuery) SyncEffectiveFieldsDuringRead(existingState ListQueryObjectsResponseQuery) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListQueryObjectsResponseQuery. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListQueryObjectsResponseQuery) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(QueryParameter{}), + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListQueryObjectsResponseQuery +// only implements ToObjectValue() and Type(). +func (o ListQueryObjectsResponseQuery) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_auto_limit": o.ApplyAutoLimit, + "catalog": o.Catalog, + "create_time": o.CreateTime, + "description": o.Description, + "display_name": o.DisplayName, + "id": o.Id, + "last_modifier_user_name": o.LastModifierUserName, + "lifecycle_state": o.LifecycleState, + "owner_user_name": o.OwnerUserName, + "parameters": o.Parameters, + "query_text": o.QueryText, + "run_as_mode": o.RunAsMode, + "schema": o.Schema, + "tags": o.Tags, + "update_time": o.UpdateTime, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListQueryObjectsResponseQuery) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_auto_limit": types.BoolType, + "catalog": types.StringType, + "create_time": types.StringType, + "description": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + "last_modifier_user_name": types.StringType, + "lifecycle_state": types.StringType, + "owner_user_name": types.StringType, + "parameters": basetypes.ListType{ + ElemType: QueryParameter{}.Type(ctx), + }, + "query_text": types.StringType, + "run_as_mode": types.StringType, + "schema": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "update_time": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in ListQueryObjectsResponseQuery as +// a slice of QueryParameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListQueryObjectsResponseQuery) GetParameters(ctx context.Context) ([]QueryParameter, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []QueryParameter + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in ListQueryObjectsResponseQuery. +func (o *ListQueryObjectsResponseQuery) SetParameters(ctx context.Context, v []QueryParameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in ListQueryObjectsResponseQuery as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListQueryObjectsResponseQuery) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in ListQueryObjectsResponseQuery. +func (o *ListQueryObjectsResponseQuery) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type ListResponse struct { // The total number of dashboards. Count types.Int64 `tfsdk:"count" tf:"optional"` @@ -1972,7 +7075,7 @@ type ListResponse struct { // The number of dashboards per page. PageSize types.Int64 `tfsdk:"page_size" tf:"optional"` // List of dashboards returned. - Results []Dashboard `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListResponse) { @@ -1981,6 +7084,73 @@ func (newState *ListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListR func (newState *ListResponse) SyncEffectiveFieldsDuringRead(existingState ListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(Dashboard{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListResponse +// only implements ToObjectValue() and Type(). +func (o ListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "count": o.Count, + "page": o.Page, + "page_size": o.PageSize, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "count": types.Int64Type, + "page": types.Int64Type, + "page_size": types.Int64Type, + "results": basetypes.ListType{ + ElemType: Dashboard{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ListResponse as +// a slice of Dashboard values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListResponse) GetResults(ctx context.Context) ([]Dashboard, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []Dashboard + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ListResponse. +func (o *ListResponse) SetResults(ctx context.Context, v []Dashboard) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + // List visualizations on a query type ListVisualizationsForQueryRequest struct { Id types.String `tfsdk:"-"` @@ -1996,10 +7166,45 @@ func (newState *ListVisualizationsForQueryRequest) SyncEffectiveFieldsDuringCrea func (newState *ListVisualizationsForQueryRequest) SyncEffectiveFieldsDuringRead(existingState ListVisualizationsForQueryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListVisualizationsForQueryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListVisualizationsForQueryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListVisualizationsForQueryRequest +// only implements ToObjectValue() and Type(). +func (o ListVisualizationsForQueryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListVisualizationsForQueryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + type ListVisualizationsForQueryResponse struct { NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - Results []Visualization `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *ListVisualizationsForQueryResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListVisualizationsForQueryResponse) { @@ -2008,6 +7213,69 @@ func (newState *ListVisualizationsForQueryResponse) SyncEffectiveFieldsDuringCre func (newState *ListVisualizationsForQueryResponse) SyncEffectiveFieldsDuringRead(existingState ListVisualizationsForQueryResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListVisualizationsForQueryResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListVisualizationsForQueryResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(Visualization{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListVisualizationsForQueryResponse +// only implements ToObjectValue() and Type(). +func (o ListVisualizationsForQueryResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListVisualizationsForQueryResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "results": basetypes.ListType{ + ElemType: Visualization{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in ListVisualizationsForQueryResponse as +// a slice of Visualization values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListVisualizationsForQueryResponse) GetResults(ctx context.Context) ([]Visualization, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []Visualization + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in ListVisualizationsForQueryResponse. +func (o *ListVisualizationsForQueryResponse) SetResults(ctx context.Context, v []Visualization) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + // List warehouses type ListWarehousesRequest struct { // Service Principal which will be used to fetch the list of warehouses. If @@ -2021,9 +7289,40 @@ func (newState *ListWarehousesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *ListWarehousesRequest) SyncEffectiveFieldsDuringRead(existingState ListWarehousesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListWarehousesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListWarehousesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListWarehousesRequest +// only implements ToObjectValue() and Type(). +func (o ListWarehousesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "run_as_user_id": o.RunAsUserId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListWarehousesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "run_as_user_id": types.Int64Type, + }, + } +} + type ListWarehousesResponse struct { // A list of warehouses and their configurations. - Warehouses []EndpointInfo `tfsdk:"warehouses" tf:"optional"` + Warehouses types.List `tfsdk:"warehouses" tf:"optional"` } func (newState *ListWarehousesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListWarehousesResponse) { @@ -2032,6 +7331,67 @@ func (newState *ListWarehousesResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ListWarehousesResponse) SyncEffectiveFieldsDuringRead(existingState ListWarehousesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListWarehousesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListWarehousesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "warehouses": reflect.TypeOf(EndpointInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListWarehousesResponse +// only implements ToObjectValue() and Type(). +func (o ListWarehousesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "warehouses": o.Warehouses, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListWarehousesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "warehouses": basetypes.ListType{ + ElemType: EndpointInfo{}.Type(ctx), + }, + }, + } +} + +// GetWarehouses returns the value of the Warehouses field in ListWarehousesResponse as +// a slice of EndpointInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListWarehousesResponse) GetWarehouses(ctx context.Context) ([]EndpointInfo, bool) { + if o.Warehouses.IsNull() || o.Warehouses.IsUnknown() { + return nil, false + } + var v []EndpointInfo + d := o.Warehouses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWarehouses sets the value of the Warehouses field in ListWarehousesResponse. +func (o *ListWarehousesResponse) SetWarehouses(ctx context.Context, v []EndpointInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["warehouses"] + t = t.(attr.TypeWithElementType).ElementType() + o.Warehouses = types.ListValueMust(t, vs) +} + type MultiValuesOptions struct { // Character that prefixes each selected parameter value. Prefix types.String `tfsdk:"prefix" tf:"optional"` @@ -2048,6 +7408,41 @@ func (newState *MultiValuesOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *MultiValuesOptions) SyncEffectiveFieldsDuringRead(existingState MultiValuesOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MultiValuesOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MultiValuesOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MultiValuesOptions +// only implements ToObjectValue() and Type(). +func (o MultiValuesOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "prefix": o.Prefix, + "separator": o.Separator, + "suffix": o.Suffix, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MultiValuesOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "prefix": types.StringType, + "separator": types.StringType, + "suffix": types.StringType, + }, + } +} + type NumericValue struct { Value types.Float64 `tfsdk:"value" tf:"optional"` } @@ -2058,6 +7453,37 @@ func (newState *NumericValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan Numer func (newState *NumericValue) SyncEffectiveFieldsDuringRead(existingState NumericValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in NumericValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a NumericValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, NumericValue +// only implements ToObjectValue() and Type(). +func (o NumericValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o NumericValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": types.Float64Type, + }, + } +} + type OdbcParams struct { Hostname types.String `tfsdk:"hostname" tf:"optional"` @@ -2074,13 +7500,50 @@ func (newState *OdbcParams) SyncEffectiveFieldsDuringCreateOrUpdate(plan OdbcPar func (newState *OdbcParams) SyncEffectiveFieldsDuringRead(existingState OdbcParams) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OdbcParams. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OdbcParams) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OdbcParams +// only implements ToObjectValue() and Type(). +func (o OdbcParams) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "hostname": o.Hostname, + "path": o.Path, + "port": o.Port, + "protocol": o.Protocol, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o OdbcParams) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "hostname": types.StringType, + "path": types.StringType, + "port": types.Int64Type, + "protocol": types.StringType, + }, + } +} + type Parameter struct { // List of valid parameter values, newline delimited. Only applies for // dropdown list parameters. EnumOptions types.String `tfsdk:"enumOptions" tf:"optional"` // If specified, allows multiple values to be selected for this parameter. // Only applies to dropdown list and query-based dropdown list parameters. - MultiValuesOptions []MultiValuesOptions `tfsdk:"multiValuesOptions" tf:"optional,object"` + MultiValuesOptions types.List `tfsdk:"multiValuesOptions" tf:"optional,object"` // The literal parameter marker that appears between double curly braces in // the query text. Name types.String `tfsdk:"name" tf:"optional"` @@ -2090,9 +7553,9 @@ type Parameter struct { // The text displayed in a parameter picking widget. Title types.String `tfsdk:"title" tf:"optional"` // Parameters can have several different types. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` // The default value for this parameter. - Value any `tfsdk:"value" tf:"optional"` + Value types.Object `tfsdk:"value" tf:"optional"` } func (newState *Parameter) SyncEffectiveFieldsDuringCreateOrUpdate(plan Parameter) { @@ -2101,6 +7564,79 @@ func (newState *Parameter) SyncEffectiveFieldsDuringCreateOrUpdate(plan Paramete func (newState *Parameter) SyncEffectiveFieldsDuringRead(existingState Parameter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Parameter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Parameter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "multiValuesOptions": reflect.TypeOf(MultiValuesOptions{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Parameter +// only implements ToObjectValue() and Type(). +func (o Parameter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enumOptions": o.EnumOptions, + "multiValuesOptions": o.MultiValuesOptions, + "name": o.Name, + "queryId": o.QueryId, + "title": o.Title, + "type": o.Type_, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Parameter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enumOptions": types.StringType, + "multiValuesOptions": basetypes.ListType{ + ElemType: MultiValuesOptions{}.Type(ctx), + }, + "name": types.StringType, + "queryId": types.StringType, + "title": types.StringType, + "type": types.StringType, + "value": types.ObjectType{}, + }, + } +} + +// GetMultiValuesOptions returns the value of the MultiValuesOptions field in Parameter as +// a MultiValuesOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *Parameter) GetMultiValuesOptions(ctx context.Context) (MultiValuesOptions, bool) { + var e MultiValuesOptions + if o.MultiValuesOptions.IsNull() || o.MultiValuesOptions.IsUnknown() { + return e, false + } + var v []MultiValuesOptions + d := o.MultiValuesOptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMultiValuesOptions sets the value of the MultiValuesOptions field in Parameter. +func (o *Parameter) SetMultiValuesOptions(ctx context.Context, v MultiValuesOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["multiValuesOptions"] + o.MultiValuesOptions = types.ListValueMust(t, vs) +} + type Query struct { // Whether to apply a 1000 row limit to the query result. ApplyAutoLimit types.Bool `tfsdk:"apply_auto_limit" tf:"optional"` @@ -2123,7 +7659,7 @@ type Query struct { // Username of the user that owns the query. OwnerUserName types.String `tfsdk:"owner_user_name" tf:"optional"` // List of query parameter definitions. - Parameters []QueryParameter `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // Workspace path of the workspace folder containing the object. ParentPath types.String `tfsdk:"parent_path" tf:"optional"` // Text of the query to be run. @@ -2133,7 +7669,7 @@ type Query struct { // Name of the schema where this query will be executed. Schema types.String `tfsdk:"schema" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // Timestamp when this query was last updated. UpdateTime types.String `tfsdk:"update_time" tf:"optional"` // ID of the SQL warehouse attached to the query. @@ -2146,13 +7682,135 @@ func (newState *Query) SyncEffectiveFieldsDuringCreateOrUpdate(plan Query) { func (newState *Query) SyncEffectiveFieldsDuringRead(existingState Query) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Query. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Query) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(QueryParameter{}), + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Query +// only implements ToObjectValue() and Type(). +func (o Query) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_auto_limit": o.ApplyAutoLimit, + "catalog": o.Catalog, + "create_time": o.CreateTime, + "description": o.Description, + "display_name": o.DisplayName, + "id": o.Id, + "last_modifier_user_name": o.LastModifierUserName, + "lifecycle_state": o.LifecycleState, + "owner_user_name": o.OwnerUserName, + "parameters": o.Parameters, + "parent_path": o.ParentPath, + "query_text": o.QueryText, + "run_as_mode": o.RunAsMode, + "schema": o.Schema, + "tags": o.Tags, + "update_time": o.UpdateTime, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Query) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_auto_limit": types.BoolType, + "catalog": types.StringType, + "create_time": types.StringType, + "description": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + "last_modifier_user_name": types.StringType, + "lifecycle_state": types.StringType, + "owner_user_name": types.StringType, + "parameters": basetypes.ListType{ + ElemType: QueryParameter{}.Type(ctx), + }, + "parent_path": types.StringType, + "query_text": types.StringType, + "run_as_mode": types.StringType, + "schema": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "update_time": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in Query as +// a slice of QueryParameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *Query) GetParameters(ctx context.Context) ([]QueryParameter, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []QueryParameter + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in Query. +func (o *Query) SetParameters(ctx context.Context, v []QueryParameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in Query as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *Query) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in Query. +func (o *Query) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type QueryBackedValue struct { // If specified, allows multiple values to be selected for this parameter. - MultiValuesOptions []MultiValuesOptions `tfsdk:"multi_values_options" tf:"optional,object"` + MultiValuesOptions types.List `tfsdk:"multi_values_options" tf:"optional,object"` // UUID of the query that provides the parameter values. QueryId types.String `tfsdk:"query_id" tf:"optional"` // List of selected query parameter values. - Values []types.String `tfsdk:"values" tf:"optional"` + Values types.List `tfsdk:"values" tf:"optional"` } func (newState *QueryBackedValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryBackedValue) { @@ -2161,6 +7819,100 @@ func (newState *QueryBackedValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan Q func (newState *QueryBackedValue) SyncEffectiveFieldsDuringRead(existingState QueryBackedValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryBackedValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryBackedValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "multi_values_options": reflect.TypeOf(MultiValuesOptions{}), + "values": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryBackedValue +// only implements ToObjectValue() and Type(). +func (o QueryBackedValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "multi_values_options": o.MultiValuesOptions, + "query_id": o.QueryId, + "values": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryBackedValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "multi_values_options": basetypes.ListType{ + ElemType: MultiValuesOptions{}.Type(ctx), + }, + "query_id": types.StringType, + "values": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetMultiValuesOptions returns the value of the MultiValuesOptions field in QueryBackedValue as +// a MultiValuesOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryBackedValue) GetMultiValuesOptions(ctx context.Context) (MultiValuesOptions, bool) { + var e MultiValuesOptions + if o.MultiValuesOptions.IsNull() || o.MultiValuesOptions.IsUnknown() { + return e, false + } + var v []MultiValuesOptions + d := o.MultiValuesOptions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMultiValuesOptions sets the value of the MultiValuesOptions field in QueryBackedValue. +func (o *QueryBackedValue) SetMultiValuesOptions(ctx context.Context, v MultiValuesOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["multi_values_options"] + o.MultiValuesOptions = types.ListValueMust(t, vs) +} + +// GetValues returns the value of the Values field in QueryBackedValue as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryBackedValue) GetValues(ctx context.Context) ([]types.String, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in QueryBackedValue. +func (o *QueryBackedValue) SetValues(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["values"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type QueryEditContent struct { // Data source ID maps to the ID of the data source used by the resource and // is distinct from the warehouse ID. [Learn more] @@ -2176,7 +7928,7 @@ type QueryEditContent struct { // Exclusively used for storing a list parameter definitions. A parameter is // an object with `title`, `name`, `type`, and `value` properties. The // `value` field here is the default value. It can be overridden at runtime. - Options any `tfsdk:"options" tf:"optional"` + Options types.Object `tfsdk:"options" tf:"optional"` // The text of the query to be run. Query types.String `tfsdk:"query" tf:"optional"` @@ -2186,7 +7938,7 @@ type QueryEditContent struct { // owner" behavior) RunAsRole types.String `tfsdk:"run_as_role" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *QueryEditContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryEditContent) { @@ -2195,18 +7947,93 @@ func (newState *QueryEditContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan Q func (newState *QueryEditContent) SyncEffectiveFieldsDuringRead(existingState QueryEditContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryEditContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryEditContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryEditContent +// only implements ToObjectValue() and Type(). +func (o QueryEditContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_source_id": o.DataSourceId, + "description": o.Description, + "name": o.Name, + "options": o.Options, + "query": o.Query, + "query_id": o.QueryId, + "run_as_role": o.RunAsRole, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryEditContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_source_id": types.StringType, + "description": types.StringType, + "name": types.StringType, + "options": types.ObjectType{}, + "query": types.StringType, + "query_id": types.StringType, + "run_as_role": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetTags returns the value of the Tags field in QueryEditContent as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryEditContent) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in QueryEditContent. +func (o *QueryEditContent) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type QueryFilter struct { // A range filter for query submitted time. The time range must be <= 30 // days. - QueryStartTimeRange []TimeRange `tfsdk:"query_start_time_range" tf:"optional,object"` + QueryStartTimeRange types.List `tfsdk:"query_start_time_range" tf:"optional,object"` // A list of statement IDs. - StatementIds []types.String `tfsdk:"statement_ids" tf:"optional"` + StatementIds types.List `tfsdk:"statement_ids" tf:"optional"` - Statuses []types.String `tfsdk:"statuses" tf:"optional"` + Statuses types.List `tfsdk:"statuses" tf:"optional"` // A list of user IDs who ran the queries. - UserIds []types.Int64 `tfsdk:"user_ids" tf:"optional"` + UserIds types.List `tfsdk:"user_ids" tf:"optional"` // A list of warehouse IDs. - WarehouseIds []types.String `tfsdk:"warehouse_ids" tf:"optional"` + WarehouseIds types.List `tfsdk:"warehouse_ids" tf:"optional"` } func (newState *QueryFilter) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryFilter) { @@ -2215,9 +8042,194 @@ func (newState *QueryFilter) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryF func (newState *QueryFilter) SyncEffectiveFieldsDuringRead(existingState QueryFilter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryFilter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryFilter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "query_start_time_range": reflect.TypeOf(TimeRange{}), + "statement_ids": reflect.TypeOf(types.String{}), + "statuses": reflect.TypeOf(types.String{}), + "user_ids": reflect.TypeOf(types.Int64{}), + "warehouse_ids": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryFilter +// only implements ToObjectValue() and Type(). +func (o QueryFilter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query_start_time_range": o.QueryStartTimeRange, + "statement_ids": o.StatementIds, + "statuses": o.Statuses, + "user_ids": o.UserIds, + "warehouse_ids": o.WarehouseIds, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryFilter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query_start_time_range": basetypes.ListType{ + ElemType: TimeRange{}.Type(ctx), + }, + "statement_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + "statuses": basetypes.ListType{ + ElemType: types.StringType, + }, + "user_ids": basetypes.ListType{ + ElemType: types.Int64Type, + }, + "warehouse_ids": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetQueryStartTimeRange returns the value of the QueryStartTimeRange field in QueryFilter as +// a TimeRange value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryFilter) GetQueryStartTimeRange(ctx context.Context) (TimeRange, bool) { + var e TimeRange + if o.QueryStartTimeRange.IsNull() || o.QueryStartTimeRange.IsUnknown() { + return e, false + } + var v []TimeRange + d := o.QueryStartTimeRange.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueryStartTimeRange sets the value of the QueryStartTimeRange field in QueryFilter. +func (o *QueryFilter) SetQueryStartTimeRange(ctx context.Context, v TimeRange) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query_start_time_range"] + o.QueryStartTimeRange = types.ListValueMust(t, vs) +} + +// GetStatementIds returns the value of the StatementIds field in QueryFilter as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryFilter) GetStatementIds(ctx context.Context) ([]types.String, bool) { + if o.StatementIds.IsNull() || o.StatementIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.StatementIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStatementIds sets the value of the StatementIds field in QueryFilter. +func (o *QueryFilter) SetStatementIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["statement_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.StatementIds = types.ListValueMust(t, vs) +} + +// GetStatuses returns the value of the Statuses field in QueryFilter as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryFilter) GetStatuses(ctx context.Context) ([]types.String, bool) { + if o.Statuses.IsNull() || o.Statuses.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Statuses.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetStatuses sets the value of the Statuses field in QueryFilter. +func (o *QueryFilter) SetStatuses(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["statuses"] + t = t.(attr.TypeWithElementType).ElementType() + o.Statuses = types.ListValueMust(t, vs) +} + +// GetUserIds returns the value of the UserIds field in QueryFilter as +// a slice of types.Int64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryFilter) GetUserIds(ctx context.Context) ([]types.Int64, bool) { + if o.UserIds.IsNull() || o.UserIds.IsUnknown() { + return nil, false + } + var v []types.Int64 + d := o.UserIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetUserIds sets the value of the UserIds field in QueryFilter. +func (o *QueryFilter) SetUserIds(ctx context.Context, v []types.Int64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["user_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.UserIds = types.ListValueMust(t, vs) +} + +// GetWarehouseIds returns the value of the WarehouseIds field in QueryFilter as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryFilter) GetWarehouseIds(ctx context.Context) ([]types.String, bool) { + if o.WarehouseIds.IsNull() || o.WarehouseIds.IsUnknown() { + return nil, false + } + var v []types.String + d := o.WarehouseIds.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetWarehouseIds sets the value of the WarehouseIds field in QueryFilter. +func (o *QueryFilter) SetWarehouseIds(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["warehouse_ids"] + t = t.(attr.TypeWithElementType).ElementType() + o.WarehouseIds = types.ListValueMust(t, vs) +} + type QueryInfo struct { // SQL Warehouse channel information at the time of query execution - ChannelUsed []ChannelInfo `tfsdk:"channel_used" tf:"optional,object"` + ChannelUsed types.List `tfsdk:"channel_used" tf:"optional,object"` // Total execution time of the statement ( excluding result fetch time ). Duration types.Int64 `tfsdk:"duration" tf:"optional"` // Alias for `warehouse_id`. @@ -2236,7 +8248,7 @@ type QueryInfo struct { // A key that can be used to look up query details. LookupKey types.String `tfsdk:"lookup_key" tf:"optional"` // Metrics about query execution. - Metrics []QueryMetrics `tfsdk:"metrics" tf:"optional,object"` + Metrics types.List `tfsdk:"metrics" tf:"optional,object"` // Whether plans exist for the execution, or the reason why they are missing PlansState types.String `tfsdk:"plans_state" tf:"optional"` // The time the query ended. @@ -2273,6 +8285,138 @@ func (newState *QueryInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryInf func (newState *QueryInfo) SyncEffectiveFieldsDuringRead(existingState QueryInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel_used": reflect.TypeOf(ChannelInfo{}), + "metrics": reflect.TypeOf(QueryMetrics{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryInfo +// only implements ToObjectValue() and Type(). +func (o QueryInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "channel_used": o.ChannelUsed, + "duration": o.Duration, + "endpoint_id": o.EndpointId, + "error_message": o.ErrorMessage, + "executed_as_user_id": o.ExecutedAsUserId, + "executed_as_user_name": o.ExecutedAsUserName, + "execution_end_time_ms": o.ExecutionEndTimeMs, + "is_final": o.IsFinal, + "lookup_key": o.LookupKey, + "metrics": o.Metrics, + "plans_state": o.PlansState, + "query_end_time_ms": o.QueryEndTimeMs, + "query_id": o.QueryId, + "query_start_time_ms": o.QueryStartTimeMs, + "query_text": o.QueryText, + "rows_produced": o.RowsProduced, + "spark_ui_url": o.SparkUiUrl, + "statement_type": o.StatementType, + "status": o.Status, + "user_id": o.UserId, + "user_name": o.UserName, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "channel_used": basetypes.ListType{ + ElemType: ChannelInfo{}.Type(ctx), + }, + "duration": types.Int64Type, + "endpoint_id": types.StringType, + "error_message": types.StringType, + "executed_as_user_id": types.Int64Type, + "executed_as_user_name": types.StringType, + "execution_end_time_ms": types.Int64Type, + "is_final": types.BoolType, + "lookup_key": types.StringType, + "metrics": basetypes.ListType{ + ElemType: QueryMetrics{}.Type(ctx), + }, + "plans_state": types.StringType, + "query_end_time_ms": types.Int64Type, + "query_id": types.StringType, + "query_start_time_ms": types.Int64Type, + "query_text": types.StringType, + "rows_produced": types.Int64Type, + "spark_ui_url": types.StringType, + "statement_type": types.StringType, + "status": types.StringType, + "user_id": types.Int64Type, + "user_name": types.StringType, + "warehouse_id": types.StringType, + }, + } +} + +// GetChannelUsed returns the value of the ChannelUsed field in QueryInfo as +// a ChannelInfo value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryInfo) GetChannelUsed(ctx context.Context) (ChannelInfo, bool) { + var e ChannelInfo + if o.ChannelUsed.IsNull() || o.ChannelUsed.IsUnknown() { + return e, false + } + var v []ChannelInfo + d := o.ChannelUsed.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannelUsed sets the value of the ChannelUsed field in QueryInfo. +func (o *QueryInfo) SetChannelUsed(ctx context.Context, v ChannelInfo) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel_used"] + o.ChannelUsed = types.ListValueMust(t, vs) +} + +// GetMetrics returns the value of the Metrics field in QueryInfo as +// a QueryMetrics value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryInfo) GetMetrics(ctx context.Context) (QueryMetrics, bool) { + var e QueryMetrics + if o.Metrics.IsNull() || o.Metrics.IsUnknown() { + return e, false + } + var v []QueryMetrics + d := o.Metrics.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetMetrics sets the value of the Metrics field in QueryInfo. +func (o *QueryInfo) SetMetrics(ctx context.Context, v QueryMetrics) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["metrics"] + o.Metrics = types.ListValueMust(t, vs) +} + type QueryList struct { // The total number of queries. Count types.Int64 `tfsdk:"count" tf:"optional"` @@ -2281,7 +8425,7 @@ type QueryList struct { // The number of queries per page. PageSize types.Int64 `tfsdk:"page_size" tf:"optional"` // List of queries returned. - Results []LegacyQuery `tfsdk:"results" tf:"optional"` + Results types.List `tfsdk:"results" tf:"optional"` } func (newState *QueryList) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryList) { @@ -2290,6 +8434,73 @@ func (newState *QueryList) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryLis func (newState *QueryList) SyncEffectiveFieldsDuringRead(existingState QueryList) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryList. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryList) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "results": reflect.TypeOf(LegacyQuery{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryList +// only implements ToObjectValue() and Type(). +func (o QueryList) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "count": o.Count, + "page": o.Page, + "page_size": o.PageSize, + "results": o.Results, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryList) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "count": types.Int64Type, + "page": types.Int64Type, + "page_size": types.Int64Type, + "results": basetypes.ListType{ + ElemType: LegacyQuery{}.Type(ctx), + }, + }, + } +} + +// GetResults returns the value of the Results field in QueryList as +// a slice of LegacyQuery values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryList) GetResults(ctx context.Context) ([]LegacyQuery, bool) { + if o.Results.IsNull() || o.Results.IsUnknown() { + return nil, false + } + var v []LegacyQuery + d := o.Results.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetResults sets the value of the Results field in QueryList. +func (o *QueryList) SetResults(ctx context.Context, v []LegacyQuery) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["results"] + t = t.(attr.TypeWithElementType).ElementType() + o.Results = types.ListValueMust(t, vs) +} + // A query metric that encapsulates a set of measurements for a single query. // Metrics come from the driver and are stored in the history service database. type QueryMetrics struct { @@ -2357,6 +8568,79 @@ func (newState *QueryMetrics) SyncEffectiveFieldsDuringCreateOrUpdate(plan Query func (newState *QueryMetrics) SyncEffectiveFieldsDuringRead(existingState QueryMetrics) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryMetrics. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryMetrics) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryMetrics +// only implements ToObjectValue() and Type(). +func (o QueryMetrics) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "compilation_time_ms": o.CompilationTimeMs, + "execution_time_ms": o.ExecutionTimeMs, + "network_sent_bytes": o.NetworkSentBytes, + "overloading_queue_start_timestamp": o.OverloadingQueueStartTimestamp, + "photon_total_time_ms": o.PhotonTotalTimeMs, + "provisioning_queue_start_timestamp": o.ProvisioningQueueStartTimestamp, + "pruned_bytes": o.PrunedBytes, + "pruned_files_count": o.PrunedFilesCount, + "query_compilation_start_timestamp": o.QueryCompilationStartTimestamp, + "read_bytes": o.ReadBytes, + "read_cache_bytes": o.ReadCacheBytes, + "read_files_count": o.ReadFilesCount, + "read_partitions_count": o.ReadPartitionsCount, + "read_remote_bytes": o.ReadRemoteBytes, + "result_fetch_time_ms": o.ResultFetchTimeMs, + "result_from_cache": o.ResultFromCache, + "rows_produced_count": o.RowsProducedCount, + "rows_read_count": o.RowsReadCount, + "spill_to_disk_bytes": o.SpillToDiskBytes, + "task_total_time_ms": o.TaskTotalTimeMs, + "total_time_ms": o.TotalTimeMs, + "write_remote_bytes": o.WriteRemoteBytes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryMetrics) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "compilation_time_ms": types.Int64Type, + "execution_time_ms": types.Int64Type, + "network_sent_bytes": types.Int64Type, + "overloading_queue_start_timestamp": types.Int64Type, + "photon_total_time_ms": types.Int64Type, + "provisioning_queue_start_timestamp": types.Int64Type, + "pruned_bytes": types.Int64Type, + "pruned_files_count": types.Int64Type, + "query_compilation_start_timestamp": types.Int64Type, + "read_bytes": types.Int64Type, + "read_cache_bytes": types.Int64Type, + "read_files_count": types.Int64Type, + "read_partitions_count": types.Int64Type, + "read_remote_bytes": types.Int64Type, + "result_fetch_time_ms": types.Int64Type, + "result_from_cache": types.BoolType, + "rows_produced_count": types.Int64Type, + "rows_read_count": types.Int64Type, + "spill_to_disk_bytes": types.Int64Type, + "task_total_time_ms": types.Int64Type, + "total_time_ms": types.Int64Type, + "write_remote_bytes": types.Int64Type, + }, + } +} + type QueryOptions struct { // The name of the catalog to execute this query in. Catalog types.String `tfsdk:"catalog" tf:"optional"` @@ -2365,7 +8649,7 @@ type QueryOptions struct { // days. MovedToTrashAt types.String `tfsdk:"moved_to_trash_at" tf:"optional"` - Parameters []Parameter `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // The name of the schema to execute this query in. Schema types.String `tfsdk:"schema" tf:"optional"` } @@ -2376,24 +8660,91 @@ func (newState *QueryOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan Query func (newState *QueryOptions) SyncEffectiveFieldsDuringRead(existingState QueryOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(Parameter{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryOptions +// only implements ToObjectValue() and Type(). +func (o QueryOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "catalog": o.Catalog, + "moved_to_trash_at": o.MovedToTrashAt, + "parameters": o.Parameters, + "schema": o.Schema, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "catalog": types.StringType, + "moved_to_trash_at": types.StringType, + "parameters": basetypes.ListType{ + ElemType: Parameter{}.Type(ctx), + }, + "schema": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in QueryOptions as +// a slice of Parameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryOptions) GetParameters(ctx context.Context) ([]Parameter, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []Parameter + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in QueryOptions. +func (o *QueryOptions) SetParameters(ctx context.Context, v []Parameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + type QueryParameter struct { // Date-range query parameter value. Can only specify one of // `dynamic_date_range_value` or `date_range_value`. - DateRangeValue []DateRangeValue `tfsdk:"date_range_value" tf:"optional,object"` + DateRangeValue types.List `tfsdk:"date_range_value" tf:"optional,object"` // Date query parameter value. Can only specify one of `dynamic_date_value` // or `date_value`. - DateValue []DateValue `tfsdk:"date_value" tf:"optional,object"` + DateValue types.List `tfsdk:"date_value" tf:"optional,object"` // Dropdown query parameter value. - EnumValue []EnumValue `tfsdk:"enum_value" tf:"optional,object"` + EnumValue types.List `tfsdk:"enum_value" tf:"optional,object"` // Literal parameter marker that appears between double curly braces in the // query text. Name types.String `tfsdk:"name" tf:"optional"` // Numeric query parameter value. - NumericValue []NumericValue `tfsdk:"numeric_value" tf:"optional,object"` + NumericValue types.List `tfsdk:"numeric_value" tf:"optional,object"` // Query-based dropdown query parameter value. - QueryBackedValue []QueryBackedValue `tfsdk:"query_backed_value" tf:"optional,object"` + QueryBackedValue types.List `tfsdk:"query_backed_value" tf:"optional,object"` // Text query parameter value. - TextValue []TextValue `tfsdk:"text_value" tf:"optional,object"` + TextValue types.List `tfsdk:"text_value" tf:"optional,object"` // Text displayed in the user-facing parameter widget in the UI. Title types.String `tfsdk:"title" tf:"optional"` } @@ -2404,6 +8755,226 @@ func (newState *QueryParameter) SyncEffectiveFieldsDuringCreateOrUpdate(plan Que func (newState *QueryParameter) SyncEffectiveFieldsDuringRead(existingState QueryParameter) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryParameter. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryParameter) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "date_range_value": reflect.TypeOf(DateRangeValue{}), + "date_value": reflect.TypeOf(DateValue{}), + "enum_value": reflect.TypeOf(EnumValue{}), + "numeric_value": reflect.TypeOf(NumericValue{}), + "query_backed_value": reflect.TypeOf(QueryBackedValue{}), + "text_value": reflect.TypeOf(TextValue{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryParameter +// only implements ToObjectValue() and Type(). +func (o QueryParameter) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "date_range_value": o.DateRangeValue, + "date_value": o.DateValue, + "enum_value": o.EnumValue, + "name": o.Name, + "numeric_value": o.NumericValue, + "query_backed_value": o.QueryBackedValue, + "text_value": o.TextValue, + "title": o.Title, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryParameter) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "date_range_value": basetypes.ListType{ + ElemType: DateRangeValue{}.Type(ctx), + }, + "date_value": basetypes.ListType{ + ElemType: DateValue{}.Type(ctx), + }, + "enum_value": basetypes.ListType{ + ElemType: EnumValue{}.Type(ctx), + }, + "name": types.StringType, + "numeric_value": basetypes.ListType{ + ElemType: NumericValue{}.Type(ctx), + }, + "query_backed_value": basetypes.ListType{ + ElemType: QueryBackedValue{}.Type(ctx), + }, + "text_value": basetypes.ListType{ + ElemType: TextValue{}.Type(ctx), + }, + "title": types.StringType, + }, + } +} + +// GetDateRangeValue returns the value of the DateRangeValue field in QueryParameter as +// a DateRangeValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryParameter) GetDateRangeValue(ctx context.Context) (DateRangeValue, bool) { + var e DateRangeValue + if o.DateRangeValue.IsNull() || o.DateRangeValue.IsUnknown() { + return e, false + } + var v []DateRangeValue + d := o.DateRangeValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDateRangeValue sets the value of the DateRangeValue field in QueryParameter. +func (o *QueryParameter) SetDateRangeValue(ctx context.Context, v DateRangeValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["date_range_value"] + o.DateRangeValue = types.ListValueMust(t, vs) +} + +// GetDateValue returns the value of the DateValue field in QueryParameter as +// a DateValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryParameter) GetDateValue(ctx context.Context) (DateValue, bool) { + var e DateValue + if o.DateValue.IsNull() || o.DateValue.IsUnknown() { + return e, false + } + var v []DateValue + d := o.DateValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDateValue sets the value of the DateValue field in QueryParameter. +func (o *QueryParameter) SetDateValue(ctx context.Context, v DateValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["date_value"] + o.DateValue = types.ListValueMust(t, vs) +} + +// GetEnumValue returns the value of the EnumValue field in QueryParameter as +// a EnumValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryParameter) GetEnumValue(ctx context.Context) (EnumValue, bool) { + var e EnumValue + if o.EnumValue.IsNull() || o.EnumValue.IsUnknown() { + return e, false + } + var v []EnumValue + d := o.EnumValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEnumValue sets the value of the EnumValue field in QueryParameter. +func (o *QueryParameter) SetEnumValue(ctx context.Context, v EnumValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["enum_value"] + o.EnumValue = types.ListValueMust(t, vs) +} + +// GetNumericValue returns the value of the NumericValue field in QueryParameter as +// a NumericValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryParameter) GetNumericValue(ctx context.Context) (NumericValue, bool) { + var e NumericValue + if o.NumericValue.IsNull() || o.NumericValue.IsUnknown() { + return e, false + } + var v []NumericValue + d := o.NumericValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetNumericValue sets the value of the NumericValue field in QueryParameter. +func (o *QueryParameter) SetNumericValue(ctx context.Context, v NumericValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["numeric_value"] + o.NumericValue = types.ListValueMust(t, vs) +} + +// GetQueryBackedValue returns the value of the QueryBackedValue field in QueryParameter as +// a QueryBackedValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryParameter) GetQueryBackedValue(ctx context.Context) (QueryBackedValue, bool) { + var e QueryBackedValue + if o.QueryBackedValue.IsNull() || o.QueryBackedValue.IsUnknown() { + return e, false + } + var v []QueryBackedValue + d := o.QueryBackedValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQueryBackedValue sets the value of the QueryBackedValue field in QueryParameter. +func (o *QueryParameter) SetQueryBackedValue(ctx context.Context, v QueryBackedValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query_backed_value"] + o.QueryBackedValue = types.ListValueMust(t, vs) +} + +// GetTextValue returns the value of the TextValue field in QueryParameter as +// a TextValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryParameter) GetTextValue(ctx context.Context) (TextValue, bool) { + var e TextValue + if o.TextValue.IsNull() || o.TextValue.IsUnknown() { + return e, false + } + var v []TextValue + d := o.TextValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetTextValue sets the value of the TextValue field in QueryParameter. +func (o *QueryParameter) SetTextValue(ctx context.Context, v TextValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["text_value"] + o.TextValue = types.ListValueMust(t, vs) +} + type QueryPostContent struct { // Data source ID maps to the ID of the data source used by the resource and // is distinct from the warehouse ID. [Learn more] @@ -2419,7 +8990,7 @@ type QueryPostContent struct { // Exclusively used for storing a list parameter definitions. A parameter is // an object with `title`, `name`, `type`, and `value` properties. The // `value` field here is the default value. It can be overridden at runtime. - Options any `tfsdk:"options" tf:"optional"` + Options types.Object `tfsdk:"options" tf:"optional"` // The identifier of the workspace folder containing the object. Parent types.String `tfsdk:"parent" tf:"optional"` // The text of the query to be run. @@ -2429,7 +9000,7 @@ type QueryPostContent struct { // owner" behavior) RunAsRole types.String `tfsdk:"run_as_role" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` } func (newState *QueryPostContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryPostContent) { @@ -2438,11 +9009,86 @@ func (newState *QueryPostContent) SyncEffectiveFieldsDuringCreateOrUpdate(plan Q func (newState *QueryPostContent) SyncEffectiveFieldsDuringRead(existingState QueryPostContent) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryPostContent. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryPostContent) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryPostContent +// only implements ToObjectValue() and Type(). +func (o QueryPostContent) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_source_id": o.DataSourceId, + "description": o.Description, + "name": o.Name, + "options": o.Options, + "parent": o.Parent, + "query": o.Query, + "run_as_role": o.RunAsRole, + "tags": o.Tags, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryPostContent) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_source_id": types.StringType, + "description": types.StringType, + "name": types.StringType, + "options": types.ObjectType{}, + "parent": types.StringType, + "query": types.StringType, + "run_as_role": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetTags returns the value of the Tags field in QueryPostContent as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryPostContent) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in QueryPostContent. +func (o *QueryPostContent) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type RepeatedEndpointConfPairs struct { // Deprecated: Use configuration_pairs - ConfigPair []EndpointConfPair `tfsdk:"config_pair" tf:"optional"` + ConfigPair types.List `tfsdk:"config_pair" tf:"optional"` - ConfigurationPairs []EndpointConfPair `tfsdk:"configuration_pairs" tf:"optional"` + ConfigurationPairs types.List `tfsdk:"configuration_pairs" tf:"optional"` } func (newState *RepeatedEndpointConfPairs) SyncEffectiveFieldsDuringCreateOrUpdate(plan RepeatedEndpointConfPairs) { @@ -2451,6 +9097,98 @@ func (newState *RepeatedEndpointConfPairs) SyncEffectiveFieldsDuringCreateOrUpda func (newState *RepeatedEndpointConfPairs) SyncEffectiveFieldsDuringRead(existingState RepeatedEndpointConfPairs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepeatedEndpointConfPairs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepeatedEndpointConfPairs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "config_pair": reflect.TypeOf(EndpointConfPair{}), + "configuration_pairs": reflect.TypeOf(EndpointConfPair{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepeatedEndpointConfPairs +// only implements ToObjectValue() and Type(). +func (o RepeatedEndpointConfPairs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "config_pair": o.ConfigPair, + "configuration_pairs": o.ConfigurationPairs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepeatedEndpointConfPairs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "config_pair": basetypes.ListType{ + ElemType: EndpointConfPair{}.Type(ctx), + }, + "configuration_pairs": basetypes.ListType{ + ElemType: EndpointConfPair{}.Type(ctx), + }, + }, + } +} + +// GetConfigPair returns the value of the ConfigPair field in RepeatedEndpointConfPairs as +// a slice of EndpointConfPair values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepeatedEndpointConfPairs) GetConfigPair(ctx context.Context) ([]EndpointConfPair, bool) { + if o.ConfigPair.IsNull() || o.ConfigPair.IsUnknown() { + return nil, false + } + var v []EndpointConfPair + d := o.ConfigPair.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetConfigPair sets the value of the ConfigPair field in RepeatedEndpointConfPairs. +func (o *RepeatedEndpointConfPairs) SetConfigPair(ctx context.Context, v []EndpointConfPair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config_pair"] + t = t.(attr.TypeWithElementType).ElementType() + o.ConfigPair = types.ListValueMust(t, vs) +} + +// GetConfigurationPairs returns the value of the ConfigurationPairs field in RepeatedEndpointConfPairs as +// a slice of EndpointConfPair values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepeatedEndpointConfPairs) GetConfigurationPairs(ctx context.Context) ([]EndpointConfPair, bool) { + if o.ConfigurationPairs.IsNull() || o.ConfigurationPairs.IsUnknown() { + return nil, false + } + var v []EndpointConfPair + d := o.ConfigurationPairs.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetConfigurationPairs sets the value of the ConfigurationPairs field in RepeatedEndpointConfPairs. +func (o *RepeatedEndpointConfPairs) SetConfigurationPairs(ctx context.Context, v []EndpointConfPair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["configuration_pairs"] + t = t.(attr.TypeWithElementType).ElementType() + o.ConfigurationPairs = types.ListValueMust(t, vs) +} + // Restore a dashboard type RestoreDashboardRequest struct { DashboardId types.String `tfsdk:"-"` @@ -2462,6 +9200,37 @@ func (newState *RestoreDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *RestoreDashboardRequest) SyncEffectiveFieldsDuringRead(existingState RestoreDashboardRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreDashboardRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreDashboardRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreDashboardRequest +// only implements ToObjectValue() and Type(). +func (o RestoreDashboardRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dashboard_id": o.DashboardId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreDashboardRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dashboard_id": types.StringType, + }, + } +} + // Restore a query type RestoreQueriesLegacyRequest struct { QueryId types.String `tfsdk:"-"` @@ -2473,6 +9242,37 @@ func (newState *RestoreQueriesLegacyRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *RestoreQueriesLegacyRequest) SyncEffectiveFieldsDuringRead(existingState RestoreQueriesLegacyRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreQueriesLegacyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreQueriesLegacyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreQueriesLegacyRequest +// only implements ToObjectValue() and Type(). +func (o RestoreQueriesLegacyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "query_id": o.QueryId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreQueriesLegacyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "query_id": types.StringType, + }, + } +} + type RestoreResponse struct { } @@ -2482,6 +9282,33 @@ func (newState *RestoreResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Re func (newState *RestoreResponse) SyncEffectiveFieldsDuringRead(existingState RestoreResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RestoreResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RestoreResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RestoreResponse +// only implements ToObjectValue() and Type(). +func (o RestoreResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o RestoreResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ResultData struct { // The number of bytes in the result chunk. This field is not available when // using `INLINE` disposition. @@ -2491,9 +9318,9 @@ type ResultData struct { // The `JSON_ARRAY` format is an array of arrays of values, where each // non-null value is formatted as a string. Null values are encoded as JSON // `null`. - DataArray [][]types.String `tfsdk:"data_array" tf:"optional"` + DataArray types.List `tfsdk:"data_array" tf:"optional"` - ExternalLinks []ExternalLink `tfsdk:"external_links" tf:"optional"` + ExternalLinks types.List `tfsdk:"external_links" tf:"optional"` // When fetching, provides the `chunk_index` for the _next_ chunk. If // absent, indicates there are no more chunks. The next chunk can be fetched // with a :method:statementexecution/getStatementResultChunkN request. @@ -2515,14 +9342,120 @@ func (newState *ResultData) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResultD func (newState *ResultData) SyncEffectiveFieldsDuringRead(existingState ResultData) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResultData. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResultData) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data_array": reflect.TypeOf(types.String{}), + "external_links": reflect.TypeOf(ExternalLink{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResultData +// only implements ToObjectValue() and Type(). +func (o ResultData) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "byte_count": o.ByteCount, + "chunk_index": o.ChunkIndex, + "data_array": o.DataArray, + "external_links": o.ExternalLinks, + "next_chunk_index": o.NextChunkIndex, + "next_chunk_internal_link": o.NextChunkInternalLink, + "row_count": o.RowCount, + "row_offset": o.RowOffset, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResultData) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "byte_count": types.Int64Type, + "chunk_index": types.Int64Type, + "data_array": basetypes.ListType{ + ElemType: basetypes.ListType{ + ElemType: types.StringType, + }, + }, + "external_links": basetypes.ListType{ + ElemType: ExternalLink{}.Type(ctx), + }, + "next_chunk_index": types.Int64Type, + "next_chunk_internal_link": types.StringType, + "row_count": types.Int64Type, + "row_offset": types.Int64Type, + }, + } +} + +// GetDataArray returns the value of the DataArray field in ResultData as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultData) GetDataArray(ctx context.Context) ([]types.String, bool) { + if o.DataArray.IsNull() || o.DataArray.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DataArray.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDataArray sets the value of the DataArray field in ResultData. +func (o *ResultData) SetDataArray(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_array"] + t = t.(attr.TypeWithElementType).ElementType() + o.DataArray = types.ListValueMust(t, vs) +} + +// GetExternalLinks returns the value of the ExternalLinks field in ResultData as +// a slice of ExternalLink values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultData) GetExternalLinks(ctx context.Context) ([]ExternalLink, bool) { + if o.ExternalLinks.IsNull() || o.ExternalLinks.IsUnknown() { + return nil, false + } + var v []ExternalLink + d := o.ExternalLinks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetExternalLinks sets the value of the ExternalLinks field in ResultData. +func (o *ResultData) SetExternalLinks(ctx context.Context, v []ExternalLink) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["external_links"] + t = t.(attr.TypeWithElementType).ElementType() + o.ExternalLinks = types.ListValueMust(t, vs) +} + // The result manifest provides schema and metadata for the result set. type ResultManifest struct { // Array of result set chunk metadata. - Chunks []BaseChunkInfo `tfsdk:"chunks" tf:"optional"` + Chunks types.List `tfsdk:"chunks" tf:"optional"` Format types.String `tfsdk:"format" tf:"optional"` // The schema is an ordered list of column descriptions. - Schema []ResultSchema `tfsdk:"schema" tf:"optional,object"` + Schema types.List `tfsdk:"schema" tf:"optional,object"` // The total number of bytes in the result set. This field is not available // when using `INLINE` disposition. TotalByteCount types.Int64 `tfsdk:"total_byte_count" tf:"optional"` @@ -2541,11 +9474,113 @@ func (newState *ResultManifest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Res func (newState *ResultManifest) SyncEffectiveFieldsDuringRead(existingState ResultManifest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResultManifest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResultManifest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "chunks": reflect.TypeOf(BaseChunkInfo{}), + "schema": reflect.TypeOf(ResultSchema{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResultManifest +// only implements ToObjectValue() and Type(). +func (o ResultManifest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "chunks": o.Chunks, + "format": o.Format, + "schema": o.Schema, + "total_byte_count": o.TotalByteCount, + "total_chunk_count": o.TotalChunkCount, + "total_row_count": o.TotalRowCount, + "truncated": o.Truncated, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResultManifest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "chunks": basetypes.ListType{ + ElemType: BaseChunkInfo{}.Type(ctx), + }, + "format": types.StringType, + "schema": basetypes.ListType{ + ElemType: ResultSchema{}.Type(ctx), + }, + "total_byte_count": types.Int64Type, + "total_chunk_count": types.Int64Type, + "total_row_count": types.Int64Type, + "truncated": types.BoolType, + }, + } +} + +// GetChunks returns the value of the Chunks field in ResultManifest as +// a slice of BaseChunkInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultManifest) GetChunks(ctx context.Context) ([]BaseChunkInfo, bool) { + if o.Chunks.IsNull() || o.Chunks.IsUnknown() { + return nil, false + } + var v []BaseChunkInfo + d := o.Chunks.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetChunks sets the value of the Chunks field in ResultManifest. +func (o *ResultManifest) SetChunks(ctx context.Context, v []BaseChunkInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["chunks"] + t = t.(attr.TypeWithElementType).ElementType() + o.Chunks = types.ListValueMust(t, vs) +} + +// GetSchema returns the value of the Schema field in ResultManifest as +// a ResultSchema value. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultManifest) GetSchema(ctx context.Context) (ResultSchema, bool) { + var e ResultSchema + if o.Schema.IsNull() || o.Schema.IsUnknown() { + return e, false + } + var v []ResultSchema + d := o.Schema.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSchema sets the value of the Schema field in ResultManifest. +func (o *ResultManifest) SetSchema(ctx context.Context, v ResultSchema) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["schema"] + o.Schema = types.ListValueMust(t, vs) +} + // The schema is an ordered list of column descriptions. type ResultSchema struct { ColumnCount types.Int64 `tfsdk:"column_count" tf:"optional"` - Columns []ColumnInfo `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` } func (newState *ResultSchema) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResultSchema) { @@ -2554,6 +9589,69 @@ func (newState *ResultSchema) SyncEffectiveFieldsDuringCreateOrUpdate(plan Resul func (newState *ResultSchema) SyncEffectiveFieldsDuringRead(existingState ResultSchema) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResultSchema. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResultSchema) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(ColumnInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResultSchema +// only implements ToObjectValue() and Type(). +func (o ResultSchema) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "column_count": o.ColumnCount, + "columns": o.Columns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResultSchema) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "column_count": types.Int64Type, + "columns": basetypes.ListType{ + ElemType: ColumnInfo{}.Type(ctx), + }, + }, + } +} + +// GetColumns returns the value of the Columns field in ResultSchema as +// a slice of ColumnInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultSchema) GetColumns(ctx context.Context) ([]ColumnInfo, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []ColumnInfo + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in ResultSchema. +func (o *ResultSchema) SetColumns(ctx context.Context, v []ColumnInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + type ServiceError struct { ErrorCode types.String `tfsdk:"error_code" tf:"optional"` // A brief summary of the error condition. @@ -2566,9 +9664,42 @@ func (newState *ServiceError) SyncEffectiveFieldsDuringCreateOrUpdate(plan Servi func (newState *ServiceError) SyncEffectiveFieldsDuringRead(existingState ServiceError) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ServiceError. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ServiceError) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ServiceError +// only implements ToObjectValue() and Type(). +func (o ServiceError) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error_code": o.ErrorCode, + "message": o.Message, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ServiceError) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error_code": types.StringType, + "message": types.StringType, + }, + } +} + // Set object ACL type SetRequest struct { - AccessControlList []AccessControl `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // Object ID. The ACL for the object with this UUID is overwritten by this // request's POST content. ObjectId types.String `tfsdk:"-"` @@ -2582,8 +9713,73 @@ func (newState *SetRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan SetRequ func (newState *SetRequest) SyncEffectiveFieldsDuringRead(existingState SetRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AccessControl{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetRequest +// only implements ToObjectValue() and Type(). +func (o SetRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "objectId": o.ObjectId, + "objectType": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AccessControl{}.Type(ctx), + }, + "objectId": types.StringType, + "objectType": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in SetRequest as +// a slice of AccessControl values. +// If the field is unknown or null, the boolean return value is false. +func (o *SetRequest) GetAccessControlList(ctx context.Context) ([]AccessControl, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AccessControl + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in SetRequest. +func (o *SetRequest) SetAccessControlList(ctx context.Context, v []AccessControl) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type SetResponse struct { - AccessControlList []AccessControl `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // An object's type and UUID, separated by a forward slash (/) character. ObjectId types.String `tfsdk:"object_id" tf:"optional"` // A singular noun object type. @@ -2596,23 +9792,88 @@ func (newState *SetResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan SetRes func (newState *SetResponse) SyncEffectiveFieldsDuringRead(existingState SetResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(AccessControl{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetResponse +// only implements ToObjectValue() and Type(). +func (o SetResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: AccessControl{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in SetResponse as +// a slice of AccessControl values. +// If the field is unknown or null, the boolean return value is false. +func (o *SetResponse) GetAccessControlList(ctx context.Context) ([]AccessControl, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []AccessControl + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in SetResponse. +func (o *SetResponse) SetAccessControlList(ctx context.Context, v []AccessControl) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type SetWorkspaceWarehouseConfigRequest struct { // Optional: Channel selection details - Channel []Channel `tfsdk:"channel" tf:"optional,object"` + Channel types.List `tfsdk:"channel" tf:"optional,object"` // Deprecated: Use sql_configuration_parameters - ConfigParam []RepeatedEndpointConfPairs `tfsdk:"config_param" tf:"optional,object"` + ConfigParam types.List `tfsdk:"config_param" tf:"optional,object"` // Spark confs for external hive metastore configuration JSON serialized // size must be less than <= 512K - DataAccessConfig []EndpointConfPair `tfsdk:"data_access_config" tf:"optional"` + DataAccessConfig types.List `tfsdk:"data_access_config" tf:"optional"` // List of Warehouse Types allowed in this workspace (limits allowed value // of the type field in CreateWarehouse and EditWarehouse). Note: Some types // cannot be disabled, they don't need to be specified in // SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing // warehouses to be converted to another type. Used by frontend to save // specific type availability in the warehouse create and edit form UI. - EnabledWarehouseTypes []WarehouseTypePair `tfsdk:"enabled_warehouse_types" tf:"optional"` + EnabledWarehouseTypes types.List `tfsdk:"enabled_warehouse_types" tf:"optional"` // Deprecated: Use sql_configuration_parameters - GlobalParam []RepeatedEndpointConfPairs `tfsdk:"global_param" tf:"optional,object"` + GlobalParam types.List `tfsdk:"global_param" tf:"optional,object"` // GCP only: Google Service Account used to pass to cluster to access Google // Cloud Storage GoogleServiceAccount types.String `tfsdk:"google_service_account" tf:"optional"` @@ -2621,7 +9882,7 @@ type SetWorkspaceWarehouseConfigRequest struct { // Security policy for warehouses SecurityPolicy types.String `tfsdk:"security_policy" tf:"optional"` // SQL configuration parameters - SqlConfigurationParameters []RepeatedEndpointConfPairs `tfsdk:"sql_configuration_parameters" tf:"optional,object"` + SqlConfigurationParameters types.List `tfsdk:"sql_configuration_parameters" tf:"optional,object"` } func (newState *SetWorkspaceWarehouseConfigRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan SetWorkspaceWarehouseConfigRequest) { @@ -2630,6 +9891,228 @@ func (newState *SetWorkspaceWarehouseConfigRequest) SyncEffectiveFieldsDuringCre func (newState *SetWorkspaceWarehouseConfigRequest) SyncEffectiveFieldsDuringRead(existingState SetWorkspaceWarehouseConfigRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetWorkspaceWarehouseConfigRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetWorkspaceWarehouseConfigRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "channel": reflect.TypeOf(Channel{}), + "config_param": reflect.TypeOf(RepeatedEndpointConfPairs{}), + "data_access_config": reflect.TypeOf(EndpointConfPair{}), + "enabled_warehouse_types": reflect.TypeOf(WarehouseTypePair{}), + "global_param": reflect.TypeOf(RepeatedEndpointConfPairs{}), + "sql_configuration_parameters": reflect.TypeOf(RepeatedEndpointConfPairs{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetWorkspaceWarehouseConfigRequest +// only implements ToObjectValue() and Type(). +func (o SetWorkspaceWarehouseConfigRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "channel": o.Channel, + "config_param": o.ConfigParam, + "data_access_config": o.DataAccessConfig, + "enabled_warehouse_types": o.EnabledWarehouseTypes, + "global_param": o.GlobalParam, + "google_service_account": o.GoogleServiceAccount, + "instance_profile_arn": o.InstanceProfileArn, + "security_policy": o.SecurityPolicy, + "sql_configuration_parameters": o.SqlConfigurationParameters, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SetWorkspaceWarehouseConfigRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "channel": basetypes.ListType{ + ElemType: Channel{}.Type(ctx), + }, + "config_param": basetypes.ListType{ + ElemType: RepeatedEndpointConfPairs{}.Type(ctx), + }, + "data_access_config": basetypes.ListType{ + ElemType: EndpointConfPair{}.Type(ctx), + }, + "enabled_warehouse_types": basetypes.ListType{ + ElemType: WarehouseTypePair{}.Type(ctx), + }, + "global_param": basetypes.ListType{ + ElemType: RepeatedEndpointConfPairs{}.Type(ctx), + }, + "google_service_account": types.StringType, + "instance_profile_arn": types.StringType, + "security_policy": types.StringType, + "sql_configuration_parameters": basetypes.ListType{ + ElemType: RepeatedEndpointConfPairs{}.Type(ctx), + }, + }, + } +} + +// GetChannel returns the value of the Channel field in SetWorkspaceWarehouseConfigRequest as +// a Channel value. +// If the field is unknown or null, the boolean return value is false. +func (o *SetWorkspaceWarehouseConfigRequest) GetChannel(ctx context.Context) (Channel, bool) { + var e Channel + if o.Channel.IsNull() || o.Channel.IsUnknown() { + return e, false + } + var v []Channel + d := o.Channel.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetChannel sets the value of the Channel field in SetWorkspaceWarehouseConfigRequest. +func (o *SetWorkspaceWarehouseConfigRequest) SetChannel(ctx context.Context, v Channel) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["channel"] + o.Channel = types.ListValueMust(t, vs) +} + +// GetConfigParam returns the value of the ConfigParam field in SetWorkspaceWarehouseConfigRequest as +// a RepeatedEndpointConfPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *SetWorkspaceWarehouseConfigRequest) GetConfigParam(ctx context.Context) (RepeatedEndpointConfPairs, bool) { + var e RepeatedEndpointConfPairs + if o.ConfigParam.IsNull() || o.ConfigParam.IsUnknown() { + return e, false + } + var v []RepeatedEndpointConfPairs + d := o.ConfigParam.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetConfigParam sets the value of the ConfigParam field in SetWorkspaceWarehouseConfigRequest. +func (o *SetWorkspaceWarehouseConfigRequest) SetConfigParam(ctx context.Context, v RepeatedEndpointConfPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["config_param"] + o.ConfigParam = types.ListValueMust(t, vs) +} + +// GetDataAccessConfig returns the value of the DataAccessConfig field in SetWorkspaceWarehouseConfigRequest as +// a slice of EndpointConfPair values. +// If the field is unknown or null, the boolean return value is false. +func (o *SetWorkspaceWarehouseConfigRequest) GetDataAccessConfig(ctx context.Context) ([]EndpointConfPair, bool) { + if o.DataAccessConfig.IsNull() || o.DataAccessConfig.IsUnknown() { + return nil, false + } + var v []EndpointConfPair + d := o.DataAccessConfig.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDataAccessConfig sets the value of the DataAccessConfig field in SetWorkspaceWarehouseConfigRequest. +func (o *SetWorkspaceWarehouseConfigRequest) SetDataAccessConfig(ctx context.Context, v []EndpointConfPair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_access_config"] + t = t.(attr.TypeWithElementType).ElementType() + o.DataAccessConfig = types.ListValueMust(t, vs) +} + +// GetEnabledWarehouseTypes returns the value of the EnabledWarehouseTypes field in SetWorkspaceWarehouseConfigRequest as +// a slice of WarehouseTypePair values. +// If the field is unknown or null, the boolean return value is false. +func (o *SetWorkspaceWarehouseConfigRequest) GetEnabledWarehouseTypes(ctx context.Context) ([]WarehouseTypePair, bool) { + if o.EnabledWarehouseTypes.IsNull() || o.EnabledWarehouseTypes.IsUnknown() { + return nil, false + } + var v []WarehouseTypePair + d := o.EnabledWarehouseTypes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEnabledWarehouseTypes sets the value of the EnabledWarehouseTypes field in SetWorkspaceWarehouseConfigRequest. +func (o *SetWorkspaceWarehouseConfigRequest) SetEnabledWarehouseTypes(ctx context.Context, v []WarehouseTypePair) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["enabled_warehouse_types"] + t = t.(attr.TypeWithElementType).ElementType() + o.EnabledWarehouseTypes = types.ListValueMust(t, vs) +} + +// GetGlobalParam returns the value of the GlobalParam field in SetWorkspaceWarehouseConfigRequest as +// a RepeatedEndpointConfPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *SetWorkspaceWarehouseConfigRequest) GetGlobalParam(ctx context.Context) (RepeatedEndpointConfPairs, bool) { + var e RepeatedEndpointConfPairs + if o.GlobalParam.IsNull() || o.GlobalParam.IsUnknown() { + return e, false + } + var v []RepeatedEndpointConfPairs + d := o.GlobalParam.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetGlobalParam sets the value of the GlobalParam field in SetWorkspaceWarehouseConfigRequest. +func (o *SetWorkspaceWarehouseConfigRequest) SetGlobalParam(ctx context.Context, v RepeatedEndpointConfPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["global_param"] + o.GlobalParam = types.ListValueMust(t, vs) +} + +// GetSqlConfigurationParameters returns the value of the SqlConfigurationParameters field in SetWorkspaceWarehouseConfigRequest as +// a RepeatedEndpointConfPairs value. +// If the field is unknown or null, the boolean return value is false. +func (o *SetWorkspaceWarehouseConfigRequest) GetSqlConfigurationParameters(ctx context.Context) (RepeatedEndpointConfPairs, bool) { + var e RepeatedEndpointConfPairs + if o.SqlConfigurationParameters.IsNull() || o.SqlConfigurationParameters.IsUnknown() { + return e, false + } + var v []RepeatedEndpointConfPairs + d := o.SqlConfigurationParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSqlConfigurationParameters sets the value of the SqlConfigurationParameters field in SetWorkspaceWarehouseConfigRequest. +func (o *SetWorkspaceWarehouseConfigRequest) SetSqlConfigurationParameters(ctx context.Context, v RepeatedEndpointConfPairs) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sql_configuration_parameters"] + o.SqlConfigurationParameters = types.ListValueMust(t, vs) +} + type SetWorkspaceWarehouseConfigResponse struct { } @@ -2639,6 +10122,33 @@ func (newState *SetWorkspaceWarehouseConfigResponse) SyncEffectiveFieldsDuringCr func (newState *SetWorkspaceWarehouseConfigResponse) SyncEffectiveFieldsDuringRead(existingState SetWorkspaceWarehouseConfigResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SetWorkspaceWarehouseConfigResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SetWorkspaceWarehouseConfigResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SetWorkspaceWarehouseConfigResponse +// only implements ToObjectValue() and Type(). +func (o SetWorkspaceWarehouseConfigResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SetWorkspaceWarehouseConfigResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Start a warehouse type StartRequest struct { // Required. Id of the SQL warehouse. @@ -2651,6 +10161,37 @@ func (newState *StartRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Start func (newState *StartRequest) SyncEffectiveFieldsDuringRead(existingState StartRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartRequest +// only implements ToObjectValue() and Type(). +func (o StartRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StartRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type StartWarehouseResponse struct { } @@ -2660,6 +10201,33 @@ func (newState *StartWarehouseResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *StartWarehouseResponse) SyncEffectiveFieldsDuringRead(existingState StartWarehouseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StartWarehouseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StartWarehouseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StartWarehouseResponse +// only implements ToObjectValue() and Type(). +func (o StartWarehouseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o StartWarehouseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type StatementParameterListItem struct { // The name of a parameter marker to be substituted in the statement. Name types.String `tfsdk:"name" tf:""` @@ -2670,7 +10238,7 @@ type StatementParameterListItem struct { // reference. // // [Data types]: https://docs.databricks.com/sql/language-manual/functions/cast.html - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` // The value to substitute, represented as a string. If omitted, the value // is interpreted as NULL. Value types.String `tfsdk:"value" tf:"optional"` @@ -2682,17 +10250,52 @@ func (newState *StatementParameterListItem) SyncEffectiveFieldsDuringCreateOrUpd func (newState *StatementParameterListItem) SyncEffectiveFieldsDuringRead(existingState StatementParameterListItem) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StatementParameterListItem. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StatementParameterListItem) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StatementParameterListItem +// only implements ToObjectValue() and Type(). +func (o StatementParameterListItem) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + "type": o.Type_, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StatementParameterListItem) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + "type": types.StringType, + "value": types.StringType, + }, + } +} + type StatementResponse struct { // The result manifest provides schema and metadata for the result set. - Manifest []ResultManifest `tfsdk:"manifest" tf:"optional,object"` + Manifest types.List `tfsdk:"manifest" tf:"optional,object"` - Result []ResultData `tfsdk:"result" tf:"optional,object"` + Result types.List `tfsdk:"result" tf:"optional,object"` // The statement ID is returned upon successfully submitting a SQL // statement, and is a required reference for all subsequent calls. StatementId types.String `tfsdk:"statement_id" tf:"optional"` // The status response includes execution state and if relevant, error // information. - Status []StatementStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` } func (newState *StatementResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan StatementResponse) { @@ -2701,10 +10304,135 @@ func (newState *StatementResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *StatementResponse) SyncEffectiveFieldsDuringRead(existingState StatementResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StatementResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StatementResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "manifest": reflect.TypeOf(ResultManifest{}), + "result": reflect.TypeOf(ResultData{}), + "status": reflect.TypeOf(StatementStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StatementResponse +// only implements ToObjectValue() and Type(). +func (o StatementResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "manifest": o.Manifest, + "result": o.Result, + "statement_id": o.StatementId, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StatementResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "manifest": basetypes.ListType{ + ElemType: ResultManifest{}.Type(ctx), + }, + "result": basetypes.ListType{ + ElemType: ResultData{}.Type(ctx), + }, + "statement_id": types.StringType, + "status": basetypes.ListType{ + ElemType: StatementStatus{}.Type(ctx), + }, + }, + } +} + +// GetManifest returns the value of the Manifest field in StatementResponse as +// a ResultManifest value. +// If the field is unknown or null, the boolean return value is false. +func (o *StatementResponse) GetManifest(ctx context.Context) (ResultManifest, bool) { + var e ResultManifest + if o.Manifest.IsNull() || o.Manifest.IsUnknown() { + return e, false + } + var v []ResultManifest + d := o.Manifest.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetManifest sets the value of the Manifest field in StatementResponse. +func (o *StatementResponse) SetManifest(ctx context.Context, v ResultManifest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["manifest"] + o.Manifest = types.ListValueMust(t, vs) +} + +// GetResult returns the value of the Result field in StatementResponse as +// a ResultData value. +// If the field is unknown or null, the boolean return value is false. +func (o *StatementResponse) GetResult(ctx context.Context) (ResultData, bool) { + var e ResultData + if o.Result.IsNull() || o.Result.IsUnknown() { + return e, false + } + var v []ResultData + d := o.Result.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetResult sets the value of the Result field in StatementResponse. +func (o *StatementResponse) SetResult(ctx context.Context, v ResultData) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["result"] + o.Result = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in StatementResponse as +// a StatementStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *StatementResponse) GetStatus(ctx context.Context) (StatementStatus, bool) { + var e StatementStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []StatementStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in StatementResponse. +func (o *StatementResponse) SetStatus(ctx context.Context, v StatementStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + // The status response includes execution state and if relevant, error // information. type StatementStatus struct { - Error []ServiceError `tfsdk:"error" tf:"optional,object"` + Error types.List `tfsdk:"error" tf:"optional,object"` // Statement execution state: - `PENDING`: waiting for warehouse - // `RUNNING`: running - `SUCCEEDED`: execution was successful, result data // available for fetch - `FAILED`: execution failed; reason for failure @@ -2721,6 +10449,69 @@ func (newState *StatementStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan St func (newState *StatementStatus) SyncEffectiveFieldsDuringRead(existingState StatementStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StatementStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StatementStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "error": reflect.TypeOf(ServiceError{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StatementStatus +// only implements ToObjectValue() and Type(). +func (o StatementStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "error": o.Error, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StatementStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "error": basetypes.ListType{ + ElemType: ServiceError{}.Type(ctx), + }, + "state": types.StringType, + }, + } +} + +// GetError returns the value of the Error field in StatementStatus as +// a ServiceError value. +// If the field is unknown or null, the boolean return value is false. +func (o *StatementStatus) GetError(ctx context.Context) (ServiceError, bool) { + var e ServiceError + if o.Error.IsNull() || o.Error.IsUnknown() { + return e, false + } + var v []ServiceError + d := o.Error.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetError sets the value of the Error field in StatementStatus. +func (o *StatementStatus) SetError(ctx context.Context, v ServiceError) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["error"] + o.Error = types.ListValueMust(t, vs) +} + // Stop a warehouse type StopRequest struct { // Required. Id of the SQL warehouse. @@ -2733,6 +10524,37 @@ func (newState *StopRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan StopRe func (newState *StopRequest) SyncEffectiveFieldsDuringRead(existingState StopRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StopRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StopRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StopRequest +// only implements ToObjectValue() and Type(). +func (o StopRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o StopRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type StopWarehouseResponse struct { } @@ -2742,6 +10564,33 @@ func (newState *StopWarehouseResponse) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *StopWarehouseResponse) SyncEffectiveFieldsDuringRead(existingState StopWarehouseResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in StopWarehouseResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a StopWarehouseResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, StopWarehouseResponse +// only implements ToObjectValue() and Type(). +func (o StopWarehouseResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o StopWarehouseResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type Success struct { Message types.String `tfsdk:"message" tf:"optional"` } @@ -2752,14 +10601,45 @@ func (newState *Success) SyncEffectiveFieldsDuringCreateOrUpdate(plan Success) { func (newState *Success) SyncEffectiveFieldsDuringRead(existingState Success) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Success. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Success) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Success +// only implements ToObjectValue() and Type(). +func (o Success) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Success) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + }, + } +} + type TerminationReason struct { // status code indicating why the cluster was terminated Code types.String `tfsdk:"code" tf:"optional"` // list of parameters that provide additional information about why the // cluster was terminated - Parameters map[string]types.String `tfsdk:"parameters" tf:"optional"` + Parameters types.Map `tfsdk:"parameters" tf:"optional"` // type of the termination - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *TerminationReason) SyncEffectiveFieldsDuringCreateOrUpdate(plan TerminationReason) { @@ -2768,6 +10648,71 @@ func (newState *TerminationReason) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TerminationReason) SyncEffectiveFieldsDuringRead(existingState TerminationReason) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TerminationReason. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TerminationReason) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TerminationReason +// only implements ToObjectValue() and Type(). +func (o TerminationReason) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "code": o.Code, + "parameters": o.Parameters, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TerminationReason) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "code": types.StringType, + "parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "type": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in TerminationReason as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *TerminationReason) GetParameters(ctx context.Context) (map[string]types.String, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in TerminationReason. +func (o *TerminationReason) SetParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.MapValueMust(t, vs) +} + type TextValue struct { Value types.String `tfsdk:"value" tf:"optional"` } @@ -2778,6 +10723,37 @@ func (newState *TextValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan TextValu func (newState *TextValue) SyncEffectiveFieldsDuringRead(existingState TextValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TextValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TextValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TextValue +// only implements ToObjectValue() and Type(). +func (o TextValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TextValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "value": types.StringType, + }, + } +} + type TimeRange struct { // The end time in milliseconds. EndTimeMs types.Int64 `tfsdk:"end_time_ms" tf:"optional"` @@ -2791,6 +10767,39 @@ func (newState *TimeRange) SyncEffectiveFieldsDuringCreateOrUpdate(plan TimeRang func (newState *TimeRange) SyncEffectiveFieldsDuringRead(existingState TimeRange) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TimeRange. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TimeRange) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TimeRange +// only implements ToObjectValue() and Type(). +func (o TimeRange) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "end_time_ms": o.EndTimeMs, + "start_time_ms": o.StartTimeMs, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TimeRange) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "end_time_ms": types.Int64Type, + "start_time_ms": types.Int64Type, + }, + } +} + type TransferOwnershipObjectId struct { // Email address for the new owner, who must exist in the workspace. NewOwner types.String `tfsdk:"new_owner" tf:"optional"` @@ -2802,12 +10811,43 @@ func (newState *TransferOwnershipObjectId) SyncEffectiveFieldsDuringCreateOrUpda func (newState *TransferOwnershipObjectId) SyncEffectiveFieldsDuringRead(existingState TransferOwnershipObjectId) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TransferOwnershipObjectId. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TransferOwnershipObjectId) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TransferOwnershipObjectId +// only implements ToObjectValue() and Type(). +func (o TransferOwnershipObjectId) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "new_owner": o.NewOwner, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TransferOwnershipObjectId) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "new_owner": types.StringType, + }, + } +} + // Transfer object ownership type TransferOwnershipRequest struct { // Email address for the new owner, who must exist in the workspace. NewOwner types.String `tfsdk:"new_owner" tf:"optional"` // The ID of the object on which to change ownership. - ObjectId []TransferOwnershipObjectId `tfsdk:"-"` + ObjectId types.List `tfsdk:"-"` // The type of object on which to change ownership. ObjectType types.String `tfsdk:"-"` } @@ -2818,6 +10858,71 @@ func (newState *TransferOwnershipRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *TransferOwnershipRequest) SyncEffectiveFieldsDuringRead(existingState TransferOwnershipRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TransferOwnershipRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TransferOwnershipRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "objectId": reflect.TypeOf(TransferOwnershipObjectId{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TransferOwnershipRequest +// only implements ToObjectValue() and Type(). +func (o TransferOwnershipRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "new_owner": o.NewOwner, + "objectId": o.ObjectId, + "objectType": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TransferOwnershipRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "new_owner": types.StringType, + "objectId": basetypes.ListType{ + ElemType: TransferOwnershipObjectId{}.Type(ctx), + }, + "objectType": types.StringType, + }, + } +} + +// GetObjectId returns the value of the ObjectId field in TransferOwnershipRequest as +// a TransferOwnershipObjectId value. +// If the field is unknown or null, the boolean return value is false. +func (o *TransferOwnershipRequest) GetObjectId(ctx context.Context) (TransferOwnershipObjectId, bool) { + var e TransferOwnershipObjectId + if o.ObjectId.IsNull() || o.ObjectId.IsUnknown() { + return e, false + } + var v []TransferOwnershipObjectId + d := o.ObjectId.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetObjectId sets the value of the ObjectId field in TransferOwnershipRequest. +func (o *TransferOwnershipRequest) SetObjectId(ctx context.Context, v TransferOwnershipObjectId) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["objectId"] + o.ObjectId = types.ListValueMust(t, vs) +} + // Delete an alert type TrashAlertRequest struct { Id types.String `tfsdk:"-"` @@ -2829,6 +10934,37 @@ func (newState *TrashAlertRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TrashAlertRequest) SyncEffectiveFieldsDuringRead(existingState TrashAlertRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TrashAlertRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TrashAlertRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TrashAlertRequest +// only implements ToObjectValue() and Type(). +func (o TrashAlertRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TrashAlertRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + // Delete a query type TrashQueryRequest struct { Id types.String `tfsdk:"-"` @@ -2840,8 +10976,39 @@ func (newState *TrashQueryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *TrashQueryRequest) SyncEffectiveFieldsDuringRead(existingState TrashQueryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in TrashQueryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a TrashQueryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, TrashQueryRequest +// only implements ToObjectValue() and Type(). +func (o TrashQueryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o TrashQueryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + }, + } +} + type UpdateAlertRequest struct { - Alert []UpdateAlertRequestAlert `tfsdk:"alert" tf:"optional,object"` + Alert types.List `tfsdk:"alert" tf:"optional,object"` Id types.String `tfsdk:"-"` // Field mask is required to be passed into the PATCH request. Field mask @@ -2857,9 +11024,74 @@ func (newState *UpdateAlertRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateAlertRequest) SyncEffectiveFieldsDuringRead(existingState UpdateAlertRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAlertRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAlertRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "alert": reflect.TypeOf(UpdateAlertRequestAlert{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAlertRequest +// only implements ToObjectValue() and Type(). +func (o UpdateAlertRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "alert": o.Alert, + "id": o.Id, + "update_mask": o.UpdateMask, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAlertRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "alert": basetypes.ListType{ + ElemType: UpdateAlertRequestAlert{}.Type(ctx), + }, + "id": types.StringType, + "update_mask": types.StringType, + }, + } +} + +// GetAlert returns the value of the Alert field in UpdateAlertRequest as +// a UpdateAlertRequestAlert value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAlertRequest) GetAlert(ctx context.Context) (UpdateAlertRequestAlert, bool) { + var e UpdateAlertRequestAlert + if o.Alert.IsNull() || o.Alert.IsUnknown() { + return e, false + } + var v []UpdateAlertRequestAlert + d := o.Alert.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetAlert sets the value of the Alert field in UpdateAlertRequest. +func (o *UpdateAlertRequest) SetAlert(ctx context.Context, v UpdateAlertRequestAlert) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["alert"] + o.Alert = types.ListValueMust(t, vs) +} + type UpdateAlertRequestAlert struct { // Trigger conditions of the alert. - Condition []AlertCondition `tfsdk:"condition" tf:"optional,object"` + Condition types.List `tfsdk:"condition" tf:"optional,object"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // @@ -2892,10 +11124,85 @@ func (newState *UpdateAlertRequestAlert) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *UpdateAlertRequestAlert) SyncEffectiveFieldsDuringRead(existingState UpdateAlertRequestAlert) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAlertRequestAlert. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAlertRequestAlert) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "condition": reflect.TypeOf(AlertCondition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAlertRequestAlert +// only implements ToObjectValue() and Type(). +func (o UpdateAlertRequestAlert) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "condition": o.Condition, + "custom_body": o.CustomBody, + "custom_subject": o.CustomSubject, + "display_name": o.DisplayName, + "notify_on_ok": o.NotifyOnOk, + "owner_user_name": o.OwnerUserName, + "query_id": o.QueryId, + "seconds_to_retrigger": o.SecondsToRetrigger, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAlertRequestAlert) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "condition": basetypes.ListType{ + ElemType: AlertCondition{}.Type(ctx), + }, + "custom_body": types.StringType, + "custom_subject": types.StringType, + "display_name": types.StringType, + "notify_on_ok": types.BoolType, + "owner_user_name": types.StringType, + "query_id": types.StringType, + "seconds_to_retrigger": types.Int64Type, + }, + } +} + +// GetCondition returns the value of the Condition field in UpdateAlertRequestAlert as +// a AlertCondition value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAlertRequestAlert) GetCondition(ctx context.Context) (AlertCondition, bool) { + var e AlertCondition + if o.Condition.IsNull() || o.Condition.IsUnknown() { + return e, false + } + var v []AlertCondition + d := o.Condition.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCondition sets the value of the Condition field in UpdateAlertRequestAlert. +func (o *UpdateAlertRequestAlert) SetCondition(ctx context.Context, v AlertCondition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["condition"] + o.Condition = types.ListValueMust(t, vs) +} + type UpdateQueryRequest struct { Id types.String `tfsdk:"-"` - Query []UpdateQueryRequestQuery `tfsdk:"query" tf:"optional,object"` + Query types.List `tfsdk:"query" tf:"optional,object"` // Field mask is required to be passed into the PATCH request. Field mask // specifies which fields of the setting payload will be updated. The field // mask needs to be supplied as single string. To specify multiple fields in @@ -2909,6 +11216,71 @@ func (newState *UpdateQueryRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateQueryRequest) SyncEffectiveFieldsDuringRead(existingState UpdateQueryRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateQueryRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateQueryRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "query": reflect.TypeOf(UpdateQueryRequestQuery{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateQueryRequest +// only implements ToObjectValue() and Type(). +func (o UpdateQueryRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "query": o.Query, + "update_mask": o.UpdateMask, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateQueryRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "query": basetypes.ListType{ + ElemType: UpdateQueryRequestQuery{}.Type(ctx), + }, + "update_mask": types.StringType, + }, + } +} + +// GetQuery returns the value of the Query field in UpdateQueryRequest as +// a UpdateQueryRequestQuery value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateQueryRequest) GetQuery(ctx context.Context) (UpdateQueryRequestQuery, bool) { + var e UpdateQueryRequestQuery + if o.Query.IsNull() || o.Query.IsUnknown() { + return e, false + } + var v []UpdateQueryRequestQuery + d := o.Query.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetQuery sets the value of the Query field in UpdateQueryRequest. +func (o *UpdateQueryRequest) SetQuery(ctx context.Context, v UpdateQueryRequestQuery) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query"] + o.Query = types.ListValueMust(t, vs) +} + type UpdateQueryRequestQuery struct { // Whether to apply a 1000 row limit to the query result. ApplyAutoLimit types.Bool `tfsdk:"apply_auto_limit" tf:"optional"` @@ -2923,7 +11295,7 @@ type UpdateQueryRequestQuery struct { // Username of the user that owns the query. OwnerUserName types.String `tfsdk:"owner_user_name" tf:"optional"` // List of query parameter definitions. - Parameters []QueryParameter `tfsdk:"parameters" tf:"optional"` + Parameters types.List `tfsdk:"parameters" tf:"optional"` // Text of the query to be run. QueryText types.String `tfsdk:"query_text" tf:"optional"` // Sets the "Run as" role for the object. @@ -2931,7 +11303,7 @@ type UpdateQueryRequestQuery struct { // Name of the schema where this query will be executed. Schema types.String `tfsdk:"schema" tf:"optional"` - Tags []types.String `tfsdk:"tags" tf:"optional"` + Tags types.List `tfsdk:"tags" tf:"optional"` // ID of the SQL warehouse attached to the query. WarehouseId types.String `tfsdk:"warehouse_id" tf:"optional"` } @@ -2942,6 +11314,116 @@ func (newState *UpdateQueryRequestQuery) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *UpdateQueryRequestQuery) SyncEffectiveFieldsDuringRead(existingState UpdateQueryRequestQuery) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateQueryRequestQuery. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateQueryRequestQuery) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "parameters": reflect.TypeOf(QueryParameter{}), + "tags": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateQueryRequestQuery +// only implements ToObjectValue() and Type(). +func (o UpdateQueryRequestQuery) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "apply_auto_limit": o.ApplyAutoLimit, + "catalog": o.Catalog, + "description": o.Description, + "display_name": o.DisplayName, + "owner_user_name": o.OwnerUserName, + "parameters": o.Parameters, + "query_text": o.QueryText, + "run_as_mode": o.RunAsMode, + "schema": o.Schema, + "tags": o.Tags, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateQueryRequestQuery) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "apply_auto_limit": types.BoolType, + "catalog": types.StringType, + "description": types.StringType, + "display_name": types.StringType, + "owner_user_name": types.StringType, + "parameters": basetypes.ListType{ + ElemType: QueryParameter{}.Type(ctx), + }, + "query_text": types.StringType, + "run_as_mode": types.StringType, + "schema": types.StringType, + "tags": basetypes.ListType{ + ElemType: types.StringType, + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetParameters returns the value of the Parameters field in UpdateQueryRequestQuery as +// a slice of QueryParameter values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateQueryRequestQuery) GetParameters(ctx context.Context) ([]QueryParameter, bool) { + if o.Parameters.IsNull() || o.Parameters.IsUnknown() { + return nil, false + } + var v []QueryParameter + d := o.Parameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetParameters sets the value of the Parameters field in UpdateQueryRequestQuery. +func (o *UpdateQueryRequestQuery) SetParameters(ctx context.Context, v []QueryParameter) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.Parameters = types.ListValueMust(t, vs) +} + +// GetTags returns the value of the Tags field in UpdateQueryRequestQuery as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateQueryRequestQuery) GetTags(ctx context.Context) ([]types.String, bool) { + if o.Tags.IsNull() || o.Tags.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Tags.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetTags sets the value of the Tags field in UpdateQueryRequestQuery. +func (o *UpdateQueryRequestQuery) SetTags(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["tags"] + t = t.(attr.TypeWithElementType).ElementType() + o.Tags = types.ListValueMust(t, vs) +} + type UpdateResponse struct { } @@ -2951,6 +11433,33 @@ func (newState *UpdateResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Upd func (newState *UpdateResponse) SyncEffectiveFieldsDuringRead(existingState UpdateResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateResponse +// only implements ToObjectValue() and Type(). +func (o UpdateResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateVisualizationRequest struct { Id types.String `tfsdk:"-"` // Field mask is required to be passed into the PATCH request. Field mask @@ -2959,7 +11468,7 @@ type UpdateVisualizationRequest struct { // the field mask, use comma as the separator (no space). UpdateMask types.String `tfsdk:"update_mask" tf:""` - Visualization []UpdateVisualizationRequestVisualization `tfsdk:"visualization" tf:"optional,object"` + Visualization types.List `tfsdk:"visualization" tf:"optional,object"` } func (newState *UpdateVisualizationRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateVisualizationRequest) { @@ -2968,6 +11477,71 @@ func (newState *UpdateVisualizationRequest) SyncEffectiveFieldsDuringCreateOrUpd func (newState *UpdateVisualizationRequest) SyncEffectiveFieldsDuringRead(existingState UpdateVisualizationRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateVisualizationRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateVisualizationRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "visualization": reflect.TypeOf(UpdateVisualizationRequestVisualization{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateVisualizationRequest +// only implements ToObjectValue() and Type(). +func (o UpdateVisualizationRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "update_mask": o.UpdateMask, + "visualization": o.Visualization, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateVisualizationRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "update_mask": types.StringType, + "visualization": basetypes.ListType{ + ElemType: UpdateVisualizationRequestVisualization{}.Type(ctx), + }, + }, + } +} + +// GetVisualization returns the value of the Visualization field in UpdateVisualizationRequest as +// a UpdateVisualizationRequestVisualization value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateVisualizationRequest) GetVisualization(ctx context.Context) (UpdateVisualizationRequestVisualization, bool) { + var e UpdateVisualizationRequestVisualization + if o.Visualization.IsNull() || o.Visualization.IsUnknown() { + return e, false + } + var v []UpdateVisualizationRequestVisualization + d := o.Visualization.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVisualization sets the value of the Visualization field in UpdateVisualizationRequest. +func (o *UpdateVisualizationRequest) SetVisualization(ctx context.Context, v UpdateVisualizationRequestVisualization) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["visualization"] + o.Visualization = types.ListValueMust(t, vs) +} + type UpdateVisualizationRequestVisualization struct { // The display name of the visualization. DisplayName types.String `tfsdk:"display_name" tf:"optional"` @@ -2980,7 +11554,7 @@ type UpdateVisualizationRequestVisualization struct { // visualization query plan directly. SerializedQueryPlan types.String `tfsdk:"serialized_query_plan" tf:"optional"` // The type of visualization: counter, table, funnel, and so on. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` } func (newState *UpdateVisualizationRequestVisualization) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateVisualizationRequestVisualization) { @@ -2989,6 +11563,43 @@ func (newState *UpdateVisualizationRequestVisualization) SyncEffectiveFieldsDuri func (newState *UpdateVisualizationRequestVisualization) SyncEffectiveFieldsDuringRead(existingState UpdateVisualizationRequestVisualization) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateVisualizationRequestVisualization. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateVisualizationRequestVisualization) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateVisualizationRequestVisualization +// only implements ToObjectValue() and Type(). +func (o UpdateVisualizationRequestVisualization) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "display_name": o.DisplayName, + "serialized_options": o.SerializedOptions, + "serialized_query_plan": o.SerializedQueryPlan, + "type": o.Type_, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateVisualizationRequestVisualization) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "display_name": types.StringType, + "serialized_options": types.StringType, + "serialized_query_plan": types.StringType, + "type": types.StringType, + }, + } +} + type User struct { Email types.String `tfsdk:"email" tf:"optional"` @@ -3003,6 +11614,41 @@ func (newState *User) SyncEffectiveFieldsDuringCreateOrUpdate(plan User) { func (newState *User) SyncEffectiveFieldsDuringRead(existingState User) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in User. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a User) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, User +// only implements ToObjectValue() and Type(). +func (o User) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "email": o.Email, + "id": o.Id, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o User) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "email": types.StringType, + "id": types.Int64Type, + "name": types.StringType, + }, + } +} + type Visualization struct { // The timestamp indicating when the visualization was created. CreateTime types.String `tfsdk:"create_time" tf:"optional"` @@ -3021,7 +11667,7 @@ type Visualization struct { // visualization query plan directly. SerializedQueryPlan types.String `tfsdk:"serialized_query_plan" tf:"optional"` // The type of visualization: counter, table, funnel, and so on. - Type types.String `tfsdk:"type" tf:"optional"` + Type_ types.String `tfsdk:"type" tf:"optional"` // The timestamp indicating when the visualization was updated. UpdateTime types.String `tfsdk:"update_time" tf:"optional"` } @@ -3032,6 +11678,51 @@ func (newState *Visualization) SyncEffectiveFieldsDuringCreateOrUpdate(plan Visu func (newState *Visualization) SyncEffectiveFieldsDuringRead(existingState Visualization) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Visualization. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Visualization) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Visualization +// only implements ToObjectValue() and Type(). +func (o Visualization) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "display_name": o.DisplayName, + "id": o.Id, + "query_id": o.QueryId, + "serialized_options": o.SerializedOptions, + "serialized_query_plan": o.SerializedQueryPlan, + "type": o.Type_, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Visualization) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "display_name": types.StringType, + "id": types.StringType, + "query_id": types.StringType, + "serialized_options": types.StringType, + "serialized_query_plan": types.StringType, + "type": types.StringType, + "update_time": types.StringType, + }, + } +} + type WarehouseAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -3049,9 +11740,46 @@ func (newState *WarehouseAccessControlRequest) SyncEffectiveFieldsDuringCreateOr func (newState *WarehouseAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState WarehouseAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehouseAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehouseAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehouseAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o WarehouseAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehouseAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type WarehouseAccessControlResponse struct { // All permissions. - AllPermissions []WarehousePermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -3068,10 +11796,79 @@ func (newState *WarehouseAccessControlResponse) SyncEffectiveFieldsDuringCreateO func (newState *WarehouseAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState WarehouseAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehouseAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehouseAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(WarehousePermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehouseAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o WarehouseAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehouseAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: WarehousePermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in WarehouseAccessControlResponse as +// a slice of WarehousePermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *WarehouseAccessControlResponse) GetAllPermissions(ctx context.Context) ([]WarehousePermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []WarehousePermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in WarehouseAccessControlResponse. +func (o *WarehouseAccessControlResponse) SetAllPermissions(ctx context.Context, v []WarehousePermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type WarehousePermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -3082,8 +11879,73 @@ func (newState *WarehousePermission) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *WarehousePermission) SyncEffectiveFieldsDuringRead(existingState WarehousePermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehousePermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehousePermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehousePermission +// only implements ToObjectValue() and Type(). +func (o WarehousePermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehousePermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in WarehousePermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *WarehousePermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in WarehousePermission. +func (o *WarehousePermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type WarehousePermissions struct { - AccessControlList []WarehouseAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -3096,6 +11958,71 @@ func (newState *WarehousePermissions) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *WarehousePermissions) SyncEffectiveFieldsDuringRead(existingState WarehousePermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehousePermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehousePermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(WarehouseAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehousePermissions +// only implements ToObjectValue() and Type(). +func (o WarehousePermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehousePermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: WarehouseAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in WarehousePermissions as +// a slice of WarehouseAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *WarehousePermissions) GetAccessControlList(ctx context.Context) ([]WarehouseAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []WarehouseAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in WarehousePermissions. +func (o *WarehousePermissions) SetAccessControlList(ctx context.Context, v []WarehouseAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type WarehousePermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -3108,8 +12035,41 @@ func (newState *WarehousePermissionsDescription) SyncEffectiveFieldsDuringCreate func (newState *WarehousePermissionsDescription) SyncEffectiveFieldsDuringRead(existingState WarehousePermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehousePermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehousePermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehousePermissionsDescription +// only implements ToObjectValue() and Type(). +func (o WarehousePermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehousePermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type WarehousePermissionsRequest struct { - AccessControlList []WarehouseAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The SQL warehouse for which to get or manage permissions. WarehouseId types.String `tfsdk:"-"` } @@ -3120,6 +12080,69 @@ func (newState *WarehousePermissionsRequest) SyncEffectiveFieldsDuringCreateOrUp func (newState *WarehousePermissionsRequest) SyncEffectiveFieldsDuringRead(existingState WarehousePermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehousePermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehousePermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(WarehouseAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehousePermissionsRequest +// only implements ToObjectValue() and Type(). +func (o WarehousePermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "warehouse_id": o.WarehouseId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehousePermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: WarehouseAccessControlRequest{}.Type(ctx), + }, + "warehouse_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in WarehousePermissionsRequest as +// a slice of WarehouseAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *WarehousePermissionsRequest) GetAccessControlList(ctx context.Context) ([]WarehouseAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []WarehouseAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in WarehousePermissionsRequest. +func (o *WarehousePermissionsRequest) SetAccessControlList(ctx context.Context, v []WarehouseAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type WarehouseTypePair struct { // If set to false the specific warehouse type will not be be allowed as a // value for warehouse_type in CreateWarehouse and EditWarehouse @@ -3134,17 +12157,50 @@ func (newState *WarehouseTypePair) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *WarehouseTypePair) SyncEffectiveFieldsDuringRead(existingState WarehouseTypePair) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WarehouseTypePair. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WarehouseTypePair) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WarehouseTypePair +// only implements ToObjectValue() and Type(). +func (o WarehouseTypePair) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "enabled": o.Enabled, + "warehouse_type": o.WarehouseType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WarehouseTypePair) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "enabled": types.BoolType, + "warehouse_type": types.StringType, + }, + } +} + type Widget struct { // The unique ID for this widget. Id types.String `tfsdk:"id" tf:"optional"` - Options []WidgetOptions `tfsdk:"options" tf:"optional,object"` + Options types.List `tfsdk:"options" tf:"optional,object"` // The visualization description API changes frequently and is unsupported. // You can duplicate a visualization by copying description objects received // _from the API_ and then using them to create a new one with a POST // request to the same endpoint. Databricks does not recommend constructing // ad-hoc visualizations entirely in JSON. - Visualization []LegacyVisualization `tfsdk:"visualization" tf:"optional,object"` + Visualization types.List `tfsdk:"visualization" tf:"optional,object"` // Unused field. Width types.Int64 `tfsdk:"width" tf:"optional"` } @@ -3155,6 +12211,102 @@ func (newState *Widget) SyncEffectiveFieldsDuringCreateOrUpdate(plan Widget) { func (newState *Widget) SyncEffectiveFieldsDuringRead(existingState Widget) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Widget. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Widget) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "options": reflect.TypeOf(WidgetOptions{}), + "visualization": reflect.TypeOf(LegacyVisualization{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Widget +// only implements ToObjectValue() and Type(). +func (o Widget) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "id": o.Id, + "options": o.Options, + "visualization": o.Visualization, + "width": o.Width, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Widget) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "id": types.StringType, + "options": basetypes.ListType{ + ElemType: WidgetOptions{}.Type(ctx), + }, + "visualization": basetypes.ListType{ + ElemType: LegacyVisualization{}.Type(ctx), + }, + "width": types.Int64Type, + }, + } +} + +// GetOptions returns the value of the Options field in Widget as +// a WidgetOptions value. +// If the field is unknown or null, the boolean return value is false. +func (o *Widget) GetOptions(ctx context.Context) (WidgetOptions, bool) { + var e WidgetOptions + if o.Options.IsNull() || o.Options.IsUnknown() { + return e, false + } + var v []WidgetOptions + d := o.Options.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOptions sets the value of the Options field in Widget. +func (o *Widget) SetOptions(ctx context.Context, v WidgetOptions) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["options"] + o.Options = types.ListValueMust(t, vs) +} + +// GetVisualization returns the value of the Visualization field in Widget as +// a LegacyVisualization value. +// If the field is unknown or null, the boolean return value is false. +func (o *Widget) GetVisualization(ctx context.Context) (LegacyVisualization, bool) { + var e LegacyVisualization + if o.Visualization.IsNull() || o.Visualization.IsUnknown() { + return e, false + } + var v []LegacyVisualization + d := o.Visualization.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVisualization sets the value of the Visualization field in Widget. +func (o *Widget) SetVisualization(ctx context.Context, v LegacyVisualization) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["visualization"] + o.Visualization = types.ListValueMust(t, vs) +} + type WidgetOptions struct { // Timestamp when this object was created CreatedAt types.String `tfsdk:"created_at" tf:"optional"` @@ -3165,10 +12317,10 @@ type WidgetOptions struct { // How parameters used by the visualization in this widget relate to other // widgets on the dashboard. Databricks does not recommend modifying this // definition in JSON. - ParameterMappings any `tfsdk:"parameterMappings" tf:"optional"` + ParameterMappings types.Object `tfsdk:"parameterMappings" tf:"optional"` // Coordinates of this widget on a dashboard. This portion of the API // changes frequently and is unsupported. - Position []WidgetPosition `tfsdk:"position" tf:"optional,object"` + Position types.List `tfsdk:"position" tf:"optional,object"` // Custom title of the widget Title types.String `tfsdk:"title" tf:"optional"` // Timestamp of the last time this object was updated. @@ -3181,6 +12333,79 @@ func (newState *WidgetOptions) SyncEffectiveFieldsDuringCreateOrUpdate(plan Widg func (newState *WidgetOptions) SyncEffectiveFieldsDuringRead(existingState WidgetOptions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WidgetOptions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WidgetOptions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "position": reflect.TypeOf(WidgetPosition{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WidgetOptions +// only implements ToObjectValue() and Type(). +func (o WidgetOptions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "description": o.Description, + "isHidden": o.IsHidden, + "parameterMappings": o.ParameterMappings, + "position": o.Position, + "title": o.Title, + "updated_at": o.UpdatedAt, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WidgetOptions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.StringType, + "description": types.StringType, + "isHidden": types.BoolType, + "parameterMappings": types.ObjectType{}, + "position": basetypes.ListType{ + ElemType: WidgetPosition{}.Type(ctx), + }, + "title": types.StringType, + "updated_at": types.StringType, + }, + } +} + +// GetPosition returns the value of the Position field in WidgetOptions as +// a WidgetPosition value. +// If the field is unknown or null, the boolean return value is false. +func (o *WidgetOptions) GetPosition(ctx context.Context) (WidgetPosition, bool) { + var e WidgetPosition + if o.Position.IsNull() || o.Position.IsUnknown() { + return e, false + } + var v []WidgetPosition + d := o.Position.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPosition sets the value of the Position field in WidgetOptions. +func (o *WidgetOptions) SetPosition(ctx context.Context, v WidgetPosition) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["position"] + o.Position = types.ListValueMust(t, vs) +} + // Coordinates of this widget on a dashboard. This portion of the API changes // frequently and is unsupported. type WidgetPosition struct { @@ -3201,3 +12426,42 @@ func (newState *WidgetPosition) SyncEffectiveFieldsDuringCreateOrUpdate(plan Wid func (newState *WidgetPosition) SyncEffectiveFieldsDuringRead(existingState WidgetPosition) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WidgetPosition. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WidgetPosition) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WidgetPosition +// only implements ToObjectValue() and Type(). +func (o WidgetPosition) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "autoHeight": o.AutoHeight, + "col": o.Col, + "row": o.Row, + "sizeX": o.SizeX, + "sizeY": o.SizeY, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WidgetPosition) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "autoHeight": types.BoolType, + "col": types.Int64Type, + "row": types.Int64Type, + "sizeX": types.Int64Type, + "sizeY": types.Int64Type, + }, + } +} diff --git a/internal/service/vectorsearch_tf/model.go b/internal/service/vectorsearch_tf/model.go index 4c3558494..e54058ff9 100755 --- a/internal/service/vectorsearch_tf/model.go +++ b/internal/service/vectorsearch_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package vectorsearch_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type ColumnInfo struct { @@ -25,6 +32,37 @@ func (newState *ColumnInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ColumnI func (newState *ColumnInfo) SyncEffectiveFieldsDuringRead(existingState ColumnInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ColumnInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ColumnInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ColumnInfo +// only implements ToObjectValue() and Type(). +func (o ColumnInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ColumnInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "name": types.StringType, + }, + } +} + type CreateEndpoint struct { // Type of endpoint. EndpointType types.String `tfsdk:"endpoint_type" tf:""` @@ -38,13 +76,46 @@ func (newState *CreateEndpoint) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CreateEndpoint) SyncEffectiveFieldsDuringRead(existingState CreateEndpoint) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateEndpoint. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateEndpoint) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateEndpoint +// only implements ToObjectValue() and Type(). +func (o CreateEndpoint) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_type": o.EndpointType, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateEndpoint) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_type": types.StringType, + "name": types.StringType, + }, + } +} + type CreateVectorIndexRequest struct { // Specification for Delta Sync Index. Required if `index_type` is // `DELTA_SYNC`. - DeltaSyncIndexSpec []DeltaSyncVectorIndexSpecRequest `tfsdk:"delta_sync_index_spec" tf:"optional,object"` + DeltaSyncIndexSpec types.List `tfsdk:"delta_sync_index_spec" tf:"optional,object"` // Specification for Direct Vector Access Index. Required if `index_type` is // `DIRECT_ACCESS`. - DirectAccessIndexSpec []DirectAccessVectorIndexSpec `tfsdk:"direct_access_index_spec" tf:"optional,object"` + DirectAccessIndexSpec types.List `tfsdk:"direct_access_index_spec" tf:"optional,object"` // Name of the endpoint to be used for serving the index EndpointName types.String `tfsdk:"endpoint_name" tf:""` // There are 2 types of Vector Search indexes: @@ -67,8 +138,108 @@ func (newState *CreateVectorIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CreateVectorIndexRequest) SyncEffectiveFieldsDuringRead(existingState CreateVectorIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateVectorIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateVectorIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "delta_sync_index_spec": reflect.TypeOf(DeltaSyncVectorIndexSpecRequest{}), + "direct_access_index_spec": reflect.TypeOf(DirectAccessVectorIndexSpec{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateVectorIndexRequest +// only implements ToObjectValue() and Type(). +func (o CreateVectorIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "delta_sync_index_spec": o.DeltaSyncIndexSpec, + "direct_access_index_spec": o.DirectAccessIndexSpec, + "endpoint_name": o.EndpointName, + "index_type": o.IndexType, + "name": o.Name, + "primary_key": o.PrimaryKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateVectorIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "delta_sync_index_spec": basetypes.ListType{ + ElemType: DeltaSyncVectorIndexSpecRequest{}.Type(ctx), + }, + "direct_access_index_spec": basetypes.ListType{ + ElemType: DirectAccessVectorIndexSpec{}.Type(ctx), + }, + "endpoint_name": types.StringType, + "index_type": types.StringType, + "name": types.StringType, + "primary_key": types.StringType, + }, + } +} + +// GetDeltaSyncIndexSpec returns the value of the DeltaSyncIndexSpec field in CreateVectorIndexRequest as +// a DeltaSyncVectorIndexSpecRequest value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateVectorIndexRequest) GetDeltaSyncIndexSpec(ctx context.Context) (DeltaSyncVectorIndexSpecRequest, bool) { + var e DeltaSyncVectorIndexSpecRequest + if o.DeltaSyncIndexSpec.IsNull() || o.DeltaSyncIndexSpec.IsUnknown() { + return e, false + } + var v []DeltaSyncVectorIndexSpecRequest + d := o.DeltaSyncIndexSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeltaSyncIndexSpec sets the value of the DeltaSyncIndexSpec field in CreateVectorIndexRequest. +func (o *CreateVectorIndexRequest) SetDeltaSyncIndexSpec(ctx context.Context, v DeltaSyncVectorIndexSpecRequest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["delta_sync_index_spec"] + o.DeltaSyncIndexSpec = types.ListValueMust(t, vs) +} + +// GetDirectAccessIndexSpec returns the value of the DirectAccessIndexSpec field in CreateVectorIndexRequest as +// a DirectAccessVectorIndexSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateVectorIndexRequest) GetDirectAccessIndexSpec(ctx context.Context) (DirectAccessVectorIndexSpec, bool) { + var e DirectAccessVectorIndexSpec + if o.DirectAccessIndexSpec.IsNull() || o.DirectAccessIndexSpec.IsUnknown() { + return e, false + } + var v []DirectAccessVectorIndexSpec + d := o.DirectAccessIndexSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDirectAccessIndexSpec sets the value of the DirectAccessIndexSpec field in CreateVectorIndexRequest. +func (o *CreateVectorIndexRequest) SetDirectAccessIndexSpec(ctx context.Context, v DirectAccessVectorIndexSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["direct_access_index_spec"] + o.DirectAccessIndexSpec = types.ListValueMust(t, vs) +} + type CreateVectorIndexResponse struct { - VectorIndex []VectorIndex `tfsdk:"vector_index" tf:"optional,object"` + VectorIndex types.List `tfsdk:"vector_index" tf:"optional,object"` } func (newState *CreateVectorIndexResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateVectorIndexResponse) { @@ -77,10 +248,71 @@ func (newState *CreateVectorIndexResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *CreateVectorIndexResponse) SyncEffectiveFieldsDuringRead(existingState CreateVectorIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateVectorIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateVectorIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "vector_index": reflect.TypeOf(VectorIndex{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateVectorIndexResponse +// only implements ToObjectValue() and Type(). +func (o CreateVectorIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "vector_index": o.VectorIndex, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateVectorIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "vector_index": basetypes.ListType{ + ElemType: VectorIndex{}.Type(ctx), + }, + }, + } +} + +// GetVectorIndex returns the value of the VectorIndex field in CreateVectorIndexResponse as +// a VectorIndex value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateVectorIndexResponse) GetVectorIndex(ctx context.Context) (VectorIndex, bool) { + var e VectorIndex + if o.VectorIndex.IsNull() || o.VectorIndex.IsUnknown() { + return e, false + } + var v []VectorIndex + d := o.VectorIndex.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetVectorIndex sets the value of the VectorIndex field in CreateVectorIndexResponse. +func (o *CreateVectorIndexResponse) SetVectorIndex(ctx context.Context, v VectorIndex) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["vector_index"] + o.VectorIndex = types.ListValueMust(t, vs) +} + // Result of the upsert or delete operation. type DeleteDataResult struct { // List of primary keys for rows that failed to process. - FailedPrimaryKeys []types.String `tfsdk:"failed_primary_keys" tf:"optional"` + FailedPrimaryKeys types.List `tfsdk:"failed_primary_keys" tf:"optional"` // Count of successfully processed rows. SuccessRowCount types.Int64 `tfsdk:"success_row_count" tf:"optional"` } @@ -91,13 +323,76 @@ func (newState *DeleteDataResult) SyncEffectiveFieldsDuringCreateOrUpdate(plan D func (newState *DeleteDataResult) SyncEffectiveFieldsDuringRead(existingState DeleteDataResult) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDataResult. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDataResult) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "failed_primary_keys": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDataResult +// only implements ToObjectValue() and Type(). +func (o DeleteDataResult) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "failed_primary_keys": o.FailedPrimaryKeys, + "success_row_count": o.SuccessRowCount, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDataResult) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "failed_primary_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "success_row_count": types.Int64Type, + }, + } +} + +// GetFailedPrimaryKeys returns the value of the FailedPrimaryKeys field in DeleteDataResult as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeleteDataResult) GetFailedPrimaryKeys(ctx context.Context) ([]types.String, bool) { + if o.FailedPrimaryKeys.IsNull() || o.FailedPrimaryKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FailedPrimaryKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFailedPrimaryKeys sets the value of the FailedPrimaryKeys field in DeleteDataResult. +func (o *DeleteDataResult) SetFailedPrimaryKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["failed_primary_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.FailedPrimaryKeys = types.ListValueMust(t, vs) +} + // Request payload for deleting data from a vector index. type DeleteDataVectorIndexRequest struct { // Name of the vector index where data is to be deleted. Must be a Direct // Vector Access Index. IndexName types.String `tfsdk:"-"` // List of primary keys for the data to be deleted. - PrimaryKeys []types.String `tfsdk:"primary_keys" tf:""` + PrimaryKeys types.List `tfsdk:"primary_keys" tf:""` } func (newState *DeleteDataVectorIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteDataVectorIndexRequest) { @@ -106,10 +401,73 @@ func (newState *DeleteDataVectorIndexRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *DeleteDataVectorIndexRequest) SyncEffectiveFieldsDuringRead(existingState DeleteDataVectorIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDataVectorIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDataVectorIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "primary_keys": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDataVectorIndexRequest +// only implements ToObjectValue() and Type(). +func (o DeleteDataVectorIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_name": o.IndexName, + "primary_keys": o.PrimaryKeys, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDataVectorIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_name": types.StringType, + "primary_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPrimaryKeys returns the value of the PrimaryKeys field in DeleteDataVectorIndexRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeleteDataVectorIndexRequest) GetPrimaryKeys(ctx context.Context) ([]types.String, bool) { + if o.PrimaryKeys.IsNull() || o.PrimaryKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.PrimaryKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPrimaryKeys sets the value of the PrimaryKeys field in DeleteDataVectorIndexRequest. +func (o *DeleteDataVectorIndexRequest) SetPrimaryKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["primary_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.PrimaryKeys = types.ListValueMust(t, vs) +} + // Response to a delete data vector index request. type DeleteDataVectorIndexResponse struct { // Result of the upsert or delete operation. - Result []DeleteDataResult `tfsdk:"result" tf:"optional,object"` + Result types.List `tfsdk:"result" tf:"optional,object"` // Status of the delete operation. Status types.String `tfsdk:"status" tf:"optional"` } @@ -120,6 +478,69 @@ func (newState *DeleteDataVectorIndexResponse) SyncEffectiveFieldsDuringCreateOr func (newState *DeleteDataVectorIndexResponse) SyncEffectiveFieldsDuringRead(existingState DeleteDataVectorIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteDataVectorIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteDataVectorIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "result": reflect.TypeOf(DeleteDataResult{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteDataVectorIndexResponse +// only implements ToObjectValue() and Type(). +func (o DeleteDataVectorIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "result": o.Result, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteDataVectorIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "result": basetypes.ListType{ + ElemType: DeleteDataResult{}.Type(ctx), + }, + "status": types.StringType, + }, + } +} + +// GetResult returns the value of the Result field in DeleteDataVectorIndexResponse as +// a DeleteDataResult value. +// If the field is unknown or null, the boolean return value is false. +func (o *DeleteDataVectorIndexResponse) GetResult(ctx context.Context) (DeleteDataResult, bool) { + var e DeleteDataResult + if o.Result.IsNull() || o.Result.IsUnknown() { + return e, false + } + var v []DeleteDataResult + d := o.Result.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetResult sets the value of the Result field in DeleteDataVectorIndexResponse. +func (o *DeleteDataVectorIndexResponse) SetResult(ctx context.Context, v DeleteDataResult) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["result"] + o.Result = types.ListValueMust(t, vs) +} + // Delete an endpoint type DeleteEndpointRequest struct { // Name of the endpoint @@ -132,6 +553,37 @@ func (newState *DeleteEndpointRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *DeleteEndpointRequest) SyncEffectiveFieldsDuringRead(existingState DeleteEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteEndpointRequest +// only implements ToObjectValue() and Type(). +func (o DeleteEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_name": o.EndpointName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_name": types.StringType, + }, + } +} + type DeleteEndpointResponse struct { } @@ -141,6 +593,33 @@ func (newState *DeleteEndpointResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *DeleteEndpointResponse) SyncEffectiveFieldsDuringRead(existingState DeleteEndpointResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteEndpointResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteEndpointResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteEndpointResponse +// only implements ToObjectValue() and Type(). +func (o DeleteEndpointResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteEndpointResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete an index type DeleteIndexRequest struct { // Name of the index @@ -153,6 +632,37 @@ func (newState *DeleteIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteIndexRequest) SyncEffectiveFieldsDuringRead(existingState DeleteIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteIndexRequest +// only implements ToObjectValue() and Type(). +func (o DeleteIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_name": o.IndexName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_name": types.StringType, + }, + } +} + type DeleteIndexResponse struct { } @@ -162,17 +672,44 @@ func (newState *DeleteIndexResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DeleteIndexResponse) SyncEffectiveFieldsDuringRead(existingState DeleteIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteIndexResponse +// only implements ToObjectValue() and Type(). +func (o DeleteIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeltaSyncVectorIndexSpecRequest struct { // [Optional] Select the columns to sync with the vector index. If you leave // this field blank, all columns from the source table are synced with the // index. The primary key column and embedding source column or embedding // vector column are always synced. - ColumnsToSync []types.String `tfsdk:"columns_to_sync" tf:"optional"` + ColumnsToSync types.List `tfsdk:"columns_to_sync" tf:"optional"` // The columns that contain the embedding source. - EmbeddingSourceColumns []EmbeddingSourceColumn `tfsdk:"embedding_source_columns" tf:"optional"` + EmbeddingSourceColumns types.List `tfsdk:"embedding_source_columns" tf:"optional"` // The columns that contain the embedding vectors. The format should be // array[double]. - EmbeddingVectorColumns []EmbeddingVectorColumn `tfsdk:"embedding_vector_columns" tf:"optional"` + EmbeddingVectorColumns types.List `tfsdk:"embedding_vector_columns" tf:"optional"` // [Optional] Automatically sync the vector index contents and computed // embeddings to the specified Delta table. The only supported table name is // the index name with the suffix `_writeback_table`. @@ -196,11 +733,140 @@ func (newState *DeltaSyncVectorIndexSpecRequest) SyncEffectiveFieldsDuringCreate func (newState *DeltaSyncVectorIndexSpecRequest) SyncEffectiveFieldsDuringRead(existingState DeltaSyncVectorIndexSpecRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeltaSyncVectorIndexSpecRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeltaSyncVectorIndexSpecRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns_to_sync": reflect.TypeOf(types.String{}), + "embedding_source_columns": reflect.TypeOf(EmbeddingSourceColumn{}), + "embedding_vector_columns": reflect.TypeOf(EmbeddingVectorColumn{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeltaSyncVectorIndexSpecRequest +// only implements ToObjectValue() and Type(). +func (o DeltaSyncVectorIndexSpecRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns_to_sync": o.ColumnsToSync, + "embedding_source_columns": o.EmbeddingSourceColumns, + "embedding_vector_columns": o.EmbeddingVectorColumns, + "embedding_writeback_table": o.EmbeddingWritebackTable, + "pipeline_type": o.PipelineType, + "source_table": o.SourceTable, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeltaSyncVectorIndexSpecRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns_to_sync": basetypes.ListType{ + ElemType: types.StringType, + }, + "embedding_source_columns": basetypes.ListType{ + ElemType: EmbeddingSourceColumn{}.Type(ctx), + }, + "embedding_vector_columns": basetypes.ListType{ + ElemType: EmbeddingVectorColumn{}.Type(ctx), + }, + "embedding_writeback_table": types.StringType, + "pipeline_type": types.StringType, + "source_table": types.StringType, + }, + } +} + +// GetColumnsToSync returns the value of the ColumnsToSync field in DeltaSyncVectorIndexSpecRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeltaSyncVectorIndexSpecRequest) GetColumnsToSync(ctx context.Context) ([]types.String, bool) { + if o.ColumnsToSync.IsNull() || o.ColumnsToSync.IsUnknown() { + return nil, false + } + var v []types.String + d := o.ColumnsToSync.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumnsToSync sets the value of the ColumnsToSync field in DeltaSyncVectorIndexSpecRequest. +func (o *DeltaSyncVectorIndexSpecRequest) SetColumnsToSync(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns_to_sync"] + t = t.(attr.TypeWithElementType).ElementType() + o.ColumnsToSync = types.ListValueMust(t, vs) +} + +// GetEmbeddingSourceColumns returns the value of the EmbeddingSourceColumns field in DeltaSyncVectorIndexSpecRequest as +// a slice of EmbeddingSourceColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeltaSyncVectorIndexSpecRequest) GetEmbeddingSourceColumns(ctx context.Context) ([]EmbeddingSourceColumn, bool) { + if o.EmbeddingSourceColumns.IsNull() || o.EmbeddingSourceColumns.IsUnknown() { + return nil, false + } + var v []EmbeddingSourceColumn + d := o.EmbeddingSourceColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddingSourceColumns sets the value of the EmbeddingSourceColumns field in DeltaSyncVectorIndexSpecRequest. +func (o *DeltaSyncVectorIndexSpecRequest) SetEmbeddingSourceColumns(ctx context.Context, v []EmbeddingSourceColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding_source_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddingSourceColumns = types.ListValueMust(t, vs) +} + +// GetEmbeddingVectorColumns returns the value of the EmbeddingVectorColumns field in DeltaSyncVectorIndexSpecRequest as +// a slice of EmbeddingVectorColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeltaSyncVectorIndexSpecRequest) GetEmbeddingVectorColumns(ctx context.Context) ([]EmbeddingVectorColumn, bool) { + if o.EmbeddingVectorColumns.IsNull() || o.EmbeddingVectorColumns.IsUnknown() { + return nil, false + } + var v []EmbeddingVectorColumn + d := o.EmbeddingVectorColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddingVectorColumns sets the value of the EmbeddingVectorColumns field in DeltaSyncVectorIndexSpecRequest. +func (o *DeltaSyncVectorIndexSpecRequest) SetEmbeddingVectorColumns(ctx context.Context, v []EmbeddingVectorColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding_vector_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddingVectorColumns = types.ListValueMust(t, vs) +} + type DeltaSyncVectorIndexSpecResponse struct { // The columns that contain the embedding source. - EmbeddingSourceColumns []EmbeddingSourceColumn `tfsdk:"embedding_source_columns" tf:"optional"` + EmbeddingSourceColumns types.List `tfsdk:"embedding_source_columns" tf:"optional"` // The columns that contain the embedding vectors. - EmbeddingVectorColumns []EmbeddingVectorColumn `tfsdk:"embedding_vector_columns" tf:"optional"` + EmbeddingVectorColumns types.List `tfsdk:"embedding_vector_columns" tf:"optional"` // [Optional] Name of the Delta table to sync the vector index contents and // computed embeddings to. EmbeddingWritebackTable types.String `tfsdk:"embedding_writeback_table" tf:"optional"` @@ -225,11 +891,111 @@ func (newState *DeltaSyncVectorIndexSpecResponse) SyncEffectiveFieldsDuringCreat func (newState *DeltaSyncVectorIndexSpecResponse) SyncEffectiveFieldsDuringRead(existingState DeltaSyncVectorIndexSpecResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeltaSyncVectorIndexSpecResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeltaSyncVectorIndexSpecResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "embedding_source_columns": reflect.TypeOf(EmbeddingSourceColumn{}), + "embedding_vector_columns": reflect.TypeOf(EmbeddingVectorColumn{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeltaSyncVectorIndexSpecResponse +// only implements ToObjectValue() and Type(). +func (o DeltaSyncVectorIndexSpecResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "embedding_source_columns": o.EmbeddingSourceColumns, + "embedding_vector_columns": o.EmbeddingVectorColumns, + "embedding_writeback_table": o.EmbeddingWritebackTable, + "pipeline_id": o.PipelineId, + "pipeline_type": o.PipelineType, + "source_table": o.SourceTable, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeltaSyncVectorIndexSpecResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "embedding_source_columns": basetypes.ListType{ + ElemType: EmbeddingSourceColumn{}.Type(ctx), + }, + "embedding_vector_columns": basetypes.ListType{ + ElemType: EmbeddingVectorColumn{}.Type(ctx), + }, + "embedding_writeback_table": types.StringType, + "pipeline_id": types.StringType, + "pipeline_type": types.StringType, + "source_table": types.StringType, + }, + } +} + +// GetEmbeddingSourceColumns returns the value of the EmbeddingSourceColumns field in DeltaSyncVectorIndexSpecResponse as +// a slice of EmbeddingSourceColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeltaSyncVectorIndexSpecResponse) GetEmbeddingSourceColumns(ctx context.Context) ([]EmbeddingSourceColumn, bool) { + if o.EmbeddingSourceColumns.IsNull() || o.EmbeddingSourceColumns.IsUnknown() { + return nil, false + } + var v []EmbeddingSourceColumn + d := o.EmbeddingSourceColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddingSourceColumns sets the value of the EmbeddingSourceColumns field in DeltaSyncVectorIndexSpecResponse. +func (o *DeltaSyncVectorIndexSpecResponse) SetEmbeddingSourceColumns(ctx context.Context, v []EmbeddingSourceColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding_source_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddingSourceColumns = types.ListValueMust(t, vs) +} + +// GetEmbeddingVectorColumns returns the value of the EmbeddingVectorColumns field in DeltaSyncVectorIndexSpecResponse as +// a slice of EmbeddingVectorColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *DeltaSyncVectorIndexSpecResponse) GetEmbeddingVectorColumns(ctx context.Context) ([]EmbeddingVectorColumn, bool) { + if o.EmbeddingVectorColumns.IsNull() || o.EmbeddingVectorColumns.IsUnknown() { + return nil, false + } + var v []EmbeddingVectorColumn + d := o.EmbeddingVectorColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddingVectorColumns sets the value of the EmbeddingVectorColumns field in DeltaSyncVectorIndexSpecResponse. +func (o *DeltaSyncVectorIndexSpecResponse) SetEmbeddingVectorColumns(ctx context.Context, v []EmbeddingVectorColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding_vector_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddingVectorColumns = types.ListValueMust(t, vs) +} + type DirectAccessVectorIndexSpec struct { // Contains the optional model endpoint to use during query time. - EmbeddingSourceColumns []EmbeddingSourceColumn `tfsdk:"embedding_source_columns" tf:"optional"` + EmbeddingSourceColumns types.List `tfsdk:"embedding_source_columns" tf:"optional"` - EmbeddingVectorColumns []EmbeddingVectorColumn `tfsdk:"embedding_vector_columns" tf:"optional"` + EmbeddingVectorColumns types.List `tfsdk:"embedding_vector_columns" tf:"optional"` // The schema of the index in JSON format. // // Supported types are `integer`, `long`, `float`, `double`, `boolean`, @@ -245,6 +1011,100 @@ func (newState *DirectAccessVectorIndexSpec) SyncEffectiveFieldsDuringCreateOrUp func (newState *DirectAccessVectorIndexSpec) SyncEffectiveFieldsDuringRead(existingState DirectAccessVectorIndexSpec) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DirectAccessVectorIndexSpec. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DirectAccessVectorIndexSpec) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "embedding_source_columns": reflect.TypeOf(EmbeddingSourceColumn{}), + "embedding_vector_columns": reflect.TypeOf(EmbeddingVectorColumn{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DirectAccessVectorIndexSpec +// only implements ToObjectValue() and Type(). +func (o DirectAccessVectorIndexSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "embedding_source_columns": o.EmbeddingSourceColumns, + "embedding_vector_columns": o.EmbeddingVectorColumns, + "schema_json": o.SchemaJson, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DirectAccessVectorIndexSpec) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "embedding_source_columns": basetypes.ListType{ + ElemType: EmbeddingSourceColumn{}.Type(ctx), + }, + "embedding_vector_columns": basetypes.ListType{ + ElemType: EmbeddingVectorColumn{}.Type(ctx), + }, + "schema_json": types.StringType, + }, + } +} + +// GetEmbeddingSourceColumns returns the value of the EmbeddingSourceColumns field in DirectAccessVectorIndexSpec as +// a slice of EmbeddingSourceColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *DirectAccessVectorIndexSpec) GetEmbeddingSourceColumns(ctx context.Context) ([]EmbeddingSourceColumn, bool) { + if o.EmbeddingSourceColumns.IsNull() || o.EmbeddingSourceColumns.IsUnknown() { + return nil, false + } + var v []EmbeddingSourceColumn + d := o.EmbeddingSourceColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddingSourceColumns sets the value of the EmbeddingSourceColumns field in DirectAccessVectorIndexSpec. +func (o *DirectAccessVectorIndexSpec) SetEmbeddingSourceColumns(ctx context.Context, v []EmbeddingSourceColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding_source_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddingSourceColumns = types.ListValueMust(t, vs) +} + +// GetEmbeddingVectorColumns returns the value of the EmbeddingVectorColumns field in DirectAccessVectorIndexSpec as +// a slice of EmbeddingVectorColumn values. +// If the field is unknown or null, the boolean return value is false. +func (o *DirectAccessVectorIndexSpec) GetEmbeddingVectorColumns(ctx context.Context) ([]EmbeddingVectorColumn, bool) { + if o.EmbeddingVectorColumns.IsNull() || o.EmbeddingVectorColumns.IsUnknown() { + return nil, false + } + var v []EmbeddingVectorColumn + d := o.EmbeddingVectorColumns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEmbeddingVectorColumns sets the value of the EmbeddingVectorColumns field in DirectAccessVectorIndexSpec. +func (o *DirectAccessVectorIndexSpec) SetEmbeddingVectorColumns(ctx context.Context, v []EmbeddingVectorColumn) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["embedding_vector_columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.EmbeddingVectorColumns = types.ListValueMust(t, vs) +} + type EmbeddingSourceColumn struct { // Name of the embedding model endpoint EmbeddingModelEndpointName types.String `tfsdk:"embedding_model_endpoint_name" tf:"optional"` @@ -258,6 +1118,39 @@ func (newState *EmbeddingSourceColumn) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *EmbeddingSourceColumn) SyncEffectiveFieldsDuringRead(existingState EmbeddingSourceColumn) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EmbeddingSourceColumn. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EmbeddingSourceColumn) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EmbeddingSourceColumn +// only implements ToObjectValue() and Type(). +func (o EmbeddingSourceColumn) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "embedding_model_endpoint_name": o.EmbeddingModelEndpointName, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EmbeddingSourceColumn) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "embedding_model_endpoint_name": types.StringType, + "name": types.StringType, + }, + } +} + type EmbeddingVectorColumn struct { // Dimension of the embedding vector EmbeddingDimension types.Int64 `tfsdk:"embedding_dimension" tf:"optional"` @@ -271,13 +1164,46 @@ func (newState *EmbeddingVectorColumn) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *EmbeddingVectorColumn) SyncEffectiveFieldsDuringRead(existingState EmbeddingVectorColumn) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EmbeddingVectorColumn. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EmbeddingVectorColumn) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EmbeddingVectorColumn +// only implements ToObjectValue() and Type(). +func (o EmbeddingVectorColumn) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "embedding_dimension": o.EmbeddingDimension, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EmbeddingVectorColumn) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "embedding_dimension": types.Int64Type, + "name": types.StringType, + }, + } +} + type EndpointInfo struct { // Timestamp of endpoint creation CreationTimestamp types.Int64 `tfsdk:"creation_timestamp" tf:"optional"` // Creator of the endpoint Creator types.String `tfsdk:"creator" tf:"optional"` // Current status of the endpoint - EndpointStatus []EndpointStatus `tfsdk:"endpoint_status" tf:"optional,object"` + EndpointStatus types.List `tfsdk:"endpoint_status" tf:"optional,object"` // Type of endpoint. EndpointType types.String `tfsdk:"endpoint_type" tf:"optional"` // Unique identifier of the endpoint @@ -298,6 +1224,83 @@ func (newState *EndpointInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Endpo func (newState *EndpointInfo) SyncEffectiveFieldsDuringRead(existingState EndpointInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "endpoint_status": reflect.TypeOf(EndpointStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointInfo +// only implements ToObjectValue() and Type(). +func (o EndpointInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creation_timestamp": o.CreationTimestamp, + "creator": o.Creator, + "endpoint_status": o.EndpointStatus, + "endpoint_type": o.EndpointType, + "id": o.Id, + "last_updated_timestamp": o.LastUpdatedTimestamp, + "last_updated_user": o.LastUpdatedUser, + "name": o.Name, + "num_indexes": o.NumIndexes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creation_timestamp": types.Int64Type, + "creator": types.StringType, + "endpoint_status": basetypes.ListType{ + ElemType: EndpointStatus{}.Type(ctx), + }, + "endpoint_type": types.StringType, + "id": types.StringType, + "last_updated_timestamp": types.Int64Type, + "last_updated_user": types.StringType, + "name": types.StringType, + "num_indexes": types.Int64Type, + }, + } +} + +// GetEndpointStatus returns the value of the EndpointStatus field in EndpointInfo as +// a EndpointStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *EndpointInfo) GetEndpointStatus(ctx context.Context) (EndpointStatus, bool) { + var e EndpointStatus + if o.EndpointStatus.IsNull() || o.EndpointStatus.IsUnknown() { + return e, false + } + var v []EndpointStatus + d := o.EndpointStatus.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetEndpointStatus sets the value of the EndpointStatus field in EndpointInfo. +func (o *EndpointInfo) SetEndpointStatus(ctx context.Context, v EndpointStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["endpoint_status"] + o.EndpointStatus = types.ListValueMust(t, vs) +} + // Status information of an endpoint type EndpointStatus struct { // Additional status message @@ -312,6 +1315,39 @@ func (newState *EndpointStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan End func (newState *EndpointStatus) SyncEffectiveFieldsDuringRead(existingState EndpointStatus) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in EndpointStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a EndpointStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, EndpointStatus +// only implements ToObjectValue() and Type(). +func (o EndpointStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "message": o.Message, + "state": o.State, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o EndpointStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "message": types.StringType, + "state": types.StringType, + }, + } +} + // Get an endpoint type GetEndpointRequest struct { // Name of the endpoint @@ -324,6 +1360,37 @@ func (newState *GetEndpointRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetEndpointRequest) SyncEffectiveFieldsDuringRead(existingState GetEndpointRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetEndpointRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetEndpointRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetEndpointRequest +// only implements ToObjectValue() and Type(). +func (o GetEndpointRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_name": o.EndpointName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetEndpointRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_name": types.StringType, + }, + } +} + // Get an index type GetIndexRequest struct { // Name of the index @@ -336,9 +1403,40 @@ func (newState *GetIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetIndexRequest) SyncEffectiveFieldsDuringRead(existingState GetIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetIndexRequest +// only implements ToObjectValue() and Type(). +func (o GetIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_name": o.IndexName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_name": types.StringType, + }, + } +} + type ListEndpointResponse struct { // An array of Endpoint objects - Endpoints []EndpointInfo `tfsdk:"endpoints" tf:"optional"` + Endpoints types.List `tfsdk:"endpoints" tf:"optional"` // A token that can be used to get the next page of results. If not present, // there are no more results to show. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` @@ -350,6 +1448,69 @@ func (newState *ListEndpointResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListEndpointResponse) SyncEffectiveFieldsDuringRead(existingState ListEndpointResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListEndpointResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListEndpointResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "endpoints": reflect.TypeOf(EndpointInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListEndpointResponse +// only implements ToObjectValue() and Type(). +func (o ListEndpointResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoints": o.Endpoints, + "next_page_token": o.NextPageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListEndpointResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoints": basetypes.ListType{ + ElemType: EndpointInfo{}.Type(ctx), + }, + "next_page_token": types.StringType, + }, + } +} + +// GetEndpoints returns the value of the Endpoints field in ListEndpointResponse as +// a slice of EndpointInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListEndpointResponse) GetEndpoints(ctx context.Context) ([]EndpointInfo, bool) { + if o.Endpoints.IsNull() || o.Endpoints.IsUnknown() { + return nil, false + } + var v []EndpointInfo + d := o.Endpoints.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetEndpoints sets the value of the Endpoints field in ListEndpointResponse. +func (o *ListEndpointResponse) SetEndpoints(ctx context.Context, v []EndpointInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["endpoints"] + t = t.(attr.TypeWithElementType).ElementType() + o.Endpoints = types.ListValueMust(t, vs) +} + // List all endpoints type ListEndpointsRequest struct { // Token for pagination @@ -362,6 +1523,37 @@ func (newState *ListEndpointsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListEndpointsRequest) SyncEffectiveFieldsDuringRead(existingState ListEndpointsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListEndpointsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListEndpointsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListEndpointsRequest +// only implements ToObjectValue() and Type(). +func (o ListEndpointsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListEndpointsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_token": types.StringType, + }, + } +} + // List indexes type ListIndexesRequest struct { // Name of the endpoint @@ -376,8 +1568,41 @@ func (newState *ListIndexesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListIndexesRequest) SyncEffectiveFieldsDuringRead(existingState ListIndexesRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListIndexesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListIndexesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListIndexesRequest +// only implements ToObjectValue() and Type(). +func (o ListIndexesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_name": o.EndpointName, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListIndexesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_name": types.StringType, + "page_token": types.StringType, + }, + } +} + type ListValue struct { - Values []Value `tfsdk:"values" tf:"optional"` + Values types.List `tfsdk:"values" tf:"optional"` } func (newState *ListValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListValue) { @@ -386,12 +1611,73 @@ func (newState *ListValue) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListValu func (newState *ListValue) SyncEffectiveFieldsDuringRead(existingState ListValue) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListValue. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListValue) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "values": reflect.TypeOf(Value{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListValue +// only implements ToObjectValue() and Type(). +func (o ListValue) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "values": o.Values, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListValue) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "values": basetypes.ListType{ + ElemType: Value{}.Type(ctx), + }, + }, + } +} + +// GetValues returns the value of the Values field in ListValue as +// a slice of Value values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListValue) GetValues(ctx context.Context) ([]Value, bool) { + if o.Values.IsNull() || o.Values.IsUnknown() { + return nil, false + } + var v []Value + d := o.Values.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetValues sets the value of the Values field in ListValue. +func (o *ListValue) SetValues(ctx context.Context, v []Value) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["values"] + t = t.(attr.TypeWithElementType).ElementType() + o.Values = types.ListValueMust(t, vs) +} + type ListVectorIndexesResponse struct { // A token that can be used to get the next page of results. If not present, // there are no more results to show. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` - VectorIndexes []MiniVectorIndex `tfsdk:"vector_indexes" tf:"optional"` + VectorIndexes types.List `tfsdk:"vector_indexes" tf:"optional"` } func (newState *ListVectorIndexesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListVectorIndexesResponse) { @@ -400,12 +1686,75 @@ func (newState *ListVectorIndexesResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *ListVectorIndexesResponse) SyncEffectiveFieldsDuringRead(existingState ListVectorIndexesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListVectorIndexesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListVectorIndexesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "vector_indexes": reflect.TypeOf(MiniVectorIndex{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListVectorIndexesResponse +// only implements ToObjectValue() and Type(). +func (o ListVectorIndexesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "vector_indexes": o.VectorIndexes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListVectorIndexesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "vector_indexes": basetypes.ListType{ + ElemType: MiniVectorIndex{}.Type(ctx), + }, + }, + } +} + +// GetVectorIndexes returns the value of the VectorIndexes field in ListVectorIndexesResponse as +// a slice of MiniVectorIndex values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListVectorIndexesResponse) GetVectorIndexes(ctx context.Context) ([]MiniVectorIndex, bool) { + if o.VectorIndexes.IsNull() || o.VectorIndexes.IsUnknown() { + return nil, false + } + var v []MiniVectorIndex + d := o.VectorIndexes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetVectorIndexes sets the value of the VectorIndexes field in ListVectorIndexesResponse. +func (o *ListVectorIndexesResponse) SetVectorIndexes(ctx context.Context, v []MiniVectorIndex) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["vector_indexes"] + t = t.(attr.TypeWithElementType).ElementType() + o.VectorIndexes = types.ListValueMust(t, vs) +} + // Key-value pair. type MapStringValueEntry struct { // Column name. Key types.String `tfsdk:"key" tf:"optional"` // Column value, nullable. - Value []Value `tfsdk:"value" tf:"optional,object"` + Value types.List `tfsdk:"value" tf:"optional,object"` } func (newState *MapStringValueEntry) SyncEffectiveFieldsDuringCreateOrUpdate(plan MapStringValueEntry) { @@ -414,6 +1763,69 @@ func (newState *MapStringValueEntry) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *MapStringValueEntry) SyncEffectiveFieldsDuringRead(existingState MapStringValueEntry) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MapStringValueEntry. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MapStringValueEntry) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "value": reflect.TypeOf(Value{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MapStringValueEntry +// only implements ToObjectValue() and Type(). +func (o MapStringValueEntry) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MapStringValueEntry) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": basetypes.ListType{ + ElemType: Value{}.Type(ctx), + }, + }, + } +} + +// GetValue returns the value of the Value field in MapStringValueEntry as +// a Value value. +// If the field is unknown or null, the boolean return value is false. +func (o *MapStringValueEntry) GetValue(ctx context.Context) (Value, bool) { + var e Value + if o.Value.IsNull() || o.Value.IsUnknown() { + return e, false + } + var v []Value + d := o.Value.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetValue sets the value of the Value field in MapStringValueEntry. +func (o *MapStringValueEntry) SetValue(ctx context.Context, v Value) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["value"] + o.Value = types.ListValueMust(t, vs) +} + type MiniVectorIndex struct { // The user who created the index. Creator types.String `tfsdk:"creator" tf:"optional"` @@ -439,6 +1851,45 @@ func (newState *MiniVectorIndex) SyncEffectiveFieldsDuringCreateOrUpdate(plan Mi func (newState *MiniVectorIndex) SyncEffectiveFieldsDuringRead(existingState MiniVectorIndex) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MiniVectorIndex. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MiniVectorIndex) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MiniVectorIndex +// only implements ToObjectValue() and Type(). +func (o MiniVectorIndex) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creator": o.Creator, + "endpoint_name": o.EndpointName, + "index_type": o.IndexType, + "name": o.Name, + "primary_key": o.PrimaryKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o MiniVectorIndex) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creator": types.StringType, + "endpoint_name": types.StringType, + "index_type": types.StringType, + "name": types.StringType, + "primary_key": types.StringType, + }, + } +} + // Request payload for getting next page of results. type QueryVectorIndexNextPageRequest struct { // Name of the endpoint. @@ -456,9 +1907,44 @@ func (newState *QueryVectorIndexNextPageRequest) SyncEffectiveFieldsDuringCreate func (newState *QueryVectorIndexNextPageRequest) SyncEffectiveFieldsDuringRead(existingState QueryVectorIndexNextPageRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryVectorIndexNextPageRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryVectorIndexNextPageRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryVectorIndexNextPageRequest +// only implements ToObjectValue() and Type(). +func (o QueryVectorIndexNextPageRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "endpoint_name": o.EndpointName, + "index_name": o.IndexName, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryVectorIndexNextPageRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_name": types.StringType, + "index_name": types.StringType, + "page_token": types.StringType, + }, + } +} + type QueryVectorIndexRequest struct { // List of column names to include in the response. - Columns []types.String `tfsdk:"columns" tf:""` + Columns types.List `tfsdk:"columns" tf:""` // JSON string representing query filters. // // Example filters: - `{"id <": 5}`: Filter for id less than 5. - `{"id >": @@ -476,7 +1962,7 @@ type QueryVectorIndexRequest struct { QueryType types.String `tfsdk:"query_type" tf:"optional"` // Query vector. Required for Direct Vector Access Index and Delta Sync // Index using self-managed vectors. - QueryVector []types.Float64 `tfsdk:"query_vector" tf:"optional"` + QueryVector types.List `tfsdk:"query_vector" tf:"optional"` // Threshold for the approximate nearest neighbor search. Defaults to 0.0. ScoreThreshold types.Float64 `tfsdk:"score_threshold" tf:"optional"` } @@ -487,15 +1973,119 @@ func (newState *QueryVectorIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *QueryVectorIndexRequest) SyncEffectiveFieldsDuringRead(existingState QueryVectorIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryVectorIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryVectorIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(types.String{}), + "query_vector": reflect.TypeOf(types.Float64{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryVectorIndexRequest +// only implements ToObjectValue() and Type(). +func (o QueryVectorIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "columns": o.Columns, + "filters_json": o.FiltersJson, + "index_name": o.IndexName, + "num_results": o.NumResults, + "query_text": o.QueryText, + "query_type": o.QueryType, + "query_vector": o.QueryVector, + "score_threshold": o.ScoreThreshold, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryVectorIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "columns": basetypes.ListType{ + ElemType: types.StringType, + }, + "filters_json": types.StringType, + "index_name": types.StringType, + "num_results": types.Int64Type, + "query_text": types.StringType, + "query_type": types.StringType, + "query_vector": basetypes.ListType{ + ElemType: types.Float64Type, + }, + "score_threshold": types.Float64Type, + }, + } +} + +// GetColumns returns the value of the Columns field in QueryVectorIndexRequest as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryVectorIndexRequest) GetColumns(ctx context.Context) ([]types.String, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in QueryVectorIndexRequest. +func (o *QueryVectorIndexRequest) SetColumns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + +// GetQueryVector returns the value of the QueryVector field in QueryVectorIndexRequest as +// a slice of types.Float64 values. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryVectorIndexRequest) GetQueryVector(ctx context.Context) ([]types.Float64, bool) { + if o.QueryVector.IsNull() || o.QueryVector.IsUnknown() { + return nil, false + } + var v []types.Float64 + d := o.QueryVector.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetQueryVector sets the value of the QueryVector field in QueryVectorIndexRequest. +func (o *QueryVectorIndexRequest) SetQueryVector(ctx context.Context, v []types.Float64) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["query_vector"] + t = t.(attr.TypeWithElementType).ElementType() + o.QueryVector = types.ListValueMust(t, vs) +} + type QueryVectorIndexResponse struct { // Metadata about the result set. - Manifest []ResultManifest `tfsdk:"manifest" tf:"optional,object"` + Manifest types.List `tfsdk:"manifest" tf:"optional,object"` // [Optional] Token that can be used in `QueryVectorIndexNextPage` API to // get next page of results. If more than 1000 results satisfy the query, // they are returned in groups of 1000. Empty value means no more results. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // Data returned in the query result. - Result []ResultData `tfsdk:"result" tf:"optional,object"` + Result types.List `tfsdk:"result" tf:"optional,object"` } func (newState *QueryVectorIndexResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan QueryVectorIndexResponse) { @@ -504,10 +2094,104 @@ func (newState *QueryVectorIndexResponse) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *QueryVectorIndexResponse) SyncEffectiveFieldsDuringRead(existingState QueryVectorIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in QueryVectorIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a QueryVectorIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "manifest": reflect.TypeOf(ResultManifest{}), + "result": reflect.TypeOf(ResultData{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, QueryVectorIndexResponse +// only implements ToObjectValue() and Type(). +func (o QueryVectorIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "manifest": o.Manifest, + "next_page_token": o.NextPageToken, + "result": o.Result, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o QueryVectorIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "manifest": basetypes.ListType{ + ElemType: ResultManifest{}.Type(ctx), + }, + "next_page_token": types.StringType, + "result": basetypes.ListType{ + ElemType: ResultData{}.Type(ctx), + }, + }, + } +} + +// GetManifest returns the value of the Manifest field in QueryVectorIndexResponse as +// a ResultManifest value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryVectorIndexResponse) GetManifest(ctx context.Context) (ResultManifest, bool) { + var e ResultManifest + if o.Manifest.IsNull() || o.Manifest.IsUnknown() { + return e, false + } + var v []ResultManifest + d := o.Manifest.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetManifest sets the value of the Manifest field in QueryVectorIndexResponse. +func (o *QueryVectorIndexResponse) SetManifest(ctx context.Context, v ResultManifest) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["manifest"] + o.Manifest = types.ListValueMust(t, vs) +} + +// GetResult returns the value of the Result field in QueryVectorIndexResponse as +// a ResultData value. +// If the field is unknown or null, the boolean return value is false. +func (o *QueryVectorIndexResponse) GetResult(ctx context.Context) (ResultData, bool) { + var e ResultData + if o.Result.IsNull() || o.Result.IsUnknown() { + return e, false + } + var v []ResultData + d := o.Result.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetResult sets the value of the Result field in QueryVectorIndexResponse. +func (o *QueryVectorIndexResponse) SetResult(ctx context.Context, v ResultData) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["result"] + o.Result = types.ListValueMust(t, vs) +} + // Data returned in the query result. type ResultData struct { // Data rows returned in the query. - DataArray [][]types.String `tfsdk:"data_array" tf:"optional"` + DataArray types.List `tfsdk:"data_array" tf:"optional"` // Number of rows in the result set. RowCount types.Int64 `tfsdk:"row_count" tf:"optional"` } @@ -518,12 +2202,77 @@ func (newState *ResultData) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResultD func (newState *ResultData) SyncEffectiveFieldsDuringRead(existingState ResultData) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResultData. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResultData) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data_array": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResultData +// only implements ToObjectValue() and Type(). +func (o ResultData) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data_array": o.DataArray, + "row_count": o.RowCount, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResultData) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data_array": basetypes.ListType{ + ElemType: basetypes.ListType{ + ElemType: types.StringType, + }, + }, + "row_count": types.Int64Type, + }, + } +} + +// GetDataArray returns the value of the DataArray field in ResultData as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultData) GetDataArray(ctx context.Context) ([]types.String, bool) { + if o.DataArray.IsNull() || o.DataArray.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DataArray.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDataArray sets the value of the DataArray field in ResultData. +func (o *ResultData) SetDataArray(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data_array"] + t = t.(attr.TypeWithElementType).ElementType() + o.DataArray = types.ListValueMust(t, vs) +} + // Metadata about the result set. type ResultManifest struct { // Number of columns in the result set. ColumnCount types.Int64 `tfsdk:"column_count" tf:"optional"` // Information about each column in the result set. - Columns []ColumnInfo `tfsdk:"columns" tf:"optional"` + Columns types.List `tfsdk:"columns" tf:"optional"` } func (newState *ResultManifest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ResultManifest) { @@ -532,6 +2281,69 @@ func (newState *ResultManifest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Res func (newState *ResultManifest) SyncEffectiveFieldsDuringRead(existingState ResultManifest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ResultManifest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ResultManifest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "columns": reflect.TypeOf(ColumnInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ResultManifest +// only implements ToObjectValue() and Type(). +func (o ResultManifest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "column_count": o.ColumnCount, + "columns": o.Columns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ResultManifest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "column_count": types.Int64Type, + "columns": basetypes.ListType{ + ElemType: ColumnInfo{}.Type(ctx), + }, + }, + } +} + +// GetColumns returns the value of the Columns field in ResultManifest as +// a slice of ColumnInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ResultManifest) GetColumns(ctx context.Context) ([]ColumnInfo, bool) { + if o.Columns.IsNull() || o.Columns.IsUnknown() { + return nil, false + } + var v []ColumnInfo + d := o.Columns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetColumns sets the value of the Columns field in ResultManifest. +func (o *ResultManifest) SetColumns(ctx context.Context, v []ColumnInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["columns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Columns = types.ListValueMust(t, vs) +} + // Request payload for scanning data from a vector index. type ScanVectorIndexRequest struct { // Name of the vector index to scan. @@ -548,10 +2360,45 @@ func (newState *ScanVectorIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *ScanVectorIndexRequest) SyncEffectiveFieldsDuringRead(existingState ScanVectorIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ScanVectorIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ScanVectorIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ScanVectorIndexRequest +// only implements ToObjectValue() and Type(). +func (o ScanVectorIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_name": o.IndexName, + "last_primary_key": o.LastPrimaryKey, + "num_results": o.NumResults, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ScanVectorIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_name": types.StringType, + "last_primary_key": types.StringType, + "num_results": types.Int64Type, + }, + } +} + // Response to a scan vector index request. type ScanVectorIndexResponse struct { // List of data entries - Data []Struct `tfsdk:"data" tf:"optional"` + Data types.List `tfsdk:"data" tf:"optional"` // Primary key of the last entry. LastPrimaryKey types.String `tfsdk:"last_primary_key" tf:"optional"` } @@ -562,9 +2409,72 @@ func (newState *ScanVectorIndexResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ScanVectorIndexResponse) SyncEffectiveFieldsDuringRead(existingState ScanVectorIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ScanVectorIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ScanVectorIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "data": reflect.TypeOf(Struct{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ScanVectorIndexResponse +// only implements ToObjectValue() and Type(). +func (o ScanVectorIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "data": o.Data, + "last_primary_key": o.LastPrimaryKey, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ScanVectorIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "data": basetypes.ListType{ + ElemType: Struct{}.Type(ctx), + }, + "last_primary_key": types.StringType, + }, + } +} + +// GetData returns the value of the Data field in ScanVectorIndexResponse as +// a slice of Struct values. +// If the field is unknown or null, the boolean return value is false. +func (o *ScanVectorIndexResponse) GetData(ctx context.Context) ([]Struct, bool) { + if o.Data.IsNull() || o.Data.IsUnknown() { + return nil, false + } + var v []Struct + d := o.Data.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetData sets the value of the Data field in ScanVectorIndexResponse. +func (o *ScanVectorIndexResponse) SetData(ctx context.Context, v []Struct) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["data"] + t = t.(attr.TypeWithElementType).ElementType() + o.Data = types.ListValueMust(t, vs) +} + type Struct struct { // Data entry, corresponding to a row in a vector index. - Fields []MapStringValueEntry `tfsdk:"fields" tf:"optional"` + Fields types.List `tfsdk:"fields" tf:"optional"` } func (newState *Struct) SyncEffectiveFieldsDuringCreateOrUpdate(plan Struct) { @@ -573,6 +2483,67 @@ func (newState *Struct) SyncEffectiveFieldsDuringCreateOrUpdate(plan Struct) { func (newState *Struct) SyncEffectiveFieldsDuringRead(existingState Struct) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Struct. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Struct) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "fields": reflect.TypeOf(MapStringValueEntry{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Struct +// only implements ToObjectValue() and Type(). +func (o Struct) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "fields": o.Fields, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Struct) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "fields": basetypes.ListType{ + ElemType: MapStringValueEntry{}.Type(ctx), + }, + }, + } +} + +// GetFields returns the value of the Fields field in Struct as +// a slice of MapStringValueEntry values. +// If the field is unknown or null, the boolean return value is false. +func (o *Struct) GetFields(ctx context.Context) ([]MapStringValueEntry, bool) { + if o.Fields.IsNull() || o.Fields.IsUnknown() { + return nil, false + } + var v []MapStringValueEntry + d := o.Fields.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFields sets the value of the Fields field in Struct. +func (o *Struct) SetFields(ctx context.Context, v []MapStringValueEntry) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["fields"] + t = t.(attr.TypeWithElementType).ElementType() + o.Fields = types.ListValueMust(t, vs) +} + // Synchronize an index type SyncIndexRequest struct { // Name of the vector index to synchronize. Must be a Delta Sync Index. @@ -585,6 +2556,37 @@ func (newState *SyncIndexRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan S func (newState *SyncIndexRequest) SyncEffectiveFieldsDuringRead(existingState SyncIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SyncIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SyncIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SyncIndexRequest +// only implements ToObjectValue() and Type(). +func (o SyncIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_name": o.IndexName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SyncIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_name": types.StringType, + }, + } +} + type SyncIndexResponse struct { } @@ -594,10 +2596,37 @@ func (newState *SyncIndexResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *SyncIndexResponse) SyncEffectiveFieldsDuringRead(existingState SyncIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SyncIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SyncIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SyncIndexResponse +// only implements ToObjectValue() and Type(). +func (o SyncIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o SyncIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Result of the upsert or delete operation. type UpsertDataResult struct { // List of primary keys for rows that failed to process. - FailedPrimaryKeys []types.String `tfsdk:"failed_primary_keys" tf:"optional"` + FailedPrimaryKeys types.List `tfsdk:"failed_primary_keys" tf:"optional"` // Count of successfully processed rows. SuccessRowCount types.Int64 `tfsdk:"success_row_count" tf:"optional"` } @@ -608,6 +2637,69 @@ func (newState *UpsertDataResult) SyncEffectiveFieldsDuringCreateOrUpdate(plan U func (newState *UpsertDataResult) SyncEffectiveFieldsDuringRead(existingState UpsertDataResult) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpsertDataResult. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpsertDataResult) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "failed_primary_keys": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpsertDataResult +// only implements ToObjectValue() and Type(). +func (o UpsertDataResult) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "failed_primary_keys": o.FailedPrimaryKeys, + "success_row_count": o.SuccessRowCount, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpsertDataResult) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "failed_primary_keys": basetypes.ListType{ + ElemType: types.StringType, + }, + "success_row_count": types.Int64Type, + }, + } +} + +// GetFailedPrimaryKeys returns the value of the FailedPrimaryKeys field in UpsertDataResult as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *UpsertDataResult) GetFailedPrimaryKeys(ctx context.Context) ([]types.String, bool) { + if o.FailedPrimaryKeys.IsNull() || o.FailedPrimaryKeys.IsUnknown() { + return nil, false + } + var v []types.String + d := o.FailedPrimaryKeys.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetFailedPrimaryKeys sets the value of the FailedPrimaryKeys field in UpsertDataResult. +func (o *UpsertDataResult) SetFailedPrimaryKeys(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["failed_primary_keys"] + t = t.(attr.TypeWithElementType).ElementType() + o.FailedPrimaryKeys = types.ListValueMust(t, vs) +} + // Request payload for upserting data into a vector index. type UpsertDataVectorIndexRequest struct { // Name of the vector index where data is to be upserted. Must be a Direct @@ -623,10 +2715,43 @@ func (newState *UpsertDataVectorIndexRequest) SyncEffectiveFieldsDuringCreateOrU func (newState *UpsertDataVectorIndexRequest) SyncEffectiveFieldsDuringRead(existingState UpsertDataVectorIndexRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpsertDataVectorIndexRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpsertDataVectorIndexRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpsertDataVectorIndexRequest +// only implements ToObjectValue() and Type(). +func (o UpsertDataVectorIndexRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_name": o.IndexName, + "inputs_json": o.InputsJson, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpsertDataVectorIndexRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_name": types.StringType, + "inputs_json": types.StringType, + }, + } +} + // Response to an upsert data vector index request. type UpsertDataVectorIndexResponse struct { // Result of the upsert or delete operation. - Result []UpsertDataResult `tfsdk:"result" tf:"optional,object"` + Result types.List `tfsdk:"result" tf:"optional,object"` // Status of the upsert operation. Status types.String `tfsdk:"status" tf:"optional"` } @@ -637,10 +2762,73 @@ func (newState *UpsertDataVectorIndexResponse) SyncEffectiveFieldsDuringCreateOr func (newState *UpsertDataVectorIndexResponse) SyncEffectiveFieldsDuringRead(existingState UpsertDataVectorIndexResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpsertDataVectorIndexResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpsertDataVectorIndexResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "result": reflect.TypeOf(UpsertDataResult{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpsertDataVectorIndexResponse +// only implements ToObjectValue() and Type(). +func (o UpsertDataVectorIndexResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "result": o.Result, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpsertDataVectorIndexResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "result": basetypes.ListType{ + ElemType: UpsertDataResult{}.Type(ctx), + }, + "status": types.StringType, + }, + } +} + +// GetResult returns the value of the Result field in UpsertDataVectorIndexResponse as +// a UpsertDataResult value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpsertDataVectorIndexResponse) GetResult(ctx context.Context) (UpsertDataResult, bool) { + var e UpsertDataResult + if o.Result.IsNull() || o.Result.IsUnknown() { + return e, false + } + var v []UpsertDataResult + d := o.Result.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetResult sets the value of the Result field in UpsertDataVectorIndexResponse. +func (o *UpsertDataVectorIndexResponse) SetResult(ctx context.Context, v UpsertDataResult) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["result"] + o.Result = types.ListValueMust(t, vs) +} + type Value struct { BoolValue types.Bool `tfsdk:"bool_value" tf:"optional"` - ListValue []ListValue `tfsdk:"list_value" tf:"optional,object"` + ListValue types.List `tfsdk:"list_value" tf:"optional,object"` NullValue types.String `tfsdk:"null_value" tf:"optional"` @@ -648,7 +2836,7 @@ type Value struct { StringValue types.String `tfsdk:"string_value" tf:"optional"` - StructValue []Struct `tfsdk:"struct_value" tf:"optional,object"` + StructValue types.List `tfsdk:"struct_value" tf:"optional,object"` } func (newState *Value) SyncEffectiveFieldsDuringCreateOrUpdate(plan Value) { @@ -657,13 +2845,113 @@ func (newState *Value) SyncEffectiveFieldsDuringCreateOrUpdate(plan Value) { func (newState *Value) SyncEffectiveFieldsDuringRead(existingState Value) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Value. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Value) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "list_value": reflect.TypeOf(ListValue{}), + "struct_value": reflect.TypeOf(Struct{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Value +// only implements ToObjectValue() and Type(). +func (o Value) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bool_value": o.BoolValue, + "list_value": o.ListValue, + "null_value": o.NullValue, + "number_value": o.NumberValue, + "string_value": o.StringValue, + "struct_value": o.StructValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Value) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bool_value": types.BoolType, + "list_value": basetypes.ListType{ + ElemType: ListValue{}.Type(ctx), + }, + "null_value": types.StringType, + "number_value": types.Float64Type, + "string_value": types.StringType, + "struct_value": basetypes.ListType{ + ElemType: Struct{}.Type(ctx), + }, + }, + } +} + +// GetListValue returns the value of the ListValue field in Value as +// a ListValue value. +// If the field is unknown or null, the boolean return value is false. +func (o *Value) GetListValue(ctx context.Context) (ListValue, bool) { + var e ListValue + if o.ListValue.IsNull() || o.ListValue.IsUnknown() { + return e, false + } + var v []ListValue + d := o.ListValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetListValue sets the value of the ListValue field in Value. +func (o *Value) SetListValue(ctx context.Context, v ListValue) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["list_value"] + o.ListValue = types.ListValueMust(t, vs) +} + +// GetStructValue returns the value of the StructValue field in Value as +// a Struct value. +// If the field is unknown or null, the boolean return value is false. +func (o *Value) GetStructValue(ctx context.Context) (Struct, bool) { + var e Struct + if o.StructValue.IsNull() || o.StructValue.IsUnknown() { + return e, false + } + var v []Struct + d := o.StructValue.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStructValue sets the value of the StructValue field in Value. +func (o *Value) SetStructValue(ctx context.Context, v Struct) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["struct_value"] + o.StructValue = types.ListValueMust(t, vs) +} + type VectorIndex struct { // The user who created the index. Creator types.String `tfsdk:"creator" tf:"optional"` - DeltaSyncIndexSpec []DeltaSyncVectorIndexSpecResponse `tfsdk:"delta_sync_index_spec" tf:"optional,object"` + DeltaSyncIndexSpec types.List `tfsdk:"delta_sync_index_spec" tf:"optional,object"` - DirectAccessIndexSpec []DirectAccessVectorIndexSpec `tfsdk:"direct_access_index_spec" tf:"optional,object"` + DirectAccessIndexSpec types.List `tfsdk:"direct_access_index_spec" tf:"optional,object"` // Name of the endpoint associated with the index EndpointName types.String `tfsdk:"endpoint_name" tf:"optional"` // There are 2 types of Vector Search indexes: @@ -679,7 +2967,7 @@ type VectorIndex struct { // Primary key of the index PrimaryKey types.String `tfsdk:"primary_key" tf:"optional"` - Status []VectorIndexStatus `tfsdk:"status" tf:"optional,object"` + Status types.List `tfsdk:"status" tf:"optional,object"` } func (newState *VectorIndex) SyncEffectiveFieldsDuringCreateOrUpdate(plan VectorIndex) { @@ -688,6 +2976,139 @@ func (newState *VectorIndex) SyncEffectiveFieldsDuringCreateOrUpdate(plan Vector func (newState *VectorIndex) SyncEffectiveFieldsDuringRead(existingState VectorIndex) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in VectorIndex. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a VectorIndex) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "delta_sync_index_spec": reflect.TypeOf(DeltaSyncVectorIndexSpecResponse{}), + "direct_access_index_spec": reflect.TypeOf(DirectAccessVectorIndexSpec{}), + "status": reflect.TypeOf(VectorIndexStatus{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, VectorIndex +// only implements ToObjectValue() and Type(). +func (o VectorIndex) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "creator": o.Creator, + "delta_sync_index_spec": o.DeltaSyncIndexSpec, + "direct_access_index_spec": o.DirectAccessIndexSpec, + "endpoint_name": o.EndpointName, + "index_type": o.IndexType, + "name": o.Name, + "primary_key": o.PrimaryKey, + "status": o.Status, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o VectorIndex) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "creator": types.StringType, + "delta_sync_index_spec": basetypes.ListType{ + ElemType: DeltaSyncVectorIndexSpecResponse{}.Type(ctx), + }, + "direct_access_index_spec": basetypes.ListType{ + ElemType: DirectAccessVectorIndexSpec{}.Type(ctx), + }, + "endpoint_name": types.StringType, + "index_type": types.StringType, + "name": types.StringType, + "primary_key": types.StringType, + "status": basetypes.ListType{ + ElemType: VectorIndexStatus{}.Type(ctx), + }, + }, + } +} + +// GetDeltaSyncIndexSpec returns the value of the DeltaSyncIndexSpec field in VectorIndex as +// a DeltaSyncVectorIndexSpecResponse value. +// If the field is unknown or null, the boolean return value is false. +func (o *VectorIndex) GetDeltaSyncIndexSpec(ctx context.Context) (DeltaSyncVectorIndexSpecResponse, bool) { + var e DeltaSyncVectorIndexSpecResponse + if o.DeltaSyncIndexSpec.IsNull() || o.DeltaSyncIndexSpec.IsUnknown() { + return e, false + } + var v []DeltaSyncVectorIndexSpecResponse + d := o.DeltaSyncIndexSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDeltaSyncIndexSpec sets the value of the DeltaSyncIndexSpec field in VectorIndex. +func (o *VectorIndex) SetDeltaSyncIndexSpec(ctx context.Context, v DeltaSyncVectorIndexSpecResponse) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["delta_sync_index_spec"] + o.DeltaSyncIndexSpec = types.ListValueMust(t, vs) +} + +// GetDirectAccessIndexSpec returns the value of the DirectAccessIndexSpec field in VectorIndex as +// a DirectAccessVectorIndexSpec value. +// If the field is unknown or null, the boolean return value is false. +func (o *VectorIndex) GetDirectAccessIndexSpec(ctx context.Context) (DirectAccessVectorIndexSpec, bool) { + var e DirectAccessVectorIndexSpec + if o.DirectAccessIndexSpec.IsNull() || o.DirectAccessIndexSpec.IsUnknown() { + return e, false + } + var v []DirectAccessVectorIndexSpec + d := o.DirectAccessIndexSpec.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetDirectAccessIndexSpec sets the value of the DirectAccessIndexSpec field in VectorIndex. +func (o *VectorIndex) SetDirectAccessIndexSpec(ctx context.Context, v DirectAccessVectorIndexSpec) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["direct_access_index_spec"] + o.DirectAccessIndexSpec = types.ListValueMust(t, vs) +} + +// GetStatus returns the value of the Status field in VectorIndex as +// a VectorIndexStatus value. +// If the field is unknown or null, the boolean return value is false. +func (o *VectorIndex) GetStatus(ctx context.Context) (VectorIndexStatus, bool) { + var e VectorIndexStatus + if o.Status.IsNull() || o.Status.IsUnknown() { + return e, false + } + var v []VectorIndexStatus + d := o.Status.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetStatus sets the value of the Status field in VectorIndex. +func (o *VectorIndex) SetStatus(ctx context.Context, v VectorIndexStatus) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["status"] + o.Status = types.ListValueMust(t, vs) +} + type VectorIndexStatus struct { // Index API Url to be used to perform operations on the index IndexUrl types.String `tfsdk:"index_url" tf:"optional"` @@ -704,3 +3125,40 @@ func (newState *VectorIndexStatus) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *VectorIndexStatus) SyncEffectiveFieldsDuringRead(existingState VectorIndexStatus) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in VectorIndexStatus. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a VectorIndexStatus) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, VectorIndexStatus +// only implements ToObjectValue() and Type(). +func (o VectorIndexStatus) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "index_url": o.IndexUrl, + "indexed_row_count": o.IndexedRowCount, + "message": o.Message, + "ready": o.Ready, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o VectorIndexStatus) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "index_url": types.StringType, + "indexed_row_count": types.Int64Type, + "message": types.StringType, + "ready": types.BoolType, + }, + } +} diff --git a/internal/service/workspace_tf/model.go b/internal/service/workspace_tf/model.go index 508e90337..ea6811069 100755 --- a/internal/service/workspace_tf/model.go +++ b/internal/service/workspace_tf/model.go @@ -11,7 +11,14 @@ We use go-native types for lists and maps intentionally for the ease for convert package workspace_tf import ( + "context" + "reflect" + + pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" + + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) type AclItem struct { @@ -27,6 +34,39 @@ func (newState *AclItem) SyncEffectiveFieldsDuringCreateOrUpdate(plan AclItem) { func (newState *AclItem) SyncEffectiveFieldsDuringRead(existingState AclItem) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AclItem. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AclItem) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AclItem +// only implements ToObjectValue() and Type(). +func (o AclItem) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission": o.Permission, + "principal": o.Principal, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AclItem) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission": types.StringType, + "principal": types.StringType, + }, + } +} + type AzureKeyVaultSecretScopeMetadata struct { // The DNS of the KeyVault DnsName types.String `tfsdk:"dns_name" tf:""` @@ -41,6 +81,39 @@ func (newState *AzureKeyVaultSecretScopeMetadata) SyncEffectiveFieldsDuringCreat func (newState *AzureKeyVaultSecretScopeMetadata) SyncEffectiveFieldsDuringRead(existingState AzureKeyVaultSecretScopeMetadata) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in AzureKeyVaultSecretScopeMetadata. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a AzureKeyVaultSecretScopeMetadata) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, AzureKeyVaultSecretScopeMetadata +// only implements ToObjectValue() and Type(). +func (o AzureKeyVaultSecretScopeMetadata) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "dns_name": o.DnsName, + "resource_id": o.ResourceId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o AzureKeyVaultSecretScopeMetadata) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "dns_name": types.StringType, + "resource_id": types.StringType, + }, + } +} + type CreateCredentialsRequest struct { // Git provider. This field is case-insensitive. The available Git providers // are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, @@ -69,6 +142,41 @@ func (newState *CreateCredentialsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *CreateCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState CreateCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o CreateCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "git_provider": o.GitProvider, + "git_username": o.GitUsername, + "personal_access_token": o.PersonalAccessToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "git_provider": types.StringType, + "git_username": types.StringType, + "personal_access_token": types.StringType, + }, + } +} + type CreateCredentialsResponse struct { // ID of the credential object in the workspace. CredentialId types.Int64 `tfsdk:"credential_id" tf:""` @@ -85,6 +193,41 @@ func (newState *CreateCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *CreateCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState CreateCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o CreateCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + "git_provider": o.GitProvider, + "git_username": o.GitUsername, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.Int64Type, + "git_provider": types.StringType, + "git_username": types.StringType, + }, + } +} + type CreateRepoRequest struct { // Desired path for the repo in the workspace. Almost any path in the // workspace can be chosen. If repo is created in `/Repos`, path must be in @@ -97,7 +240,7 @@ type CreateRepoRequest struct { Provider types.String `tfsdk:"provider" tf:""` // If specified, the repo will be created with sparse checkout enabled. You // cannot enable/disable sparse checkout after the repo is created. - SparseCheckout []SparseCheckout `tfsdk:"sparse_checkout" tf:"optional,object"` + SparseCheckout types.List `tfsdk:"sparse_checkout" tf:"optional,object"` // URL of the Git repository to be linked. Url types.String `tfsdk:"url" tf:""` } @@ -108,6 +251,73 @@ func (newState *CreateRepoRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateRepoRequest) SyncEffectiveFieldsDuringRead(existingState CreateRepoRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRepoRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRepoRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sparse_checkout": reflect.TypeOf(SparseCheckout{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRepoRequest +// only implements ToObjectValue() and Type(). +func (o CreateRepoRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + "provider": o.Provider, + "sparse_checkout": o.SparseCheckout, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRepoRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + "provider": types.StringType, + "sparse_checkout": basetypes.ListType{ + ElemType: SparseCheckout{}.Type(ctx), + }, + "url": types.StringType, + }, + } +} + +// GetSparseCheckout returns the value of the SparseCheckout field in CreateRepoRequest as +// a SparseCheckout value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRepoRequest) GetSparseCheckout(ctx context.Context) (SparseCheckout, bool) { + var e SparseCheckout + if o.SparseCheckout.IsNull() || o.SparseCheckout.IsUnknown() { + return e, false + } + var v []SparseCheckout + d := o.SparseCheckout.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparseCheckout sets the value of the SparseCheckout field in CreateRepoRequest. +func (o *CreateRepoRequest) SetSparseCheckout(ctx context.Context, v SparseCheckout) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sparse_checkout"] + o.SparseCheckout = types.ListValueMust(t, vs) +} + type CreateRepoResponse struct { // Branch that the Git folder (repo) is checked out to. Branch types.String `tfsdk:"branch" tf:"optional"` @@ -121,7 +331,7 @@ type CreateRepoResponse struct { // Git provider of the linked Git repository. Provider types.String `tfsdk:"provider" tf:"optional"` // Sparse checkout settings for the Git folder (repo). - SparseCheckout []SparseCheckout `tfsdk:"sparse_checkout" tf:"optional,object"` + SparseCheckout types.List `tfsdk:"sparse_checkout" tf:"optional,object"` // URL of the linked Git repository. Url types.String `tfsdk:"url" tf:"optional"` } @@ -132,9 +342,82 @@ func (newState *CreateRepoResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *CreateRepoResponse) SyncEffectiveFieldsDuringRead(existingState CreateRepoResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateRepoResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateRepoResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sparse_checkout": reflect.TypeOf(SparseCheckout{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateRepoResponse +// only implements ToObjectValue() and Type(). +func (o CreateRepoResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "branch": o.Branch, + "head_commit_id": o.HeadCommitId, + "id": o.Id, + "path": o.Path, + "provider": o.Provider, + "sparse_checkout": o.SparseCheckout, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateRepoResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "branch": types.StringType, + "head_commit_id": types.StringType, + "id": types.Int64Type, + "path": types.StringType, + "provider": types.StringType, + "sparse_checkout": basetypes.ListType{ + ElemType: SparseCheckout{}.Type(ctx), + }, + "url": types.StringType, + }, + } +} + +// GetSparseCheckout returns the value of the SparseCheckout field in CreateRepoResponse as +// a SparseCheckout value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateRepoResponse) GetSparseCheckout(ctx context.Context) (SparseCheckout, bool) { + var e SparseCheckout + if o.SparseCheckout.IsNull() || o.SparseCheckout.IsUnknown() { + return e, false + } + var v []SparseCheckout + d := o.SparseCheckout.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparseCheckout sets the value of the SparseCheckout field in CreateRepoResponse. +func (o *CreateRepoResponse) SetSparseCheckout(ctx context.Context, v SparseCheckout) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sparse_checkout"] + o.SparseCheckout = types.ListValueMust(t, vs) +} + type CreateScope struct { // The metadata for the secret scope if the type is `AZURE_KEYVAULT` - BackendAzureKeyvault []AzureKeyVaultSecretScopeMetadata `tfsdk:"backend_azure_keyvault" tf:"optional,object"` + BackendAzureKeyvault types.List `tfsdk:"backend_azure_keyvault" tf:"optional,object"` // The principal that is initially granted `MANAGE` permission to the // created scope. InitialManagePrincipal types.String `tfsdk:"initial_manage_principal" tf:"optional"` @@ -151,6 +434,73 @@ func (newState *CreateScope) SyncEffectiveFieldsDuringCreateOrUpdate(plan Create func (newState *CreateScope) SyncEffectiveFieldsDuringRead(existingState CreateScope) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateScope. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateScope) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "backend_azure_keyvault": reflect.TypeOf(AzureKeyVaultSecretScopeMetadata{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateScope +// only implements ToObjectValue() and Type(). +func (o CreateScope) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "backend_azure_keyvault": o.BackendAzureKeyvault, + "initial_manage_principal": o.InitialManagePrincipal, + "scope": o.Scope, + "scope_backend_type": o.ScopeBackendType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateScope) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "backend_azure_keyvault": basetypes.ListType{ + ElemType: AzureKeyVaultSecretScopeMetadata{}.Type(ctx), + }, + "initial_manage_principal": types.StringType, + "scope": types.StringType, + "scope_backend_type": types.StringType, + }, + } +} + +// GetBackendAzureKeyvault returns the value of the BackendAzureKeyvault field in CreateScope as +// a AzureKeyVaultSecretScopeMetadata value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateScope) GetBackendAzureKeyvault(ctx context.Context) (AzureKeyVaultSecretScopeMetadata, bool) { + var e AzureKeyVaultSecretScopeMetadata + if o.BackendAzureKeyvault.IsNull() || o.BackendAzureKeyvault.IsUnknown() { + return e, false + } + var v []AzureKeyVaultSecretScopeMetadata + d := o.BackendAzureKeyvault.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetBackendAzureKeyvault sets the value of the BackendAzureKeyvault field in CreateScope. +func (o *CreateScope) SetBackendAzureKeyvault(ctx context.Context, v AzureKeyVaultSecretScopeMetadata) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["backend_azure_keyvault"] + o.BackendAzureKeyvault = types.ListValueMust(t, vs) +} + type CreateScopeResponse struct { } @@ -160,6 +510,33 @@ func (newState *CreateScopeResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *CreateScopeResponse) SyncEffectiveFieldsDuringRead(existingState CreateScopeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateScopeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateScopeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateScopeResponse +// only implements ToObjectValue() and Type(). +func (o CreateScopeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateScopeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type CredentialInfo struct { // ID of the credential object in the workspace. CredentialId types.Int64 `tfsdk:"credential_id" tf:""` @@ -176,6 +553,41 @@ func (newState *CredentialInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan Cre func (newState *CredentialInfo) SyncEffectiveFieldsDuringRead(existingState CredentialInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CredentialInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CredentialInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CredentialInfo +// only implements ToObjectValue() and Type(). +func (o CredentialInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + "git_provider": o.GitProvider, + "git_username": o.GitUsername, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CredentialInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.Int64Type, + "git_provider": types.StringType, + "git_username": types.StringType, + }, + } +} + type Delete struct { // The absolute path of the notebook or directory. Path types.String `tfsdk:"path" tf:""` @@ -192,6 +604,39 @@ func (newState *Delete) SyncEffectiveFieldsDuringCreateOrUpdate(plan Delete) { func (newState *Delete) SyncEffectiveFieldsDuringRead(existingState Delete) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Delete. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Delete) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Delete +// only implements ToObjectValue() and Type(). +func (o Delete) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + "recursive": o.Recursive, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Delete) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + "recursive": types.BoolType, + }, + } +} + type DeleteAcl struct { // The principal to remove an existing ACL from. Principal types.String `tfsdk:"principal" tf:""` @@ -205,6 +650,39 @@ func (newState *DeleteAcl) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteAc func (newState *DeleteAcl) SyncEffectiveFieldsDuringRead(existingState DeleteAcl) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAcl. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAcl) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAcl +// only implements ToObjectValue() and Type(). +func (o DeleteAcl) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principal": o.Principal, + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAcl) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principal": types.StringType, + "scope": types.StringType, + }, + } +} + type DeleteAclResponse struct { } @@ -214,6 +692,33 @@ func (newState *DeleteAclResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteAclResponse) SyncEffectiveFieldsDuringRead(existingState DeleteAclResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAclResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAclResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAclResponse +// only implements ToObjectValue() and Type(). +func (o DeleteAclResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAclResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a credential type DeleteCredentialsRequest struct { // The ID for the corresponding credential to access. @@ -226,6 +731,37 @@ func (newState *DeleteCredentialsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *DeleteCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState DeleteCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o DeleteCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.Int64Type, + }, + } +} + type DeleteCredentialsResponse struct { } @@ -235,6 +771,33 @@ func (newState *DeleteCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *DeleteCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState DeleteCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o DeleteCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Delete a repo type DeleteRepoRequest struct { // The ID for the corresponding repo to delete. @@ -247,6 +810,37 @@ func (newState *DeleteRepoRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteRepoRequest) SyncEffectiveFieldsDuringRead(existingState DeleteRepoRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRepoRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRepoRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRepoRequest +// only implements ToObjectValue() and Type(). +func (o DeleteRepoRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "repo_id": o.RepoId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRepoRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "repo_id": types.Int64Type, + }, + } +} + type DeleteRepoResponse struct { } @@ -256,6 +850,33 @@ func (newState *DeleteRepoResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *DeleteRepoResponse) SyncEffectiveFieldsDuringRead(existingState DeleteRepoResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteRepoResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteRepoResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteRepoResponse +// only implements ToObjectValue() and Type(). +func (o DeleteRepoResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteRepoResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteResponse struct { } @@ -265,6 +886,33 @@ func (newState *DeleteResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Del func (newState *DeleteResponse) SyncEffectiveFieldsDuringRead(existingState DeleteResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteResponse +// only implements ToObjectValue() and Type(). +func (o DeleteResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteScope struct { // Name of the scope to delete. Scope types.String `tfsdk:"scope" tf:""` @@ -276,6 +924,37 @@ func (newState *DeleteScope) SyncEffectiveFieldsDuringCreateOrUpdate(plan Delete func (newState *DeleteScope) SyncEffectiveFieldsDuringRead(existingState DeleteScope) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteScope. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteScope) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteScope +// only implements ToObjectValue() and Type(). +func (o DeleteScope) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteScope) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "scope": types.StringType, + }, + } +} + type DeleteScopeResponse struct { } @@ -285,6 +964,33 @@ func (newState *DeleteScopeResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *DeleteScopeResponse) SyncEffectiveFieldsDuringRead(existingState DeleteScopeResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteScopeResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteScopeResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteScopeResponse +// only implements ToObjectValue() and Type(). +func (o DeleteScopeResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteScopeResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type DeleteSecret struct { // Name of the secret to delete. Key types.String `tfsdk:"key" tf:""` @@ -298,6 +1004,39 @@ func (newState *DeleteSecret) SyncEffectiveFieldsDuringCreateOrUpdate(plan Delet func (newState *DeleteSecret) SyncEffectiveFieldsDuringRead(existingState DeleteSecret) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteSecret. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteSecret) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteSecret +// only implements ToObjectValue() and Type(). +func (o DeleteSecret) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteSecret) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "scope": types.StringType, + }, + } +} + type DeleteSecretResponse struct { } @@ -307,6 +1046,33 @@ func (newState *DeleteSecretResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *DeleteSecretResponse) SyncEffectiveFieldsDuringRead(existingState DeleteSecretResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteSecretResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteSecretResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteSecretResponse +// only implements ToObjectValue() and Type(). +func (o DeleteSecretResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteSecretResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Export a workspace object type ExportRequest struct { // This specifies the format of the exported file. By default, this is @@ -335,6 +1101,39 @@ func (newState *ExportRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Expo func (newState *ExportRequest) SyncEffectiveFieldsDuringRead(existingState ExportRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExportRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExportRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExportRequest +// only implements ToObjectValue() and Type(). +func (o ExportRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "format": o.Format, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExportRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "format": types.StringType, + "path": types.StringType, + }, + } +} + type ExportResponse struct { // The base64-encoded content. If the limit (10MB) is exceeded, exception // with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown. @@ -349,6 +1148,39 @@ func (newState *ExportResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Exp func (newState *ExportResponse) SyncEffectiveFieldsDuringRead(existingState ExportResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ExportResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ExportResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ExportResponse +// only implements ToObjectValue() and Type(). +func (o ExportResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "file_type": o.FileType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ExportResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "file_type": types.StringType, + }, + } +} + // Get secret ACL details type GetAclRequest struct { // The principal to fetch ACL information for. @@ -363,6 +1195,39 @@ func (newState *GetAclRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetA func (newState *GetAclRequest) SyncEffectiveFieldsDuringRead(existingState GetAclRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAclRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAclRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAclRequest +// only implements ToObjectValue() and Type(). +func (o GetAclRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "principal": o.Principal, + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAclRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "principal": types.StringType, + "scope": types.StringType, + }, + } +} + // Get a credential entry type GetCredentialsRequest struct { // The ID for the corresponding credential to access. @@ -375,6 +1240,37 @@ func (newState *GetCredentialsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(p func (newState *GetCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState GetCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o GetCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.Int64Type, + }, + } +} + type GetCredentialsResponse struct { // ID of the credential object in the workspace. CredentialId types.Int64 `tfsdk:"credential_id" tf:""` @@ -391,6 +1287,41 @@ func (newState *GetCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *GetCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState GetCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o GetCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + "git_provider": o.GitProvider, + "git_username": o.GitUsername, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.Int64Type, + "git_provider": types.StringType, + "git_username": types.StringType, + }, + } +} + // Get repo permission levels type GetRepoPermissionLevelsRequest struct { // The repo for which to get or manage permissions. @@ -403,9 +1334,40 @@ func (newState *GetRepoPermissionLevelsRequest) SyncEffectiveFieldsDuringCreateO func (newState *GetRepoPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetRepoPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRepoPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRepoPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRepoPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetRepoPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "repo_id": o.RepoId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRepoPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "repo_id": types.StringType, + }, + } +} + type GetRepoPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []RepoPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetRepoPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetRepoPermissionLevelsResponse) { @@ -414,6 +1376,67 @@ func (newState *GetRepoPermissionLevelsResponse) SyncEffectiveFieldsDuringCreate func (newState *GetRepoPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetRepoPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRepoPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRepoPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(RepoPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRepoPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetRepoPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRepoPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: RepoPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetRepoPermissionLevelsResponse as +// a slice of RepoPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetRepoPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]RepoPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []RepoPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetRepoPermissionLevelsResponse. +func (o *GetRepoPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []RepoPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get repo permissions type GetRepoPermissionsRequest struct { // The repo for which to get or manage permissions. @@ -426,6 +1449,37 @@ func (newState *GetRepoPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpda func (newState *GetRepoPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetRepoPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRepoPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRepoPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRepoPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetRepoPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "repo_id": o.RepoId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRepoPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "repo_id": types.StringType, + }, + } +} + // Get a repo type GetRepoRequest struct { // ID of the Git folder (repo) object in the workspace. @@ -438,6 +1492,37 @@ func (newState *GetRepoRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Get func (newState *GetRepoRequest) SyncEffectiveFieldsDuringRead(existingState GetRepoRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRepoRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRepoRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRepoRequest +// only implements ToObjectValue() and Type(). +func (o GetRepoRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "repo_id": o.RepoId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRepoRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "repo_id": types.Int64Type, + }, + } +} + type GetRepoResponse struct { // Branch that the local version of the repo is checked out to. Branch types.String `tfsdk:"branch" tf:"optional"` @@ -450,7 +1535,7 @@ type GetRepoResponse struct { // Git provider of the linked Git repository. Provider types.String `tfsdk:"provider" tf:"optional"` // Sparse checkout settings for the Git folder (repo). - SparseCheckout []SparseCheckout `tfsdk:"sparse_checkout" tf:"optional,object"` + SparseCheckout types.List `tfsdk:"sparse_checkout" tf:"optional,object"` // URL of the linked Git repository. Url types.String `tfsdk:"url" tf:"optional"` } @@ -461,6 +1546,79 @@ func (newState *GetRepoResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Ge func (newState *GetRepoResponse) SyncEffectiveFieldsDuringRead(existingState GetRepoResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetRepoResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetRepoResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sparse_checkout": reflect.TypeOf(SparseCheckout{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetRepoResponse +// only implements ToObjectValue() and Type(). +func (o GetRepoResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "branch": o.Branch, + "head_commit_id": o.HeadCommitId, + "id": o.Id, + "path": o.Path, + "provider": o.Provider, + "sparse_checkout": o.SparseCheckout, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetRepoResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "branch": types.StringType, + "head_commit_id": types.StringType, + "id": types.Int64Type, + "path": types.StringType, + "provider": types.StringType, + "sparse_checkout": basetypes.ListType{ + ElemType: SparseCheckout{}.Type(ctx), + }, + "url": types.StringType, + }, + } +} + +// GetSparseCheckout returns the value of the SparseCheckout field in GetRepoResponse as +// a SparseCheckout value. +// If the field is unknown or null, the boolean return value is false. +func (o *GetRepoResponse) GetSparseCheckout(ctx context.Context) (SparseCheckout, bool) { + var e SparseCheckout + if o.SparseCheckout.IsNull() || o.SparseCheckout.IsUnknown() { + return e, false + } + var v []SparseCheckout + d := o.SparseCheckout.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparseCheckout sets the value of the SparseCheckout field in GetRepoResponse. +func (o *GetRepoResponse) SetSparseCheckout(ctx context.Context, v SparseCheckout) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sparse_checkout"] + o.SparseCheckout = types.ListValueMust(t, vs) +} + // Get a secret type GetSecretRequest struct { // The key to fetch secret for. @@ -475,6 +1633,39 @@ func (newState *GetSecretRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetSecretRequest) SyncEffectiveFieldsDuringRead(existingState GetSecretRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetSecretRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetSecretRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetSecretRequest +// only implements ToObjectValue() and Type(). +func (o GetSecretRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetSecretRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "scope": types.StringType, + }, + } +} + type GetSecretResponse struct { // A unique name to identify the secret. Key types.String `tfsdk:"key" tf:"optional"` @@ -488,6 +1679,39 @@ func (newState *GetSecretResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *GetSecretResponse) SyncEffectiveFieldsDuringRead(existingState GetSecretResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetSecretResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetSecretResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetSecretResponse +// only implements ToObjectValue() and Type(). +func (o GetSecretResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "value": o.Value, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetSecretResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + } +} + // Get status type GetStatusRequest struct { // The absolute path of the notebook or directory. @@ -500,6 +1724,37 @@ func (newState *GetStatusRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan G func (newState *GetStatusRequest) SyncEffectiveFieldsDuringRead(existingState GetStatusRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetStatusRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetStatusRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetStatusRequest +// only implements ToObjectValue() and Type(). +func (o GetStatusRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetStatusRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + // Get workspace object permission levels type GetWorkspaceObjectPermissionLevelsRequest struct { // The workspace object for which to get or manage permissions. @@ -514,9 +1769,42 @@ func (newState *GetWorkspaceObjectPermissionLevelsRequest) SyncEffectiveFieldsDu func (newState *GetWorkspaceObjectPermissionLevelsRequest) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceObjectPermissionLevelsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceObjectPermissionLevelsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceObjectPermissionLevelsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceObjectPermissionLevelsRequest +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceObjectPermissionLevelsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_object_id": o.WorkspaceObjectId, + "workspace_object_type": o.WorkspaceObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceObjectPermissionLevelsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_object_id": types.StringType, + "workspace_object_type": types.StringType, + }, + } +} + type GetWorkspaceObjectPermissionLevelsResponse struct { // Specific permission levels - PermissionLevels []WorkspaceObjectPermissionsDescription `tfsdk:"permission_levels" tf:"optional"` + PermissionLevels types.List `tfsdk:"permission_levels" tf:"optional"` } func (newState *GetWorkspaceObjectPermissionLevelsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetWorkspaceObjectPermissionLevelsResponse) { @@ -525,6 +1813,67 @@ func (newState *GetWorkspaceObjectPermissionLevelsResponse) SyncEffectiveFieldsD func (newState *GetWorkspaceObjectPermissionLevelsResponse) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceObjectPermissionLevelsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceObjectPermissionLevelsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceObjectPermissionLevelsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "permission_levels": reflect.TypeOf(WorkspaceObjectPermissionsDescription{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceObjectPermissionLevelsResponse +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceObjectPermissionLevelsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission_levels": o.PermissionLevels, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceObjectPermissionLevelsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission_levels": basetypes.ListType{ + ElemType: WorkspaceObjectPermissionsDescription{}.Type(ctx), + }, + }, + } +} + +// GetPermissionLevels returns the value of the PermissionLevels field in GetWorkspaceObjectPermissionLevelsResponse as +// a slice of WorkspaceObjectPermissionsDescription values. +// If the field is unknown or null, the boolean return value is false. +func (o *GetWorkspaceObjectPermissionLevelsResponse) GetPermissionLevels(ctx context.Context) ([]WorkspaceObjectPermissionsDescription, bool) { + if o.PermissionLevels.IsNull() || o.PermissionLevels.IsUnknown() { + return nil, false + } + var v []WorkspaceObjectPermissionsDescription + d := o.PermissionLevels.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPermissionLevels sets the value of the PermissionLevels field in GetWorkspaceObjectPermissionLevelsResponse. +func (o *GetWorkspaceObjectPermissionLevelsResponse) SetPermissionLevels(ctx context.Context, v []WorkspaceObjectPermissionsDescription) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["permission_levels"] + t = t.(attr.TypeWithElementType).ElementType() + o.PermissionLevels = types.ListValueMust(t, vs) +} + // Get workspace object permissions type GetWorkspaceObjectPermissionsRequest struct { // The workspace object for which to get or manage permissions. @@ -539,6 +1888,39 @@ func (newState *GetWorkspaceObjectPermissionsRequest) SyncEffectiveFieldsDuringC func (newState *GetWorkspaceObjectPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState GetWorkspaceObjectPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetWorkspaceObjectPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetWorkspaceObjectPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetWorkspaceObjectPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o GetWorkspaceObjectPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "workspace_object_id": o.WorkspaceObjectId, + "workspace_object_type": o.WorkspaceObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetWorkspaceObjectPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "workspace_object_id": types.StringType, + "workspace_object_type": types.StringType, + }, + } +} + type Import struct { // The base64-encoded content. This has a limit of 10 MB. // @@ -578,6 +1960,45 @@ func (newState *Import) SyncEffectiveFieldsDuringCreateOrUpdate(plan Import) { func (newState *Import) SyncEffectiveFieldsDuringRead(existingState Import) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Import. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Import) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Import +// only implements ToObjectValue() and Type(). +func (o Import) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "content": o.Content, + "format": o.Format, + "language": o.Language, + "overwrite": o.Overwrite, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Import) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "content": types.StringType, + "format": types.StringType, + "language": types.StringType, + "overwrite": types.BoolType, + "path": types.StringType, + }, + } +} + type ImportResponse struct { } @@ -587,6 +2008,33 @@ func (newState *ImportResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Imp func (newState *ImportResponse) SyncEffectiveFieldsDuringRead(existingState ImportResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ImportResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ImportResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ImportResponse +// only implements ToObjectValue() and Type(). +func (o ImportResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o ImportResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + // Lists ACLs type ListAclsRequest struct { // The name of the scope to fetch ACL information from. @@ -599,9 +2047,40 @@ func (newState *ListAclsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan Li func (newState *ListAclsRequest) SyncEffectiveFieldsDuringRead(existingState ListAclsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAclsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAclsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAclsRequest +// only implements ToObjectValue() and Type(). +func (o ListAclsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAclsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "scope": types.StringType, + }, + } +} + type ListAclsResponse struct { // The associated ACLs rule applied to principals in the given scope. - Items []AclItem `tfsdk:"items" tf:"optional"` + Items types.List `tfsdk:"items" tf:"optional"` } func (newState *ListAclsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAclsResponse) { @@ -610,9 +2089,70 @@ func (newState *ListAclsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListAclsResponse) SyncEffectiveFieldsDuringRead(existingState ListAclsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAclsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAclsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "items": reflect.TypeOf(AclItem{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAclsResponse +// only implements ToObjectValue() and Type(). +func (o ListAclsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "items": o.Items, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAclsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "items": basetypes.ListType{ + ElemType: AclItem{}.Type(ctx), + }, + }, + } +} + +// GetItems returns the value of the Items field in ListAclsResponse as +// a slice of AclItem values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListAclsResponse) GetItems(ctx context.Context) ([]AclItem, bool) { + if o.Items.IsNull() || o.Items.IsUnknown() { + return nil, false + } + var v []AclItem + d := o.Items.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetItems sets the value of the Items field in ListAclsResponse. +func (o *ListAclsResponse) SetItems(ctx context.Context, v []AclItem) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["items"] + t = t.(attr.TypeWithElementType).ElementType() + o.Items = types.ListValueMust(t, vs) +} + type ListCredentialsResponse struct { // List of credentials. - Credentials []CredentialInfo `tfsdk:"credentials" tf:"optional"` + Credentials types.List `tfsdk:"credentials" tf:"optional"` } func (newState *ListCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListCredentialsResponse) { @@ -621,6 +2161,67 @@ func (newState *ListCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpdate func (newState *ListCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState ListCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "credentials": reflect.TypeOf(CredentialInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o ListCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credentials": o.Credentials, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credentials": basetypes.ListType{ + ElemType: CredentialInfo{}.Type(ctx), + }, + }, + } +} + +// GetCredentials returns the value of the Credentials field in ListCredentialsResponse as +// a slice of CredentialInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListCredentialsResponse) GetCredentials(ctx context.Context) ([]CredentialInfo, bool) { + if o.Credentials.IsNull() || o.Credentials.IsUnknown() { + return nil, false + } + var v []CredentialInfo + d := o.Credentials.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetCredentials sets the value of the Credentials field in ListCredentialsResponse. +func (o *ListCredentialsResponse) SetCredentials(ctx context.Context, v []CredentialInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["credentials"] + t = t.(attr.TypeWithElementType).ElementType() + o.Credentials = types.ListValueMust(t, vs) +} + // Get repos type ListReposRequest struct { // Token used to get the next page of results. If not specified, returns the @@ -639,12 +2240,45 @@ func (newState *ListReposRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan L func (newState *ListReposRequest) SyncEffectiveFieldsDuringRead(existingState ListReposRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListReposRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListReposRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListReposRequest +// only implements ToObjectValue() and Type(). +func (o ListReposRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "path_prefix": o.PathPrefix, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListReposRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "path_prefix": types.StringType, + }, + } +} + type ListReposResponse struct { // Token that can be specified as a query parameter to the `GET /repos` // endpoint to retrieve the next page of results. NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` // List of Git folders (repos). - Repos []RepoInfo `tfsdk:"repos" tf:"optional"` + Repos types.List `tfsdk:"repos" tf:"optional"` } func (newState *ListReposResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListReposResponse) { @@ -653,9 +2287,72 @@ func (newState *ListReposResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListReposResponse) SyncEffectiveFieldsDuringRead(existingState ListReposResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListReposResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListReposResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "repos": reflect.TypeOf(RepoInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListReposResponse +// only implements ToObjectValue() and Type(). +func (o ListReposResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "repos": o.Repos, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListReposResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "repos": basetypes.ListType{ + ElemType: RepoInfo{}.Type(ctx), + }, + }, + } +} + +// GetRepos returns the value of the Repos field in ListReposResponse as +// a slice of RepoInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListReposResponse) GetRepos(ctx context.Context) ([]RepoInfo, bool) { + if o.Repos.IsNull() || o.Repos.IsUnknown() { + return nil, false + } + var v []RepoInfo + d := o.Repos.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetRepos sets the value of the Repos field in ListReposResponse. +func (o *ListReposResponse) SetRepos(ctx context.Context, v []RepoInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["repos"] + t = t.(attr.TypeWithElementType).ElementType() + o.Repos = types.ListValueMust(t, vs) +} + type ListResponse struct { // List of objects. - Objects []ObjectInfo `tfsdk:"objects" tf:"optional"` + Objects types.List `tfsdk:"objects" tf:"optional"` } func (newState *ListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListResponse) { @@ -664,9 +2361,70 @@ func (newState *ListResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListR func (newState *ListResponse) SyncEffectiveFieldsDuringRead(existingState ListResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "objects": reflect.TypeOf(ObjectInfo{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListResponse +// only implements ToObjectValue() and Type(). +func (o ListResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "objects": o.Objects, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "objects": basetypes.ListType{ + ElemType: ObjectInfo{}.Type(ctx), + }, + }, + } +} + +// GetObjects returns the value of the Objects field in ListResponse as +// a slice of ObjectInfo values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListResponse) GetObjects(ctx context.Context) ([]ObjectInfo, bool) { + if o.Objects.IsNull() || o.Objects.IsUnknown() { + return nil, false + } + var v []ObjectInfo + d := o.Objects.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetObjects sets the value of the Objects field in ListResponse. +func (o *ListResponse) SetObjects(ctx context.Context, v []ObjectInfo) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["objects"] + t = t.(attr.TypeWithElementType).ElementType() + o.Objects = types.ListValueMust(t, vs) +} + type ListScopesResponse struct { // The available secret scopes. - Scopes []SecretScope `tfsdk:"scopes" tf:"optional"` + Scopes types.List `tfsdk:"scopes" tf:"optional"` } func (newState *ListScopesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListScopesResponse) { @@ -675,6 +2433,67 @@ func (newState *ListScopesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListScopesResponse) SyncEffectiveFieldsDuringRead(existingState ListScopesResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListScopesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListScopesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "scopes": reflect.TypeOf(SecretScope{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListScopesResponse +// only implements ToObjectValue() and Type(). +func (o ListScopesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "scopes": o.Scopes, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListScopesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "scopes": basetypes.ListType{ + ElemType: SecretScope{}.Type(ctx), + }, + }, + } +} + +// GetScopes returns the value of the Scopes field in ListScopesResponse as +// a slice of SecretScope values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListScopesResponse) GetScopes(ctx context.Context) ([]SecretScope, bool) { + if o.Scopes.IsNull() || o.Scopes.IsUnknown() { + return nil, false + } + var v []SecretScope + d := o.Scopes.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetScopes sets the value of the Scopes field in ListScopesResponse. +func (o *ListScopesResponse) SetScopes(ctx context.Context, v []SecretScope) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["scopes"] + t = t.(attr.TypeWithElementType).ElementType() + o.Scopes = types.ListValueMust(t, vs) +} + // List secret keys type ListSecretsRequest struct { // The name of the scope to list secrets within. @@ -687,9 +2506,40 @@ func (newState *ListSecretsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *ListSecretsRequest) SyncEffectiveFieldsDuringRead(existingState ListSecretsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSecretsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSecretsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSecretsRequest +// only implements ToObjectValue() and Type(). +func (o ListSecretsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSecretsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "scope": types.StringType, + }, + } +} + type ListSecretsResponse struct { // Metadata information of all secrets contained within the given scope. - Secrets []SecretMetadata `tfsdk:"secrets" tf:"optional"` + Secrets types.List `tfsdk:"secrets" tf:"optional"` } func (newState *ListSecretsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListSecretsResponse) { @@ -698,6 +2548,67 @@ func (newState *ListSecretsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(pla func (newState *ListSecretsResponse) SyncEffectiveFieldsDuringRead(existingState ListSecretsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListSecretsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListSecretsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "secrets": reflect.TypeOf(SecretMetadata{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListSecretsResponse +// only implements ToObjectValue() and Type(). +func (o ListSecretsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "secrets": o.Secrets, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListSecretsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "secrets": basetypes.ListType{ + ElemType: SecretMetadata{}.Type(ctx), + }, + }, + } +} + +// GetSecrets returns the value of the Secrets field in ListSecretsResponse as +// a slice of SecretMetadata values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListSecretsResponse) GetSecrets(ctx context.Context) ([]SecretMetadata, bool) { + if o.Secrets.IsNull() || o.Secrets.IsUnknown() { + return nil, false + } + var v []SecretMetadata + d := o.Secrets.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetSecrets sets the value of the Secrets field in ListSecretsResponse. +func (o *ListSecretsResponse) SetSecrets(ctx context.Context, v []SecretMetadata) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["secrets"] + t = t.(attr.TypeWithElementType).ElementType() + o.Secrets = types.ListValueMust(t, vs) +} + // List contents type ListWorkspaceRequest struct { // UTC timestamp in milliseconds @@ -712,6 +2623,39 @@ func (newState *ListWorkspaceRequest) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *ListWorkspaceRequest) SyncEffectiveFieldsDuringRead(existingState ListWorkspaceRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListWorkspaceRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListWorkspaceRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListWorkspaceRequest +// only implements ToObjectValue() and Type(). +func (o ListWorkspaceRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "notebooks_modified_after": o.NotebooksModifiedAfter, + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListWorkspaceRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "notebooks_modified_after": types.Int64Type, + "path": types.StringType, + }, + } +} + type Mkdirs struct { // The absolute path of the directory. If the parent directories do not // exist, it will also create them. If the directory already exists, this @@ -725,6 +2669,37 @@ func (newState *Mkdirs) SyncEffectiveFieldsDuringCreateOrUpdate(plan Mkdirs) { func (newState *Mkdirs) SyncEffectiveFieldsDuringRead(existingState Mkdirs) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in Mkdirs. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a Mkdirs) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, Mkdirs +// only implements ToObjectValue() and Type(). +func (o Mkdirs) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "path": o.Path, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o Mkdirs) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "path": types.StringType, + }, + } +} + type MkdirsResponse struct { } @@ -734,6 +2709,33 @@ func (newState *MkdirsResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Mkd func (newState *MkdirsResponse) SyncEffectiveFieldsDuringRead(existingState MkdirsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in MkdirsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a MkdirsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, MkdirsResponse +// only implements ToObjectValue() and Type(). +func (o MkdirsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o MkdirsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type ObjectInfo struct { // Only applicable to files. The creation UTC timestamp. CreatedAt types.Int64 `tfsdk:"created_at" tf:"optional"` @@ -765,6 +2767,51 @@ func (newState *ObjectInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan ObjectI func (newState *ObjectInfo) SyncEffectiveFieldsDuringRead(existingState ObjectInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ObjectInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ObjectInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ObjectInfo +// only implements ToObjectValue() and Type(). +func (o ObjectInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "created_at": o.CreatedAt, + "language": o.Language, + "modified_at": o.ModifiedAt, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + "path": o.Path, + "resource_id": o.ResourceId, + "size": o.Size, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ObjectInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "created_at": types.Int64Type, + "language": types.StringType, + "modified_at": types.Int64Type, + "object_id": types.Int64Type, + "object_type": types.StringType, + "path": types.StringType, + "resource_id": types.StringType, + "size": types.Int64Type, + }, + } +} + type PutAcl struct { // The permission level applied to the principal. Permission types.String `tfsdk:"permission" tf:""` @@ -780,6 +2827,41 @@ func (newState *PutAcl) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutAcl) { func (newState *PutAcl) SyncEffectiveFieldsDuringRead(existingState PutAcl) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutAcl. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutAcl) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutAcl +// only implements ToObjectValue() and Type(). +func (o PutAcl) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "permission": o.Permission, + "principal": o.Principal, + "scope": o.Scope, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PutAcl) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "permission": types.StringType, + "principal": types.StringType, + "scope": types.StringType, + }, + } +} + type PutAclResponse struct { } @@ -789,6 +2871,33 @@ func (newState *PutAclResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan Put func (newState *PutAclResponse) SyncEffectiveFieldsDuringRead(existingState PutAclResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutAclResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutAclResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutAclResponse +// only implements ToObjectValue() and Type(). +func (o PutAclResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PutAclResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type PutSecret struct { // If specified, value will be stored as bytes. BytesValue types.String `tfsdk:"bytes_value" tf:"optional"` @@ -806,6 +2915,43 @@ func (newState *PutSecret) SyncEffectiveFieldsDuringCreateOrUpdate(plan PutSecre func (newState *PutSecret) SyncEffectiveFieldsDuringRead(existingState PutSecret) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutSecret. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutSecret) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutSecret +// only implements ToObjectValue() and Type(). +func (o PutSecret) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "bytes_value": o.BytesValue, + "key": o.Key, + "scope": o.Scope, + "string_value": o.StringValue, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o PutSecret) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "bytes_value": types.StringType, + "key": types.StringType, + "scope": types.StringType, + "string_value": types.StringType, + }, + } +} + type PutSecretResponse struct { } @@ -815,6 +2961,33 @@ func (newState *PutSecretResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *PutSecretResponse) SyncEffectiveFieldsDuringRead(existingState PutSecretResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in PutSecretResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a PutSecretResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, PutSecretResponse +// only implements ToObjectValue() and Type(). +func (o PutSecretResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o PutSecretResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type RepoAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -832,9 +3005,46 @@ func (newState *RepoAccessControlRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *RepoAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState RepoAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o RepoAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type RepoAccessControlResponse struct { // All permissions. - AllPermissions []RepoPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -851,6 +3061,75 @@ func (newState *RepoAccessControlResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *RepoAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState RepoAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(RepoPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o RepoAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: RepoPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in RepoAccessControlResponse as +// a slice of RepoPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepoAccessControlResponse) GetAllPermissions(ctx context.Context) ([]RepoPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []RepoPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in RepoAccessControlResponse. +func (o *RepoAccessControlResponse) SetAllPermissions(ctx context.Context, v []RepoPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + // Git folder (repo) information. type RepoInfo struct { // Name of the current git branch of the git folder (repo). @@ -864,7 +3143,7 @@ type RepoInfo struct { // Git provider of the remote git repository, e.g. `gitHub`. Provider types.String `tfsdk:"provider" tf:"optional"` // Sparse checkout config for the git folder (repo). - SparseCheckout []SparseCheckout `tfsdk:"sparse_checkout" tf:"optional,object"` + SparseCheckout types.List `tfsdk:"sparse_checkout" tf:"optional,object"` // URL of the remote git repository. Url types.String `tfsdk:"url" tf:"optional"` } @@ -875,10 +3154,83 @@ func (newState *RepoInfo) SyncEffectiveFieldsDuringCreateOrUpdate(plan RepoInfo) func (newState *RepoInfo) SyncEffectiveFieldsDuringRead(existingState RepoInfo) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoInfo. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoInfo) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sparse_checkout": reflect.TypeOf(SparseCheckout{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoInfo +// only implements ToObjectValue() and Type(). +func (o RepoInfo) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "branch": o.Branch, + "head_commit_id": o.HeadCommitId, + "id": o.Id, + "path": o.Path, + "provider": o.Provider, + "sparse_checkout": o.SparseCheckout, + "url": o.Url, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoInfo) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "branch": types.StringType, + "head_commit_id": types.StringType, + "id": types.Int64Type, + "path": types.StringType, + "provider": types.StringType, + "sparse_checkout": basetypes.ListType{ + ElemType: SparseCheckout{}.Type(ctx), + }, + "url": types.StringType, + }, + } +} + +// GetSparseCheckout returns the value of the SparseCheckout field in RepoInfo as +// a SparseCheckout value. +// If the field is unknown or null, the boolean return value is false. +func (o *RepoInfo) GetSparseCheckout(ctx context.Context) (SparseCheckout, bool) { + var e SparseCheckout + if o.SparseCheckout.IsNull() || o.SparseCheckout.IsUnknown() { + return e, false + } + var v []SparseCheckout + d := o.SparseCheckout.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparseCheckout sets the value of the SparseCheckout field in RepoInfo. +func (o *RepoInfo) SetSparseCheckout(ctx context.Context, v SparseCheckout) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sparse_checkout"] + o.SparseCheckout = types.ListValueMust(t, vs) +} + type RepoPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -889,8 +3241,73 @@ func (newState *RepoPermission) SyncEffectiveFieldsDuringCreateOrUpdate(plan Rep func (newState *RepoPermission) SyncEffectiveFieldsDuringRead(existingState RepoPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoPermission +// only implements ToObjectValue() and Type(). +func (o RepoPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in RepoPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepoPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in RepoPermission. +func (o *RepoPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type RepoPermissions struct { - AccessControlList []RepoAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -903,6 +3320,71 @@ func (newState *RepoPermissions) SyncEffectiveFieldsDuringCreateOrUpdate(plan Re func (newState *RepoPermissions) SyncEffectiveFieldsDuringRead(existingState RepoPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(RepoAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoPermissions +// only implements ToObjectValue() and Type(). +func (o RepoPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: RepoAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in RepoPermissions as +// a slice of RepoAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepoPermissions) GetAccessControlList(ctx context.Context) ([]RepoAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []RepoAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in RepoPermissions. +func (o *RepoPermissions) SetAccessControlList(ctx context.Context, v []RepoAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type RepoPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -915,8 +3397,41 @@ func (newState *RepoPermissionsDescription) SyncEffectiveFieldsDuringCreateOrUpd func (newState *RepoPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState RepoPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o RepoPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type RepoPermissionsRequest struct { - AccessControlList []RepoAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The repo for which to get or manage permissions. RepoId types.String `tfsdk:"-"` } @@ -927,6 +3442,69 @@ func (newState *RepoPermissionsRequest) SyncEffectiveFieldsDuringCreateOrUpdate( func (newState *RepoPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState RepoPermissionsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in RepoPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a RepoPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(RepoAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, RepoPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o RepoPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "repo_id": o.RepoId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o RepoPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: RepoAccessControlRequest{}.Type(ctx), + }, + "repo_id": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in RepoPermissionsRequest as +// a slice of RepoAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *RepoPermissionsRequest) GetAccessControlList(ctx context.Context) ([]RepoAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []RepoAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in RepoPermissionsRequest. +func (o *RepoPermissionsRequest) SetAccessControlList(ctx context.Context, v []RepoAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type SecretMetadata struct { // A unique name to identify the secret. Key types.String `tfsdk:"key" tf:"optional"` @@ -940,11 +3518,44 @@ func (newState *SecretMetadata) SyncEffectiveFieldsDuringCreateOrUpdate(plan Sec func (newState *SecretMetadata) SyncEffectiveFieldsDuringRead(existingState SecretMetadata) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SecretMetadata. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SecretMetadata) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SecretMetadata +// only implements ToObjectValue() and Type(). +func (o SecretMetadata) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "key": o.Key, + "last_updated_timestamp": o.LastUpdatedTimestamp, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SecretMetadata) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "last_updated_timestamp": types.Int64Type, + }, + } +} + type SecretScope struct { // The type of secret scope backend. BackendType types.String `tfsdk:"backend_type" tf:"optional"` // The metadata for the secret scope if the type is `AZURE_KEYVAULT` - KeyvaultMetadata []AzureKeyVaultSecretScopeMetadata `tfsdk:"keyvault_metadata" tf:"optional,object"` + KeyvaultMetadata types.List `tfsdk:"keyvault_metadata" tf:"optional,object"` // A unique name to identify the secret scope. Name types.String `tfsdk:"name" tf:"optional"` } @@ -955,13 +3566,78 @@ func (newState *SecretScope) SyncEffectiveFieldsDuringCreateOrUpdate(plan Secret func (newState *SecretScope) SyncEffectiveFieldsDuringRead(existingState SecretScope) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SecretScope. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SecretScope) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "keyvault_metadata": reflect.TypeOf(AzureKeyVaultSecretScopeMetadata{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SecretScope +// only implements ToObjectValue() and Type(). +func (o SecretScope) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "backend_type": o.BackendType, + "keyvault_metadata": o.KeyvaultMetadata, + "name": o.Name, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SecretScope) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "backend_type": types.StringType, + "keyvault_metadata": basetypes.ListType{ + ElemType: AzureKeyVaultSecretScopeMetadata{}.Type(ctx), + }, + "name": types.StringType, + }, + } +} + +// GetKeyvaultMetadata returns the value of the KeyvaultMetadata field in SecretScope as +// a AzureKeyVaultSecretScopeMetadata value. +// If the field is unknown or null, the boolean return value is false. +func (o *SecretScope) GetKeyvaultMetadata(ctx context.Context) (AzureKeyVaultSecretScopeMetadata, bool) { + var e AzureKeyVaultSecretScopeMetadata + if o.KeyvaultMetadata.IsNull() || o.KeyvaultMetadata.IsUnknown() { + return e, false + } + var v []AzureKeyVaultSecretScopeMetadata + d := o.KeyvaultMetadata.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetKeyvaultMetadata sets the value of the KeyvaultMetadata field in SecretScope. +func (o *SecretScope) SetKeyvaultMetadata(ctx context.Context, v AzureKeyVaultSecretScopeMetadata) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["keyvault_metadata"] + o.KeyvaultMetadata = types.ListValueMust(t, vs) +} + // Sparse checkout configuration, it contains options like cone patterns. type SparseCheckout struct { // List of sparse checkout cone patterns, see [cone mode handling] for // details. // // [cone mode handling]: https://git-scm.com/docs/git-sparse-checkout#_internalscone_mode_handling - Patterns []types.String `tfsdk:"patterns" tf:"optional"` + Patterns types.List `tfsdk:"patterns" tf:"optional"` } func (newState *SparseCheckout) SyncEffectiveFieldsDuringCreateOrUpdate(plan SparseCheckout) { @@ -970,13 +3646,74 @@ func (newState *SparseCheckout) SyncEffectiveFieldsDuringCreateOrUpdate(plan Spa func (newState *SparseCheckout) SyncEffectiveFieldsDuringRead(existingState SparseCheckout) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparseCheckout. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparseCheckout) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "patterns": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparseCheckout +// only implements ToObjectValue() and Type(). +func (o SparseCheckout) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "patterns": o.Patterns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparseCheckout) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "patterns": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPatterns returns the value of the Patterns field in SparseCheckout as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SparseCheckout) GetPatterns(ctx context.Context) ([]types.String, bool) { + if o.Patterns.IsNull() || o.Patterns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Patterns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPatterns sets the value of the Patterns field in SparseCheckout. +func (o *SparseCheckout) SetPatterns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["patterns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Patterns = types.ListValueMust(t, vs) +} + // Sparse checkout configuration, it contains options like cone patterns. type SparseCheckoutUpdate struct { // List of sparse checkout cone patterns, see [cone mode handling] for // details. // // [cone mode handling]: https://git-scm.com/docs/git-sparse-checkout#_internalscone_mode_handling - Patterns []types.String `tfsdk:"patterns" tf:"optional"` + Patterns types.List `tfsdk:"patterns" tf:"optional"` } func (newState *SparseCheckoutUpdate) SyncEffectiveFieldsDuringCreateOrUpdate(plan SparseCheckoutUpdate) { @@ -985,6 +3722,67 @@ func (newState *SparseCheckoutUpdate) SyncEffectiveFieldsDuringCreateOrUpdate(pl func (newState *SparseCheckoutUpdate) SyncEffectiveFieldsDuringRead(existingState SparseCheckoutUpdate) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in SparseCheckoutUpdate. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a SparseCheckoutUpdate) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "patterns": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, SparseCheckoutUpdate +// only implements ToObjectValue() and Type(). +func (o SparseCheckoutUpdate) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "patterns": o.Patterns, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o SparseCheckoutUpdate) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "patterns": basetypes.ListType{ + ElemType: types.StringType, + }, + }, + } +} + +// GetPatterns returns the value of the Patterns field in SparseCheckoutUpdate as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *SparseCheckoutUpdate) GetPatterns(ctx context.Context) ([]types.String, bool) { + if o.Patterns.IsNull() || o.Patterns.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Patterns.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPatterns sets the value of the Patterns field in SparseCheckoutUpdate. +func (o *SparseCheckoutUpdate) SetPatterns(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["patterns"] + t = t.(attr.TypeWithElementType).ElementType() + o.Patterns = types.ListValueMust(t, vs) +} + type UpdateCredentialsRequest struct { // The ID for the corresponding credential to access. CredentialId types.Int64 `tfsdk:"-"` @@ -1015,6 +3813,43 @@ func (newState *UpdateCredentialsRequest) SyncEffectiveFieldsDuringCreateOrUpdat func (newState *UpdateCredentialsRequest) SyncEffectiveFieldsDuringRead(existingState UpdateCredentialsRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCredentialsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCredentialsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCredentialsRequest +// only implements ToObjectValue() and Type(). +func (o UpdateCredentialsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "credential_id": o.CredentialId, + "git_provider": o.GitProvider, + "git_username": o.GitUsername, + "personal_access_token": o.PersonalAccessToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCredentialsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "credential_id": types.Int64Type, + "git_provider": types.StringType, + "git_username": types.StringType, + "personal_access_token": types.StringType, + }, + } +} + type UpdateCredentialsResponse struct { } @@ -1024,6 +3859,33 @@ func (newState *UpdateCredentialsResponse) SyncEffectiveFieldsDuringCreateOrUpda func (newState *UpdateCredentialsResponse) SyncEffectiveFieldsDuringRead(existingState UpdateCredentialsResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateCredentialsResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateCredentialsResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateCredentialsResponse +// only implements ToObjectValue() and Type(). +func (o UpdateCredentialsResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateCredentialsResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type UpdateRepoRequest struct { // Branch that the local version of the repo is checked out to. Branch types.String `tfsdk:"branch" tf:"optional"` @@ -1031,7 +3893,7 @@ type UpdateRepoRequest struct { RepoId types.Int64 `tfsdk:"-"` // If specified, update the sparse checkout settings. The update will fail // if sparse checkout is not enabled for the repo. - SparseCheckout []SparseCheckoutUpdate `tfsdk:"sparse_checkout" tf:"optional,object"` + SparseCheckout types.List `tfsdk:"sparse_checkout" tf:"optional,object"` // Tag that the local version of the repo is checked out to. Updating the // repo to a tag puts the repo in a detached HEAD state. Before committing // new changes, you must update the repo to a branch instead of the detached @@ -1045,6 +3907,73 @@ func (newState *UpdateRepoRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateRepoRequest) SyncEffectiveFieldsDuringRead(existingState UpdateRepoRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRepoRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRepoRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "sparse_checkout": reflect.TypeOf(SparseCheckoutUpdate{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRepoRequest +// only implements ToObjectValue() and Type(). +func (o UpdateRepoRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "branch": o.Branch, + "repo_id": o.RepoId, + "sparse_checkout": o.SparseCheckout, + "tag": o.Tag, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRepoRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "branch": types.StringType, + "repo_id": types.Int64Type, + "sparse_checkout": basetypes.ListType{ + ElemType: SparseCheckoutUpdate{}.Type(ctx), + }, + "tag": types.StringType, + }, + } +} + +// GetSparseCheckout returns the value of the SparseCheckout field in UpdateRepoRequest as +// a SparseCheckoutUpdate value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateRepoRequest) GetSparseCheckout(ctx context.Context) (SparseCheckoutUpdate, bool) { + var e SparseCheckoutUpdate + if o.SparseCheckout.IsNull() || o.SparseCheckout.IsUnknown() { + return e, false + } + var v []SparseCheckoutUpdate + d := o.SparseCheckout.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetSparseCheckout sets the value of the SparseCheckout field in UpdateRepoRequest. +func (o *UpdateRepoRequest) SetSparseCheckout(ctx context.Context, v SparseCheckoutUpdate) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["sparse_checkout"] + o.SparseCheckout = types.ListValueMust(t, vs) +} + type UpdateRepoResponse struct { } @@ -1054,6 +3983,33 @@ func (newState *UpdateRepoResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan func (newState *UpdateRepoResponse) SyncEffectiveFieldsDuringRead(existingState UpdateRepoResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateRepoResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateRepoResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateRepoResponse +// only implements ToObjectValue() and Type(). +func (o UpdateRepoResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{}) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateRepoResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{}, + } +} + type WorkspaceObjectAccessControlRequest struct { // name of the group GroupName types.String `tfsdk:"group_name" tf:"optional"` @@ -1071,9 +4027,46 @@ func (newState *WorkspaceObjectAccessControlRequest) SyncEffectiveFieldsDuringCr func (newState *WorkspaceObjectAccessControlRequest) SyncEffectiveFieldsDuringRead(existingState WorkspaceObjectAccessControlRequest) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceObjectAccessControlRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceObjectAccessControlRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceObjectAccessControlRequest +// only implements ToObjectValue() and Type(). +func (o WorkspaceObjectAccessControlRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "group_name": o.GroupName, + "permission_level": o.PermissionLevel, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceObjectAccessControlRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "group_name": types.StringType, + "permission_level": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + type WorkspaceObjectAccessControlResponse struct { // All permissions. - AllPermissions []WorkspaceObjectPermission `tfsdk:"all_permissions" tf:"optional"` + AllPermissions types.List `tfsdk:"all_permissions" tf:"optional"` // Display name of the user or service principal. DisplayName types.String `tfsdk:"display_name" tf:"optional"` // name of the group @@ -1090,10 +4083,79 @@ func (newState *WorkspaceObjectAccessControlResponse) SyncEffectiveFieldsDuringC func (newState *WorkspaceObjectAccessControlResponse) SyncEffectiveFieldsDuringRead(existingState WorkspaceObjectAccessControlResponse) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceObjectAccessControlResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceObjectAccessControlResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "all_permissions": reflect.TypeOf(WorkspaceObjectPermission{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceObjectAccessControlResponse +// only implements ToObjectValue() and Type(). +func (o WorkspaceObjectAccessControlResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "all_permissions": o.AllPermissions, + "display_name": o.DisplayName, + "group_name": o.GroupName, + "service_principal_name": o.ServicePrincipalName, + "user_name": o.UserName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceObjectAccessControlResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "all_permissions": basetypes.ListType{ + ElemType: WorkspaceObjectPermission{}.Type(ctx), + }, + "display_name": types.StringType, + "group_name": types.StringType, + "service_principal_name": types.StringType, + "user_name": types.StringType, + }, + } +} + +// GetAllPermissions returns the value of the AllPermissions field in WorkspaceObjectAccessControlResponse as +// a slice of WorkspaceObjectPermission values. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkspaceObjectAccessControlResponse) GetAllPermissions(ctx context.Context) ([]WorkspaceObjectPermission, bool) { + if o.AllPermissions.IsNull() || o.AllPermissions.IsUnknown() { + return nil, false + } + var v []WorkspaceObjectPermission + d := o.AllPermissions.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAllPermissions sets the value of the AllPermissions field in WorkspaceObjectAccessControlResponse. +func (o *WorkspaceObjectAccessControlResponse) SetAllPermissions(ctx context.Context, v []WorkspaceObjectPermission) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["all_permissions"] + t = t.(attr.TypeWithElementType).ElementType() + o.AllPermissions = types.ListValueMust(t, vs) +} + type WorkspaceObjectPermission struct { Inherited types.Bool `tfsdk:"inherited" tf:"optional"` - InheritedFromObject []types.String `tfsdk:"inherited_from_object" tf:"optional"` + InheritedFromObject types.List `tfsdk:"inherited_from_object" tf:"optional"` // Permission level PermissionLevel types.String `tfsdk:"permission_level" tf:"optional"` } @@ -1104,8 +4166,73 @@ func (newState *WorkspaceObjectPermission) SyncEffectiveFieldsDuringCreateOrUpda func (newState *WorkspaceObjectPermission) SyncEffectiveFieldsDuringRead(existingState WorkspaceObjectPermission) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceObjectPermission. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceObjectPermission) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "inherited_from_object": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceObjectPermission +// only implements ToObjectValue() and Type(). +func (o WorkspaceObjectPermission) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "inherited": o.Inherited, + "inherited_from_object": o.InheritedFromObject, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceObjectPermission) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "inherited": types.BoolType, + "inherited_from_object": basetypes.ListType{ + ElemType: types.StringType, + }, + "permission_level": types.StringType, + }, + } +} + +// GetInheritedFromObject returns the value of the InheritedFromObject field in WorkspaceObjectPermission as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkspaceObjectPermission) GetInheritedFromObject(ctx context.Context) ([]types.String, bool) { + if o.InheritedFromObject.IsNull() || o.InheritedFromObject.IsUnknown() { + return nil, false + } + var v []types.String + d := o.InheritedFromObject.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetInheritedFromObject sets the value of the InheritedFromObject field in WorkspaceObjectPermission. +func (o *WorkspaceObjectPermission) SetInheritedFromObject(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["inherited_from_object"] + t = t.(attr.TypeWithElementType).ElementType() + o.InheritedFromObject = types.ListValueMust(t, vs) +} + type WorkspaceObjectPermissions struct { - AccessControlList []WorkspaceObjectAccessControlResponse `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` ObjectId types.String `tfsdk:"object_id" tf:"optional"` @@ -1118,6 +4245,71 @@ func (newState *WorkspaceObjectPermissions) SyncEffectiveFieldsDuringCreateOrUpd func (newState *WorkspaceObjectPermissions) SyncEffectiveFieldsDuringRead(existingState WorkspaceObjectPermissions) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceObjectPermissions. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceObjectPermissions) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(WorkspaceObjectAccessControlResponse{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceObjectPermissions +// only implements ToObjectValue() and Type(). +func (o WorkspaceObjectPermissions) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "object_id": o.ObjectId, + "object_type": o.ObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceObjectPermissions) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: WorkspaceObjectAccessControlResponse{}.Type(ctx), + }, + "object_id": types.StringType, + "object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in WorkspaceObjectPermissions as +// a slice of WorkspaceObjectAccessControlResponse values. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkspaceObjectPermissions) GetAccessControlList(ctx context.Context) ([]WorkspaceObjectAccessControlResponse, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []WorkspaceObjectAccessControlResponse + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in WorkspaceObjectPermissions. +func (o *WorkspaceObjectPermissions) SetAccessControlList(ctx context.Context, v []WorkspaceObjectAccessControlResponse) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +} + type WorkspaceObjectPermissionsDescription struct { Description types.String `tfsdk:"description" tf:"optional"` // Permission level @@ -1130,8 +4322,41 @@ func (newState *WorkspaceObjectPermissionsDescription) SyncEffectiveFieldsDuring func (newState *WorkspaceObjectPermissionsDescription) SyncEffectiveFieldsDuringRead(existingState WorkspaceObjectPermissionsDescription) { } +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceObjectPermissionsDescription. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceObjectPermissionsDescription) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceObjectPermissionsDescription +// only implements ToObjectValue() and Type(). +func (o WorkspaceObjectPermissionsDescription) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "description": o.Description, + "permission_level": o.PermissionLevel, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceObjectPermissionsDescription) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "description": types.StringType, + "permission_level": types.StringType, + }, + } +} + type WorkspaceObjectPermissionsRequest struct { - AccessControlList []WorkspaceObjectAccessControlRequest `tfsdk:"access_control_list" tf:"optional"` + AccessControlList types.List `tfsdk:"access_control_list" tf:"optional"` // The workspace object for which to get or manage permissions. WorkspaceObjectId types.String `tfsdk:"-"` // The workspace object type for which to get or manage permissions. @@ -1143,3 +4368,68 @@ func (newState *WorkspaceObjectPermissionsRequest) SyncEffectiveFieldsDuringCrea func (newState *WorkspaceObjectPermissionsRequest) SyncEffectiveFieldsDuringRead(existingState WorkspaceObjectPermissionsRequest) { } + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in WorkspaceObjectPermissionsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a WorkspaceObjectPermissionsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "access_control_list": reflect.TypeOf(WorkspaceObjectAccessControlRequest{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, WorkspaceObjectPermissionsRequest +// only implements ToObjectValue() and Type(). +func (o WorkspaceObjectPermissionsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "access_control_list": o.AccessControlList, + "workspace_object_id": o.WorkspaceObjectId, + "workspace_object_type": o.WorkspaceObjectType, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o WorkspaceObjectPermissionsRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "access_control_list": basetypes.ListType{ + ElemType: WorkspaceObjectAccessControlRequest{}.Type(ctx), + }, + "workspace_object_id": types.StringType, + "workspace_object_type": types.StringType, + }, + } +} + +// GetAccessControlList returns the value of the AccessControlList field in WorkspaceObjectPermissionsRequest as +// a slice of WorkspaceObjectAccessControlRequest values. +// If the field is unknown or null, the boolean return value is false. +func (o *WorkspaceObjectPermissionsRequest) GetAccessControlList(ctx context.Context) ([]WorkspaceObjectAccessControlRequest, bool) { + if o.AccessControlList.IsNull() || o.AccessControlList.IsUnknown() { + return nil, false + } + var v []WorkspaceObjectAccessControlRequest + d := o.AccessControlList.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAccessControlList sets the value of the AccessControlList field in WorkspaceObjectPermissionsRequest. +func (o *WorkspaceObjectPermissionsRequest) SetAccessControlList(ctx context.Context, v []WorkspaceObjectAccessControlRequest) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["access_control_list"] + t = t.(attr.TypeWithElementType).ElementType() + o.AccessControlList = types.ListValueMust(t, vs) +}