From 0a56744731471a067329d25d6f74a6a674f50c05 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Thu, 5 Dec 2024 14:44:27 -0500 Subject: [PATCH] gofumpt --- ...ce_datacenter_ct_bgp_peering_generic_system.go | 8 +++++++- ...ource_datacenter_ct_bgp_peering_ip_endpoint.go | 6 ++++++ ...ta_source_datacenter_ct_custom_static_route.go | 8 +++++++- ...ta_source_datacenter_ct_dynamic_bgp_peering.go | 6 ++++++ apstra/data_source_datacenter_ct_ip_link.go | 5 +++++ .../data_source_datacenter_ct_routing_policy.go | 6 ++++++ ...ource_datacenter_ct_routing_zone_constraint.go | 6 ++++++ apstra/data_source_datacenter_ct_static_route.go | 6 ++++++ ...urce_datacenter_ct_virtual_network_multiple.go | 6 ++++++ ...source_datacenter_ct_virtual_network_single.go | 6 ++++++ .../resource_datacenter_connectivity_template.go | 15 +++++++++++---- 11 files changed, 72 insertions(+), 6 deletions(-) diff --git a/apstra/data_source_datacenter_ct_bgp_peering_generic_system.go b/apstra/data_source_datacenter_ct_bgp_peering_generic_system.go index 28ef77f4..2f9eb3dd 100644 --- a/apstra/data_source_datacenter_ct_bgp_peering_generic_system.go +++ b/apstra/data_source_datacenter_ct_bgp_peering_generic_system.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + "github.com/Juniper/apstra-go-sdk/apstra" connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -22,6 +23,11 @@ func (o *dataSourceDatacenterCtBgpPeeringGenericSystem) Schema(_ context.Context MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.BgpPeeringGenericSystem{}.DataSourceAttributes(), } } @@ -34,7 +40,7 @@ func (o *dataSourceDatacenterCtBgpPeeringGenericSystem) ValidateConfig(ctx conte } if config.Ipv4AddressingType.IsUnknown() || config.Ipv6AddressingType.IsUnknown() { - return //cannot validate until both values are known + return // cannot validate until both values are known } v4NoneString := apstra.CtPrimitiveIPv4ProtocolSessionAddressingNone.String() // "none" diff --git a/apstra/data_source_datacenter_ct_bgp_peering_ip_endpoint.go b/apstra/data_source_datacenter_ct_bgp_peering_ip_endpoint.go index c4d805a1..98ebe744 100644 --- a/apstra/data_source_datacenter_ct_bgp_peering_ip_endpoint.go +++ b/apstra/data_source_datacenter_ct_bgp_peering_ip_endpoint.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtBgpPeeringIpEndpoint) Schema(_ context.Context, _ MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.BgpPeeringIpEndpoint{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_custom_static_route.go b/apstra/data_source_datacenter_ct_custom_static_route.go index d3e17bf8..07d469fe 100644 --- a/apstra/data_source_datacenter_ct_custom_static_route.go +++ b/apstra/data_source_datacenter_ct_custom_static_route.go @@ -3,13 +3,14 @@ package tfapstra import ( "context" "fmt" + "net" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/types" - "net" ) var _ datasource.DataSourceWithValidateConfig = &dataSourceDatacenterCtCustomStaticRoute{} @@ -25,6 +26,11 @@ func (o *dataSourceDatacenterCtCustomStaticRoute) Schema(_ context.Context, _ da MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.CustomStaticRoute{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_dynamic_bgp_peering.go b/apstra/data_source_datacenter_ct_dynamic_bgp_peering.go index eacf9a8c..d1cb54cb 100644 --- a/apstra/data_source_datacenter_ct_dynamic_bgp_peering.go +++ b/apstra/data_source_datacenter_ct_dynamic_bgp_peering.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtDynamicBgpPeering) Schema(_ context.Context, _ da MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.DynamicBgpPeering{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_ip_link.go b/apstra/data_source_datacenter_ct_ip_link.go index f6381c5f..600d1e52 100644 --- a/apstra/data_source_datacenter_ct_ip_link.go +++ b/apstra/data_source_datacenter_ct_ip_link.go @@ -29,6 +29,11 @@ func (o *dataSourceDatacenterCtIpLink) Schema(_ context.Context, _ datasource.Sc MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.IpLink{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_routing_policy.go b/apstra/data_source_datacenter_ct_routing_policy.go index c1a81a18..4326eb25 100644 --- a/apstra/data_source_datacenter_ct_routing_policy.go +++ b/apstra/data_source_datacenter_ct_routing_policy.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtRoutingPolicy) Schema(_ context.Context, _ dataso MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.RoutingPolicy{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_routing_zone_constraint.go b/apstra/data_source_datacenter_ct_routing_zone_constraint.go index 8e3c0ed5..e14f9f37 100644 --- a/apstra/data_source_datacenter_ct_routing_zone_constraint.go +++ b/apstra/data_source_datacenter_ct_routing_zone_constraint.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtRoutingZoneConstraint) Schema(_ context.Context, MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.RoutingZoneConstraint{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_static_route.go b/apstra/data_source_datacenter_ct_static_route.go index 2c6fe603..0dabb8d3 100644 --- a/apstra/data_source_datacenter_ct_static_route.go +++ b/apstra/data_source_datacenter_ct_static_route.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtStaticRoute) Schema(_ context.Context, _ datasour MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.StaticRoute{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_virtual_network_multiple.go b/apstra/data_source_datacenter_ct_virtual_network_multiple.go index 6f84f16d..0bf40701 100644 --- a/apstra/data_source_datacenter_ct_virtual_network_multiple.go +++ b/apstra/data_source_datacenter_ct_virtual_network_multiple.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtVnMultiple) Schema(_ context.Context, _ datasourc MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.VnMultiple{}.DataSourceAttributes(), } } diff --git a/apstra/data_source_datacenter_ct_virtual_network_single.go b/apstra/data_source_datacenter_ct_virtual_network_single.go index 4c3ddc1a..6fb0a3c2 100644 --- a/apstra/data_source_datacenter_ct_virtual_network_single.go +++ b/apstra/data_source_datacenter_ct_virtual_network_single.go @@ -2,6 +2,7 @@ package tfapstra import ( "context" + connectivitytemplate "github.com/Juniper/terraform-provider-apstra/apstra/connectivity_template" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -21,6 +22,11 @@ func (o *dataSourceDatacenterCtVnSingle) Schema(_ context.Context, _ datasource. MarkdownDescription: docCategoryDatacenter + "This data source composes a Connectivity Template Primitive as a JSON string, " + "suitable for use in the `primitives` attribute of an `apstra_datacenter_connectivity_template` " + "resource or the `child_primitives` attribute of a Different Connectivity Template Primitive.", + DeprecationMessage: "This data source will be removed in a future version. Please migrate your use of the " + + "`apstra_datacenter_connectivity_template` resource (the likely reason this data source is being invoked) " + + "to one of the new resources which do not depend on this data source: " + + "`apstra_datacenter_connectivity_template_interface`, `apstra_datacenter_connectivity_template_loopback`, " + + "`apstra_datacenter_connectivity_template_svi`, or `apstra_datacenter_connectivity_template_system`.", Attributes: connectivitytemplate.VnSingle{}.DataSourceAttributes(), } } diff --git a/apstra/resource_datacenter_connectivity_template.go b/apstra/resource_datacenter_connectivity_template.go index dff1fa0d..e0254fc3 100644 --- a/apstra/resource_datacenter_connectivity_template.go +++ b/apstra/resource_datacenter_connectivity_template.go @@ -3,6 +3,7 @@ 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/utils" @@ -11,9 +12,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ resource.ResourceWithConfigure = &resourceDatacenterConnectivityTemplate{} -var _ resourceWithSetDcBpClientFunc = &resourceDatacenterConnectivityTemplate{} -var _ resourceWithSetBpLockFunc = &resourceDatacenterConnectivityTemplate{} +var ( + _ resource.ResourceWithConfigure = &resourceDatacenterConnectivityTemplate{} + _ resourceWithSetDcBpClientFunc = &resourceDatacenterConnectivityTemplate{} + _ resourceWithSetBpLockFunc = &resourceDatacenterConnectivityTemplate{} +) type resourceDatacenterConnectivityTemplate struct { getBpClientFunc func(context.Context, string) (*apstra.TwoStageL3ClosClient, error) @@ -31,7 +34,11 @@ func (o *resourceDatacenterConnectivityTemplate) Configure(ctx context.Context, func (o *resourceDatacenterConnectivityTemplate) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: docCategoryDatacenter + "This resource creates a Connectivity Template within a Datacenter Blueprint.", - Attributes: blueprint.ConnectivityTemplate{}.ResourceAttributes(), + DeprecationMessage: "This resource will be removed in a future version. Please migrate your configurations to use " + + "one of the new Connectivity Template resources: `apstra_datacenter_connectivity_template_interface`, " + + "`apstra_datacenter_connectivity_template_loopback`, `apstra_datacenter_connectivity_template_svi`, or " + + "`apstra_datacenter_connectivity_template_system`.", + Attributes: blueprint.ConnectivityTemplate{}.ResourceAttributes(), } }