Skip to content

Commit

Permalink
Introduce WorkspaceDataSourceModel
Browse files Browse the repository at this point in the history
  • Loading branch information
favoretti committed Nov 20, 2023
1 parent 57f5276 commit b8fec2f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/services/monitor/monitor_workspace_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ type WorkspaceDataSource struct{}

var _ sdk.DataSource = WorkspaceDataSource{}

type WorkspaceDataSourceModel struct {
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
QueryEndpoint string `tfschema:"query_endpoint"`
PublicNetworkAccessEnabled bool `tfschema:"public_network_access_enabled"`
Location string `tfschema:"location"`
Tags map[string]string `tfschema:"tags"`
}

func (d WorkspaceDataSource) ModelObject() interface{} {
return &WorkspaceDataSource{}
}
Expand Down Expand Up @@ -66,7 +75,7 @@ func (d WorkspaceDataSource) Read() sdk.ResourceFunc {
client := metadata.Client.Monitor.WorkspacesClient
subscriptionId := metadata.Client.Account.SubscriptionId

var state WorkspaceResourceModel
var state WorkspaceDataSourceModel
if err := metadata.Decode(&state); err != nil {
return fmt.Errorf("decoding: %+v", err)
}
Expand Down Expand Up @@ -101,7 +110,7 @@ func (d WorkspaceDataSource) Read() sdk.ResourceFunc {

metadata.SetID(id)

return metadata.Encode(&WorkspaceResourceModel{
return metadata.Encode(&WorkspaceDataSourceModel{
Location: location,
Name: id.AccountName,
PublicNetworkAccessEnabled: enablePublicNetWorkAccess,
Expand Down

0 comments on commit b8fec2f

Please sign in to comment.