diff --git a/apstra/blueprint/blueprint.go b/apstra/blueprint/blueprint.go index 94fbf010..c5db0b80 100644 --- a/apstra/blueprint/blueprint.go +++ b/apstra/blueprint/blueprint.go @@ -25,7 +25,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "golang.org/x/exp/constraints" ) type Blueprint struct { @@ -748,11 +747,11 @@ func (o *Blueprint) LoadFabricSettings(ctx context.Context, settings *apstra.Fab } } - o.DefaultIpLinksToGenericMtu = int64AttrValueFromPtr(settings.ExternalRouterMtu) - o.DefaultSviL3Mtu = int64AttrValueFromPtr(settings.DefaultSviL3Mtu) - o.EsiMacMsb = int64AttrValueFromPtr(settings.EsiMacMsb) + o.DefaultIpLinksToGenericMtu = utils.Int64AttrValueFromPtr(settings.ExternalRouterMtu) + o.DefaultSviL3Mtu = utils.Int64AttrValueFromPtr(settings.DefaultSviL3Mtu) + o.EsiMacMsb = utils.Int64AttrValueFromPtr(settings.EsiMacMsb) o.EvpnType5Routes = boolAttrValueFromFeatureswitchEnumPtr(settings.EvpnGenerateType5HostRoutes) - o.FabricMtu = int64AttrValueFromPtr(settings.FabricL3Mtu) + o.FabricMtu = utils.Int64AttrValueFromPtr(settings.FabricL3Mtu) o.Ipv6Applications = boolAttrValueFromBoolPtr(settings.Ipv6Enabled) o.JunosEvpnMaxNexthopAndInterfaceNumber = boolAttrValueFromFeatureswitchEnumPtr(settings.JunosEvpnMaxNexthopAndInterfaceNumber) o.JunosEvpnRoutingInstanceModeMacVrf = boolAttrValueFromFeatureswitchEnumPtr(settings.JunosEvpnRoutingInstanceVlanAware) @@ -968,11 +967,3 @@ func boolAttrValueFromFeatureswitchEnumPtr(fs *apstra.FeatureSwitchEnum) types.B return types.BoolValue(fs.Value == apstra.FeatureSwitchEnumEnabled.Value) } - -func int64AttrValueFromPtr[A constraints.Integer](a *A) types.Int64 { - if a == nil { - return types.Int64Null() - } - - return types.Int64Value(int64(*a)) -} diff --git a/apstra/data_source_freeform_allocation_group.go b/apstra/data_source_freeform_allocation_group.go index 35d87ddb..241f7816 100644 --- a/apstra/data_source_freeform_allocation_group.go +++ b/apstra/data_source_freeform_allocation_group.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformAllocGroup) Schema(_ context.Context, _ datasource.Sc resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a Freeform Allocation Group.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformAllocGroup{}.DataSourceAttributes(), + Attributes: freeform.FreeformAllocGroup{}.DataSourceAttributes(), } } func (o *dataSourceFreeformAllocGroup) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformAllocGroup + var config freeform.FreeformAllocGroup resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_config_template.go b/apstra/data_source_freeform_config_template.go index 8be3437c..eed984dd 100644 --- a/apstra/data_source_freeform_config_template.go +++ b/apstra/data_source_freeform_config_template.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformConfigTemplate) Schema(_ context.Context, _ datasourc resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Config Template.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformConfigTemplate{}.DataSourceAttributes(), + Attributes: freeform.FreeformConfigTemplate{}.DataSourceAttributes(), } } func (o *dataSourceFreeformConfigTemplate) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformConfigTemplate + var config freeform.FreeformConfigTemplate resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_link.go b/apstra/data_source_freeform_link.go index 7a232b4c..9cae8508 100644 --- a/apstra/data_source_freeform_link.go +++ b/apstra/data_source_freeform_link.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformLink) Schema(_ context.Context, _ datasource.SchemaRe resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Link.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformLink{}.DataSourceAttributes(), + Attributes: freeform.FreeformLink{}.DataSourceAttributes(), } } func (o *dataSourceFreeformLink) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformLink + var config freeform.FreeformLink resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_property_set.go b/apstra/data_source_freeform_property_set.go index 36a2f55b..447820e0 100644 --- a/apstra/data_source_freeform_property_set.go +++ b/apstra/data_source_freeform_property_set.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformPropertySet) Schema(_ context.Context, _ datasource.S resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Property Set.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformPropertySet{}.DataSourceAttributes(), + Attributes: freeform.FreeformPropertySet{}.DataSourceAttributes(), } } func (o *dataSourceFreeformPropertySet) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformPropertySet + var config freeform.FreeformPropertySet resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_resource.go b/apstra/data_source_freeform_resource.go index ae9cd764..31899dad 100644 --- a/apstra/data_source_freeform_resource.go +++ b/apstra/data_source_freeform_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformResource) Schema(_ context.Context, _ datasource.Sche resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Resource.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformResource{}.DataSourceAttributes(), + Attributes: freeform.FreeformResource{}.DataSourceAttributes(), } } func (o *dataSourceFreeformResource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformResource + var config freeform.FreeformResource resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_resource_generator.go b/apstra/data_source_freeform_resource_generator.go index 9932a11f..282e5f4e 100644 --- a/apstra/data_source_freeform_resource_generator.go +++ b/apstra/data_source_freeform_resource_generator.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformResourceGenerator) Schema(_ context.Context, _ dataso resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Resource Generator.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformResourceGenerator{}.DataSourceAttributes(), + Attributes: freeform.FreeformResourceGenerator{}.DataSourceAttributes(), } } func (o *dataSourceFreeformResourceGenerator) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformResourceGenerator + var config freeform.FreeformResourceGenerator resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_resource_group.go b/apstra/data_source_freeform_resource_group.go index 563725ae..b2024df3 100644 --- a/apstra/data_source_freeform_resource_group.go +++ b/apstra/data_source_freeform_resource_group.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformResourceGroup) Schema(_ context.Context, _ datasource resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Resource Group.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformResourceGroup{}.DataSourceAttributes(), + Attributes: freeform.FreeformResourceGroup{}.DataSourceAttributes(), } } func (o *dataSourceFreeformResourceGroup) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformResourceGroup + var config freeform.FreeformResourceGroup resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_system.go b/apstra/data_source_freeform_system.go index 3d7dd4fe..2b875d51 100644 --- a/apstra/data_source_freeform_system.go +++ b/apstra/data_source_freeform_system.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -34,12 +34,12 @@ func (o *dataSourceFreeformSystem) Schema(_ context.Context, _ datasource.Schema resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform System.\n\n" + "At least one optional attribute is required.", - Attributes: blueprint.FreeformSystem{}.DataSourceAttributes(), + Attributes: freeform.FreeformSystem{}.DataSourceAttributes(), } } func (o *dataSourceFreeformSystem) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var config blueprint.FreeformSystem + var config freeform.FreeformSystem resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/blueprint/freeform_allocation_group.go b/apstra/freeform/freeform_allocation_group.go similarity index 99% rename from apstra/blueprint/freeform_allocation_group.go rename to apstra/freeform/freeform_allocation_group.go index 53b3323b..b02009f2 100644 --- a/apstra/blueprint/freeform_allocation_group.go +++ b/apstra/freeform/freeform_allocation_group.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" diff --git a/apstra/blueprint/freeform_config_template.go b/apstra/freeform/freeform_config_template.go similarity index 99% rename from apstra/blueprint/freeform_config_template.go rename to apstra/freeform/freeform_config_template.go index 15d624b4..47c9e522 100644 --- a/apstra/blueprint/freeform_config_template.go +++ b/apstra/freeform/freeform_config_template.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" diff --git a/apstra/blueprint/freeform_endpoint.go b/apstra/freeform/freeform_endpoint.go similarity index 91% rename from apstra/blueprint/freeform_endpoint.go rename to apstra/freeform/freeform_endpoint.go index ce1ef655..5cdb67f0 100644 --- a/apstra/blueprint/freeform_endpoint.go +++ b/apstra/freeform/freeform_endpoint.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -type freeformEndpoint struct { +type FreeformEndpoint struct { InterfaceName types.String `tfsdk:"interface_name"` InterfaceId types.String `tfsdk:"interface_id"` TransformationId types.Int64 `tfsdk:"transformation_id"` @@ -29,7 +29,7 @@ type freeformEndpoint struct { Tags types.Set `tfsdk:"tags"` } -func (o freeformEndpoint) attrTypes() map[string]attr.Type { +func (o FreeformEndpoint) attrTypes() map[string]attr.Type { return map[string]attr.Type{ "interface_name": types.StringType, "interface_id": types.StringType, @@ -40,7 +40,7 @@ func (o freeformEndpoint) attrTypes() map[string]attr.Type { } } -func (o freeformEndpoint) DatasourceAttributes() map[string]dataSourceSchema.Attribute { +func (o FreeformEndpoint) DatasourceAttributes() map[string]dataSourceSchema.Attribute { return map[string]dataSourceSchema.Attribute{ "interface_name": dataSourceSchema.StringAttribute{ Computed: true, @@ -72,7 +72,7 @@ func (o freeformEndpoint) DatasourceAttributes() map[string]dataSourceSchema.Att } } -func (o freeformEndpoint) ResourceAttributes() map[string]resourceSchema.Attribute { +func (o FreeformEndpoint) ResourceAttributes() map[string]resourceSchema.Attribute { return map[string]resourceSchema.Attribute{ "interface_name": resourceSchema.StringAttribute{ Required: true, @@ -110,7 +110,7 @@ func (o freeformEndpoint) ResourceAttributes() map[string]resourceSchema.Attribu } } -func (o *freeformEndpoint) request(ctx context.Context, systemId string, diags *diag.Diagnostics) *apstra.FreeformEndpoint { +func (o *FreeformEndpoint) request(ctx context.Context, systemId string, diags *diag.Diagnostics) *apstra.FreeformEndpoint { var ipNet4, ipNet6 *net.IPNet if !o.Ipv4Address.IsNull() { var ip4 net.IP @@ -140,7 +140,7 @@ func (o *freeformEndpoint) request(ctx context.Context, systemId string, diags * } } -func (o *freeformEndpoint) loadApiData(ctx context.Context, in apstra.FreeformEndpoint, diags *diag.Diagnostics) { +func (o *FreeformEndpoint) loadApiData(ctx context.Context, in apstra.FreeformEndpoint, diags *diag.Diagnostics) { if in.Interface.Id == nil { diags.AddError( fmt.Sprintf("api returned nil interface Id for system %s", in.SystemId), @@ -164,15 +164,15 @@ func (o *freeformEndpoint) loadApiData(ctx context.Context, in apstra.FreeformEn } func newFreeformEndpointMap(ctx context.Context, in [2]apstra.FreeformEndpoint, diags *diag.Diagnostics) types.Map { - endpoints := make(map[string]freeformEndpoint, len(in)) + endpoints := make(map[string]FreeformEndpoint, len(in)) for i := range in { - var endpoint freeformEndpoint + var endpoint FreeformEndpoint endpoint.loadApiData(ctx, in[i], diags) endpoints[in[i].SystemId.String()] = endpoint } if diags.HasError() { - return types.MapNull(types.ObjectType{AttrTypes: freeformEndpoint{}.attrTypes()}) + return types.MapNull(types.ObjectType{AttrTypes: FreeformEndpoint{}.attrTypes()}) } - return utils.MapValueOrNull(ctx, types.ObjectType{AttrTypes: freeformEndpoint{}.attrTypes()}, endpoints, diags) + return utils.MapValueOrNull(ctx, types.ObjectType{AttrTypes: FreeformEndpoint{}.attrTypes()}, endpoints, diags) } diff --git a/apstra/blueprint/freeform_link.go b/apstra/freeform/freeform_link.go similarity index 97% rename from apstra/blueprint/freeform_link.go rename to apstra/freeform/freeform_link.go index fd515451..c0bbfcc0 100644 --- a/apstra/blueprint/freeform_link.go +++ b/apstra/freeform/freeform_link.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" @@ -82,7 +82,7 @@ func (o FreeformLink) DataSourceAttributes() map[string]dataSourceSchema.Attribu MarkdownDescription: "Endpoints assigned to the Link", Computed: true, NestedObject: dataSourceSchema.NestedAttributeObject{ - Attributes: freeformEndpoint{}.DatasourceAttributes(), + Attributes: FreeformEndpoint{}.DatasourceAttributes(), }, }, "tags": dataSourceSchema.SetAttribute{ @@ -128,7 +128,7 @@ func (o FreeformLink) ResourceAttributes() map[string]resourceSchema.Attribute { }, "endpoints": resourceSchema.MapNestedAttribute{ NestedObject: resourceSchema.NestedAttributeObject{ - Attributes: freeformEndpoint{}.ResourceAttributes(), + Attributes: FreeformEndpoint{}.ResourceAttributes(), }, PlanModifiers: []planmodifier.Map{mapplanmodifier.RequiresReplace()}, MarkdownDescription: "Endpoints of the Link", @@ -154,7 +154,7 @@ func (o *FreeformLink) Request(ctx context.Context, diags *diag.Diagnostics) *ap return nil } - var endpoints map[string]freeformEndpoint + var endpoints map[string]FreeformEndpoint diags.Append(o.Endpoints.ElementsAs(ctx, &endpoints, false)...) if diags.HasError() { return nil diff --git a/apstra/blueprint/freeform_property_set.go b/apstra/freeform/freeform_property_set.go similarity index 99% rename from apstra/blueprint/freeform_property_set.go rename to apstra/freeform/freeform_property_set.go index 88085be1..8458b659 100644 --- a/apstra/blueprint/freeform_property_set.go +++ b/apstra/freeform/freeform_property_set.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" diff --git a/apstra/blueprint/freeform_resource.go b/apstra/freeform/freeform_resource.go similarity index 99% rename from apstra/blueprint/freeform_resource.go rename to apstra/freeform/freeform_resource.go index cf886bb9..039a3110 100644 --- a/apstra/blueprint/freeform_resource.go +++ b/apstra/freeform/freeform_resource.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" diff --git a/apstra/blueprint/freeform_resource_generator.go b/apstra/freeform/freeform_resource_generator.go similarity index 99% rename from apstra/blueprint/freeform_resource_generator.go rename to apstra/freeform/freeform_resource_generator.go index 6bfd3a30..55a4f3c4 100644 --- a/apstra/blueprint/freeform_resource_generator.go +++ b/apstra/freeform/freeform_resource_generator.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" @@ -197,5 +197,5 @@ func (o *FreeformResourceGenerator) LoadApiData(_ context.Context, in *apstra.Fr o.AllocatedFrom = types.StringPointerValue((*string)(in.AllocatedFrom)) } o.ContainerId = types.StringValue(string(in.ContainerId)) - o.SubnetPrefixLen = int64AttrValueFromPtr(in.SubnetPrefixLen) + o.SubnetPrefixLen = utils.Int64AttrValueFromPtr(in.SubnetPrefixLen) } diff --git a/apstra/blueprint/freeform_resource_group.go b/apstra/freeform/freeform_resource_group.go similarity index 99% rename from apstra/blueprint/freeform_resource_group.go rename to apstra/freeform/freeform_resource_group.go index 7c4403ed..2fd09b68 100644 --- a/apstra/blueprint/freeform_resource_group.go +++ b/apstra/freeform/freeform_resource_group.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" diff --git a/apstra/blueprint/freeform_system.go b/apstra/freeform/freeform_system.go similarity index 99% rename from apstra/blueprint/freeform_system.go rename to apstra/freeform/freeform_system.go index 7fa19a91..64aae985 100644 --- a/apstra/blueprint/freeform_system.go +++ b/apstra/freeform/freeform_system.go @@ -1,4 +1,4 @@ -package blueprint +package freeform import ( "context" diff --git a/apstra/resource_freeform_allocation_group.go b/apstra/resource_freeform_allocation_group.go index 20a3106b..21d7467d 100644 --- a/apstra/resource_freeform_allocation_group.go +++ b/apstra/resource_freeform_allocation_group.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -34,13 +34,13 @@ func (o *resourceFreeformAllocGroup) Configure(ctx context.Context, req resource func (o *resourceFreeformAllocGroup) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates an Allocation Group in a Freeform Blueprint.", - Attributes: blueprint.FreeformAllocGroup{}.ResourceAttributes(), + Attributes: freeform.FreeformAllocGroup{}.ResourceAttributes(), } } func (o *resourceFreeformAllocGroup) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformAllocGroup + var plan freeform.FreeformAllocGroup resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -85,7 +85,7 @@ func (o *resourceFreeformAllocGroup) Create(ctx context.Context, req resource.Cr } func (o *resourceFreeformAllocGroup) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformAllocGroup + var state freeform.FreeformAllocGroup resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -123,7 +123,7 @@ func (o *resourceFreeformAllocGroup) Read(ctx context.Context, req resource.Read func (o *resourceFreeformAllocGroup) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformAllocGroup + var plan freeform.FreeformAllocGroup resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -166,7 +166,7 @@ func (o *resourceFreeformAllocGroup) Update(ctx context.Context, req resource.Up } func (o *resourceFreeformAllocGroup) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformAllocGroup + var state freeform.FreeformAllocGroup resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_config_template.go b/apstra/resource_freeform_config_template.go index fede0cee..02cf1984 100644 --- a/apstra/resource_freeform_config_template.go +++ b/apstra/resource_freeform_config_template.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -34,13 +34,13 @@ func (o *resourceFreeformConfigTemplate) Configure(ctx context.Context, req reso func (o *resourceFreeformConfigTemplate) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a Config Template in a Freeform Blueprint.", - Attributes: blueprint.FreeformConfigTemplate{}.ResourceAttributes(), + Attributes: freeform.FreeformConfigTemplate{}.ResourceAttributes(), } } func (o *resourceFreeformConfigTemplate) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformConfigTemplate + var plan freeform.FreeformConfigTemplate resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -85,7 +85,7 @@ func (o *resourceFreeformConfigTemplate) Create(ctx context.Context, req resourc } func (o *resourceFreeformConfigTemplate) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformConfigTemplate + var state freeform.FreeformConfigTemplate resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -123,7 +123,7 @@ func (o *resourceFreeformConfigTemplate) Read(ctx context.Context, req resource. func (o *resourceFreeformConfigTemplate) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformConfigTemplate + var plan freeform.FreeformConfigTemplate resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -165,7 +165,7 @@ func (o *resourceFreeformConfigTemplate) Update(ctx context.Context, req resourc } func (o *resourceFreeformConfigTemplate) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformConfigTemplate + var state freeform.FreeformConfigTemplate resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_link.go b/apstra/resource_freeform_link.go index 5f27081c..53be48cd 100644 --- a/apstra/resource_freeform_link.go +++ b/apstra/resource_freeform_link.go @@ -3,8 +3,9 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -33,13 +34,13 @@ func (o *resourceFreeformLink) Configure(ctx context.Context, req resource.Confi func (o *resourceFreeformLink) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a Link in a Freeform Blueprint.", - Attributes: blueprint.FreeformLink{}.ResourceAttributes(), + Attributes: freeform.FreeformLink{}.ResourceAttributes(), } } func (o *resourceFreeformLink) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformLink + var plan freeform.FreeformLink resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -92,7 +93,7 @@ func (o *resourceFreeformLink) Create(ctx context.Context, req resource.CreateRe } func (o *resourceFreeformLink) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformLink + var state freeform.FreeformLink resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -130,7 +131,7 @@ func (o *resourceFreeformLink) Read(ctx context.Context, req resource.ReadReques func (o *resourceFreeformLink) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformLink + var plan freeform.FreeformLink resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -173,7 +174,7 @@ func (o *resourceFreeformLink) Update(ctx context.Context, req resource.UpdateRe } func (o *resourceFreeformLink) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformLink + var state freeform.FreeformLink resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_property_set.go b/apstra/resource_freeform_property_set.go index c4f30501..bd4cc469 100644 --- a/apstra/resource_freeform_property_set.go +++ b/apstra/resource_freeform_property_set.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -34,13 +34,13 @@ func (o *resourceFreeformPropertySet) Configure(ctx context.Context, req resourc func (o *resourceFreeformPropertySet) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a Property Set in a Freeform Blueprint.", - Attributes: blueprint.FreeformPropertySet{}.ResourceAttributes(), + Attributes: freeform.FreeformPropertySet{}.ResourceAttributes(), } } func (o *resourceFreeformPropertySet) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformPropertySet + var plan freeform.FreeformPropertySet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -85,7 +85,7 @@ func (o *resourceFreeformPropertySet) Create(ctx context.Context, req resource.C } func (o *resourceFreeformPropertySet) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformPropertySet + var state freeform.FreeformPropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -123,7 +123,7 @@ func (o *resourceFreeformPropertySet) Read(ctx context.Context, req resource.Rea func (o *resourceFreeformPropertySet) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformPropertySet + var plan freeform.FreeformPropertySet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -166,7 +166,7 @@ func (o *resourceFreeformPropertySet) Update(ctx context.Context, req resource.U } func (o *resourceFreeformPropertySet) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformPropertySet + var state freeform.FreeformPropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_resource.go b/apstra/resource_freeform_resource.go index f1a05a1f..246c328a 100644 --- a/apstra/resource_freeform_resource.go +++ b/apstra/resource_freeform_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -36,13 +36,13 @@ func (o *resourceFreeformResource) Configure(ctx context.Context, req resource.C func (o *resourceFreeformResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a Resource in a Freeform Blueprint.", - Attributes: blueprint.FreeformResource{}.ResourceAttributes(), + Attributes: freeform.FreeformResource{}.ResourceAttributes(), } } func (o *resourceFreeformResource) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { // Retrieve values from config - var config blueprint.FreeformResource + var config freeform.FreeformResource resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return @@ -123,7 +123,7 @@ func (o *resourceFreeformResource) ValidateConfig(ctx context.Context, req resou func (o *resourceFreeformResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformResource + var plan freeform.FreeformResource resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -181,7 +181,7 @@ func (o *resourceFreeformResource) Create(ctx context.Context, req resource.Crea } func (o *resourceFreeformResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformResource + var state freeform.FreeformResource resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -219,7 +219,7 @@ func (o *resourceFreeformResource) Read(ctx context.Context, req resource.ReadRe func (o *resourceFreeformResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformResource + var plan freeform.FreeformResource resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -272,7 +272,7 @@ func (o *resourceFreeformResource) Update(ctx context.Context, req resource.Upda } func (o *resourceFreeformResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformResource + var state freeform.FreeformResource resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_resource_generator.go b/apstra/resource_freeform_resource_generator.go index 54764c7b..a624dbcf 100644 --- a/apstra/resource_freeform_resource_generator.go +++ b/apstra/resource_freeform_resource_generator.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -36,13 +36,13 @@ func (o *resourceFreeformResourceGenerator) Configure(ctx context.Context, req r func (o *resourceFreeformResourceGenerator) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a Resource Generator in a Freeform Blueprint.", - Attributes: blueprint.FreeformResourceGenerator{}.ResourceAttributes(), + Attributes: freeform.FreeformResourceGenerator{}.ResourceAttributes(), } } func (o *resourceFreeformResourceGenerator) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { // Retrieve values from config - var config blueprint.FreeformResourceGenerator + var config freeform.FreeformResourceGenerator resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { return @@ -70,7 +70,7 @@ func (o *resourceFreeformResourceGenerator) ValidateConfig(ctx context.Context, func (o *resourceFreeformResourceGenerator) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformResourceGenerator + var plan freeform.FreeformResourceGenerator resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -116,7 +116,7 @@ func (o *resourceFreeformResourceGenerator) Create(ctx context.Context, req reso } func (o *resourceFreeformResourceGenerator) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformResourceGenerator + var state freeform.FreeformResourceGenerator resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -154,7 +154,7 @@ func (o *resourceFreeformResourceGenerator) Read(ctx context.Context, req resour func (o *resourceFreeformResourceGenerator) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformResourceGenerator + var plan freeform.FreeformResourceGenerator resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -198,7 +198,7 @@ func (o *resourceFreeformResourceGenerator) Update(ctx context.Context, req reso } func (o *resourceFreeformResourceGenerator) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformResourceGenerator + var state freeform.FreeformResourceGenerator resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_resource_group.go b/apstra/resource_freeform_resource_group.go index 6ce53bb9..e18aa22e 100644 --- a/apstra/resource_freeform_resource_group.go +++ b/apstra/resource_freeform_resource_group.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -34,13 +34,13 @@ func (o *resourceFreeformResourceGroup) Configure(ctx context.Context, req resou func (o *resourceFreeformResourceGroup) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a Resource Group in a Freeform Blueprint.", - Attributes: blueprint.FreeformResourceGroup{}.ResourceAttributes(), + Attributes: freeform.FreeformResourceGroup{}.ResourceAttributes(), } } func (o *resourceFreeformResourceGroup) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformResourceGroup + var plan freeform.FreeformResourceGroup resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -88,7 +88,7 @@ func (o *resourceFreeformResourceGroup) Create(ctx context.Context, req resource } func (o *resourceFreeformResourceGroup) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformResourceGroup + var state freeform.FreeformResourceGroup resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -128,7 +128,7 @@ func (o *resourceFreeformResourceGroup) Read(ctx context.Context, req resource.R func (o *resourceFreeformResourceGroup) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformResourceGroup + var plan freeform.FreeformResourceGroup resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -175,7 +175,7 @@ func (o *resourceFreeformResourceGroup) Update(ctx context.Context, req resource } func (o *resourceFreeformResourceGroup) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformResourceGroup + var state freeform.FreeformResourceGroup resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/resource_freeform_system.go b/apstra/resource_freeform_system.go index 7b255471..c6fe449b 100644 --- a/apstra/resource_freeform_system.go +++ b/apstra/resource_freeform_system.go @@ -3,8 +3,9 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" - "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" + "github.com/Juniper/terraform-provider-apstra/apstra/freeform" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -33,13 +34,13 @@ func (o *resourceFreeformSystem) Configure(ctx context.Context, req resource.Con func (o *resourceFreeformSystem) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryFreeform + "This resource creates a System in a Freeform Blueprint.", - Attributes: blueprint.FreeformSystem{}.ResourceAttributes(), + Attributes: freeform.FreeformSystem{}.ResourceAttributes(), } } func (o *resourceFreeformSystem) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // Retrieve values from plan - var plan blueprint.FreeformSystem + var plan freeform.FreeformSystem resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -84,7 +85,7 @@ func (o *resourceFreeformSystem) Create(ctx context.Context, req resource.Create } func (o *resourceFreeformSystem) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - var state blueprint.FreeformSystem + var state freeform.FreeformSystem resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return @@ -122,7 +123,7 @@ func (o *resourceFreeformSystem) Read(ctx context.Context, req resource.ReadRequ func (o *resourceFreeformSystem) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values - var plan blueprint.FreeformSystem + var plan freeform.FreeformSystem resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { return @@ -165,7 +166,7 @@ func (o *resourceFreeformSystem) Update(ctx context.Context, req resource.Update } func (o *resourceFreeformSystem) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - var state blueprint.FreeformSystem + var state freeform.FreeformSystem resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { return diff --git a/apstra/utils/terraform_plugin_framework_value_creation.go b/apstra/utils/terraform_plugin_framework_value_creation.go index 30ec230e..8c863636 100644 --- a/apstra/utils/terraform_plugin_framework_value_creation.go +++ b/apstra/utils/terraform_plugin_framework_value_creation.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" + "golang.org/x/exp/constraints" "reflect" ) @@ -146,3 +147,11 @@ func Int64ValueOrNull(_ context.Context, in any, diags *diag.Diagnostics) types. return types.Int64Null() } + +func Int64AttrValueFromPtr[A constraints.Integer](a *A) types.Int64 { + if a == nil { + return types.Int64Null() + } + + return types.Int64Value(int64(*a)) +}