Skip to content

Commit

Permalink
fix: rename alias and title to name
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 committed Oct 10, 2024
1 parent f3de22d commit bcd8225
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type wiredNetworkDataSource struct {

type wiredNetworkDataSourceModel struct {
ID types.String `tfsdk:"id"`
Alias types.String `tfsdk:"alias"`
Name types.String `tfsdk:"name"`
IpVersion types.String `tfsdk:"ip_version"`
Security types.String `tfsdk:"security"`
DnsLookupDomain types.String `tfsdk:"dns_lookup_domain"`
Expand All @@ -50,7 +50,7 @@ func (d *wiredNetworkDataSource) Schema(_ context.Context, _ datasource.SchemaRe
"id": schema.StringAttribute{
Computed: true,
},
"alias": schema.StringAttribute{
"name": schema.StringAttribute{
Computed: true,
},
"ip_version": schema.StringAttribute{
Expand Down Expand Up @@ -116,7 +116,7 @@ func (d *wiredNetworkDataSource) Read(ctx context.Context, req datasource.ReadRe

network := networkResponse.Items[0]
state.ID = types.StringValue(network.Id)
state.Alias = types.StringValue(network.Name)
state.Name = types.StringValue(network.Name)
state.IpVersion = types.StringValue(network.IpVersion)
state.Security = types.StringValue(*network.Security.Get())
state.DnsLookupDomain = types.StringValue(*network.DnsLookupDomain.Get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type wirelessNetworkDataSource struct {
type wirelessNetworkDataSourceModel struct {
ID types.String `tfsdk:"id"`
Ssid types.String `tfsdk:"ssid"`
Alias types.String `tfsdk:"alias"`
Name types.String `tfsdk:"name"`
IpVersion types.String `tfsdk:"ip_version"`
Security types.String `tfsdk:"security"`
Hidden types.Bool `tfsdk:"hidden"`
Expand Down Expand Up @@ -55,7 +55,7 @@ func (d *wirelessNetworkDataSource) Schema(_ context.Context, _ datasource.Schem
"ssid": schema.StringAttribute{
Computed: true,
},
"alias": schema.StringAttribute{
"name": schema.StringAttribute{
Computed: true,
},
"ip_version": schema.StringAttribute{
Expand Down Expand Up @@ -125,7 +125,7 @@ func (d *wirelessNetworkDataSource) Read(ctx context.Context, req datasource.Rea
network := networkResponse.Items[0]
state.ID = types.StringValue(network.Id)
state.Ssid = types.StringValue(network.Ssid)
state.Alias = types.StringValue(network.Name)
state.Name = types.StringValue(network.Name)
state.IpVersion = types.StringValue(network.IpVersion)
state.Security = types.StringValue(*network.Security.Get())
state.Hidden = types.BoolValue(network.Hidden)
Expand Down
12 changes: 6 additions & 6 deletions pkg/config-api-provider/provider/resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ var (
)

type serviceTestResourceModel struct {
ID types.String `tfsdk:"id"`
Title types.String `tfsdk:"title"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
}

// TODO: Switch this to use the Client Model when that becomes available
type ServiceTestResponseModel struct {
Uid string // <service_test_uid:str>,
Category string // <category:str>,
Title string // <title:str>,
Name string // <name:str>,
Target string // Nullable<<target:str>>,
Template string // <template:str>,
IsEnabled bool // <is_enabled:bool>
Expand All @@ -52,7 +52,7 @@ func (r *serviceTestResource) Schema(_ context.Context, _ resource.SchemaRequest
stringplanmodifier.UseStateForUnknown(),
},
},
"title": schema.StringAttribute{
"name": schema.StringAttribute{
Required: true,
},
},
Expand Down Expand Up @@ -82,7 +82,7 @@ func (r *serviceTestResource) Read(ctx context.Context, req resource.ReadRequest
response := GetServiceTest(state.ID.ValueString())

// Update state from client response
state.Title = types.StringValue(response.Title)
state.Name = types.StringValue(response.Name)

// Set refreshed state
diags = resp.State.Set(ctx, &state)
Expand Down Expand Up @@ -119,7 +119,7 @@ var GetServiceTest = func(uid string) ServiceTestResponseModel {
return ServiceTestResponseModel{
Uid: uid,
Category: "category",
Title: "title",
Name: "name",
Target: "target",
Template: "template",
IsEnabled: true,
Expand Down
8 changes: 4 additions & 4 deletions pkg/config-api-provider/provider/resources/wired_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ var (
)

type wiredNetworkResourceModel struct {
ID types.String `tfsdk:"id"`
Alias types.String `tfsdk:"alias"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
}

func NewWiredNetworkResource() resource.Resource {
Expand All @@ -45,7 +45,7 @@ func (r *wiredNetworkResource) Schema(_ context.Context, _ resource.SchemaReques
stringplanmodifier.UseStateForUnknown(),
},
},
"alias": schema.StringAttribute{
"name": schema.StringAttribute{
Required: true,
},
},
Expand Down Expand Up @@ -110,7 +110,7 @@ func (r *wiredNetworkResource) Read(ctx context.Context, req resource.ReadReques
network := networkResponse.Items[0]

// Update state from client response
state.Alias = types.StringValue(network.Name)
state.Name = types.StringValue(network.Name)

// Set refreshed state
diags = resp.State.Set(ctx, &state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ var (
)

type wirelessNetworkResourceModel struct {
ID types.String `tfsdk:"id"`
Alias types.String `tfsdk:"alias"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
}

func NewWirelessNetworkResource() resource.Resource {
Expand All @@ -45,7 +45,7 @@ func (r *wirelessNetworkResource) Schema(_ context.Context, _ resource.SchemaReq
stringplanmodifier.UseStateForUnknown(),
},
},
"alias": schema.StringAttribute{
"name": schema.StringAttribute{
Required: true,
},
},
Expand Down Expand Up @@ -110,7 +110,7 @@ func (r *wirelessNetworkResource) Read(ctx context.Context, req resource.ReadReq
network := networkResponse.Items[0]

// Update state from client response
state.Alias = types.StringValue(network.Name)
state.Name = types.StringValue(network.Name)

// Set refreshed state
diags = resp.State.Set(ctx, &state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ 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", "name", "name"),
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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ 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", "name", "name"),
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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand All @@ -155,7 +155,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
}
resource "uxi_wired_network" "my_network_2" {
alias = "alias_2"
name = "name_2"
}
import {
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
}
resource "uxi_wireless_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
}
resource "uxi_wireless_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand All @@ -377,7 +377,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
}
resource "uxi_wireless_network" "my_network_2" {
alias = "alias_2"
name = "name_2"
}
import {
Expand Down Expand Up @@ -504,7 +504,7 @@ func TestNetworkGroupAssignmentResource429Handling(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down Expand Up @@ -611,7 +611,7 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down Expand Up @@ -655,7 +655,7 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down Expand Up @@ -709,7 +709,7 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down Expand Up @@ -766,7 +766,7 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) {
}
resource "uxi_wired_network" "my_network" {
alias = "alias"
name = "name"
}
import {
Expand Down
8 changes: 4 additions & 4 deletions pkg/config-api-provider/test/resources/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestServiceTestResource(t *testing.T) {
{
Config: provider.ProviderConfig + `
resource "uxi_service_test" "my_service_test" {
title = "title"
name = "name"
}`,

ExpectError: regexp.MustCompile(`(?s)creating a service_test is not supported; service_tests can only be\s*imported`),
Expand All @@ -41,7 +41,7 @@ func TestServiceTestResource(t *testing.T) {
},
Config: provider.ProviderConfig + `
resource "uxi_service_test" "my_service_test" {
title = "title"
name = "name"
}
import {
Expand All @@ -50,7 +50,7 @@ func TestServiceTestResource(t *testing.T) {
}`,

Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("uxi_service_test.my_service_test", "title", "title"),
resource.TestCheckResourceAttr("uxi_service_test.my_service_test", "name", "name"),
resource.TestCheckResourceAttr("uxi_service_test.my_service_test", "id", "uid"),
),
},
Expand All @@ -64,7 +64,7 @@ func TestServiceTestResource(t *testing.T) {
{
Config: provider.ProviderConfig + `
resource "uxi_service_test" "my_service_test" {
title = "updated_title"
name = "updated_name"
}`,
ExpectError: regexp.MustCompile(`(?s)updating a service_test is not supported; service_tests can only be updated\s*through the dashboard`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) {
}
resource "uxi_service_test" "my_service_test" {
title = "title"
name = "name"
}
import {
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) {
}
resource "uxi_service_test" "my_service_test" {
title = "title"
name = "name"
}
import {
Expand All @@ -141,7 +141,7 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) {
}
resource "uxi_service_test" "my_service_test_2" {
title = "title_2"
name = "name_2"
}
import {
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) {
}
resource "uxi_service_test" "my_service_test" {
title = "title"
name = "name"
}
import {
Expand Down Expand Up @@ -331,7 +331,7 @@ func TestServiceTestGroupAssignmentResourceHttpErrorHandling(t *testing.T) {
}
resource "uxi_service_test" "my_service_test" {
title = "title"
name = "name"
}
import {
Expand Down
Loading

0 comments on commit bcd8225

Please sign in to comment.