From 046c3de9ee287095cd9a6feb0b47a0b19d69943d Mon Sep 17 00:00:00 2001 From: bwJuniper Date: Wed, 19 Jul 2023 19:30:49 +0200 Subject: [PATCH] Fix issue #140 --- apstra/constants.go | 5 --- apstra/data_source_agent.go | 5 --- apstra/data_source_agent_profile.go | 5 --- apstra/data_source_agent_profiles.go | 5 --- apstra/data_source_agents.go | 5 --- apstra/data_source_anomalies.go | 5 --- apstra/data_source_asn_pool.go | 5 --- apstra/data_source_asn_pools.go | 5 --- apstra/data_source_blueprint_deployment.go | 5 --- apstra/data_source_blueprints.go | 5 --- apstra/data_source_configlet.go | 5 --- apstra/data_source_configlets.go | 5 --- apstra/data_source_datacenter_blueprint.go | 5 --- apstra/data_source_datacenter_property_set.go | 5 --- .../data_source_datacenter_property_sets.go | 5 --- apstra/data_source_datacenter_routing_zone.go | 5 --- .../data_source_datacenter_routing_zones.go | 5 --- apstra/data_source_datacenter_system.go | 5 --- apstra/data_source_datacenter_systems.go | 5 --- ...ter_virtual_network_binding_constructor.go | 5 --- apstra/data_source_interface_map.go | 5 --- apstra/data_source_interface_maps.go | 5 --- apstra/data_source_ipv4_pool.go | 5 --- apstra/data_source_ipv4_pools.go | 5 --- apstra/data_source_ipv6_pool.go | 5 --- apstra/data_source_ipv6_pools.go | 5 --- apstra/data_source_logical_device.go | 5 --- apstra/data_source_property_set.go | 5 --- apstra/data_source_property_sets.go | 5 --- apstra/data_source_rack_type.go | 5 --- apstra/data_source_rack_types.go | 5 --- apstra/data_source_tag.go | 5 --- apstra/data_source_template_rack_based.go | 5 --- apstra/data_source_templates.go | 5 --- apstra/data_source_vni_pool.go | 5 --- apstra/data_source_vni_pools.go | 5 --- apstra/resource_agent_profile.go | 20 ----------- apstra/resource_asn_pool.go | 20 ----------- apstra/resource_blueprint_deployment.go | 20 ----------- apstra/resource_configlet.go | 19 ----------- apstra/resource_datacenter_blueprint.go | 20 ----------- .../resource_datacenter_device_allocation.go | 20 ----------- apstra/resource_datacenter_generic_system.go | 20 ----------- apstra/resource_datacenter_property_set.go | 20 ----------- ...rce_datacenter_resource_pool_allocation.go | 20 ----------- apstra/resource_datacenter_routing_policy.go | 20 ----------- apstra/resource_datacenter_routing_zone.go | 20 ----------- apstra/resource_datacenter_virtual_network.go | 20 ----------- apstra/resource_interface_map.go | 20 ----------- apstra/resource_ipv4_pool.go | 20 ----------- apstra/resource_ipv6_pool.go | 20 ----------- apstra/resource_logical_device.go | 20 ----------- apstra/resource_managed_device.go | 20 ----------- apstra/resource_managed_device_ack.go | 5 --- apstra/resource_property_set.go | 19 ----------- apstra/resource_rack_type.go | 20 ----------- apstra/resource_tag.go | 20 ----------- apstra/resource_template_rack_based.go | 20 ----------- apstra/resource_vni_pool.go | 20 ----------- test/output.tf | 34 ------------------- test/provider.tf | 13 ------- 61 files changed, 670 deletions(-) delete mode 100644 test/output.tf delete mode 100644 test/provider.tf diff --git a/apstra/constants.go b/apstra/constants.go index 8c1315b7..f50a950f 100644 --- a/apstra/constants.go +++ b/apstra/constants.go @@ -9,13 +9,8 @@ const ( errResourceConfigureProviderDataSummary = "Unexpected Resource Configure Type." errResourceConfigureProviderDataDetail = "Expected '%T', got: '%T'. Please report this issue to the provider maintainers." errDataSourceUnconfiguredSummary = "Data Source not configured" - errDatasourceUnconfiguredDetail = "Unconfigured data source encountered in Read() operation, possibly because it depends on an unknown value from another object. This leads to weird stuff happening, so we'd prefer if you didn't do that. Thanks!" errProviderInvalidConfig = "Provider configuration invalid" errResourceUnconfiguredSummary = "Resource not configured" - errResourceUnconfiguredCreateDetail = "Unconfigured resource encountered in Create() operation, possibly because it depends on an unknown value from another object. This leads to weird stuff happening, so we'd prefer if you didn't do that. Thanks!" - errResourceUnconfiguredReadDetail = "Unconfigured resource encountered in Read() operation, possibly because it depends on an unknown value from another object. This leads to weird stuff happening, so we'd prefer if you didn't do that. Thanks!" - errResourceUnconfiguredUpdateDetail = "Unconfigured resource encountered in Update() operation, possibly because it depends on an unknown value from another object. This leads to weird stuff happening, so we'd prefer if you didn't do that. Thanks!" - errResourceUnconfiguredDeleteDetail = "Unconfigured resource encountered in Delete() operation, possibly because it depends on an unknown value from another object. This leads to weird stuff happening, so we'd prefer if you didn't do that. Thanks!" errReadingAllocation = "error reading '%s' resource allocation '%s' for Blueprint '%s'" errSettingAllocation = "error setting resource allocation" errProviderBug = "Provider Bug. Please report this issue to the provider maintainers." diff --git a/apstra/data_source_agent.go b/apstra/data_source_agent.go index 1f3716c5..82681b8a 100644 --- a/apstra/data_source_agent.go +++ b/apstra/data_source_agent.go @@ -32,11 +32,6 @@ func (o *dataSourceAgent) Schema(_ context.Context, _ datasource.SchemaRequest, } func (o *dataSourceAgent) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - // Retrieve values from config. var config systemAgents.ManagedDevice resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) diff --git a/apstra/data_source_agent_profile.go b/apstra/data_source_agent_profile.go index c353f775..cdbaf7d7 100644 --- a/apstra/data_source_agent_profile.go +++ b/apstra/data_source_agent_profile.go @@ -34,11 +34,6 @@ func (o *dataSourceAgentProfile) Schema(_ context.Context, _ datasource.SchemaRe } func (o *dataSourceAgentProfile) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config agentProfile resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_agent_profiles.go b/apstra/data_source_agent_profiles.go index 5932d58c..58250e0f 100644 --- a/apstra/data_source_agent_profiles.go +++ b/apstra/data_source_agent_profiles.go @@ -48,11 +48,6 @@ func (o *dataSourceAgentProfiles) Schema(_ context.Context, _ datasource.SchemaR } func (o *dataSourceAgentProfiles) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - config := struct { Ids types.Set `tfsdk:"ids"` Platform types.String `tfsdk:"platform"` diff --git a/apstra/data_source_agents.go b/apstra/data_source_agents.go index 23592069..99f28f76 100644 --- a/apstra/data_source_agents.go +++ b/apstra/data_source_agents.go @@ -47,11 +47,6 @@ func (o *dataSourceAgents) Schema(_ context.Context, _ datasource.SchemaRequest, } func (o *dataSourceAgents) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - type systems struct { IDs types.Set `tfsdk:"ids"` Filters types.Object `tfsdk:"filters"` diff --git a/apstra/data_source_anomalies.go b/apstra/data_source_anomalies.go index 0b44cc7f..7eff8141 100644 --- a/apstra/data_source_anomalies.go +++ b/apstra/data_source_anomalies.go @@ -32,11 +32,6 @@ func (o *dataSourceAnomalies) Schema(_ context.Context, _ datasource.SchemaReque } func (o *dataSourceAnomalies) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.Anomalies resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_asn_pool.go b/apstra/data_source_asn_pool.go index a5e3b2e3..38d66c3f 100644 --- a/apstra/data_source_asn_pool.go +++ b/apstra/data_source_asn_pool.go @@ -37,11 +37,6 @@ func (o *dataSourceAsnPool) Schema(_ context.Context, _ datasource.SchemaRequest } func (o *dataSourceAsnPool) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config resources.AsnPool resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_asn_pools.go b/apstra/data_source_asn_pools.go index ee2bb3a2..1af8cc1d 100644 --- a/apstra/data_source_asn_pools.go +++ b/apstra/data_source_asn_pools.go @@ -36,11 +36,6 @@ func (o *dataSourceAsnPools) Schema(_ context.Context, _ datasource.SchemaReques } func (o *dataSourceAsnPools) Read(ctx context.Context, _ datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - ids, err := o.client.ListAsnPoolIds(ctx) if err != nil { resp.Diagnostics.AddError("Error retrieving ASN Pool IDs", err.Error()) diff --git a/apstra/data_source_blueprint_deployment.go b/apstra/data_source_blueprint_deployment.go index 0b048633..fedce1f8 100644 --- a/apstra/data_source_blueprint_deployment.go +++ b/apstra/data_source_blueprint_deployment.go @@ -31,11 +31,6 @@ func (o *dataSourceBlueprintDeploy) Schema(_ context.Context, _ datasource.Schem } func (o *dataSourceBlueprintDeploy) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.Deploy resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_blueprints.go b/apstra/data_source_blueprints.go index 11f40f8b..0615e65e 100644 --- a/apstra/data_source_blueprints.go +++ b/apstra/data_source_blueprints.go @@ -80,11 +80,6 @@ func (o *dataSourceBlueprints) ValidateConfig(ctx context.Context, req datasourc } func (o *dataSourceBlueprints) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprints resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_configlet.go b/apstra/data_source_configlet.go index 9edbf7ad..7474dfa9 100644 --- a/apstra/data_source_configlet.go +++ b/apstra/data_source_configlet.go @@ -35,11 +35,6 @@ func (o *dataSourceConfiglet) Schema(_ context.Context, _ datasource.SchemaReque } func (o *dataSourceConfiglet) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.Configlet resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_configlets.go b/apstra/data_source_configlets.go index 3656815c..813193e6 100644 --- a/apstra/data_source_configlets.go +++ b/apstra/data_source_configlets.go @@ -50,11 +50,6 @@ func (o *dataSourceConfiglets) Schema(_ context.Context, _ datasource.SchemaRequ } func (o *dataSourceConfiglets) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config struct { Ids types.Set `tfsdk:"ids"` SupportedPlatforms types.Set `tfsdk:"supported_platforms"` diff --git a/apstra/data_source_datacenter_blueprint.go b/apstra/data_source_datacenter_blueprint.go index 65ed90a7..e7059474 100644 --- a/apstra/data_source_datacenter_blueprint.go +++ b/apstra/data_source_datacenter_blueprint.go @@ -36,11 +36,6 @@ func (o *dataSourceDatacenterBlueprint) Schema(_ context.Context, _ datasource.S } func (o *dataSourceDatacenterBlueprint) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.Blueprint resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_datacenter_property_set.go b/apstra/data_source_datacenter_property_set.go index 9f0c1fd5..81c3ea88 100644 --- a/apstra/data_source_datacenter_property_set.go +++ b/apstra/data_source_datacenter_property_set.go @@ -34,11 +34,6 @@ func (o *dataSourceDatacenterPropertySet) Schema(_ context.Context, _ datasource } func (o *dataSourceDatacenterPropertySet) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.DatacenterPropertySet resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_datacenter_property_sets.go b/apstra/data_source_datacenter_property_sets.go index a1016c83..7b50b116 100644 --- a/apstra/data_source_datacenter_property_sets.go +++ b/apstra/data_source_datacenter_property_sets.go @@ -46,11 +46,6 @@ func (o *dataSourceDatacenterPropertySets) Schema(_ context.Context, _ datasourc } func (o *dataSourceDatacenterPropertySets) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config struct { BlueprintId types.String `tfsdk:"blueprint_id"` Ids types.Set `tfsdk:"ids"` diff --git a/apstra/data_source_datacenter_routing_zone.go b/apstra/data_source_datacenter_routing_zone.go index c27dd4cf..e424897c 100644 --- a/apstra/data_source_datacenter_routing_zone.go +++ b/apstra/data_source_datacenter_routing_zone.go @@ -32,11 +32,6 @@ func (o *dataSourceDatacenterRoutingZone) Schema(_ context.Context, _ datasource } func (o *dataSourceDatacenterRoutingZone) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - // Retrieve values from config. var config blueprint.DatacenterRoutingZone resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) diff --git a/apstra/data_source_datacenter_routing_zones.go b/apstra/data_source_datacenter_routing_zones.go index d48162d8..bfc756cf 100644 --- a/apstra/data_source_datacenter_routing_zones.go +++ b/apstra/data_source_datacenter_routing_zones.go @@ -56,11 +56,6 @@ func (o *dataSourceDatacenterRoutingZones) Schema(_ context.Context, _ datasourc } func (o *dataSourceDatacenterRoutingZones) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - type routingZones struct { BlueprintId types.String `tfsdk:"blueprint_id"` IDs types.Set `tfsdk:"ids"` diff --git a/apstra/data_source_datacenter_system.go b/apstra/data_source_datacenter_system.go index aeb00f2a..b20147e4 100644 --- a/apstra/data_source_datacenter_system.go +++ b/apstra/data_source_datacenter_system.go @@ -32,11 +32,6 @@ func (o *dataSourceDatacenterSystemNode) Schema(_ context.Context, _ datasource. } func (o *dataSourceDatacenterSystemNode) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.NodeTypeSystem resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_datacenter_systems.go b/apstra/data_source_datacenter_systems.go index 4bc2a17d..5c224ed8 100644 --- a/apstra/data_source_datacenter_systems.go +++ b/apstra/data_source_datacenter_systems.go @@ -31,11 +31,6 @@ func (o *dataSourceDatacenterSystemNodes) Schema(_ context.Context, _ datasource } func (o *dataSourceDatacenterSystemNodes) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.NodesTypeSystem resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_datacenter_virtual_network_binding_constructor.go b/apstra/data_source_datacenter_virtual_network_binding_constructor.go index 650ba3bf..eb0833ed 100644 --- a/apstra/data_source_datacenter_virtual_network_binding_constructor.go +++ b/apstra/data_source_datacenter_virtual_network_binding_constructor.go @@ -37,11 +37,6 @@ func (o *dataSourceVirtualNetworkBindingConstructor) Schema(_ context.Context, _ } func (o *dataSourceVirtualNetworkBindingConstructor) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config blueprint.VnBindingConstructor resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_interface_map.go b/apstra/data_source_interface_map.go index 13cc8154..1ea16438 100644 --- a/apstra/data_source_interface_map.go +++ b/apstra/data_source_interface_map.go @@ -37,11 +37,6 @@ func (o *dataSourceInterfaceMap) Schema(_ context.Context, _ datasource.SchemaRe } func (o *dataSourceInterfaceMap) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.InterfaceMap resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_interface_maps.go b/apstra/data_source_interface_maps.go index eb373e1f..8f5df4a2 100644 --- a/apstra/data_source_interface_maps.go +++ b/apstra/data_source_interface_maps.go @@ -50,11 +50,6 @@ func (o *dataSourceInterfaceMaps) Schema(_ context.Context, _ datasource.SchemaR } func (o *dataSourceInterfaceMaps) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config interfaceMaps resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_ipv4_pool.go b/apstra/data_source_ipv4_pool.go index 8e7d0601..b50d9710 100644 --- a/apstra/data_source_ipv4_pool.go +++ b/apstra/data_source_ipv4_pool.go @@ -36,11 +36,6 @@ func (o *dataSourceIpv4Pool) Schema(_ context.Context, _ datasource.SchemaReques } func (o *dataSourceIpv4Pool) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config resources.Ipv4Pool resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_ipv4_pools.go b/apstra/data_source_ipv4_pools.go index 88769cce..ea7d9b15 100644 --- a/apstra/data_source_ipv4_pools.go +++ b/apstra/data_source_ipv4_pools.go @@ -36,11 +36,6 @@ func (o *dataSourceIpv4Pools) Schema(_ context.Context, _ datasource.SchemaReque } func (o *dataSourceIpv4Pools) Read(ctx context.Context, _ datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - ids, err := o.client.ListIp4PoolIds(ctx) if err != nil { resp.Diagnostics.AddError("Error retrieving IPv4 Pool IDs", err.Error()) diff --git a/apstra/data_source_ipv6_pool.go b/apstra/data_source_ipv6_pool.go index 53994fbe..f619e0e7 100644 --- a/apstra/data_source_ipv6_pool.go +++ b/apstra/data_source_ipv6_pool.go @@ -36,11 +36,6 @@ func (o *dataSourceIpv6Pool) Schema(_ context.Context, _ datasource.SchemaReques } func (o *dataSourceIpv6Pool) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config resources.Ipv6Pool resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_ipv6_pools.go b/apstra/data_source_ipv6_pools.go index bcfdae50..4c12de86 100644 --- a/apstra/data_source_ipv6_pools.go +++ b/apstra/data_source_ipv6_pools.go @@ -36,11 +36,6 @@ func (o *dataSourceIpv6Pools) Schema(_ context.Context, _ datasource.SchemaReque } func (o *dataSourceIpv6Pools) Read(ctx context.Context, _ datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - ids, err := o.client.ListIp6PoolIds(ctx) if err != nil { resp.Diagnostics.AddError("Error retrieving IPv6 Pool IDs", err.Error()) diff --git a/apstra/data_source_logical_device.go b/apstra/data_source_logical_device.go index b6c036be..8ebcc09c 100644 --- a/apstra/data_source_logical_device.go +++ b/apstra/data_source_logical_device.go @@ -37,11 +37,6 @@ func (o *dataSourceLogicalDevice) Schema(_ context.Context, _ datasource.SchemaR } func (o *dataSourceLogicalDevice) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.LogicalDevice resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_property_set.go b/apstra/data_source_property_set.go index 1bbffabd..0cf42e6c 100644 --- a/apstra/data_source_property_set.go +++ b/apstra/data_source_property_set.go @@ -35,11 +35,6 @@ func (o *dataSourcePropertySet) Schema(_ context.Context, _ datasource.SchemaReq } func (o *dataSourcePropertySet) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.PropertySet resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_property_sets.go b/apstra/data_source_property_sets.go index 424a53d6..8931ff04 100644 --- a/apstra/data_source_property_sets.go +++ b/apstra/data_source_property_sets.go @@ -36,11 +36,6 @@ func (o *dataSourcePropertySets) Schema(_ context.Context, _ datasource.SchemaRe } func (o *dataSourcePropertySets) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config struct { Ids types.Set `tfsdk:"ids"` } diff --git a/apstra/data_source_rack_type.go b/apstra/data_source_rack_type.go index ad03d6a5..836a5239 100644 --- a/apstra/data_source_rack_type.go +++ b/apstra/data_source_rack_type.go @@ -37,11 +37,6 @@ func (o *dataSourceRackType) Schema(_ context.Context, _ datasource.SchemaReques } func (o *dataSourceRackType) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.RackType resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_rack_types.go b/apstra/data_source_rack_types.go index 3f42f4e2..e3daf6ce 100644 --- a/apstra/data_source_rack_types.go +++ b/apstra/data_source_rack_types.go @@ -36,11 +36,6 @@ func (o *dataSourceRackTypes) Schema(_ context.Context, _ datasource.SchemaReque } func (o *dataSourceRackTypes) Read(ctx context.Context, _ datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - ids, err := o.client.ListRackTypeIds(ctx) if err != nil { resp.Diagnostics.AddError("Error retrieving Rack Type IDs", err.Error()) diff --git a/apstra/data_source_tag.go b/apstra/data_source_tag.go index ec29cd51..8366a7cb 100644 --- a/apstra/data_source_tag.go +++ b/apstra/data_source_tag.go @@ -35,11 +35,6 @@ func (o *dataSourceTag) Schema(_ context.Context, _ datasource.SchemaRequest, re } func (o *dataSourceTag) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.Tag resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_template_rack_based.go b/apstra/data_source_template_rack_based.go index aa05450d..0a39c4d6 100644 --- a/apstra/data_source_template_rack_based.go +++ b/apstra/data_source_template_rack_based.go @@ -36,11 +36,6 @@ func (o *dataSourceTemplateRackBased) Schema(_ context.Context, _ datasource.Sch } func (o *dataSourceTemplateRackBased) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config design.TemplateRackBased resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_templates.go b/apstra/data_source_templates.go index f7534bf6..e2a27ed0 100644 --- a/apstra/data_source_templates.go +++ b/apstra/data_source_templates.go @@ -50,11 +50,6 @@ func (o *dataSourceTemplates) Schema(_ context.Context, _ datasource.SchemaReque } func (o *dataSourceTemplates) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config templates resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_vni_pool.go b/apstra/data_source_vni_pool.go index d577971c..e52417c9 100644 --- a/apstra/data_source_vni_pool.go +++ b/apstra/data_source_vni_pool.go @@ -37,11 +37,6 @@ func (o *dataSourceVniPool) Schema(_ context.Context, _ datasource.SchemaRequest } func (o *dataSourceVniPool) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var config resources.VniPool resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) if resp.Diagnostics.HasError() { diff --git a/apstra/data_source_vni_pools.go b/apstra/data_source_vni_pools.go index 3fd3f600..9bd85d9b 100644 --- a/apstra/data_source_vni_pools.go +++ b/apstra/data_source_vni_pools.go @@ -36,11 +36,6 @@ func (o *dataSourceVniPools) Schema(_ context.Context, _ datasource.SchemaReques } func (o *dataSourceVniPools) Read(ctx context.Context, _ datasource.ReadRequest, resp *datasource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - ids, err := o.client.ListVniPoolIds(ctx) if err != nil { resp.Diagnostics.AddError("Error retrieving VNI Pool IDs", err.Error()) diff --git a/apstra/resource_agent_profile.go b/apstra/resource_agent_profile.go index 968a8a66..aa740b98 100644 --- a/apstra/resource_agent_profile.go +++ b/apstra/resource_agent_profile.go @@ -35,11 +35,6 @@ func (o *resourceAgentProfile) Schema(_ context.Context, _ resource.SchemaReques } func (o *resourceAgentProfile) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan agentProfile resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -67,11 +62,6 @@ func (o *resourceAgentProfile) Create(ctx context.Context, req resource.CreateRe } func (o *resourceAgentProfile) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state agentProfile resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -107,11 +97,6 @@ func (o *resourceAgentProfile) Read(ctx context.Context, req resource.ReadReques } func (o *resourceAgentProfile) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan agentProfile resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -154,11 +139,6 @@ func (o *resourceAgentProfile) Update(ctx context.Context, req resource.UpdateRe } func (o *resourceAgentProfile) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state agentProfile resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_asn_pool.go b/apstra/resource_asn_pool.go index 8e60dee8..66cd2e8e 100644 --- a/apstra/resource_asn_pool.go +++ b/apstra/resource_asn_pool.go @@ -85,11 +85,6 @@ func (o *resourceAsnPool) ValidateConfig(ctx context.Context, req resource.Valid } func (o *resourceAsnPool) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan resources.AsnPool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -141,11 +136,6 @@ func (o *resourceAsnPool) Create(ctx context.Context, req resource.CreateRequest } func (o *resourceAsnPool) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state resources.AsnPool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -179,11 +169,6 @@ func (o *resourceAsnPool) Read(ctx context.Context, req resource.ReadRequest, re } func (o *resourceAsnPool) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan resources.AsnPool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -234,11 +219,6 @@ func (o *resourceAsnPool) Update(ctx context.Context, req resource.UpdateRequest } func (o *resourceAsnPool) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state resources.AsnPool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_blueprint_deployment.go b/apstra/resource_blueprint_deployment.go index 84f08d15..44db09bd 100644 --- a/apstra/resource_blueprint_deployment.go +++ b/apstra/resource_blueprint_deployment.go @@ -41,11 +41,6 @@ func (o *resourceBlueprintDeploy) Schema(_ context.Context, _ resource.SchemaReq } func (o *resourceBlueprintDeploy) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan blueprint.Deploy resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -87,11 +82,6 @@ func (o *resourceBlueprintDeploy) Create(ctx context.Context, req resource.Creat } func (o *resourceBlueprintDeploy) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state var state blueprint.Deploy resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -126,11 +116,6 @@ func (o *resourceBlueprintDeploy) Read(ctx context.Context, req resource.ReadReq } func (o *resourceBlueprintDeploy) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan var plan blueprint.Deploy resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -173,11 +158,6 @@ func (o *resourceBlueprintDeploy) Update(ctx context.Context, req resource.Updat } func (o *resourceBlueprintDeploy) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from state var state blueprint.Deploy resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_configlet.go b/apstra/resource_configlet.go index 1edb406b..9dc5edd3 100644 --- a/apstra/resource_configlet.go +++ b/apstra/resource_configlet.go @@ -32,11 +32,6 @@ func (o *resourceConfiglet) Schema(_ context.Context, _ resource.SchemaRequest, } func (o *resourceConfiglet) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan design.Configlet req.Plan.Get(ctx, &plan) @@ -61,11 +56,6 @@ func (o *resourceConfiglet) Create(ctx context.Context, req resource.CreateReque } func (o *resourceConfiglet) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - var state design.Configlet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { @@ -91,11 +81,6 @@ func (o *resourceConfiglet) Read(ctx context.Context, req resource.ReadRequest, // Update resource func (o *resourceConfiglet) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan design.Configlet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -122,10 +107,6 @@ func (o *resourceConfiglet) Update(ctx context.Context, req resource.UpdateReque // Delete resource func (o *resourceConfiglet) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } var state design.Configlet diags := req.State.Get(ctx, &state) diff --git a/apstra/resource_datacenter_blueprint.go b/apstra/resource_datacenter_blueprint.go index 4b0661b8..275a0c8e 100644 --- a/apstra/resource_datacenter_blueprint.go +++ b/apstra/resource_datacenter_blueprint.go @@ -76,11 +76,6 @@ func (o *resourceDatacenterBlueprint) ValidateConfig(ctx context.Context, req re } func (o *resourceDatacenterBlueprint) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan. var plan blueprint.Blueprint resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -128,11 +123,6 @@ func (o *resourceDatacenterBlueprint) Create(ctx context.Context, req resource.C } func (o *resourceDatacenterBlueprint) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state. var state blueprint.Blueprint resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -167,11 +157,6 @@ func (o *resourceDatacenterBlueprint) Read(ctx context.Context, req resource.Rea // Update resource func (o *resourceDatacenterBlueprint) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve plan. var plan blueprint.Blueprint resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -224,11 +209,6 @@ func (o *resourceDatacenterBlueprint) Update(ctx context.Context, req resource.U // Delete resource func (o *resourceDatacenterBlueprint) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state blueprint.Blueprint diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) diff --git a/apstra/resource_datacenter_device_allocation.go b/apstra/resource_datacenter_device_allocation.go index 02aa82bf..53115650 100644 --- a/apstra/resource_datacenter_device_allocation.go +++ b/apstra/resource_datacenter_device_allocation.go @@ -39,11 +39,6 @@ func (o *resourceDeviceAllocation) Schema(_ context.Context, _ resource.SchemaRe } func (o *resourceDeviceAllocation) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DeviceAllocation resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -106,11 +101,6 @@ func (o *resourceDeviceAllocation) Create(ctx context.Context, req resource.Crea } func (o *resourceDeviceAllocation) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state var state blueprint.DeviceAllocation resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -196,11 +186,6 @@ func (o *resourceDeviceAllocation) Read(ctx context.Context, req resource.ReadRe } func (o *resourceDeviceAllocation) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan var plan blueprint.DeviceAllocation resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -240,11 +225,6 @@ func (o *resourceDeviceAllocation) Update(ctx context.Context, req resource.Upda } func (o *resourceDeviceAllocation) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - // Retrieve values from state var state blueprint.DeviceAllocation resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_datacenter_generic_system.go b/apstra/resource_datacenter_generic_system.go index 3370428d..932ae9a9 100644 --- a/apstra/resource_datacenter_generic_system.go +++ b/apstra/resource_datacenter_generic_system.go @@ -36,11 +36,6 @@ func (o *resourceDatacenterGenericSystem) Schema(_ context.Context, _ resource.S } func (o *resourceDatacenterGenericSystem) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterGenericSystem resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -104,11 +99,6 @@ func (o *resourceDatacenterGenericSystem) Create(ctx context.Context, req resour } func (o *resourceDatacenterGenericSystem) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterGenericSystem resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -151,11 +141,6 @@ func (o *resourceDatacenterGenericSystem) Read(ctx context.Context, req resource } func (o *resourceDatacenterGenericSystem) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterGenericSystem resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -205,11 +190,6 @@ func (o *resourceDatacenterGenericSystem) Update(ctx context.Context, req resour } func (o *resourceDatacenterGenericSystem) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterGenericSystem resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_datacenter_property_set.go b/apstra/resource_datacenter_property_set.go index b94d6ac1..49cc2210 100644 --- a/apstra/resource_datacenter_property_set.go +++ b/apstra/resource_datacenter_property_set.go @@ -37,11 +37,6 @@ func (o *resourceDatacenterPropertySet) Schema(_ context.Context, _ resource.Sch } func (o *resourceDatacenterPropertySet) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan blueprint.DatacenterPropertySet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -134,11 +129,6 @@ func (o *resourceDatacenterPropertySet) Create(ctx context.Context, req resource } func (o *resourceDatacenterPropertySet) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - // Retrieve values from state var state blueprint.DatacenterPropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -176,11 +166,6 @@ func (o *resourceDatacenterPropertySet) Read(ctx context.Context, req resource.R } func (o *resourceDatacenterPropertySet) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan var plan blueprint.DatacenterPropertySet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -261,11 +246,6 @@ func (o *resourceDatacenterPropertySet) Update(ctx context.Context, req resource } func (o *resourceDatacenterPropertySet) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - // Retrieve values from state var state blueprint.DatacenterPropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_datacenter_resource_pool_allocation.go b/apstra/resource_datacenter_resource_pool_allocation.go index b4044b34..e100c152 100644 --- a/apstra/resource_datacenter_resource_pool_allocation.go +++ b/apstra/resource_datacenter_resource_pool_allocation.go @@ -46,11 +46,6 @@ func (o *resourcePoolAllocation) Schema(_ context.Context, _ resource.SchemaRequ //} func (o *resourcePoolAllocation) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan blueprint.PoolAllocation resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -102,11 +97,6 @@ func (o *resourcePoolAllocation) Create(ctx context.Context, req resource.Create } func (o *resourcePoolAllocation) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state var state blueprint.PoolAllocation resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -157,11 +147,6 @@ func (o *resourcePoolAllocation) Read(ctx context.Context, req resource.ReadRequ } func (o *resourcePoolAllocation) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan var plan blueprint.PoolAllocation resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -202,11 +187,6 @@ func (o *resourcePoolAllocation) Update(ctx context.Context, req resource.Update } func (o *resourcePoolAllocation) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - // Retrieve values from state var state blueprint.PoolAllocation resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_datacenter_routing_policy.go b/apstra/resource_datacenter_routing_policy.go index 3b5d6689..02b3dbfb 100644 --- a/apstra/resource_datacenter_routing_policy.go +++ b/apstra/resource_datacenter_routing_policy.go @@ -36,11 +36,6 @@ func (o *resourceDatacenterRoutingPolicy) Schema(_ context.Context, _ resource.S } func (o *resourceDatacenterRoutingPolicy) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterRoutingPolicy resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -89,11 +84,6 @@ func (o *resourceDatacenterRoutingPolicy) Create(ctx context.Context, req resour } func (o *resourceDatacenterRoutingPolicy) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterRoutingPolicy resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -133,11 +123,6 @@ func (o *resourceDatacenterRoutingPolicy) Read(ctx context.Context, req resource } func (o *resourceDatacenterRoutingPolicy) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterRoutingPolicy resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -176,11 +161,6 @@ func (o *resourceDatacenterRoutingPolicy) Update(ctx context.Context, req resour } func (o *resourceDatacenterRoutingPolicy) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterRoutingPolicy resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_datacenter_routing_zone.go b/apstra/resource_datacenter_routing_zone.go index 9aa7ac7c..eb9c4967 100644 --- a/apstra/resource_datacenter_routing_zone.go +++ b/apstra/resource_datacenter_routing_zone.go @@ -109,11 +109,6 @@ func (o *resourceDatacenterRoutingZone) ModifyPlan(ctx context.Context, req reso } func (o *resourceDatacenterRoutingZone) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterRoutingZone resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -182,11 +177,6 @@ func (o *resourceDatacenterRoutingZone) Create(ctx context.Context, req resource } func (o *resourceDatacenterRoutingZone) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterRoutingZone resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -243,11 +233,6 @@ func (o *resourceDatacenterRoutingZone) Read(ctx context.Context, req resource.R } func (o *resourceDatacenterRoutingZone) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterRoutingZone resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -319,11 +304,6 @@ func (o *resourceDatacenterRoutingZone) Update(ctx context.Context, req resource } func (o *resourceDatacenterRoutingZone) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterRoutingZone resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_datacenter_virtual_network.go b/apstra/resource_datacenter_virtual_network.go index ceaa05c8..948ff17e 100644 --- a/apstra/resource_datacenter_virtual_network.go +++ b/apstra/resource_datacenter_virtual_network.go @@ -101,11 +101,6 @@ func (o *resourceDatacenterVirtualNetwork) ModifyPlan(ctx context.Context, req r } func (o *resourceDatacenterVirtualNetwork) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterVirtualNetwork resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -167,11 +162,6 @@ func (o *resourceDatacenterVirtualNetwork) Create(ctx context.Context, req resou } func (o *resourceDatacenterVirtualNetwork) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterVirtualNetwork resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -207,11 +197,6 @@ func (o *resourceDatacenterVirtualNetwork) Read(ctx context.Context, req resourc } func (o *resourceDatacenterVirtualNetwork) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Retrieve values from plan. var plan blueprint.DatacenterVirtualNetwork resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -268,11 +253,6 @@ func (o *resourceDatacenterVirtualNetwork) Update(ctx context.Context, req resou } func (o *resourceDatacenterVirtualNetwork) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - // Retrieve values from state. var state blueprint.DatacenterVirtualNetwork resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_interface_map.go b/apstra/resource_interface_map.go index b6977b6c..a00ca8ae 100644 --- a/apstra/resource_interface_map.go +++ b/apstra/resource_interface_map.go @@ -143,11 +143,6 @@ func (o *resourceInterfaceMap) ValidateConfig(ctx context.Context, req resource. } func (o *resourceInterfaceMap) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan rInterfaceMap resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -193,11 +188,6 @@ func (o *resourceInterfaceMap) Create(ctx context.Context, req resource.CreateRe } func (o *resourceInterfaceMap) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state rInterfaceMap resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -229,11 +219,6 @@ func (o *resourceInterfaceMap) Read(ctx context.Context, req resource.ReadReques // Update resource func (o *resourceInterfaceMap) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan rInterfaceMap resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -274,11 +259,6 @@ func (o *resourceInterfaceMap) Update(ctx context.Context, req resource.UpdateRe // Delete resource func (o *resourceInterfaceMap) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state rInterfaceMap resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_ipv4_pool.go b/apstra/resource_ipv4_pool.go index 6ff7cddb..09796be2 100644 --- a/apstra/resource_ipv4_pool.go +++ b/apstra/resource_ipv4_pool.go @@ -102,11 +102,6 @@ func (o *resourceIpv4Pool) ValidateConfig(ctx context.Context, req resource.Vali } func (o *resourceIpv4Pool) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan resources.Ipv4Pool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -157,11 +152,6 @@ func (o *resourceIpv4Pool) Create(ctx context.Context, req resource.CreateReques } func (o *resourceIpv4Pool) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state resources.Ipv4Pool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -196,11 +186,6 @@ func (o *resourceIpv4Pool) Read(ctx context.Context, req resource.ReadRequest, r // Update resource func (o *resourceIpv4Pool) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan resources.Ipv4Pool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -252,11 +237,6 @@ func (o *resourceIpv4Pool) Update(ctx context.Context, req resource.UpdateReques // Delete resource func (o *resourceIpv4Pool) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state resources.Ipv4Pool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_ipv6_pool.go b/apstra/resource_ipv6_pool.go index d1d16465..60b48b1e 100644 --- a/apstra/resource_ipv6_pool.go +++ b/apstra/resource_ipv6_pool.go @@ -102,11 +102,6 @@ func (o *resourceIpv6Pool) ValidateConfig(ctx context.Context, req resource.Vali } func (o *resourceIpv6Pool) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan resources.Ipv6Pool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -157,11 +152,6 @@ func (o *resourceIpv6Pool) Create(ctx context.Context, req resource.CreateReques } func (o *resourceIpv6Pool) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state resources.Ipv6Pool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -196,11 +186,6 @@ func (o *resourceIpv6Pool) Read(ctx context.Context, req resource.ReadRequest, r // Update resource func (o *resourceIpv6Pool) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan resources.Ipv6Pool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -252,11 +237,6 @@ func (o *resourceIpv6Pool) Update(ctx context.Context, req resource.UpdateReques // Delete resource func (o *resourceIpv6Pool) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state resources.Ipv6Pool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_logical_device.go b/apstra/resource_logical_device.go index 1ddf6b7b..3a5fb33b 100644 --- a/apstra/resource_logical_device.go +++ b/apstra/resource_logical_device.go @@ -59,11 +59,6 @@ func (o *resourceLogicalDevice) ValidateConfig(ctx context.Context, req resource } func (o *resourceLogicalDevice) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan design.LogicalDevice resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -87,11 +82,6 @@ func (o *resourceLogicalDevice) Create(ctx context.Context, req resource.CreateR } func (o *resourceLogicalDevice) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state design.LogicalDevice resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -128,11 +118,6 @@ func (o *resourceLogicalDevice) Read(ctx context.Context, req resource.ReadReque } func (o *resourceLogicalDevice) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan design.LogicalDevice resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -162,11 +147,6 @@ func (o *resourceLogicalDevice) Update(ctx context.Context, req resource.UpdateR } func (o *resourceLogicalDevice) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state design.LogicalDevice resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_managed_device.go b/apstra/resource_managed_device.go index a675d0e9..54f46545 100644 --- a/apstra/resource_managed_device.go +++ b/apstra/resource_managed_device.go @@ -47,11 +47,6 @@ func (o *resourceManagedDevice) Schema(_ context.Context, _ resource.SchemaReque } func (o *resourceManagedDevice) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan systemAgents.ManagedDevice resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -130,11 +125,6 @@ func (o *resourceManagedDevice) Create(ctx context.Context, req resource.CreateR } func (o *resourceManagedDevice) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state systemAgents.ManagedDevice resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -180,11 +170,6 @@ func (o *resourceManagedDevice) Read(ctx context.Context, req resource.ReadReque // Update resource func (o *resourceManagedDevice) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan systemAgents.ManagedDevice resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -221,11 +206,6 @@ func (o *resourceManagedDevice) Update(ctx context.Context, req resource.UpdateR // Delete resource func (o *resourceManagedDevice) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state systemAgents.ManagedDevice resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_managed_device_ack.go b/apstra/resource_managed_device_ack.go index 1557206d..897a1b02 100644 --- a/apstra/resource_managed_device_ack.go +++ b/apstra/resource_managed_device_ack.go @@ -39,11 +39,6 @@ func (o *resourceManagedDeviceAck) Schema(_ context.Context, _ resource.SchemaRe } func (o *resourceManagedDeviceAck) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan systemAgents.SystemAck resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) diff --git a/apstra/resource_property_set.go b/apstra/resource_property_set.go index 18ad8b43..afaa9c1c 100644 --- a/apstra/resource_property_set.go +++ b/apstra/resource_property_set.go @@ -35,10 +35,6 @@ func (o *resourcePropertySet) Schema(_ context.Context, _ resource.SchemaRequest } func (o *resourcePropertySet) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } // Retrieve values from plan var plan design.PropertySet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -68,11 +64,6 @@ func (o *resourcePropertySet) Create(ctx context.Context, req resource.CreateReq } func (o *resourcePropertySet) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errDataSourceUnconfiguredSummary, errDatasourceUnconfiguredDetail) - return - } - var state design.PropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { @@ -113,11 +104,6 @@ func (o *resourcePropertySet) Read(ctx context.Context, req resource.ReadRequest // Update resource func (o *resourcePropertySet) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan design.PropertySet resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -160,11 +146,6 @@ func (o *resourcePropertySet) Update(ctx context.Context, req resource.UpdateReq // Delete resource func (o *resourcePropertySet) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state design.PropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_rack_type.go b/apstra/resource_rack_type.go index d78e3f6b..195c8395 100644 --- a/apstra/resource_rack_type.go +++ b/apstra/resource_rack_type.go @@ -32,11 +32,6 @@ func (o *resourceRackType) Schema(_ context.Context, _ resource.SchemaRequest, r } func (o *resourceRackType) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan design.RackType resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -86,11 +81,6 @@ func (o *resourceRackType) Create(ctx context.Context, req resource.CreateReques } func (o *resourceRackType) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve values from state var state design.RackType resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -132,11 +122,6 @@ func (o *resourceRackType) Read(ctx context.Context, req resource.ReadRequest, r } func (o *resourceRackType) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Retrieve plan var plan design.RackType resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -186,11 +171,6 @@ func (o *resourceRackType) Update(ctx context.Context, req resource.UpdateReques } func (o *resourceRackType) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - // Retrieve values from state var state design.RackType resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/apstra/resource_tag.go b/apstra/resource_tag.go index a59144ed..4149a017 100644 --- a/apstra/resource_tag.go +++ b/apstra/resource_tag.go @@ -32,11 +32,6 @@ func (o *resourceTag) Schema(_ context.Context, _ resource.SchemaRequest, resp * } func (o *resourceTag) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan design.Tag resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -65,11 +60,6 @@ func (o *resourceTag) Create(ctx context.Context, req resource.CreateRequest, re } func (o *resourceTag) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state design.Tag resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -104,11 +94,6 @@ func (o *resourceTag) Read(ctx context.Context, req resource.ReadRequest, resp * // Update resource func (o *resourceTag) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan design.Tag resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -134,11 +119,6 @@ func (o *resourceTag) Update(ctx context.Context, req resource.UpdateRequest, re // Delete resource func (o *resourceTag) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state design.Tag resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_template_rack_based.go b/apstra/resource_template_rack_based.go index a602579d..5246aa8a 100644 --- a/apstra/resource_template_rack_based.go +++ b/apstra/resource_template_rack_based.go @@ -74,11 +74,6 @@ func (o *resourceTemplateRackBased) ValidateConfig(ctx context.Context, req reso } func (o *resourceTemplateRackBased) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // retrieve values from plan var plan design.TemplateRackBased resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -119,11 +114,6 @@ func (o *resourceTemplateRackBased) Create(ctx context.Context, req resource.Cre } func (o *resourceTemplateRackBased) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state design.TemplateRackBased resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -165,11 +155,6 @@ func (o *resourceTemplateRackBased) Read(ctx context.Context, req resource.ReadR // Update resource func (o *resourceTemplateRackBased) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // retrieve values from plan var plan design.TemplateRackBased resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -219,11 +204,6 @@ func (o *resourceTemplateRackBased) Update(ctx context.Context, req resource.Upd // Delete resource func (o *resourceTemplateRackBased) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state design.TemplateRackBased resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/apstra/resource_vni_pool.go b/apstra/resource_vni_pool.go index 021f1b07..62a3dc03 100644 --- a/apstra/resource_vni_pool.go +++ b/apstra/resource_vni_pool.go @@ -85,11 +85,6 @@ func (o *resourceVniPool) ValidateConfig(ctx context.Context, req resource.Valid } func (o *resourceVniPool) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredCreateDetail) - return - } - // Retrieve values from plan var plan resources.VniPool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -141,11 +136,6 @@ func (o *resourceVniPool) Create(ctx context.Context, req resource.CreateRequest } func (o *resourceVniPool) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredReadDetail) - return - } - // Get current state var state resources.VniPool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -179,11 +169,6 @@ func (o *resourceVniPool) Read(ctx context.Context, req resource.ReadRequest, re } func (o *resourceVniPool) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredUpdateDetail) - return - } - // Get plan values var plan resources.VniPool resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -234,11 +219,6 @@ func (o *resourceVniPool) Update(ctx context.Context, req resource.UpdateRequest } func (o *resourceVniPool) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - if o.client == nil { - resp.Diagnostics.AddError(errResourceUnconfiguredSummary, errResourceUnconfiguredDeleteDetail) - return - } - var state resources.VniPool resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { diff --git a/test/output.tf b/test/output.tf deleted file mode 100644 index 7a83706d..00000000 --- a/test/output.tf +++ /dev/null @@ -1,34 +0,0 @@ -#output "d_agent_profile" { value = data.apstra_agent_profile.d } -#output "d_agent_profiles" { value = data.apstra_agent_profiles.d } -#output "d_asn_pool" { value = data.apstra_asn_pool.d } -#output "d_asn_pools" { value = data.apstra_asn_pools.d } -#output "d_blueprints" { value = data.apstra_blueprints.d } -#output "d_datacenter_blueprint_status" { value = data.apstra_datacenter_blueprint_status.d } -#output "d_configlet" { value = data.apstra_configlet.d } -#output "d_configlets" { value = data.apstra_configlet.d } -#output "d_ipv4_pool" { value = data.apstra_ipv4_pool.d } -#output "d_ipv4_pools" { value = data.apstra_ipv4_pools.d } -#output "d_ipv6_pool" { value = data.apstra_ipv6_pool.d } -#output "d_ipv6_pools" { value = data.apstra_ipv6_pools.d } -#output "d_logical_device" { value = data.apstra_logical_device.d } -#output "d_datacenter_blueprint" { value = data.apstra_datacenter_blueprint.d } -#output "d_interface_map" { value = data.apstra_interface_map.d } -#output "d_interface_maps" { value = data.apstra_interface_maps.imaps } -#output "d_tag" { value = data.apstra_tag.d } -#output "d_template_rack_based" { value = data.apstra_template_rack_based.d } -#output "d_rack_type" { value = data.apstra_rack_type.d } -#output "d_vni_pool" { value = data.apstra_vni_pool.d } -#output "d_vni_pools" { value = data.apstra_vni_pools.d } - -############################################################################### - -#output "r_agent_profile" { value = apstra_agent_profile.r } -#output "r_asn_pool" { value = apstra_asn_pool.r } -#output "r_configlet" { value = apstra_configlet.r } -#output "r_ipv4_pool" { value = apstra_asn_pool.r } -#output "r_logical_device" { value = apstra_logical_device.r } -#output "r_tag" { value = apstra_tag.r } -#output "r_interface_map" { value = apstra_interface_map.r } -#output "r_rack_type" { value = apstra_rack_type.r } -#output "r_template_rack_based" { value = apstra_template_rack_based.r } -#output "r_vni_pool" { value = apstra_vni_pool.r } diff --git a/test/provider.tf b/test/provider.tf deleted file mode 100644 index 876cfb2f..00000000 --- a/test/provider.tf +++ /dev/null @@ -1,13 +0,0 @@ -terraform { - required_providers { - apstra = { - source = "Juniper/apstra" - } - } -} - -provider "apstra" { - url = "https://admin:VirtuousMoose4%5E@13.37.222.29:21809/" - tls_validation_disabled = true - blueprint_mutex_disabled = true -}