Skip to content

Commit

Permalink
undo
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskuchin committed Nov 22, 2023
1 parent cb9149d commit 83baab1
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions internal/bowtie/resources/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,47 +269,47 @@ func (d *dnsResource) Read(ctx context.Context, req resource.ReadRequest, resp *
return
}

dns, err := d.client.GetDNS(state.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError(
"Failed communicating with the bowtie api",
"Unexpected error reading DNS settings: "+err.Error(),
)
return
}

state.Servers = []dnsServersResourceModel{}
for _, v := range dns.Servers {
state.Servers = append(state.Servers, dnsServersResourceModel{
ID: types.StringValue(v.ID),
Addr: types.StringValue(v.Addr),
Order: types.Int64Value(v.Order),
})
}

state.DNS64Exclude = []dnsExcludeResourceModel{}
for _, v := range dns.DNS64Exclude {
state.DNS64Exclude = append(state.DNS64Exclude, dnsExcludeResourceModel{
ID: types.StringValue(v.ID),
Name: types.StringValue(v.Name),
Order: types.Int64Value(v.Order),
})
}

includeSites, diags := types.ListValueFrom(ctx, types.StringType, dns.IncludeOnlySites)
if diags.HasError() {
return
}

state.IncludeOnlySites = includeSites

state.Name = types.StringValue(dns.Name)

state.IsCounted = types.BoolValue(dns.IsCounted)
state.IsDropA = types.BoolValue(dns.IsDropA)
state.IsDropAll = types.BoolValue(dns.IsDropAll)
state.IsLog = types.BoolValue(dns.IsLog)
state.IsSearchDomain = types.BoolValue(dns.IsSearchDomain)
// dns, err := d.client.GetDNS(state.ID.ValueString())
// if err != nil {
// resp.Diagnostics.AddError(
// "Failed communicating with the bowtie api",
// "Unexpected error reading DNS settings: "+err.Error(),
// )
// return
// }

// state.Servers = []dnsServersResourceModel{}
// for _, v := range dns.Servers {
// state.Servers = append(state.Servers, dnsServersResourceModel{
// ID: types.StringValue(v.ID),
// Addr: types.StringValue(v.Addr),
// Order: types.Int64Value(v.Order),
// })
// }

// state.DNS64Exclude = []dnsExcludeResourceModel{}
// for _, v := range dns.DNS64Exclude {
// state.DNS64Exclude = append(state.DNS64Exclude, dnsExcludeResourceModel{
// ID: types.StringValue(v.ID),
// Name: types.StringValue(v.Name),
// Order: types.Int64Value(v.Order),
// })
// }

// includeSites, diags := types.ListValueFrom(ctx, types.StringType, dns.IncludeOnlySites)
// if diags.HasError() {
// return
// }

// state.IncludeOnlySites = includeSites

// state.Name = types.StringValue(dns.Name)

// state.IsCounted = types.BoolValue(dns.IsCounted)
// state.IsDropA = types.BoolValue(dns.IsDropA)
// state.IsDropAll = types.BoolValue(dns.IsDropAll)
// state.IsLog = types.BoolValue(dns.IsLog)
// state.IsSearchDomain = types.BoolValue(dns.IsSearchDomain)

resp.Diagnostics.Append(resp.State.Set(ctx, state)...)
}
Expand Down

0 comments on commit 83baab1

Please sign in to comment.