diff --git a/pkg/config-api-provider/provider/data-sources/wired_network.go b/pkg/config-api-provider/provider/data-sources/wired_network.go index e3f6e42b..c8829c86 100644 --- a/pkg/config-api-provider/provider/data-sources/wired_network.go +++ b/pkg/config-api-provider/provider/data-sources/wired_network.go @@ -24,7 +24,16 @@ type wiredNetworkDataSource struct { } type wiredNetworkDataSourceModel struct { - ID types.String `tfsdk:"id"` + ID types.String `tfsdk:"id"` + Alias types.String `tfsdk:"alias"` + IpVersion types.String `tfsdk:"ip_version"` + Security types.String `tfsdk:"security"` + DnsLookupDomain types.String `tfsdk:"dns_lookup_domain"` + DisableEdns types.Bool `tfsdk:"disable_edns"` + UseDns64 types.Bool `tfsdk:"use_dns64"` + ExternalConnectivity types.Bool `tfsdk:"external_connectivity"` + VlanId types.Int64 `tfsdk:"vlan_id"` + Filter struct { WiredNetworkID string `tfsdk:"wired_network_id"` } `tfsdk:"filter"` @@ -40,6 +49,30 @@ func (d *wiredNetworkDataSource) Schema(_ context.Context, _ datasource.SchemaRe "id": schema.StringAttribute{ Computed: true, }, + "alias": schema.StringAttribute{ + Computed: true, + }, + "ip_version": schema.StringAttribute{ + Computed: true, + }, + "security": schema.StringAttribute{ + Computed: true, + }, + "dns_lookup_domain": schema.StringAttribute{ + Computed: true, + }, + "disable_edns": schema.BoolAttribute{ + Computed: true, + }, + "use_dns64": schema.BoolAttribute{ + Computed: true, + }, + "external_connectivity": schema.BoolAttribute{ + Computed: true, + }, + "vlan_id": schema.Int64Attribute{ + Computed: true, + }, "filter": schema.SingleNestedAttribute{ Required: true, Attributes: map[string]schema.Attribute{ @@ -77,6 +110,14 @@ func (d *wiredNetworkDataSource) Read(ctx context.Context, req datasource.ReadRe network := networkResponse.WiredNetworks[0] state.ID = types.StringValue(network.Uid) + state.Alias = types.StringValue(network.Alias) + state.IpVersion = types.StringValue(network.IpVersion) + state.Security = types.StringValue(*network.Security.Get()) + state.DnsLookupDomain = types.StringValue(*network.DnsLookupDomain.Get()) + state.DisableEdns = types.BoolValue(network.DisableEdns) + state.UseDns64 = types.BoolValue(network.UseDns64) + state.ExternalConnectivity = types.BoolValue(network.ExternalConnectivity) + state.VlanId = types.Int64Value(int64(*network.VlanId.Get())) // Set state diags = resp.State.Set(ctx, &state) diff --git a/pkg/config-api-provider/provider/data-sources/wireless_network.go b/pkg/config-api-provider/provider/data-sources/wireless_network.go index fb247a40..89ac478e 100644 --- a/pkg/config-api-provider/provider/data-sources/wireless_network.go +++ b/pkg/config-api-provider/provider/data-sources/wireless_network.go @@ -24,7 +24,18 @@ type wirelessNetworkDataSource struct { } type wirelessNetworkDataSourceModel struct { - ID types.String `tfsdk:"id"` + ID types.String `tfsdk:"id"` + Ssid types.String `tfsdk:"ssid"` + Alias types.String `tfsdk:"alias"` + IpVersion types.String `tfsdk:"ip_version"` + Security types.String `tfsdk:"security"` + Hidden types.Bool `tfsdk:"hidden"` + BandLocking types.String `tfsdk:"band_locking"` + DnsLookupDomain types.String `tfsdk:"dns_lookup_domain"` + DisableEdns types.Bool `tfsdk:"disable_edns"` + UseDns64 types.Bool `tfsdk:"use_dns64"` + ExternalConnectivity types.Bool `tfsdk:"external_connectivity"` + Filter struct { WirelessNetworkID string `tfsdk:"wireless_network_id"` } `tfsdk:"filter"` @@ -40,6 +51,36 @@ func (d *wirelessNetworkDataSource) Schema(_ context.Context, _ datasource.Schem "id": schema.StringAttribute{ Computed: true, }, + "ssid": schema.StringAttribute{ + Computed: true, + }, + "alias": schema.StringAttribute{ + Computed: true, + }, + "ip_version": schema.StringAttribute{ + Computed: true, + }, + "security": schema.StringAttribute{ + Computed: true, + }, + "hidden": schema.BoolAttribute{ + Computed: true, + }, + "band_locking": schema.StringAttribute{ + Computed: true, + }, + "dns_lookup_domain": schema.StringAttribute{ + Computed: true, + }, + "disable_edns": schema.BoolAttribute{ + Computed: true, + }, + "use_dns64": schema.BoolAttribute{ + Computed: true, + }, + "external_connectivity": schema.BoolAttribute{ + Computed: true, + }, "filter": schema.SingleNestedAttribute{ Required: true, Attributes: map[string]schema.Attribute{ @@ -77,6 +118,16 @@ func (d *wirelessNetworkDataSource) Read(ctx context.Context, req datasource.Rea network := networkResponse.WirelessNetworks[0] state.ID = types.StringValue(network.Uid) + state.Ssid = types.StringValue(network.Ssid) + state.Alias = types.StringValue(network.Alias) + state.IpVersion = types.StringValue(network.IpVersion) + state.Security = types.StringValue(*network.Security.Get()) + state.Hidden = types.BoolValue(network.Hidden) + state.BandLocking = types.StringValue(network.BandLocking) + state.DnsLookupDomain = types.StringValue(*network.DnsLookupDomain.Get()) + state.DisableEdns = types.BoolValue(network.DisableEdns) + state.UseDns64 = types.BoolValue(network.UseDns64) + state.ExternalConnectivity = types.BoolValue(network.ExternalConnectivity) // Set state diags = resp.State.Set(ctx, &state) diff --git a/pkg/config-api-provider/test/data_source_wired_group_test.go b/pkg/config-api-provider/test/data_source_wired_group_test.go index 078f1b0c..257d3e6d 100644 --- a/pkg/config-api-provider/test/data_source_wired_group_test.go +++ b/pkg/config-api-provider/test/data_source_wired_group_test.go @@ -32,6 +32,14 @@ func TestWiredNetworkDataSource(t *testing.T) { `, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "id", "uid"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "alias", "alias"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "ip_version", "ip_version"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "security", "security"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "dns_lookup_domain", "dns_lookup_domain"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "disable_edns", "false"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "use_dns64", "false"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "external_connectivity", "false"), + resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "vlan_id", "123"), ), }, }, diff --git a/pkg/config-api-provider/test/data_source_wireless_group_test.go b/pkg/config-api-provider/test/data_source_wireless_group_test.go index ab3028ab..c2c79fb8 100644 --- a/pkg/config-api-provider/test/data_source_wireless_group_test.go +++ b/pkg/config-api-provider/test/data_source_wireless_group_test.go @@ -32,6 +32,16 @@ func TestWirelessNetworkDataSource(t *testing.T) { `, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "id", "uid"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "ssid", "ssid"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "alias", "alias"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "ip_version", "ip_version"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "security", "security"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "hidden", "false"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "band_locking", "band_locking"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "dns_lookup_domain", "dns_lookup_domain"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "disable_edns", "false"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "use_dns64", "false"), + resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "external_connectivity", "false"), ), }, },