diff --git a/provider/describer/account.go b/provider/describer/account.go index 0a2fc213..b4aded2a 100644 --- a/provider/describer/account.go +++ b/provider/describer/account.go @@ -83,12 +83,10 @@ func getDataLakeAnalyticsAccount(ctx context.Context, account *armdatalakeanalyt ID: *account.ID, Name: *account.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataLakeAnalyticsAccountDescription{ - DataLakeAnalyticsAccount: accountGetOp.Account, - DiagnosticSettingsResource: &accountListOp, - ResourceGroup: resourceGroup, - }, + Description: model.DataLakeAnalyticsAccountDescription{ + DataLakeAnalyticsAccount: accountGetOp.Account, + DiagnosticSettingsResource: &accountListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -162,12 +160,10 @@ func getDataLakeStore(ctx context.Context, account *armdatalakestore.AccountBasi ID: *account.ID, Name: name, Location: "", - Description: JSONAllFieldsMarshaller{ - Value: model.DataLakeStoreDescription{ - DataLakeStoreAccount: accountGetOp.Account, - DiagnosticSettingsResource: &accountListOp, - ResourceGroup: resourceGroup, - }, + Description: model.DataLakeStoreDescription{ + DataLakeStoreAccount: accountGetOp.Account, + DiagnosticSettingsResource: &accountListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/alertmanagement.go b/provider/describer/alertmanagement.go index 36a8b503..8704c150 100644 --- a/provider/describer/alertmanagement.go +++ b/provider/describer/alertmanagement.go @@ -46,11 +46,9 @@ func getAlertManagement(_ context.Context, alert *armalertsmanagement.Alert) *mo return &models.Resource{ ID: *alert.ID, Name: *alert.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.AlertManagementDescription{ - Alert: *alert, - ResourceGroup: resourceGroup, - }, + Description: model.AlertManagementDescription{ + Alert: *alert, + ResourceGroup: resourceGroup, }, } } diff --git a/provider/describer/analysis.go b/provider/describer/analysis.go index f35c66d2..2b84da88 100644 --- a/provider/describer/analysis.go +++ b/provider/describer/analysis.go @@ -45,11 +45,9 @@ func getAnalysisService(ctx context.Context, server *armanalysisservices.Server) ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AnalysisServiceServerDescription{ - Server: *server, - ResourceGroup: resourceGroupName, - }, + Description: model.AnalysisServiceServerDescription{ + Server: *server, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/apimanagement.go b/provider/describer/apimanagement.go index 24e847fd..8adda815 100644 --- a/provider/describer/apimanagement.go +++ b/provider/describer/apimanagement.go @@ -66,12 +66,10 @@ func getAPIMangement(ctx context.Context, diagnosticClient *armmonitor.Diagnosti ID: *apiManagement.ID, Name: *apiManagement.Name, Location: *apiManagement.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.APIManagementDescription{ - APIManagement: *apiManagement, - DiagnosticSettingsResources: &op, - ResourceGroup: resourceGroup, - }, + Description: model.APIManagementDescription{ + APIManagement: *apiManagement, + DiagnosticSettingsResources: &op, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -141,12 +139,10 @@ func GetAPIManagementBackend(ctx context.Context, service *armapimanagement.Serv resource := models.Resource{ ID: *backend.ID, Name: *backend.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.APIManagementBackendDescription{ - APIManagementBackend: *backend, - ServiceName: *service.Name, - ResourceGroup: resourceGroup, - }, + Description: model.APIManagementBackendDescription{ + APIManagementBackend: *backend, + ServiceName: *service.Name, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/appconfiguration.go b/provider/describer/appconfiguration.go index 2cb39e79..2c8c9fe1 100644 --- a/provider/describer/appconfiguration.go +++ b/provider/describer/appconfiguration.go @@ -66,12 +66,10 @@ func getAppConfiguration(ctx context.Context, diagnosticClient *armmonitor.Diagn ID: *config.ID, Name: *config.Name, Location: *config.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AppConfigurationDescription{ - ConfigurationStore: *config, - DiagnosticSettingsResources: &op, - ResourceGroup: resourceGroup, - }, + Description: model.AppConfigurationDescription{ + ConfigurationStore: *config, + DiagnosticSettingsResources: &op, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/applicationinsights.go b/provider/describer/applicationinsights.go index 2b673281..ce937464 100644 --- a/provider/describer/applicationinsights.go +++ b/provider/describer/applicationinsights.go @@ -44,11 +44,9 @@ func GetApplicationInsights(ctx context.Context, component *armapplicationinsigh ID: *component.ID, Name: *component.Name, Location: *component.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ApplicationInsightsComponentDescription{ - Component: *component, - ResourceGroup: resourceGroup, - }, + Description: model.ApplicationInsightsComponentDescription{ + Component: *component, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/appplatform.go b/provider/describer/appplatform.go index 60f8321c..24c50b23 100644 --- a/provider/describer/appplatform.go +++ b/provider/describer/appplatform.go @@ -69,13 +69,11 @@ func getSpringCloudService(ctx context.Context, service *armspringappdiscovery.S ID: *service.ID, Name: *service.Name, Location: *site.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SpringCloudServiceDescription{ - App: *service, - Site: site, - DiagnosticSettingsResource: nil, // TODO: Arta fix this =))) - ResourceGroup: resourceGroup, - }, + Description: model.SpringCloudServiceDescription{ + App: *service, + Site: site, + DiagnosticSettingsResource: nil, // TODO: Arta fix this =))) + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/authorization.go b/provider/describer/authorization.go index 7697f548..465dc95b 100644 --- a/provider/describer/authorization.go +++ b/provider/describer/authorization.go @@ -47,10 +47,8 @@ func getRoleAssignment(ctx context.Context, v *armauthorization.RoleAssignment) ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.RoleAssignmentDescription{ - RoleAssignment: *v, - }, + Description: model.RoleAssignmentDescription{ + RoleAssignment: *v, }, } } @@ -87,10 +85,8 @@ func getRoleDefinition(ctx context.Context, v *armauthorization.RoleDefinition) ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.RoleDefinitionDescription{ - RoleDefinition: *v, - }, + Description: model.RoleDefinitionDescription{ + RoleDefinition: *v, }, } } @@ -133,11 +129,9 @@ func getPolicyDefinition(ctx context.Context, subscription string, definition *a ID: *definition.ID, Name: *definition.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.PolicyDefinitionDescription{ - Definition: *definition, - TurboData: turbotData, - }, + Description: model.PolicyDefinitionDescription{ + Definition: *definition, + TurboData: turbotData, }, } } @@ -175,17 +169,15 @@ func UserEffectiveAccess(ctx context.Context, cred *azidentity.ClientSecretCrede ID: id, Name: *roleAssignment.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.UserEffectiveAccessDescription{ - RoleAssignment: *roleAssignment, - PrincipalName: *m.GetDisplayName(), - PrincipalId: *m.GetId(), - PrincipalType: armauthorization.PrincipalTypeUser, - Scope: *roleAssignment.Properties.Scope, - ScopeType: getScopeType(*roleAssignment.Properties.Scope), - AssignmentType: "GroupAssignment", - ParentPrincipalId: roleAssignment.Properties.PrincipalID, - }, + Description: model.UserEffectiveAccessDescription{ + RoleAssignment: *roleAssignment, + PrincipalName: *m.GetDisplayName(), + PrincipalId: *m.GetId(), + PrincipalType: armauthorization.PrincipalTypeUser, + Scope: *roleAssignment.Properties.Scope, + ScopeType: getScopeType(*roleAssignment.Properties.Scope), + AssignmentType: "GroupAssignment", + ParentPrincipalId: roleAssignment.Properties.PrincipalID, }, } if stream != nil { @@ -209,17 +201,15 @@ func UserEffectiveAccess(ctx context.Context, cred *azidentity.ClientSecretCrede ID: id, Name: *roleAssignment.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.UserEffectiveAccessDescription{ - RoleAssignment: *roleAssignment, - PrincipalId: *roleAssignment.Properties.PrincipalID, - PrincipalName: *user.GetDisplayName(), - PrincipalType: armauthorization.PrincipalTypeUser, - Scope: *roleAssignment.Properties.Scope, - ScopeType: getScopeType(*roleAssignment.Properties.Scope), - AssignmentType: "Explicit", - ParentPrincipalId: nil, - }, + Description: model.UserEffectiveAccessDescription{ + RoleAssignment: *roleAssignment, + PrincipalId: *roleAssignment.Properties.PrincipalID, + PrincipalName: *user.GetDisplayName(), + PrincipalType: armauthorization.PrincipalTypeUser, + Scope: *roleAssignment.Properties.Scope, + ScopeType: getScopeType(*roleAssignment.Properties.Scope), + AssignmentType: "Explicit", + ParentPrincipalId: nil, }, } if stream != nil { @@ -242,17 +232,15 @@ func UserEffectiveAccess(ctx context.Context, cred *azidentity.ClientSecretCrede ID: id, Name: *roleAssignment.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.UserEffectiveAccessDescription{ - RoleAssignment: *roleAssignment, - PrincipalId: *roleAssignment.Properties.PrincipalID, - PrincipalName: *spn.GetDisplayName(), - PrincipalType: armauthorization.PrincipalTypeServicePrincipal, - Scope: *roleAssignment.Properties.Scope, - ScopeType: getScopeType(*roleAssignment.Properties.Scope), - AssignmentType: "Explicit", - ParentPrincipalId: nil, - }, + Description: model.UserEffectiveAccessDescription{ + RoleAssignment: *roleAssignment, + PrincipalId: *roleAssignment.Properties.PrincipalID, + PrincipalName: *spn.GetDisplayName(), + PrincipalType: armauthorization.PrincipalTypeServicePrincipal, + Scope: *roleAssignment.Properties.Scope, + ScopeType: getScopeType(*roleAssignment.Properties.Scope), + AssignmentType: "Explicit", + ParentPrincipalId: nil, }, } if stream != nil { diff --git a/provider/describer/automation.go b/provider/describer/automation.go index a4815087..d07e51f7 100644 --- a/provider/describer/automation.go +++ b/provider/describer/automation.go @@ -47,11 +47,9 @@ func getAutomationAccount(ctx context.Context, account *armautomation.Account) * ID: *account.ID, Name: *account.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AutomationAccountsDescription{ - Automation: *account, - ResourceGroup: resourceGroup, - }, + Description: model.AutomationAccountsDescription{ + Automation: *account, + ResourceGroup: resourceGroup, }, } return &resource @@ -116,12 +114,10 @@ func GetAutomationVariable(ctx context.Context, account *armautomation.Account, resource := models.Resource{ ID: *v.ID, Name: *v.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.AutomationVariablesDescription{ - Automation: *v, - AccountName: *account.Name, - ResourceGroup: resourceGroup, - }, + Description: model.AutomationVariablesDescription{ + Automation: *v, + AccountName: *account.Name, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/batch.go b/provider/describer/batch.go index 1a9c2b04..251d6ed4 100644 --- a/provider/describer/batch.go +++ b/provider/describer/batch.go @@ -71,12 +71,10 @@ func getBatchAccount(ctx context.Context, account *armbatch.Account, diagnosticC ID: *account.ID, Name: *account.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.BatchAccountDescription{ - Account: *account, - DiagnosticSettingsResources: &batchListOp, - ResourceGroup: resourceGroup, - }, + Description: model.BatchAccountDescription{ + Account: *account, + DiagnosticSettingsResources: &batchListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/blueprint.go b/provider/describer/blueprint.go index 6b01f7b2..ea40bb71 100644 --- a/provider/describer/blueprint.go +++ b/provider/describer/blueprint.go @@ -57,7 +57,7 @@ func BlueprintArtifact(ctx context.Context, cred *azidentity.ClientSecretCredent func getBluePrintArtifact(ctx context.Context, v armblueprint.ArtifactClassification) *models.Resource { return &models.Resource{ ID: *v.GetArtifact().ID, - Description: JSONAllFieldsMarshaller{Value: v.GetArtifact()}, + Description: v.GetArtifact(), } } @@ -94,9 +94,9 @@ func getBlueprintBlueprint(ctx context.Context, blueprint *armblueprint.Blueprin resourceGroupName := strings.Split(*blueprint.ID, "/")[4] return &models.Resource{ ID: *blueprint.ID, - Description: JSONAllFieldsMarshaller{Value: model.BlueprintDescription{ + Description: model.BlueprintDescription{ Blueprint: *blueprint, ResourceGroup: resourceGroupName, - }}, + }, } } diff --git a/provider/describer/botservice.go b/provider/describer/botservice.go index c2e750a8..1b458ab4 100644 --- a/provider/describer/botservice.go +++ b/provider/describer/botservice.go @@ -43,9 +43,9 @@ func getBotServiceBot(ctx context.Context, bot *armbotservice.Bot) *models.Resou resourceGroupName := strings.Split(string(*bot.ID), "/")[4] return &models.Resource{ ID: *bot.ID, - Description: JSONAllFieldsMarshaller{Value: model.BotServiceBotDescription{ + Description: model.BotServiceBotDescription{ Bot: *bot, ResourceGroup: resourceGroupName, - }}, + }, } } diff --git a/provider/describer/cdn.go b/provider/describer/cdn.go index 311d9b7d..7b042cec 100644 --- a/provider/describer/cdn.go +++ b/provider/describer/cdn.go @@ -45,11 +45,9 @@ func getCdnProfiles(ctx context.Context, v *armcdn.Profile) *models.Resource { ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.CDNProfileDescription{ - Profile: *v, - ResourceGroup: resourceGroup, - }, + Description: model.CDNProfileDescription{ + Profile: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -114,11 +112,9 @@ func getCdnEndpoint(ctx context.Context, v *armcdn.Profile, endpoint *armcdn.End ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.CDNEndpointDescription{ - Endpoint: *endpoint, - ResourceGroup: resourceGroup, - }, + Description: model.CDNEndpointDescription{ + Endpoint: *endpoint, + ResourceGroup: resourceGroup, }, } } diff --git a/provider/describer/cognitiveservices.go b/provider/describer/cognitiveservices.go index 97414be0..80f90c0e 100644 --- a/provider/describer/cognitiveservices.go +++ b/provider/describer/cognitiveservices.go @@ -63,10 +63,10 @@ func getCognitiveAccount(ctx context.Context, diagnosticsClient *armmonitor.Diag } return &models.Resource{ ID: *account.ID, - Description: JSONAllFieldsMarshaller{Value: model.CognitiveAccountDescription{ + Description: model.CognitiveAccountDescription{ Account: *account, DiagnosticSettingsResources: diagnosticSettings, ResourceGroup: resourceGroupName, - }}, + }, }, nil } diff --git a/provider/describer/compute.go b/provider/describer/compute.go index 0d6d67b5..c5550aab 100644 --- a/provider/describer/compute.go +++ b/provider/describer/compute.go @@ -51,11 +51,9 @@ func getComputeDisk(ctx context.Context, v *armcompute.Disk) *models.Resource { ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskDescription{ - Disk: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeDiskDescription{ + Disk: *v, + ResourceGroup: resourceGroup, }, } } @@ -95,11 +93,9 @@ func getComputeDiskAccess(ctx context.Context, v *armcompute.DiskAccess) *models ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskAccessDescription{ - DiskAccess: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeDiskAccessDescription{ + DiskAccess: *v, + ResourceGroup: resourceGroup, }, } } @@ -155,12 +151,10 @@ func getComputeVirtualMachineScaleSet(ctx context.Context, clientExtension *armc ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineScaleSetDescription{ - VirtualMachineScaleSet: *v, - VirtualMachineScaleSetExtensions: op, - ResourceGroup: resourceGroupName, - }, + Description: model.ComputeVirtualMachineScaleSetDescription{ + VirtualMachineScaleSet: *v, + VirtualMachineScaleSetExtensions: op, + ResourceGroup: resourceGroupName, }, } return &resource, nil @@ -220,12 +214,10 @@ func getComputeVirtualMachineScaleSetNetworkInterface(ctx context.Context, vm *a ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineScaleSetNetworkInterfaceDescription{ - VirtualMachineScaleSet: *vm, - NetworkInterface: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.ComputeVirtualMachineScaleSetNetworkInterfaceDescription{ + VirtualMachineScaleSet: *vm, + NetworkInterface: *v, + ResourceGroup: resourceGroupName, }, } return &resource @@ -279,13 +271,11 @@ func getComputeVirtualMachineScaleSetVm(ctx context.Context, vm *armcompute.Virt ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineScaleSetVmDescription{ - VirtualMachineScaleSet: *vm, - ScaleSetVM: *v, - PowerState: powerState, - ResourceGroup: resourceGroupName, - }, + Description: model.ComputeVirtualMachineScaleSetVmDescription{ + VirtualMachineScaleSet: *vm, + ScaleSetVM: *v, + PowerState: powerState, + ResourceGroup: resourceGroupName, }, } return &resource @@ -442,17 +432,15 @@ func getComputeVirtualMachine(ctx context.Context, vmClient *armcompute.VirtualM ID: *virtualMachine.ID, Name: *virtualMachine.Name, Location: *virtualMachine.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineDescription{ - VirtualMachine: *virtualMachine, - VirtualMachineInstanceView: computeInstanceViewOp.VirtualMachineInstanceView, - InterfaceIPConfigurations: ipConfigs, - PublicIPs: publicIPs, - VirtualMachineExtension: computeListOp.Value, - ExtensionsSettings: extensionsSettings, - Assignments: &configurationListOp, - ResourceGroup: resourceGroupName, - }, + Description: model.ComputeVirtualMachineDescription{ + VirtualMachine: *virtualMachine, + VirtualMachineInstanceView: computeInstanceViewOp.VirtualMachineInstanceView, + InterfaceIPConfigurations: ipConfigs, + PublicIPs: publicIPs, + VirtualMachineExtension: computeListOp.Value, + ExtensionsSettings: extensionsSettings, + Assignments: &configurationListOp, + ResourceGroup: resourceGroupName, }, } return &resource, nil @@ -493,11 +481,9 @@ func getComputeSnapshot(ctx context.Context, snapshot *armcompute.Snapshot) *mod ID: *snapshot.ID, Name: *snapshot.Name, Location: *snapshot.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeSnapshotsDescription{ - ResourceGroup: resourceGroupName, - Snapshot: *snapshot, - }, + Description: model.ComputeSnapshotsDescription{ + ResourceGroup: resourceGroupName, + Snapshot: *snapshot, }, } return &resource @@ -538,11 +524,9 @@ func getComputeAvailabilitySet(ctx context.Context, availabilitySet *armcompute. ID: *availabilitySet.ID, Name: *availabilitySet.Name, Location: *availabilitySet.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeAvailabilitySetDescription{ - ResourceGroup: resourceGroupName, - AvailabilitySet: *availabilitySet, - }, + Description: model.ComputeAvailabilitySetDescription{ + ResourceGroup: resourceGroupName, + AvailabilitySet: *availabilitySet, }, } return &resource @@ -583,11 +567,9 @@ func getComputeDiskEncryptionSet(ctx context.Context, diskEncryptionSet *armcomp ID: *diskEncryptionSet.ID, Name: *diskEncryptionSet.Name, Location: *diskEncryptionSet.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskEncryptionSetDescription{ - ResourceGroup: resourceGroupName, - DiskEncryptionSet: *diskEncryptionSet, - }, + Description: model.ComputeDiskEncryptionSetDescription{ + ResourceGroup: resourceGroupName, + DiskEncryptionSet: *diskEncryptionSet, }, } return &resource @@ -628,11 +610,9 @@ func getComputeGallery(ctx context.Context, gallery *armcompute.Gallery) *models ID: *gallery.ID, Name: *gallery.Name, Location: *gallery.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeImageGalleryDescription{ - ResourceGroup: resourceGroupName, - ImageGallery: *gallery, - }, + Description: model.ComputeImageGalleryDescription{ + ResourceGroup: resourceGroupName, + ImageGallery: *gallery, }, } return &resource @@ -672,11 +652,9 @@ func getComputeImage(ctx context.Context, v *armcompute.Image) *models.Resource ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeImageDescription{ - Image: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeImageDescription{ + Image: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -716,11 +694,9 @@ func getComputeHostGroup(ctx context.Context, v *armcompute.DedicatedHostGroup) ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeHostGroupDescription{ - HostGroup: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeHostGroupDescription{ + HostGroup: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -775,11 +751,9 @@ func getComputeHostsByGroup(ctx context.Context, hostClient *armcompute.Dedicate ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeHostGroupHostDescription{ - Host: *host, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeHostGroupHostDescription{ + Host: *host, + ResourceGroup: resourceGroup, }, } resources = append(resources, resource) @@ -822,11 +796,9 @@ func getComputeResourcePointCollection(ctx context.Context, v *armcompute.Restor ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeRestorePointCollectionDescription{ - RestorePointCollection: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeRestorePointCollectionDescription{ + RestorePointCollection: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -866,11 +838,9 @@ func getComputeSSHPublicKey(ctx context.Context, v *armcompute.SSHPublicKeyResou ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeSSHPublicKeyDescription{ - SSHPublicKey: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ComputeSSHPublicKeyDescription{ + SSHPublicKey: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -927,10 +897,8 @@ func getComputeDiskReadOps(ctx context.Context, cred *azidentity.ClientSecretCre ID: fmt.Sprintf("%s_readops", *disk.ID), Name: fmt.Sprintf("%s readops", *disk.Name), Location: *disk.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskReadOpsDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeDiskReadOpsDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -989,10 +957,8 @@ func getComputeDiskReadOpsDaily(ctx context.Context, cred *azidentity.ClientSecr ID: fmt.Sprintf("%s_readops_daily", *disk.ID), Name: fmt.Sprintf("%s readops-daily", *disk.Name), Location: *disk.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskReadOpsDailyDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeDiskReadOpsDailyDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1050,10 +1016,8 @@ func getComputeDiskReadOpsHourly(ctx context.Context, cred *azidentity.ClientSec ID: fmt.Sprintf("%s_readops_hourly", *disk.ID), Name: fmt.Sprintf("%s readops-hourly", *disk.Name), Location: *disk.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskReadOpsHourlyDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeDiskReadOpsHourlyDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1112,10 +1076,8 @@ func getComputeDiskWriteOps(ctx context.Context, cred *azidentity.ClientSecretCr ID: fmt.Sprintf("%s_writeops", *disk.ID), Name: fmt.Sprintf("%s writeops", *disk.Name), Location: *disk.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskReadOpsDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeDiskReadOpsDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1174,10 +1136,8 @@ func getComputeDiskWriteOpsDaily(ctx context.Context, cred *azidentity.ClientSec ID: fmt.Sprintf("%s_writeops_daily", *disk.ID), Name: fmt.Sprintf("%s writeops-daily", *disk.Name), Location: *disk.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskReadOpsDailyDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeDiskReadOpsDailyDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1235,10 +1195,8 @@ func getComputeDiskWriteOpsHourly(ctx context.Context, cred *azidentity.ClientSe ID: fmt.Sprintf("%s_writeops_hourly", *disk.ID), Name: fmt.Sprintf("%s writeops-hourly", *disk.Name), Location: *disk.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeDiskReadOpsHourlyDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeDiskReadOpsHourlyDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1276,10 +1234,8 @@ func ComputeResourceSKU(ctx context.Context, cred *azidentity.ClientSecretCreden func getComputeResourceSKU(ctx context.Context, subscription string, resourceSku *armcompute.ResourceSKU) *models.Resource { resource := models.Resource{ - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeResourceSKUDescription{ - ResourceSKU: *resourceSku, - }, + Description: model.ComputeResourceSKUDescription{ + ResourceSKU: *resourceSku, }, } if resourceSku.Locations != nil && len(resourceSku.Locations) > 0 { @@ -1345,10 +1301,8 @@ func getComputeVirtualMachineCpuUtilization(ctx context.Context, cred *azidentit ID: fmt.Sprintf("%s_cpu_utilization", *virtualMachine.ID), Name: fmt.Sprintf("%s cpu-utilization", *virtualMachine.Name), Location: *virtualMachine.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineCpuUtilizationDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeVirtualMachineCpuUtilizationDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1407,10 +1361,8 @@ func getComputeVirtualMachineCpuUtilizationDaily(ctx context.Context, cred *azid ID: fmt.Sprintf("%s_cpu_utilization_daily", *virtualMachine.ID), Name: fmt.Sprintf("%s cpu-utilization-daily", *virtualMachine.Name), Location: *virtualMachine.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineCpuUtilizationDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeVirtualMachineCpuUtilizationDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1469,10 +1421,8 @@ func getComputeVirtualMachineCpuUtilizationHourly(ctx context.Context, cred *azi ID: fmt.Sprintf("%s_cpu_utilization_hourly", *virtualMachine.ID), Name: fmt.Sprintf("%s cpu-utilization-hourly", *virtualMachine.Name), Location: *virtualMachine.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeVirtualMachineCpuUtilizationDescription{ - MonitoringMetric: metric, - }, + Description: model.ComputeVirtualMachineCpuUtilizationDescription{ + MonitoringMetric: metric, }, } values = append(values, resource) @@ -1513,10 +1463,8 @@ func getComputeCloudServices(ctx context.Context, v *armcompute.CloudService) *m ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ComputeCloudServiceDescription{ - CloudService: *v, - }, + Description: model.ComputeCloudServiceDescription{ + CloudService: *v, }, } return &resource diff --git a/provider/describer/containerinstance.go b/provider/describer/containerinstance.go index db55315e..b7e309c1 100644 --- a/provider/describer/containerinstance.go +++ b/provider/describer/containerinstance.go @@ -44,11 +44,9 @@ func getContainerInstanceContainerGrou(ctx context.Context, v *armcontainerinsta ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ContainerInstanceContainerGroupDescription{ - ContainerGroup: *v, - ResourceGroup: resourceGroup, - }, + Description: model.ContainerInstanceContainerGroupDescription{ + ContainerGroup: *v, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/containerregistry.go b/provider/describer/containerregistry.go index b6a7cfd7..38ddec36 100644 --- a/provider/describer/containerregistry.go +++ b/provider/describer/containerregistry.go @@ -72,14 +72,12 @@ func getContainerRegistry(ctx context.Context, client *armcontainerregistry.Regi ID: *registry.ID, Name: *registry.Name, Location: *registry.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ContainerRegistryDescription{ - Registry: *registry, - RegistryListCredentialsResult: containerRegistryListCredentialsOp, - RegistryUsages: containerRegistryListUsagesOp.Value, - Webhooks: webhooks, - ResourceGroup: resourceGroup, - }, + Description: model.ContainerRegistryDescription{ + Registry: *registry, + RegistryListCredentialsResult: containerRegistryListCredentialsOp, + RegistryUsages: containerRegistryListUsagesOp.Value, + Webhooks: webhooks, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/containerservice.go b/provider/describer/containerservice.go index 3971dce0..c897f948 100644 --- a/provider/describer/containerservice.go +++ b/provider/describer/containerservice.go @@ -45,11 +45,9 @@ func getKubernatesCluster(ctx context.Context, v *armcontainerservice.ManagedClu ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KubernetesClusterDescription{ - ManagedCluster: *v, - ResourceGroup: resourceGroup, - }, + Description: model.KubernetesClusterDescription{ + ManagedCluster: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -103,10 +101,8 @@ func getKubernatesService(ctx context.Context, location *armsubscriptions.Locati Name: *v.Version, Type: *v.Version, Location: *location.ID, - Description: JSONAllFieldsMarshaller{ - Value: model.KubernetesServiceVersionDescription{ - Version: *v, - }, + Description: model.KubernetesServiceVersionDescription{ + Version: *v, }, } return &resource diff --git a/provider/describer/cost.go b/provider/describer/cost.go index 01a819a3..9310d936 100644 --- a/provider/describer/cost.go +++ b/provider/describer/cost.go @@ -154,11 +154,9 @@ func DailyCostByResourceType(ctx context.Context, cred *azidentity.ClientSecretC resource := models.Resource{ ID: fmt.Sprintf("resource-cost-%s/%s-%d", subscription, *row.ServiceName, row.UsageDate), Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CostManagementCostByResourceTypeDescription{ - CostManagementCostByResourceType: row, - CostDateMillis: costDate.UnixMilli(), - }, + Description: model.CostManagementCostByResourceTypeDescription{ + CostManagementCostByResourceType: row, + CostDateMillis: costDate.UnixMilli(), }, } if stream != nil { @@ -194,10 +192,8 @@ func DailyCostBySubscription(ctx context.Context, cred *azidentity.ClientSecretC resource := models.Resource{ ID: fmt.Sprintf("resource-cost-%s/%d", subscription, row.UsageDate), Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CostManagementCostBySubscriptionDescription{ - CostManagementCostBySubscription: row, - }, + Description: model.CostManagementCostBySubscriptionDescription{ + CostManagementCostBySubscription: row, }, } if stream != nil { diff --git a/provider/describer/dashboard.go b/provider/describer/dashboard.go index a661cc96..1369d962 100644 --- a/provider/describer/dashboard.go +++ b/provider/describer/dashboard.go @@ -44,11 +44,9 @@ func getDashboardGrafana(ctx context.Context, v *armdashboard.ManagedGrafana) *m ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DashboardGrafanaDescription{ - Grafana: *v, - ResourceGroup: resourceGroup, - }, + Description: model.DashboardGrafanaDescription{ + Grafana: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/databoxedge.go b/provider/describer/databoxedge.go index 913cee2d..9d99d05d 100644 --- a/provider/describer/databoxedge.go +++ b/provider/describer/databoxedge.go @@ -44,11 +44,9 @@ func getDataboxEdgeDevice(ctx context.Context, v *armdataboxedge.Device) *models ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataboxEdgeDeviceDescription{ - Device: *v, - ResourceGroup: resourceGroup, - }, + Description: model.DataboxEdgeDeviceDescription{ + Device: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/databricks.go b/provider/describer/databricks.go index 5478e6ad..39ec50aa 100644 --- a/provider/describer/databricks.go +++ b/provider/describer/databricks.go @@ -45,11 +45,9 @@ func getDatabricksWorkspace(ctx context.Context, v *armdatabricks.Workspace) *mo ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DatabricksWorkspaceDescription{ - Workspace: *v, - ResourceGroup: resourceGroup, - }, + Description: model.DatabricksWorkspaceDescription{ + Workspace: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/datafactory.go b/provider/describer/datafactory.go index 1dbb3be9..19cd6294 100644 --- a/provider/describer/datafactory.go +++ b/provider/describer/datafactory.go @@ -62,12 +62,10 @@ func getDataFactory(ctx context.Context, connClient *armdatafactory.PrivateEndPo ID: *factory.ID, Name: *factory.Name, Location: *factory.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataFactoryDescription{ - Factory: *factory, - PrivateEndPointConnections: datafactoryListByFactoryOp, - ResourceGroup: resourceGroup, - }, + Description: model.DataFactoryDescription{ + Factory: *factory, + PrivateEndPointConnections: datafactoryListByFactoryOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -126,12 +124,10 @@ func getDataFactoryDataset(ctx context.Context, client *armdatafactory.DatasetsC ID: *dataset.ID, Name: *dataset.Name, Location: *factory.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataFactoryDatasetDescription{ - Factory: *factory, - Dataset: *dataset, - ResourceGroup: factoryResourceGroup, - }, + Description: model.DataFactoryDatasetDescription{ + Factory: *factory, + Dataset: *dataset, + ResourceGroup: factoryResourceGroup, }, } values = append(values, resource) @@ -194,12 +190,10 @@ func getDataFactoryPipeline(ctx context.Context, client *armdatafactory.Pipeline ID: *pipeline.ID, Name: *pipeline.Name, Location: *factory.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataFactoryPipelineDescription{ - Factory: *factory, - Pipeline: *pipeline, - ResourceGroup: factoryResourceGroup, - }, + Description: model.DataFactoryPipelineDescription{ + Factory: *factory, + Pipeline: *pipeline, + ResourceGroup: factoryResourceGroup, }, } values = append(values, resource) diff --git a/provider/describer/datamigration.go b/provider/describer/datamigration.go index 1486aefc..b31b3579 100644 --- a/provider/describer/datamigration.go +++ b/provider/describer/datamigration.go @@ -45,11 +45,9 @@ func getDataMigrationService(ctx context.Context, v *armdatamigration.Service) * ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataMigrationServiceDescription{ - Service: *v, - ResourceGroup: resourceGroup, - }, + Description: model.DataMigrationServiceDescription{ + Service: *v, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/dataprotection.go b/provider/describer/dataprotection.go index 73e06c42..9e06674d 100644 --- a/provider/describer/dataprotection.go +++ b/provider/describer/dataprotection.go @@ -44,11 +44,9 @@ func getDataProtectionBackupVaults(ctx context.Context, v *armdataprotection.Bac ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataProtectionBackupVaultsDescription{ - BackupVaults: *v, - ResourceGroup: resourceGroup, - }, + Description: model.DataProtectionBackupVaultsDescription{ + BackupVaults: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -106,11 +104,9 @@ func getDataProtectionBackupVaultsBackupPolicies(ctx context.Context, client *ar ID: *p.ID, Name: *p.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DataProtectionBackupVaultsBackupPoliciesDescription{ - BackupPolicies: *p, - ResourceGroup: resourceGroup, - }, + Description: model.DataProtectionBackupVaultsBackupPoliciesDescription{ + BackupPolicies: *p, + ResourceGroup: resourceGroup, }, } values = append(values, resource) @@ -184,12 +180,10 @@ func GetDataPotectionJob(ctx context.Context, vault *armdataprotection.BackupVau resource := models.Resource{ ID: *job.ID, Name: *job.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.DataProtectionJobDescription{ - DataProtectionJob: *job, - VaultName: *vault.Name, - ResourceGroup: resourceGroup, - }, + Description: model.DataProtectionJobDescription{ + DataProtectionJob: *job, + VaultName: *vault.Name, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/desktopvirtualization.go b/provider/describer/desktopvirtualization.go index 04ba9cfe..5aa1c1c9 100644 --- a/provider/describer/desktopvirtualization.go +++ b/provider/describer/desktopvirtualization.go @@ -28,11 +28,9 @@ func DesktopVirtualizationWorkspaces(ctx context.Context, cred *azidentity.Clien ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DesktopVirtualizationWorkspaceDescription{ - Workspace: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.DesktopVirtualizationWorkspaceDescription{ + Workspace: *v, + ResourceGroup: resourceGroupName, }, } if stream != nil { @@ -79,11 +77,9 @@ func getDesktopVirtualizationHostPool(ctx context.Context, v *armdesktopvirtuali ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DesktopVirtualizationHostPoolDescription{ - HostPool: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.DesktopVirtualizationHostPoolDescription{ + HostPool: *v, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/devices.go b/provider/describer/devices.go index 1a7f7108..ceffb2b3 100644 --- a/provider/describer/devices.go +++ b/provider/describer/devices.go @@ -64,7 +64,7 @@ func getDevicesProvisioningServicesCertificates(ctx context.Context, client *arm ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{Value: v}, + Description: v, } values = append(values, resource) } @@ -150,12 +150,10 @@ func getIOTHub(ctx context.Context, client *armmonitor.DiagnosticSettingsClient, ID: *iotHubDescription.ID, Name: *iotHubDescription.Name, Location: *iotHubDescription.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.IOTHubDescription{ - IotHubDescription: *iotHubDescription, - DiagnosticSettingsResources: &devicesListOp, - ResourceGroup: resourceGroup, - }, + Description: model.IOTHubDescription{ + IotHubDescription: *iotHubDescription, + DiagnosticSettingsResources: &devicesListOp, + ResourceGroup: resourceGroup, }, } @@ -220,12 +218,10 @@ func getIOTHubDps(ctx context.Context, client *armmonitor.DiagnosticSettingsClie ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.IOTHubDpsDescription{ - IotHubDps: *v, - DiagnosticSettingsResources: &devicesListOp, - ResourceGroup: resourceGroup, - }, + Description: model.IOTHubDpsDescription{ + IotHubDps: *v, + DiagnosticSettingsResources: &devicesListOp, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/devtestlabs.go b/provider/describer/devtestlabs.go index c1dff17f..708c7a2e 100644 --- a/provider/describer/devtestlabs.go +++ b/provider/describer/devtestlabs.go @@ -44,11 +44,9 @@ func getDevTestLabLab(ctx context.Context, v *armdevtestlabs.Lab) *models.Resour ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DevTestLabLabDescription{ - Lab: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.DevTestLabLabDescription{ + Lab: *v, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/documentdb.go b/provider/describer/documentdb.go index 93a78bcf..a5b6a346 100644 --- a/provider/describer/documentdb.go +++ b/provider/describer/documentdb.go @@ -69,12 +69,10 @@ func getDocumentDBSQLDatabase(ctx context.Context, v *armcosmos.SQLDatabaseGetRe ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CosmosdbSqlDatabaseDescription{ - Account: *account, - SqlDatabase: *v, - ResourceGroup: *rg.Name, - }, + Description: model.CosmosdbSqlDatabaseDescription{ + Account: *account, + SqlDatabase: *v, + ResourceGroup: *rg.Name, }, } return &resource @@ -136,12 +134,10 @@ func getDocumentDBMongoDatabase(ctx context.Context, v *armcosmos.MongoDBDatabas ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CosmosdbMongoDatabaseDescription{ - Account: *account, - MongoDatabase: *v, - ResourceGroup: *rg.Name, - }, + Description: model.CosmosdbMongoDatabaseDescription{ + Account: *account, + MongoDatabase: *v, + ResourceGroup: *rg.Name, }, } return &resource @@ -231,14 +227,12 @@ func getDocumentDBMongoCollection(ctx context.Context, client *armcosmos.MongoDB ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CosmosdbMongoCollectionDescription{ - Account: *account, - MongoDatabase: *db, - MongoCollection: *v, - Throughput: tp.ThroughputSettingsGetResults, - ResourceGroup: *rg.Name, - }, + Description: model.CosmosdbMongoCollectionDescription{ + Account: *account, + MongoDatabase: *db, + MongoCollection: *v, + Throughput: tp.ThroughputSettingsGetResults, + ResourceGroup: *rg.Name, }, } return &resource, nil @@ -282,11 +276,9 @@ func getDocumentDBCassandraCluster(ctx context.Context, v *armcosmos.ClusterReso ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CosmosdbCassandraClusterDescription{ - CassandraCluster: *v, - ResourceGroup: resourceGroup, - }, + Description: model.CosmosdbCassandraClusterDescription{ + CassandraCluster: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -350,11 +342,9 @@ func getCosmosdbAccount(ctx context.Context, v *armcosmos.DatabaseAccountGetResu ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CosmosdbAccountDescription{ - DatabaseAccountGetResults: *v, - ResourceGroup: resourceGroup, - }, + Description: model.CosmosdbAccountDescription{ + DatabaseAccountGetResults: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -398,11 +388,9 @@ func getRestorableDatabaseAccount(ctx context.Context, v *armcosmos.RestorableDa ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.CosmosdbRestorableDatabaseAccountDescription{ - Account: *v, - ResourceGroup: resourceGroup, - }, + Description: model.CosmosdbRestorableDatabaseAccountDescription{ + Account: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/eventgrid.go b/provider/describer/eventgrid.go index 0ab86f51..5bf7cf98 100644 --- a/provider/describer/eventgrid.go +++ b/provider/describer/eventgrid.go @@ -59,7 +59,7 @@ func getEventGridDomainTopic(ctx context.Context, v *armeventgrid.DomainTopic) * ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{Value: v}, + Description: v, } } @@ -137,12 +137,10 @@ func getEventGridDomain(ctx context.Context, domain *armeventgrid.Domain, client ID: *domain.ID, Name: *domain.Name, Location: *domain.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.EventGridDomainDescription{ - Domain: *domain, - DiagnosticSettingsResources: eventgridListOp, - ResourceGroup: resourceGroup, - }, + Description: model.EventGridDomainDescription{ + Domain: *domain, + DiagnosticSettingsResources: eventgridListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -203,12 +201,10 @@ func getEventGridTopic(ctx context.Context, v *armeventgrid.Topic, client *armmo ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.EventGridTopicDescription{ - Topic: *v, - DiagnosticSettingsResources: eventgridListOp, - ResourceGroup: resourceGroup, - }, + Description: model.EventGridTopicDescription{ + Topic: *v, + DiagnosticSettingsResources: eventgridListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/eventhub.go b/provider/describer/eventhub.go index ca543585..61047bd2 100644 --- a/provider/describer/eventhub.go +++ b/provider/describer/eventhub.go @@ -84,14 +84,12 @@ func getEventHubNamespace(ctx context.Context, diagnosticClient *armmonitor.Diag ID: *namespace.ID, Name: *namespace.Name, Location: *namespace.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.EventhubNamespaceDescription{ - EHNamespace: *namespace, - DiagnosticSettingsResources: insightsListOp, - NetworkRuleSet: eventhubGetNetworkRuleSetOp.NetworkRuleSet, - PrivateEndpointConnection: eventhubListOp, - ResourceGroup: resourceGroupName, - }, + Description: model.EventhubNamespaceDescription{ + EHNamespace: *namespace, + DiagnosticSettingsResources: insightsListOp, + NetworkRuleSet: eventhubGetNetworkRuleSetOp.NetworkRuleSet, + PrivateEndpointConnection: eventhubListOp, + ResourceGroup: resourceGroupName, }, } return &resource, nil @@ -143,12 +141,10 @@ func getEventhubNamespaceEventhub(ctx context.Context, namespace *armeventhub.EH ID: *namespace.ID, Name: *namespace.Name, Location: *namespace.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.EventhubNamespaceEventhubDescription{ - EHNamespace: *namespace, - EventHub: *eh, - ResourceGroup: resourceGroupName, - }, + Description: model.EventhubNamespaceEventhubDescription{ + EHNamespace: *namespace, + EventHub: *eh, + ResourceGroup: resourceGroupName, }, } } diff --git a/provider/describer/frontdoor.go b/provider/describer/frontdoor.go index dd30df1a..93e5b6f4 100644 --- a/provider/describer/frontdoor.go +++ b/provider/describer/frontdoor.go @@ -65,12 +65,10 @@ func getFrontDoor(ctx context.Context, diagnosticClient *armmonitor.DiagnosticSe ID: *door.ID, Name: *door.Name, Location: *door.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.FrontdoorDescription{ - FrontDoor: *door, - DiagnosticSettingsResources: frontDoorListOp, - ResourceGroup: resourceGroup, - }, + Description: model.FrontdoorDescription{ + FrontDoor: *door, + DiagnosticSettingsResources: frontDoorListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/hdinsight.go b/provider/describer/hdinsight.go index 9ad14cd8..b07886a9 100644 --- a/provider/describer/hdinsight.go +++ b/provider/describer/hdinsight.go @@ -65,12 +65,10 @@ func getHdInsightCluster(ctx context.Context, diagnosticClient *armmonitor.Diagn ID: *cluster.ID, Name: *cluster.Name, Location: *cluster.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.HdinsightClusterDescription{ - Cluster: *cluster, - DiagnosticSettingsResources: hdinsightListOp, - ResourceGroup: resourceGroup, - }, + Description: model.HdinsightClusterDescription{ + Cluster: *cluster, + DiagnosticSettingsResources: hdinsightListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/healthcareapis.go b/provider/describer/healthcareapis.go index c068bb02..17e0caab 100644 --- a/provider/describer/healthcareapis.go +++ b/provider/describer/healthcareapis.go @@ -88,13 +88,11 @@ func getHealthcareService(ctx context.Context, privateEndpointClient *armhealthc ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.HealthcareServiceDescription{ - ServicesDescription: *v, - DiagnosticSettingsResources: opValue, - PrivateEndpointConnections: opService, - ResourceGroup: resourceGroup, - }, + Description: model.HealthcareServiceDescription{ + ServicesDescription: *v, + DiagnosticSettingsResources: opValue, + PrivateEndpointConnections: opService, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/hybridcompute.go b/provider/describer/hybridcompute.go index b75f4a77..e5e11769 100644 --- a/provider/describer/hybridcompute.go +++ b/provider/describer/hybridcompute.go @@ -59,12 +59,10 @@ func getHybridComputeMachine(ctx context.Context, extentionClient *armhybridcomp ID: *machine.ID, Name: *machine.Name, Location: *machine.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.HybridComputeMachineDescription{ - Machine: *machine, - MachineExtensions: hybridComputeListResult, - ResourceGroup: resourceGroup, - }, + Description: model.HybridComputeMachineDescription{ + Machine: *machine, + MachineExtensions: hybridComputeListResult, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/hybridkubernetes.go b/provider/describer/hybridkubernetes.go index 5708998e..2556265e 100644 --- a/provider/describer/hybridkubernetes.go +++ b/provider/describer/hybridkubernetes.go @@ -65,12 +65,10 @@ func getHybridKubernetesConnectedCluster(ctx context.Context, extClient *armkube ID: *connectedCluster.ID, Name: *connectedCluster.Name, Location: *connectedCluster.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.HybridKubernetesConnectedClusterDescription{ - ConnectedCluster: *connectedCluster, - ConnectedClusterExtensions: extensions, - ResourceGroup: resourceGroup, - }, + Description: model.HybridKubernetesConnectedClusterDescription{ + ConnectedCluster: *connectedCluster, + ConnectedClusterExtensions: extensions, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/insights.go b/provider/describer/insights.go index ada7279f..cbd57ffa 100644 --- a/provider/describer/insights.go +++ b/provider/describer/insights.go @@ -52,11 +52,9 @@ func getDiagnosticSetting(ctx context.Context, diagnosticSetting *armmonitor.Dia ID: *diagnosticSetting.ID, Name: *diagnosticSetting.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.DiagnosticSettingDescription{ - DiagnosticSettingsResource: *diagnosticSetting, - ResourceGroup: resourceGroup, - }, + Description: model.DiagnosticSettingDescription{ + DiagnosticSettingsResource: *diagnosticSetting, + ResourceGroup: resourceGroup, }, } return &resource @@ -98,11 +96,9 @@ func getLogAlert(ctx context.Context, logAlert *armmonitor.ActivityLogAlertResou ID: *logAlert.ID, Name: *logAlert.Name, Location: *logAlert.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LogAlertDescription{ - ActivityLogAlertResource: *logAlert, - ResourceGroup: resourceGroup, - }, + Description: model.LogAlertDescription{ + ActivityLogAlertResource: *logAlert, + ResourceGroup: resourceGroup, }, } @@ -147,11 +143,9 @@ func getLogProfile(ctx context.Context, logProfile *armmonitor.LogProfileResourc ID: *logProfile.ID, Name: *logProfile.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.LogProfileDescription{ - LogProfileResource: *logProfile, - ResourceGroup: resourceGroup, - }, + Description: model.LogProfileDescription{ + LogProfileResource: *logProfile, + ResourceGroup: resourceGroup, }, } @@ -270,11 +264,9 @@ func getAutoscaleSetting(v *armmonitor.AutoscaleSettingResource) models.Resource ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AutoscaleSettingDescription{ - AutoscaleSettingsResource: *v, - ResourceGroup: resourceGroup, - }, + Description: model.AutoscaleSettingDescription{ + AutoscaleSettingsResource: *v, + ResourceGroup: resourceGroup, }, } } diff --git a/provider/describer/json_all_fields_marshaller.go b/provider/describer/json_all_fields_marshaller.go deleted file mode 100644 index fdccf0c8..00000000 --- a/provider/describer/json_all_fields_marshaller.go +++ /dev/null @@ -1,315 +0,0 @@ -package describer - -import ( - "encoding/json" - "errors" - "fmt" - "reflect" - "strings" -) - -var exclusionTypeSet = map[string]struct{}{ - "github.com/gofrs/uuid": {}, - "github.com/Azure/go-autorest/autorest/date": {}, -} - -func isGoPackage(path string) bool { - return path != "" && !strings.Contains(path, "/") -} - -// JSONAllFieldsMarshaller is a hack around the issue described here -// https://githubmemory.com/repo/Azure/azure-sdk-for-go/issues/12227 -// Azure sdk overrides all the MarshalJSON methods for the struct fields -// to exclude the 'READ-ONLY' fields from the JSON output of the struct. -// By simply wrapping the original struct by JSONAllFieldsMarshaller, all -// the fields will appear in the json output. -type JSONAllFieldsMarshaller struct { - Value interface{} -} - -func (x JSONAllFieldsMarshaller) MarshalJSON() (res []byte, err error) { - var val = x.Value - - v := reflect.ValueOf(x.Value) - if !v.IsValid() { - return json.Marshal(val) - } - if _, ok := exclusionTypeSet[v.Type().PkgPath()]; !ok && !isGoPackage(v.Type().PkgPath()) { - switch v.Kind() { - case reflect.Slice, reflect.Array: - val = azSliceMarshaller{Value: v} - case reflect.Ptr: - val = azPtrMarshaller{Value: v} - case reflect.Struct: - val = azStructMarshaller{Value: v} - } - } - - return json.Marshal(val) -} - -func (x *JSONAllFieldsMarshaller) UnmarshalJSON(data []byte) (err error) { - v := reflect.ValueOf(x.Value) - if !v.IsValid() { - return nil - } - if _, ok := exclusionTypeSet[v.Type().PkgPath()]; !ok && !isGoPackage(v.Type().PkgPath()) { - switch v.Kind() { - case reflect.Slice, reflect.Array: - val := &azSliceMarshaller{Value: v} - err := json.Unmarshal(data, val) - if err != nil { - return err - } - newVal := reflect.New(v.Type()) - if !val.Value.Type().AssignableTo(newVal.Elem().Type()) { - return nil - } - newVal.Elem().Set(val.Value) - x.Value = newVal.Elem().Interface() - case reflect.Struct: - val := &azStructMarshaller{Value: v} - err := json.Unmarshal(data, val) - if err != nil { - return err - } - newVal := reflect.New(v.Type()) - if !val.Value.Type().AssignableTo(newVal.Elem().Type()) { - return nil - } - newVal.Elem().Set(val.Value) - x.Value = newVal.Elem().Interface() - case reflect.Ptr: - val := &azPtrMarshaller{Value: v} - err := json.Unmarshal(data, val) - if err != nil { - return err - } - - newVal := reflect.New(v.Type()) - if !val.Value.Type().AssignableTo(newVal.Elem().Type()) { - return nil - } - newVal.Elem().Set(val.Value) - x.Value = newVal.Elem().Interface() - default: - val := reflect.New(v.Type()) - err := json.Unmarshal(data, val.Interface()) - if err != nil { - return err - } - - newVal := reflect.New(v.Type()) - if !val.Elem().Type().AssignableTo(newVal.Elem().Type()) { - return nil - } - newVal.Elem().Set(val.Elem()) - x.Value = newVal.Elem().Interface() - } - return nil - } - - val := reflect.New(v.Type()) - err = json.Unmarshal(data, val.Interface()) - if err != nil { - return err - } - - newVal := reflect.New(v.Type()) - if !val.Elem().Type().AssignableTo(newVal.Elem().Type()) { - return nil - } - newVal.Elem().Set(val.Elem()) - x.Value = newVal.Elem().Interface() - - return nil -} - -type azStructMarshaller struct { - reflect.Value -} - -func (x azStructMarshaller) MarshalJSON() ([]byte, error) { - v := x.Value - m := make(map[string]interface{}) - num := v.Type().NumField() - for i := 0; i < num; i++ { - field := v.Type().Field(i) - if !field.IsExported() { - continue - } - - jsonTag := field.Tag.Get("json") - jsonFields := strings.Split(jsonTag, ",") - jsonField := jsonFields[0] - if jsonField == "-" { - continue - } - jsonField = field.Name - - jsonOmitEmpty := false - for _, field := range jsonFields { - if field == "omitempty" { - jsonOmitEmpty = true - break - } - } - if jsonOmitEmpty && isEmptyValue(v.Field(i)) { - continue - } - m[jsonField] = JSONAllFieldsMarshaller{Value: v.Field(i).Interface()} - } - - return json.Marshal(m) -} - -func (x *azStructMarshaller) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", x.Value, err) - } - - x.Value = reflect.New(x.Value.Type()).Elem() - for i := 0; i < x.Value.Type().NumField(); i++ { - field := x.Value.Type().Field(i) - if !field.IsExported() { - continue - } - - jsonTag := field.Tag.Get("json") - jsonFields := strings.Split(jsonTag, ",") - jsonField := jsonFields[0] - if jsonField == "-" { - continue - } - jsonField = field.Name - if msg, ok := rawMsg[jsonField]; !ok || string(msg) == "null" { - continue - } - var err error - k := reflect.New(field.Type) - if k.Elem().Kind() == reflect.Interface { - continue - } - v := JSONAllFieldsMarshaller{Value: reflect.New(field.Type).Elem().Interface()} - err = json.Unmarshal(rawMsg[jsonField], &v) - if err != nil { - return fmt.Errorf("unmarshalling field %s: %v", jsonField, err) - } - - // check if the type is assignable - if !reflect.ValueOf(v.Value).Type().AssignableTo(k.Elem().Type()) { - continue - } - k.Elem().Set(reflect.ValueOf(v.Value)) - if !k.Elem().Type().AssignableTo(x.Value.Type().Field(i).Type) { - continue - } - x.Value.Field(i).Set(k.Elem()) - } - - return nil -} - -type azPtrMarshaller struct { - reflect.Value -} - -func (x azPtrMarshaller) MarshalJSON() ([]byte, error) { - val := x.Value - for val.Type().Kind() == reflect.Ptr { - if val.IsNil() { - return []byte("null"), nil - } - val = val.Elem() - } - - if !val.CanInterface() { - return nil, errors.New("cannot interface ptr marshaller") - } - - return JSONAllFieldsMarshaller{Value: val.Interface()}.MarshalJSON() -} - -func (x *azPtrMarshaller) UnmarshalJSON(data []byte) error { - v := reflect.New(x.Value.Type().Elem()) - k := JSONAllFieldsMarshaller{Value: v.Elem().Interface()} - if err := json.Unmarshal(data, &k); err != nil { - return err - } - - p := reflect.New(reflect.TypeOf(k.Value)) - if !reflect.ValueOf(k.Value).Type().AssignableTo(p.Elem().Type()) { - return nil - } - p.Elem().Set(reflect.ValueOf(k.Value)) - - x.Value = p - - return nil -} - -type azSliceMarshaller struct { - reflect.Value -} - -func (x azSliceMarshaller) MarshalJSON() ([]byte, error) { - num := x.Value.Len() - if num == 0 { - return []byte("null"), nil - } - list := make([]JSONAllFieldsMarshaller, 0, num) - for i := 0; i < num; i++ { - if !x.Value.Index(i).CanInterface() { - continue - } - - list = append(list, JSONAllFieldsMarshaller{Value: x.Value.Index(i).Interface()}) - } - - return json.Marshal(list) -} - -func (x *azSliceMarshaller) UnmarshalJSON(data []byte) error { - var list []json.RawMessage - if err := json.Unmarshal(data, &list); err != nil { - return err - } - - num := len(list) - x.Value = reflect.MakeSlice(x.Value.Type(), num, num) - for i := 0; i < num; i++ { - v := reflect.New(x.Value.Type().Elem()) - if v.Elem().Kind() == reflect.Interface { - continue - } - k := JSONAllFieldsMarshaller{Value: v.Interface()} - if err := json.Unmarshal(list[i], &k); err != nil { - return err - } - if !reflect.ValueOf(k.Value).Elem().Type().AssignableTo(x.Value.Type().Elem()) { - continue - } - x.Value.Index(i).Set(reflect.ValueOf(k.Value).Elem()) - } - - return nil -} - -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - return false -} diff --git a/provider/describer/json_all_fields_marshaller_test.go b/provider/describer/json_all_fields_marshaller_test.go deleted file mode 100644 index f59a1cbf..00000000 --- a/provider/describer/json_all_fields_marshaller_test.go +++ /dev/null @@ -1,200 +0,0 @@ -package describer - -import ( - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/automation/armautomation" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v2" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" - "github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2021-03-01/synapse" - "github.com/gdexlab/go-render/render" - "github.com/gofrs/uuid" - "github.com/opengovern/og-describer-azure/pkg/sdk/models" - "reflect" - "testing" - "time" -) - -func TestJSONAllFieldsMarshaller(t *testing.T) { - tests := []struct { - name string - value interface{} - want string - }{ - { - name: "Struct/Pointer", - value: compute.VirtualMachine{ - ID: String("MyVirtualMachine"), - Type: String("MyVirtualMachineType"), - }, - want: `{"ID":"MyVirtualMachine","Tags":null,"Type":"MyVirtualMachineType"}`, - }, - { - name: "Struct/Pointer 2", - value: compute.VirtualMachine{ - ID: String("MyVirtualMachine"), - Type: String("MyVirtualMachineType"), - Plan: &compute.Plan{ - Name: String("MyPlan"), - Publisher: String("MyPublisher"), - }, - }, - want: `{"ID":"MyVirtualMachine","Plan":{"Name":"MyPlan","Publisher":"MyPublisher"},"Tags":null,"Type":"MyVirtualMachineType"}`, - }, - { - name: "Struct/Pointer/Slice", - value: compute.VirtualMachine{ - ID: String("MyVirtualMachine"), - Type: String("MyVirtualMachineType"), - Plan: &compute.Plan{ - Name: String("MyPlan"), - Publisher: String("MyPublisher"), - }, - Resources: &[]compute.VirtualMachineExtension{ - { - ID: String("MyVirtualMachineExtension"), - }, - }, - }, - want: `{"ID":"MyVirtualMachine","Plan":{"Name":"MyPlan","Publisher":"MyPublisher"},"Resources":[{"ID":"MyVirtualMachineExtension","Tags":null}],"Tags":null,"Type":"MyVirtualMachineType"}`, - }, - { - name: "Array/Slice", - value: compute.VirtualMachine{ - ID: String("MyVirtualMachine"), - Type: String("MyVirtualMachineType"), - Resources: &[]compute.VirtualMachineExtension{ - { - ID: String("MyVirtualMachineExtension"), - Name: String("MyVirtualMachineExtensionName"), - VirtualMachineExtensionProperties: &compute.VirtualMachineExtensionProperties{ - Publisher: String("MyPublisher"), - }, - }, - }, - }, - want: `{"ID":"MyVirtualMachine","Resources":[{"ID":"MyVirtualMachineExtension","Name":"MyVirtualMachineExtensionName","Tags":null,"VirtualMachineExtensionProperties":{"Publisher":"MyPublisher"}}],"Tags":null,"Type":"MyVirtualMachineType"}`, - }, - { - name: "UUID", - value: synapse.Workspace{ - ID: String("MyWorkspace"), - WorkspaceProperties: &synapse.WorkspaceProperties{ - WorkspaceUID: UUID(uuid.Must(uuid.FromString("7eae5af9-b353-4d53-89b6-15a1a664b2c2"))), - }, - }, - want: `{"ID":"MyWorkspace","Tags":null,"WorkspaceProperties":{"ConnectivityEndpoints":null,"ExtraProperties":null,"WorkspaceUID":"7eae5af9-b353-4d53-89b6-15a1a664b2c2"}}`, - }, - { - name: "Enum", - value: armautomation.Account{ - Etag: nil, - Identity: &armautomation.Identity{ - Type: PTR(armautomation.ResourceIdentityTypeSystemAssigned), - }, - Location: nil, - Properties: nil, - Tags: nil, - ID: nil, - Name: nil, - SystemData: nil, - Type: nil, - }, - want: `{"Etag":null,"ID":null,"Identity":{"PrincipalID":null,"TenantID":null,"Type":"SystemAssigned","UserAssignedIdentities":null},"Location":null,"Name":null,"Properties":null,"SystemData":null,"Tags":null,"Type":null}`, - }, - { - name: "Nested Struct", - value: &armautomation.Account{ - Etag: nil, - Identity: &armautomation.Identity{ - Type: PTR((armautomation.ResourceIdentityType)("UserAssigned")), - UserAssignedIdentities: map[string]*armautomation.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/xyx/resourcegroups/yyy/providers/Microsoft.ManagedIdentity/userAssignedIdentities/yyz": &armautomation.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ - ClientID: nil, - PrincipalID: nil, - }, - }, - PrincipalID: nil, - TenantID: nil, - }, - Location: PTR("westeurope"), - Properties: &armautomation.AccountProperties{ - AutomationHybridServiceURL: nil, - Description: nil, - DisableLocalAuth: PTR(false), - Encryption: nil, - LastModifiedBy: nil, - PrivateEndpointConnections: nil, - PublicNetworkAccess: PTR(true), - SKU: nil, - CreationTime: PTR(time.Date(2022, 12, 1, 0, 0, 0, 0, time.UTC)), - LastModifiedTime: PTR(time.Date(2023, 2, 15, 0, 0, 0, 0, time.UTC)), - State: nil, - }, - Tags: map[string]*string{ - "app_support_group": PTR("1"), - "application_bit_id": PTR("2"), - "application_name": PTR("3"), - "bu_code": PTR("4"), - "business_owner": PTR("5"), - "data_classification": PTR("6"), - }, - ID: PTR("/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Automation/automationAccounts/zzz"), - Name: PTR("zzz"), - SystemData: nil, - Type: PTR("Microsoft.Automation/AutomationAccounts")}, - want: "{\"Etag\":null,\"ID\":\"/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Automation/automationAccounts/zzz\",\"Identity\":{\"PrincipalID\":null,\"TenantID\":null,\"Type\":\"UserAssigned\",\"UserAssignedIdentities\":{\"/subscriptions/xyx/resourcegroups/yyy/providers/Microsoft.ManagedIdentity/userAssignedIdentities/yyz\":{}}},\"Location\":\"westeurope\",\"Name\":\"zzz\",\"Properties\":{\"AutomationHybridServiceURL\":null,\"CreationTime\":\"2022-12-01T00:00:00Z\",\"Description\":null,\"DisableLocalAuth\":false,\"Encryption\":null,\"LastModifiedBy\":null,\"LastModifiedTime\":\"2023-02-15T00:00:00Z\",\"PrivateEndpointConnections\":null,\"PublicNetworkAccess\":true,\"SKU\":null,\"State\":null},\"SystemData\":null,\"Tags\":{\"app_support_group\":\"1\",\"application_bit_id\":\"2\",\"application_name\":\"3\",\"bu_code\":\"4\",\"business_owner\":\"5\",\"data_classification\":\"6\"},\"Type\":\"Microsoft.Automation/AutomationAccounts\"}", - }, - //The unmarshaller does not work for interfaces - { - name: "Interface struct", - value: armcosmos.DatabaseAccountGetResults{ - Properties: &armcosmos.DatabaseAccountGetProperties{ - BackupPolicy: &armcosmos.BackupPolicy{ - Type: PTR(armcosmos.BackupPolicyTypePeriodic), - MigrationState: nil, - }, - }, - }, - want: "{\"ID\":null,\"Identity\":null,\"Kind\":null,\"Location\":null,\"Name\":null,\"Properties\":{\"APIProperties\":null,\"AnalyticalStorageConfiguration\":null,\"BackupPolicy\":{\"MigrationState\":null,\"Type\":\"Periodic\"},\"Capabilities\":null,\"Capacity\":null,\"ConnectorOffer\":null,\"ConsistencyPolicy\":null,\"Cors\":null,\"CreateMode\":null,\"DatabaseAccountOfferType\":null,\"DefaultIdentity\":null,\"DisableKeyBasedMetadataWriteAccess\":null,\"DisableLocalAuth\":null,\"DocumentEndpoint\":null,\"EnableAnalyticalStorage\":null,\"EnableAutomaticFailover\":null,\"EnableCassandraConnector\":null,\"EnableFreeTier\":null,\"EnableMultipleWriteLocations\":null,\"EnablePartitionMerge\":null,\"FailoverPolicies\":null,\"IPRules\":null,\"InstanceID\":null,\"IsVirtualNetworkFilterEnabled\":null,\"KeyVaultKeyURI\":null,\"KeysMetadata\":null,\"Locations\":null,\"MinimalTLSVersion\":null,\"NetworkACLBypass\":null,\"NetworkACLBypassResourceIDs\":null,\"PrivateEndpointConnections\":null,\"ProvisioningState\":null,\"PublicNetworkAccess\":null,\"ReadLocations\":null,\"RestoreParameters\":null,\"VirtualNetworkRules\":null,\"WriteLocations\":null},\"SystemData\":null,\"Tags\":null,\"Type\":null}", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - x := JSONAllFieldsMarshaller{ - Value: tt.value, - } - got, err := x.MarshalJSON() - if err != nil { - t.Errorf("JSONAllFieldsMarshaller.MarshalJSON() error = %v", err) - return - } - if string(got) != tt.want { - t.Errorf("JSONAllFieldsMarshaller.MarshalJSON() = %v\n want %v", string(got), tt.want) - } - }) - t.Run(tt.name, func(t *testing.T) { - x := JSONAllFieldsMarshaller{ - Value: reflect.New(reflect.TypeOf(tt.value)).Elem().Interface(), - } - err := x.UnmarshalJSON([]byte(tt.want)) - if err != nil { - t.Errorf("JSONAllFieldsMarshaller.MarshalJSON() error = %v", err) - return - } - if render.AsCode(x.Value) != render.AsCode(tt.value) { - t.Errorf("JSONAllFieldsMarshaller.UnmarshalJSON() = %v\nwant %v\noriginal: %s", render.AsCode(x.Value), render.AsCode(tt.value), tt.want) - } - }) - } -} - -func String(s string) *string { - return &s -} - -func UUID(u uuid.UUID) *uuid.UUID { - return &u -} - -func PTR[T any](t T) *T { - return &t -} diff --git a/provider/describer/keyvault.go b/provider/describer/keyvault.go index 09fef730..0e88e333 100644 --- a/provider/describer/keyvault.go +++ b/provider/describer/keyvault.go @@ -71,12 +71,10 @@ func KeyVaultKey(ctx context.Context, cred *azidentity.ClientSecretCredential, s ID: *vCopy.ID, Name: *vCopy.Name, Location: *vCopy.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultKeyDescription{ - Vault: *vaultCopy, - Key: *vCopy, - ResourceGroup: resourceGroupCopy, - }, + Description: model.KeyVaultKeyDescription{ + Vault: *vaultCopy, + Key: *vCopy, + ResourceGroup: resourceGroupCopy, }, }, nil }) @@ -136,12 +134,10 @@ func getKeyVaultKey(ctx context.Context, keysClient *armkeyvault.KeysClient, vCo ID: *vCopy.ID, Name: *vCopy.Name, Location: *vCopy.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultKeyDescription{ - Vault: *vaultCopy, - Key: *vCopy, - ResourceGroup: resourceGroupCopy, - }, + Description: model.KeyVaultKeyDescription{ + Vault: *vaultCopy, + Key: *vCopy, + ResourceGroup: resourceGroupCopy, }, }, nil } @@ -213,13 +209,11 @@ func getKeyVault(ctx context.Context, vault *armkeyvault.Resource, vaultsClient ID: *vault.ID, Name: *vault.Name, Location: *vault.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultDescription{ - Resource: *vault, - Vault: keyVaultGetOp.Vault, - DiagnosticSettingsResources: insightsListOp, - ResourceGroup: resourceGroup, - }, + Description: model.KeyVaultDescription{ + Resource: *vault, + Vault: keyVaultGetOp.Vault, + DiagnosticSettingsResources: insightsListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -260,11 +254,9 @@ func getDeletedVault(ctx context.Context, vault *armkeyvault.DeletedVault) *mode ID: *vault.ID, Name: *vault.Name, Location: *vault.Properties.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultDeletedVaultDescription{ - Vault: *vault, - ResourceGroup: resourceGroup, - }, + Description: model.KeyVaultDeletedVaultDescription{ + Vault: *vault, + ResourceGroup: resourceGroup, }, } return &resource @@ -330,12 +322,10 @@ func getKeyVaultManagedHardwareSecurityModule(ctx context.Context, client *armmo ID: *vault.ID, Name: *vault.Name, Location: *vault.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultManagedHardwareSecurityModuleDescription{ - ManagedHsm: *vault, - DiagnosticSettingsResources: keyvaultListOp, - ResourceGroup: resourceGroup, - }, + Description: model.KeyVaultManagedHardwareSecurityModuleDescription{ + ManagedHsm: *vault, + DiagnosticSettingsResources: keyvaultListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -461,13 +451,11 @@ func GetKeyVaultKeyVersion(ctx context.Context, resourceGroup string, vault *arm ID: *version.ID, Name: *version.Name, Location: *version.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultKeyVersionDescription{ - Vault: *vault, - Key: *key, - Version: *version, - ResourceGroup: resourceGroup, - }, + Description: model.KeyVaultKeyVersionDescription{ + Vault: *vault, + Key: *key, + Version: *version, + ResourceGroup: resourceGroup, }, } return &resource @@ -539,12 +527,10 @@ func getKeyVaultCertificates(ctx context.Context, cred *azidentity.ClientSecretC ID: *vault.ID, Name: *vault.Name, Location: *vault.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultCertificateDescription{ - Policy: policy.CertificatePolicy, - Vault: *vault, - ResourceGroup: resourceGroup, - }, + Description: model.KeyVaultCertificateDescription{ + Policy: policy.CertificatePolicy, + Vault: *vault, + ResourceGroup: resourceGroup, }, } resources = append(resources, resource) diff --git a/provider/describer/kusto.go b/provider/describer/kusto.go index 9018d17b..810e94b9 100644 --- a/provider/describer/kusto.go +++ b/provider/describer/kusto.go @@ -45,11 +45,9 @@ func getKustoCluster(ctx context.Context, kusto *armkusto.Cluster) *models.Resou ID: *kusto.ID, Name: *kusto.Name, Location: *kusto.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.KustoClusterDescription{ - Cluster: *kusto, - ResourceGroup: resourceGroup, - }, + Description: model.KustoClusterDescription{ + Cluster: *kusto, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/lb.go b/provider/describer/lb.go index 7bba5c6e..829df58a 100644 --- a/provider/describer/lb.go +++ b/provider/describer/lb.go @@ -65,12 +65,10 @@ func getLoadBalancer(ctx context.Context, diagnosticClient *armmonitor.Diagnosti ID: *loadBalancer.ID, Name: *loadBalancer.Name, Location: *loadBalancer.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LoadBalancerDescription{ - ResourceGroup: resourceGroup, - DiagnosticSetting: diagnosticSettings, - LoadBalancer: *loadBalancer, - }, + Description: model.LoadBalancerDescription{ + ResourceGroup: resourceGroup, + DiagnosticSetting: diagnosticSettings, + LoadBalancer: *loadBalancer, }, } return &resource, nil @@ -140,12 +138,10 @@ func getLoadBalancerBackendAddressPools(ctx context.Context, loadBalancer *armne resource := models.Resource{ ID: *pool.ID, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.LoadBalancerBackendAddressPoolDescription{ - ResourceGroup: resourceGroup, - LoadBalancer: *loadBalancer, - Pool: *pool, - }, + Description: model.LoadBalancerBackendAddressPoolDescription{ + ResourceGroup: resourceGroup, + LoadBalancer: *loadBalancer, + Pool: *pool, }, } @@ -212,12 +208,10 @@ func getLoadBalancerNatRule(ctx context.Context, loadBalancer *armnetwork.LoadBa ID: *natRule.ID, Name: *natRule.Name, Location: *loadBalancer.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LoadBalancerNatRuleDescription{ - ResourceGroup: resourceGroup, - LoadBalancerName: *loadBalancer.Name, - Rule: *natRule, - }, + Description: model.LoadBalancerNatRuleDescription{ + ResourceGroup: resourceGroup, + LoadBalancerName: *loadBalancer.Name, + Rule: *natRule, }, } @@ -284,12 +278,10 @@ func getLoadBalancerOutboundRule(ctx context.Context, loadBalancer *armnetwork.L ID: *outboundRule.ID, Name: *outboundRule.Name, Location: *loadBalancer.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LoadBalancerOutboundRuleDescription{ - ResourceGroup: resourceGroup, - LoadBalancerName: *loadBalancer.Name, - Rule: *outboundRule, - }, + Description: model.LoadBalancerOutboundRuleDescription{ + ResourceGroup: resourceGroup, + LoadBalancerName: *loadBalancer.Name, + Rule: *outboundRule, }, } @@ -356,12 +348,10 @@ func getLoadBalancerProbe(ctx context.Context, loadBalancer *armnetwork.LoadBala ID: *probe.ID, Name: *probe.Name, Location: *loadBalancer.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LoadBalancerProbeDescription{ - ResourceGroup: resourceGroup, - LoadBalancerName: *loadBalancer.Name, - Probe: *probe, - }, + Description: model.LoadBalancerProbeDescription{ + ResourceGroup: resourceGroup, + LoadBalancerName: *loadBalancer.Name, + Probe: *probe, }, } @@ -428,12 +418,10 @@ func getLoadBalancerRule(ctx context.Context, loadBalancer *armnetwork.LoadBalan ID: *rule.ID, Name: *rule.Name, Location: *loadBalancer.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LoadBalancerRuleDescription{ - ResourceGroup: resourceGroup, - LoadBalancerName: *loadBalancer.Name, - Rule: *rule, - }, + Description: model.LoadBalancerRuleDescription{ + ResourceGroup: resourceGroup, + LoadBalancerName: *loadBalancer.Name, + Rule: *rule, }, } diff --git a/provider/describer/links.go b/provider/describer/links.go index d5253e01..137a8185 100644 --- a/provider/describer/links.go +++ b/provider/describer/links.go @@ -41,10 +41,8 @@ func getResourceLink(ctx context.Context, v *armlinks.ResourceLink) *models.Reso ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.ResourceLinkDescription{ - ResourceLink: *v, - }, + Description: model.ResourceLinkDescription{ + ResourceLink: *v, }, } return &resource diff --git a/provider/describer/logic.go b/provider/describer/logic.go index d7882328..e9033b19 100644 --- a/provider/describer/logic.go +++ b/provider/describer/logic.go @@ -65,12 +65,10 @@ func getLogicAppWorkflow(ctx context.Context, diagnosticClient *armmonitor.Diagn ID: *workflow.ID, Name: *workflow.Name, Location: *workflow.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LogicAppWorkflowDescription{ - Workflow: *workflow, - DiagnosticSettingsResources: logicListOp, - ResourceGroup: resourceGroup, - }, + Description: model.LogicAppWorkflowDescription{ + Workflow: *workflow, + DiagnosticSettingsResources: logicListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -111,11 +109,9 @@ func getLogicIntegrationAccounts(ctx context.Context, account *armlogic.Integrat ID: *account.ID, Name: *account.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LogicIntegrationAccountsDescription{ - Account: *account, - ResourceGroup: resourceGroup, - }, + Description: model.LogicIntegrationAccountsDescription{ + Account: *account, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/machinelearningservices.go b/provider/describer/machinelearningservices.go index 01c21bfb..7ea9ebce 100644 --- a/provider/describer/machinelearningservices.go +++ b/provider/describer/machinelearningservices.go @@ -64,12 +64,10 @@ func getMachineLearningWorkspace(ctx context.Context, diagnosticClient *armmonit ID: *workspace.ID, Name: *workspace.Name, Location: *workspace.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MachineLearningWorkspaceDescription{ - Workspace: *workspace, - DiagnosticSettingsResources: machineLearningServicesListOp, - ResourceGroup: resourceGroup, - }, + Description: model.MachineLearningWorkspaceDescription{ + Workspace: *workspace, + DiagnosticSettingsResources: machineLearningServicesListOp, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/maintenance.go b/provider/describer/maintenance.go index 6db1b118..08d4e184 100644 --- a/provider/describer/maintenance.go +++ b/provider/describer/maintenance.go @@ -51,11 +51,9 @@ func getMaintenanceConfiguration(ctx context.Context, configuration *armmaintena resource := models.Resource{ ID: *configuration.ID, Name: *configuration.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.MaintenanceConfigurationDescription{ - MaintenanceConfiguration: *configuration, - ResourceGroup: resourceGroup, - }, + Description: model.MaintenanceConfigurationDescription{ + MaintenanceConfiguration: *configuration, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/managedservices.go b/provider/describer/managedservices.go index 63399670..67a0fa80 100644 --- a/provider/describer/managedservices.go +++ b/provider/describer/managedservices.go @@ -49,12 +49,10 @@ func getLighthouseDefinition(_ context.Context, lighthouseDefinition *armmanaged ID: *lighthouseDefinition.ID, Name: *lighthouseDefinition.Name, Type: *lighthouseDefinition.Type, - Description: JSONAllFieldsMarshaller{ - Value: model.LighthouseDefinitionDescription{ - LighthouseDefinition: *lighthouseDefinition, - Scope: scope, - ResourceGroup: resourceGroup, - }, + Description: model.LighthouseDefinitionDescription{ + LighthouseDefinition: *lighthouseDefinition, + Scope: scope, + ResourceGroup: resourceGroup, }, } return &resource @@ -99,12 +97,10 @@ func getLighthouseAssignment(_ context.Context, lighthouseAssignment *armmanaged ID: *lighthouseAssignment.ID, Name: *lighthouseAssignment.Name, Type: *lighthouseAssignment.Type, - Description: JSONAllFieldsMarshaller{ - Value: model.LighthouseAssignmentDescription{ - LighthouseAssignment: *lighthouseAssignment, - Scope: scope, - ResourceGroup: resourceGroup, - }, + Description: model.LighthouseAssignmentDescription{ + LighthouseAssignment: *lighthouseAssignment, + Scope: scope, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/management.go b/provider/describer/management.go index 42ed84df..99859169 100644 --- a/provider/describer/management.go +++ b/provider/describer/management.go @@ -51,10 +51,8 @@ func getManagementGroup(ctx context.Context, client *armmanagementgroups.Client, resource := &models.Resource{ ID: *info.ID, Name: *info.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.ManagementGroupDescription{ - Group: info.ManagementGroup, - }, + Description: model.ManagementGroupDescription{ + Group: info.ManagementGroup, }, } return resource, nil @@ -94,11 +92,9 @@ func getManagementLock(ctx context.Context, lockObject *armlocks.ManagementLockO ID: *lockObject.ID, Name: *lockObject.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.ManagementLockDescription{ - Lock: *lockObject, - ResourceGroup: resourceGroup, - }, + Description: model.ManagementLockDescription{ + Lock: *lockObject, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/mariadb.go b/provider/describer/mariadb.go index 1b26be84..8f867399 100644 --- a/provider/describer/mariadb.go +++ b/provider/describer/mariadb.go @@ -45,11 +45,9 @@ func getMariadbServer(ctx context.Context, server *armmariadb.Server) *models.Re ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MariadbServerDescription{ - Server: *server, - ResourceGroup: resourceGroup, - }, + Description: model.MariadbServerDescription{ + Server: *server, + ResourceGroup: resourceGroup, }, } @@ -115,12 +113,10 @@ func getMariadbDatabase(ctx context.Context, server *armmariadb.Server, r *armma ID: *r.ID, Name: *r.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MariadbDatabaseDescription{ - Database: *r, - Server: *server, - ResourceGroup: resourceGroup, - }, + Description: model.MariadbDatabaseDescription{ + Database: *r, + Server: *server, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/monitor.go b/provider/describer/monitor.go index 4d1bc01f..c35bf4d8 100644 --- a/provider/describer/monitor.go +++ b/provider/describer/monitor.go @@ -50,11 +50,9 @@ func getMonitorLogProfile(ctx context.Context, logProfile *armmonitor.LogProfile ID: *logProfile.ID, Name: *logProfile.Name, Location: *logProfile.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MonitorLogProfileDescription{ - LogProfile: *logProfile, - ResourceGroup: resourceGroup, - }, + Description: model.MonitorLogProfileDescription{ + LogProfile: *logProfile, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/mysql.go b/provider/describer/mysql.go index 351b0200..86488e11 100644 --- a/provider/describer/mysql.go +++ b/provider/describer/mysql.go @@ -95,15 +95,13 @@ func getMysqlServer(ctx context.Context, keysClient *armmysql.ServerKeysClient, ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MysqlServerDescription{ - Server: *server, - Configurations: configurations, - ServerKeys: keys, - SecurityAlertPolicies: alertPolicies, - VnetRules: vnetRules, - ResourceGroup: resourceGroup, - }, + Description: model.MysqlServerDescription{ + Server: *server, + Configurations: configurations, + ServerKeys: keys, + SecurityAlertPolicies: alertPolicies, + VnetRules: vnetRules, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -144,11 +142,9 @@ func getMysqlFlexibleservers(ctx context.Context, server *armmysqlflexibleserver ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MysqlFlexibleserverDescription{ - Server: *server, - ResourceGroup: resourceGroup, - }, + Description: model.MysqlFlexibleserverDescription{ + Server: *server, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/netapp.go b/provider/describer/netapp.go index da39c30d..fbd2ee4f 100644 --- a/provider/describer/netapp.go +++ b/provider/describer/netapp.go @@ -43,11 +43,9 @@ func getNetAppAccount(ctx context.Context, v *armnetapp.Account) *models.Resourc ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetAppAccountDescription{ - Account: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.NetAppAccountDescription{ + Account: *v, + ResourceGroup: resourceGroupName, }, } @@ -116,11 +114,9 @@ func getNetAppCapacityPool(ctx context.Context, v *armnetapp.Account, pool *armn ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetAppCapacityPoolDescription{ - CapacityPool: *pool, - ResourceGroup: resourceGroupName, - }, + Description: model.NetAppCapacityPoolDescription{ + CapacityPool: *pool, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/network.go b/provider/describer/network.go index 7bef14bf..3e92cd8b 100644 --- a/provider/describer/network.go +++ b/provider/describer/network.go @@ -50,11 +50,9 @@ func getNetworkInterface(ctx context.Context, v *armnetwork.Interface) *models.R ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkInterfaceDescription{ - Interface: *v, - ResourceGroup: resourceGroup, - }, + Description: model.NetworkInterfaceDescription{ + Interface: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -121,12 +119,10 @@ func getWatcherFlowLog(ctx context.Context, watcher *armnetwork.Watcher, v *armn ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkWatcherFlowLogDescription{ - NetworkWatcherName: *watcher.Name, - FlowLog: *v, - ResourceGroup: resourceGroupID, - }, + Description: model.NetworkWatcherFlowLogDescription{ + NetworkWatcherName: *watcher.Name, + FlowLog: *v, + ResourceGroup: resourceGroupID, }, } return &resource @@ -193,12 +189,10 @@ func getVirtualNetworkSubnet(ctx context.Context, virtualnetwork *armnetwork.Vir ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.SubnetDescription{ - VirtualNetworkName: *virtualnetwork.Name, - Subnet: *v, - ResourceGroup: resourceGroupID, - }, + Description: model.SubnetDescription{ + VirtualNetworkName: *virtualnetwork.Name, + Subnet: *v, + ResourceGroup: resourceGroupID, }, } return &resource @@ -238,11 +232,9 @@ func getVirtualNetwork(ctx context.Context, v *armnetwork.VirtualNetwork) *model ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VirtualNetworkDescription{ - VirtualNetwork: *v, - ResourceGroup: resourceGroup, - }, + Description: model.VirtualNetworkDescription{ + VirtualNetwork: *v, + ResourceGroup: resourceGroup, }, } @@ -302,12 +294,10 @@ func getApplicationGateway(ctx context.Context, diagnosticClient *armmonitor.Dia ID: *gateway.ID, Name: *gateway.Name, Location: *gateway.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ApplicationGatewayDescription{ - ApplicationGateway: *gateway, - DiagnosticSettingsResources: networkListOp, - ResourceGroup: resourceGroup, - }, + Description: model.ApplicationGatewayDescription{ + ApplicationGateway: *gateway, + DiagnosticSettingsResources: networkListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -371,12 +361,10 @@ func getNetworkSecurityGroup(ctx context.Context, diagnosticClient *armmonitor.D ID: *networkSecurityGroup.ID, Name: *networkSecurityGroup.Name, Location: *networkSecurityGroup.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkSecurityGroupDescription{ - SecurityGroup: *networkSecurityGroup, - DiagnosticSettingsResources: networkListOp, - ResourceGroup: resourceGroup, - }, + Description: model.NetworkSecurityGroupDescription{ + SecurityGroup: *networkSecurityGroup, + DiagnosticSettingsResources: networkListOp, + ResourceGroup: resourceGroup, }, } @@ -417,11 +405,9 @@ func getNetworkWatcher(ctx context.Context, networkWatcher *armnetwork.Watcher) ID: *networkWatcher.ID, Name: *networkWatcher.Name, Location: *networkWatcher.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkWatcherDescription{ - Watcher: *networkWatcher, - ResourceGroup: resourceGroup, - }, + Description: model.NetworkWatcherDescription{ + Watcher: *networkWatcher, + ResourceGroup: resourceGroup, }, } @@ -462,11 +448,9 @@ func getRouteTable(ctx context.Context, routeTable *armnetwork.RouteTable) *mode ID: *routeTable.ID, Name: *routeTable.Name, Location: *routeTable.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.RouteTablesDescription{ - ResourceGroup: resourceGroup, - RouteTable: *routeTable, - }, + Description: model.RouteTablesDescription{ + ResourceGroup: resourceGroup, + RouteTable: *routeTable, }, } return &resource @@ -506,11 +490,9 @@ func getApplicationSecurityGroup(ctx context.Context, applicationSecurityGroup * ID: *applicationSecurityGroup.ID, Name: *applicationSecurityGroup.Name, Location: *applicationSecurityGroup.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkApplicationSecurityGroupsDescription{ - ApplicationSecurityGroup: *applicationSecurityGroup, - ResourceGroup: resourceGroup, - }, + Description: model.NetworkApplicationSecurityGroupsDescription{ + ApplicationSecurityGroup: *applicationSecurityGroup, + ResourceGroup: resourceGroup, }, } @@ -551,11 +533,9 @@ func getAzureFirewall(ctx context.Context, azureFirewall *armnetwork.AzureFirewa ID: *azureFirewall.ID, Name: *azureFirewall.Name, Location: *azureFirewall.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkAzureFirewallDescription{ - AzureFirewall: *azureFirewall, - ResourceGroup: resourceGroup, - }, + Description: model.NetworkAzureFirewallDescription{ + AzureFirewall: *azureFirewall, + ResourceGroup: resourceGroup, }, } @@ -596,11 +576,9 @@ func getExpressRouteCircuit(ctx context.Context, expressRouteCircuit *armnetwork ID: *expressRouteCircuit.ID, Name: *expressRouteCircuit.Name, Location: *expressRouteCircuit.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ExpressRouteCircuitDescription{ - ExpressRouteCircuit: *expressRouteCircuit, - ResourceGroup: resourceGroup, - }, + Description: model.ExpressRouteCircuitDescription{ + ExpressRouteCircuit: *expressRouteCircuit, + ResourceGroup: resourceGroup, }, } return &resource @@ -685,13 +663,11 @@ func getVirtualNetworkGateway(ctx context.Context, client *armnetwork.VirtualNet ID: *virtualNetworkGateway.ID, Name: *virtualNetworkGateway.Name, Location: *virtualNetworkGateway.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VirtualNetworkGatewayDescription{ - ResourceGroup: resourceGroup, - VirtualNetworkGateway: *virtualNetworkGateway, - VirtualNetworkGatewayConnection: gatewayConnections, - VirtualNetwork: virtualNetwork, - }, + Description: model.VirtualNetworkGatewayDescription{ + ResourceGroup: resourceGroup, + VirtualNetworkGateway: *virtualNetworkGateway, + VirtualNetworkGatewayConnection: gatewayConnections, + VirtualNetwork: virtualNetwork, }, } @@ -732,11 +708,9 @@ func getFirewallPolicy(ctx context.Context, firewallPolicy *armnetwork.FirewallP ID: *firewallPolicy.ID, Name: *firewallPolicy.Name, Location: *firewallPolicy.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.FirewallPolicyDescription{ - ResourceGroup: resourceGroup, - FirewallPolicy: *firewallPolicy, - }, + Description: model.FirewallPolicyDescription{ + ResourceGroup: resourceGroup, + FirewallPolicy: *firewallPolicy, }, } @@ -796,11 +770,9 @@ func getLocalNetworkGateway(ctx context.Context, localNetworkGateway *armnetwork ID: *localNetworkGateway.ID, Name: *localNetworkGateway.Name, Location: *localNetworkGateway.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.LocalNetworkGatewayDescription{ - ResourceGroup: resourceGroup, - LocalNetworkGateway: *localNetworkGateway, - }, + Description: model.LocalNetworkGatewayDescription{ + ResourceGroup: resourceGroup, + LocalNetworkGateway: *localNetworkGateway, }, } @@ -860,11 +832,9 @@ func getNatGateway(ctx context.Context, natGateway *armnetwork.NatGateway) *mode ID: *natGateway.ID, Name: *natGateway.Name, Location: *natGateway.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NatGatewayDescription{ - ResourceGroup: resourceGroup, - NatGateway: *natGateway, - }, + Description: model.NatGatewayDescription{ + ResourceGroup: resourceGroup, + NatGateway: *natGateway, }, } @@ -924,11 +894,9 @@ func getPrivateLinkService(ctx context.Context, privateLinkService *armnetwork.P ID: *privateLinkService.ID, Name: *privateLinkService.Name, Location: *privateLinkService.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PrivateLinkServiceDescription{ - ResourceGroup: resourceGroup, - PrivateLinkService: *privateLinkService, - }, + Description: model.PrivateLinkServiceDescription{ + ResourceGroup: resourceGroup, + PrivateLinkService: *privateLinkService, }, } @@ -969,11 +937,9 @@ func getRouteFilter(ctx context.Context, routeFilter *armnetwork.RouteFilter) *m ID: *routeFilter.ID, Name: *routeFilter.Name, Location: *routeFilter.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.RouteFilterDescription{ - ResourceGroup: resourceGroup, - RouteFilter: *routeFilter, - }, + Description: model.RouteFilterDescription{ + ResourceGroup: resourceGroup, + RouteFilter: *routeFilter, }, } @@ -1014,11 +980,9 @@ func getVpnGateway(ctx context.Context, vpnGateway *armnetwork.VPNGateway) *mode ID: *vpnGateway.ID, Name: *vpnGateway.Name, Location: *vpnGateway.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VpnGatewayDescription{ - ResourceGroup: resourceGroup, - VpnGateway: *vpnGateway, - }, + Description: model.VpnGatewayDescription{ + ResourceGroup: resourceGroup, + VpnGateway: *vpnGateway, }, } @@ -1086,12 +1050,10 @@ func getNetworkVpnGatewaysVpnConnections(ctx context.Context, vpnGateway *armnet ID: *vpnConn.ID, Name: *vpnConn.Name, Location: *vpnGateway.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VpnGatewayVpnConnectionDescription{ - VpnConnection: *vpnConn, - VpnGateway: *vpnGateway, - ResourceGroup: resourceGroup, - }, + Description: model.VpnGatewayVpnConnectionDescription{ + VpnConnection: *vpnConn, + VpnGateway: *vpnGateway, + ResourceGroup: resourceGroup, }, } @@ -1126,11 +1088,9 @@ func getNetworkVpnGatewaysVpnSites(ctx context.Context, v *armnetwork.VPNSite) * ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VpnSiteDescription{ - ResourceGroup: resourceGroup, - VpnSite: *v, - }, + Description: model.VpnSiteDescription{ + ResourceGroup: resourceGroup, + VpnSite: *v, }, } @@ -1188,11 +1148,9 @@ func getPublicIPAddress(ctx context.Context, resourceGroup armresources.Resource ID: *publicIPAddress.ID, Name: *publicIPAddress.Name, Location: *publicIPAddress.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PublicIPAddressDescription{ - ResourceGroup: *resourceGroup.Name, - PublicIPAddress: *publicIPAddress, - }, + Description: model.PublicIPAddressDescription{ + ResourceGroup: *resourceGroup.Name, + PublicIPAddress: *publicIPAddress, }, } return &resource @@ -1249,11 +1207,9 @@ func getPublicIPPrefix(ctx context.Context, resourceGroup armresources.ResourceG ID: *publicIPPrefix.ID, Name: *publicIPPrefix.Name, Location: *publicIPPrefix.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PublicIPPrefixDescription{ - ResourceGroup: *resourceGroup.Name, - PublicIPPrefix: *publicIPPrefix, - }, + Description: model.PublicIPPrefixDescription{ + ResourceGroup: *resourceGroup.Name, + PublicIPPrefix: *publicIPPrefix, }, } @@ -1294,11 +1250,9 @@ func GetDNSZone(ctx context.Context, dnsZone *armdns.Zone) *models.Resource { ID: *dnsZone.ID, Name: *dnsZone.Name, Location: *dnsZone.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DNSZonesDescription{ - DNSZone: *dnsZone, - ResourceGroup: resourceGroup, - }, + Description: model.DNSZonesDescription{ + DNSZone: *dnsZone, + ResourceGroup: resourceGroup, }, } @@ -1338,11 +1292,9 @@ func GetDNSResolver(ctx context.Context, dnsResolver *armdnsresolver.DNSResolver ID: *dnsResolver.ID, Name: *dnsResolver.Name, Location: *dnsResolver.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.DNSResolverDescription{ - DNSResolver: *dnsResolver, - ResourceGroup: resourceGroup, - }, + Description: model.DNSResolverDescription{ + DNSResolver: *dnsResolver, + ResourceGroup: resourceGroup, }, } @@ -1383,11 +1335,9 @@ func GetTrafficManagerProfile(ctx context.Context, profile *armtrafficmanager.Pr ID: *profile.ID, Name: *profile.Name, Location: *profile.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.TrafficManagerProfileDescription{ - Profile: *profile, - ResourceGroup: resourceGroup, - }, + Description: model.TrafficManagerProfileDescription{ + Profile: *profile, + ResourceGroup: resourceGroup, }, } @@ -1428,11 +1378,9 @@ func GetPrivateDnsZone(ctx context.Context, privateZone *armprivatedns.PrivateZo ID: *privateZone.ID, Name: *privateZone.Name, Location: *privateZone.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PrivateDNSZonesDescription{ - PrivateZone: *privateZone, - ResourceGroup: resourceGroup, - }, + Description: model.PrivateDNSZonesDescription{ + PrivateZone: *privateZone, + ResourceGroup: resourceGroup, }, } @@ -1490,11 +1438,9 @@ func GetPrivateEndpoint(ctx context.Context, resourceGroup armresources.Resource ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PrivateEndpointDescription{ - PrivateEndpoint: *v, - ResourceGroup: *resourceGroup.Name, - }, + Description: model.PrivateEndpointDescription{ + PrivateEndpoint: *v, + ResourceGroup: *resourceGroup.Name, }, } @@ -1534,11 +1480,9 @@ func GetBastionHost(ctx context.Context, v *armnetwork.BastionHost) *models.Reso ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.BastionHostsDescription{ - BastianHost: *v, - ResourceGroup: resourceGroup, - }, + Description: model.BastionHostsDescription{ + BastianHost: *v, + ResourceGroup: resourceGroup, }, } @@ -1597,11 +1541,9 @@ func GetNetworkConnection(ctx context.Context, resourceGroup armresources.Resour ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ConnectionDescription{ - Connection: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.ConnectionDescription{ + Connection: *v, + ResourceGroup: resourceGroupName, }, } @@ -1641,11 +1583,9 @@ func GetNetworkVirtualHub(ctx context.Context, v *armnetwork.VirtualHub) *models ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VirtualHubsDescription{ - VirtualHub: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.VirtualHubsDescription{ + VirtualHub: *v, + ResourceGroup: resourceGroupName, }, } @@ -1685,11 +1625,9 @@ func GetNetworkVirtualWan(ctx context.Context, v *armnetwork.VirtualWAN) *models ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VirtualWansDescription{ - VirtualWan: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.VirtualWansDescription{ + VirtualWan: *v, + ResourceGroup: resourceGroupName, }, } return &resource @@ -1728,11 +1666,9 @@ func GetNetworkDDoSProtectionPlan(ctx context.Context, v *armnetwork.DdosProtect ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.NetworkDDoSProtectionPlanDescription{ - DDoSProtectionPlan: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.NetworkDDoSProtectionPlanDescription{ + DDoSProtectionPlan: *v, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/operationalinsights.go b/provider/describer/operationalinsights.go index 44abc6bb..a6698aaa 100644 --- a/provider/describer/operationalinsights.go +++ b/provider/describer/operationalinsights.go @@ -44,11 +44,9 @@ func getOperationalInsightsWorkspace(ctx context.Context, v *armoperationalinsig ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.OperationalInsightsWorkspacesDescription{ - Workspace: *v, - ResourceGroup: resourceGroup, - }, + Description: model.OperationalInsightsWorkspacesDescription{ + Workspace: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/policy.go b/provider/describer/policy.go index b4f65882..f6b49583 100644 --- a/provider/describer/policy.go +++ b/provider/describer/policy.go @@ -55,11 +55,9 @@ func GetPolicyAssignment(ctx context.Context, resourceClient *armresources.Clien ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.PolicyAssignmentDescription{ - Assignment: *v, - Resource: res.GenericResource, - }, + Description: model.PolicyAssignmentDescription{ + Assignment: *v, + Resource: res.GenericResource, }, } diff --git a/provider/describer/postgresql.go b/provider/describer/postgresql.go index 8df2db6a..77c9a109 100644 --- a/provider/describer/postgresql.go +++ b/provider/describer/postgresql.go @@ -105,16 +105,14 @@ func GetPostgresqlServer(ctx context.Context, firewallClient *armpostgresql.Fire ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PostgresqlServerDescription{ - Server: *server, - ServerAdministratorResources: adminListOp, - Configurations: confListByServerOp, - ServerKeys: kop, - FirewallRules: firewallListByServerOp, - ServerSecurityAlertPolicies: serverSecurityAlertPolicies, - ResourceGroup: resourceGroupName, - }, + Description: model.PostgresqlServerDescription{ + Server: *server, + ServerAdministratorResources: adminListOp, + Configurations: confListByServerOp, + ServerKeys: kop, + FirewallRules: firewallListByServerOp, + ServerSecurityAlertPolicies: serverSecurityAlertPolicies, + ResourceGroup: resourceGroupName, }, } @@ -171,12 +169,10 @@ func GetPostgresqlFlexibleserver(ctx context.Context, configurationsClient *armp ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PostgresqlFlexibleServerDescription{ - Server: *server, - ServerConfigurations: serverConfigurations, - ResourceGroup: resourceGroupName, - }, + Description: model.PostgresqlFlexibleServerDescription{ + Server: *server, + ServerConfigurations: serverConfigurations, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/powerbi.go b/provider/describer/powerbi.go index 19bc650e..d85b7e31 100644 --- a/provider/describer/powerbi.go +++ b/provider/describer/powerbi.go @@ -44,11 +44,9 @@ func GetPowerBIDedicatedCapacity(ctx context.Context, v *armpowerbidedicated.Ded ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PowerBIDedicatedCapacityDescription{ - Capacity: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.PowerBIDedicatedCapacityDescription{ + Capacity: *v, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/purview.go b/provider/describer/purview.go index 1f3b2b60..5a6e51de 100644 --- a/provider/describer/purview.go +++ b/provider/describer/purview.go @@ -44,11 +44,9 @@ func GetPurviewAccount(ctx context.Context, v *armpurview.Account) *models.Resou ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.PurviewAccountDescription{ - Account: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.PurviewAccountDescription{ + Account: *v, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/recoveryservice.go b/provider/describer/recoveryservice.go index f9c00575..4655f119 100644 --- a/provider/describer/recoveryservice.go +++ b/provider/describer/recoveryservice.go @@ -67,12 +67,10 @@ func GetRecoveryServicesVault(ctx context.Context, diagnosticClient *armmonitor. ID: *vault.ID, Name: *vault.Name, Location: *vault.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.RecoveryServicesVaultDescription{ - Vault: *vault, - DiagnosticSettingsResource: diagnostic, - ResourceGroup: resourceGroup, - }, + Description: model.RecoveryServicesVaultDescription{ + Vault: *vault, + DiagnosticSettingsResource: diagnostic, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -146,27 +144,25 @@ func GetRecoveryServicesBackupJob(resourceGroup, vaultName string, job *armrecov return nil, err } resource := models.Resource{ - Description: JSONAllFieldsMarshaller{ - Value: model.RecoveryServicesBackupJobDescription{ - Job: struct { - Name *string - ID *string - Type *string - ETag *string - Tags map[string]*string - Location *string - }{ - Name: job.Name, - ID: job.ID, - Location: job.Location, - Type: job.Type, - Tags: job.Tags, - ETag: job.ETag, - }, - VaultName: vaultName, - Properties: properties, - ResourceGroup: resourceGroup, + Description: model.RecoveryServicesBackupJobDescription{ + Job: struct { + Name *string + ID *string + Type *string + ETag *string + Tags map[string]*string + Location *string + }{ + Name: job.Name, + ID: job.ID, + Location: job.Location, + Type: job.Type, + Tags: job.Tags, + ETag: job.ETag, }, + VaultName: vaultName, + Properties: properties, + ResourceGroup: resourceGroup, }, } if job.ID != nil { @@ -280,27 +276,25 @@ func ListRecoveryServicesVaultBackupPolicies(ctx context.Context, client *armrec func GetRecoveryServicesBackupPolicy(policy *armrecoveryservicesbackup.ProtectionPolicyResource, vaultName, resourceGroup string) models.Resource { return models.Resource{ - Description: JSONAllFieldsMarshaller{ - Value: model.RecoveryServicesBackupPolicyDescription{ - ResourceGroup: resourceGroup, - VaultName: vaultName, - Policy: struct { - Name *string - ID *string - Type *string - ETag *string - Tags map[string]*string - Location *string - }{ - Name: policy.Name, - ID: policy.ID, - Location: policy.Location, - Type: policy.Type, - Tags: policy.Tags, - ETag: policy.ETag, - }, - Properties: extractData(policy.Properties), + Description: model.RecoveryServicesBackupPolicyDescription{ + ResourceGroup: resourceGroup, + VaultName: vaultName, + Policy: struct { + Name *string + ID *string + Type *string + ETag *string + Tags map[string]*string + Location *string + }{ + Name: policy.Name, + ID: policy.ID, + Location: policy.Location, + Type: policy.Type, + Tags: policy.Tags, + ETag: policy.ETag, }, + Properties: extractData(policy.Properties), }, } } @@ -367,27 +361,25 @@ func ListRecoveryServicesVaultBackupItems(ctx context.Context, client *armrecove func GetRecoveryServicesBackupItem(item *armrecoveryservicesbackup.ProtectedItemResource, vaultName, resourceGroup string) models.Resource { return models.Resource{ - Description: JSONAllFieldsMarshaller{ - Value: model.RecoveryServicesBackupItemDescription{ - ResourceGroup: resourceGroup, - VaultName: vaultName, - Item: struct { - Name *string - ID *string - Type *string - ETag *string - Tags map[string]*string - Location *string - }{ - Name: item.Name, - ID: item.ID, - Location: item.Location, - Type: item.Type, - Tags: item.Tags, - ETag: item.ETag, - }, - Properties: extractData(item.Properties), + Description: model.RecoveryServicesBackupItemDescription{ + ResourceGroup: resourceGroup, + VaultName: vaultName, + Item: struct { + Name *string + ID *string + Type *string + ETag *string + Tags map[string]*string + Location *string + }{ + Name: item.Name, + ID: item.ID, + Location: item.Location, + Type: item.Type, + Tags: item.Tags, + ETag: item.ETag, }, + Properties: extractData(item.Properties), }, } } diff --git a/provider/describer/redis.go b/provider/describer/redis.go index 911c729b..2592f6fe 100644 --- a/provider/describer/redis.go +++ b/provider/describer/redis.go @@ -45,11 +45,9 @@ func GetRedisCache(ctx context.Context, v *armredis.ResourceInfo) *models.Resour ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.RedisCacheDescription{ - ResourceInfo: *v, - ResourceGroup: resourceGroup, - }, + Description: model.RedisCacheDescription{ + ResourceInfo: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -89,11 +87,9 @@ func GetCacheRedisEnterprise(ctx context.Context, v *armredisenterprise.Cluster) ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.RedisEnterpriseCacheDescription{ - RedisEnterprise: *v, - ResourceGroup: resourceGroup, - }, + Description: model.RedisEnterpriseCacheDescription{ + RedisEnterprise: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/resources.go b/provider/describer/resources.go index 9b1ee5dd..25702152 100644 --- a/provider/describer/resources.go +++ b/provider/describer/resources.go @@ -63,10 +63,8 @@ func GetResourceProvider(ctx context.Context, provider *armresources.Provider) * resource := models.Resource{ ID: *provider.ID, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.ResourceProviderDescription{ - Provider: *provider, - }, + Description: model.ResourceProviderDescription{ + Provider: *provider, }, } @@ -106,10 +104,8 @@ func GetResourceGroup(ctx context.Context, group *armresources.ResourceGroup) *m ID: *group.ID, Name: *group.Name, Location: *group.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ResourceGroupDescription{ - Group: *group, - }, + Description: model.ResourceGroupDescription{ + Group: *group, }, } @@ -154,11 +150,9 @@ func GetResource(ctx context.Context, genericResource *armresources.GenericResou ID: *genericResource.ID, Name: *genericResource.Name, Location: *genericResource.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.GenericResourceDescription{ - GenericResource: *genericResource, - ResourceGroup: resourceGroupName, - }, + Description: model.GenericResourceDescription{ + GenericResource: *genericResource, + ResourceGroup: resourceGroupName, }, } return &resource diff --git a/provider/describer/search.go b/provider/describer/search.go index 429f27ef..37388d58 100644 --- a/provider/describer/search.go +++ b/provider/describer/search.go @@ -65,12 +65,10 @@ func GetSearchService(ctx context.Context, diagnosticClient *armmonitor.Diagnost ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SearchServiceDescription{ - Service: *v, - DiagnosticSettingsResources: searchListOp, - ResourceGroup: resourceGroupName, - }, + Description: model.SearchServiceDescription{ + Service: *v, + DiagnosticSettingsResources: searchListOp, + ResourceGroup: resourceGroupName, }, } return &resource, nil diff --git a/provider/describer/secret.go b/provider/describer/secret.go index 1b4c27bd..30afc891 100644 --- a/provider/describer/secret.go +++ b/provider/describer/secret.go @@ -84,13 +84,11 @@ func KeyVaultSecret(ctx context.Context, cred *azidentity.ClientSecretCredential ID: *sc.ID, Name: *sc.ID, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.KeyVaultSecretDescription{ - SecretItem: *sc, - Vault: keyVaultGetOp.Vault, - TurboData: turbotData, - ResourceGroup: *rg.Name, - }, + Description: model.KeyVaultSecretDescription{ + SecretItem: *sc, + Vault: keyVaultGetOp.Vault, + TurboData: turbotData, + ResourceGroup: *rg.Name, }, } if stream != nil { diff --git a/provider/describer/security.go b/provider/describer/security.go index 34f43a1a..7f5c7d4b 100644 --- a/provider/describer/security.go +++ b/provider/describer/security.go @@ -43,10 +43,8 @@ func GetSecurityCenterAutoProvisioning(ctx context.Context, v *armsecurity.AutoP ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.SecurityCenterAutoProvisioningDescription{ - AutoProvisioningSetting: *v, - }, + Description: model.SecurityCenterAutoProvisioningDescription{ + AutoProvisioningSetting: *v, }, } @@ -86,10 +84,8 @@ func GetSecurityCenterContact(ctx context.Context, v *armsecurity.Contact) *mode ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.SecurityCenterContactDescription{ - Contact: *v, - }, + Description: model.SecurityCenterContactDescription{ + Contact: *v, }, } return &resource @@ -128,10 +124,8 @@ func GetSecurityCenterJitNetworkAccessPolicy(ctx context.Context, v *armsecurity ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SecurityCenterJitNetworkAccessPolicyDescription{ - JitNetworkAccessPolicy: *v, - }, + Description: model.SecurityCenterJitNetworkAccessPolicyDescription{ + JitNetworkAccessPolicy: *v, }, } return &resource @@ -214,10 +208,8 @@ func GetSecurityCenterSubscriptionPricing(ctx context.Context, v *armsecurity.Pr ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.SecurityCenterSubscriptionPricingDescription{ - Pricing: *v, - }, + Description: model.SecurityCenterSubscriptionPricingDescription{ + Pricing: *v, }, } return &resource @@ -257,11 +249,9 @@ func GetSecurityCenterAutomation(ctx context.Context, v *armsecurity.Automation) ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SecurityCenterAutomationDescription{ - Automation: *v, - ResourceGroup: resourceGroup, - }, + Description: model.SecurityCenterAutomationDescription{ + Automation: *v, + ResourceGroup: resourceGroup, }, } return &resource @@ -302,11 +292,9 @@ func GetSecurityCenterSubAssessment(ctx context.Context, v *armsecurity.SubAsses ID: *v.ID, Location: "global", Name: *v.Name, - Description: JSONAllFieldsMarshaller{ - Value: model.SecurityCenterSubAssessmentDescription{ - SubAssessment: *v, - ResourceGroup: resourceGroup, - }, + Description: model.SecurityCenterSubAssessmentDescription{ + SubAssessment: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/servicebus.go b/provider/describer/servicebus.go index 9f25036d..3dd079de 100644 --- a/provider/describer/servicebus.go +++ b/provider/describer/servicebus.go @@ -82,7 +82,7 @@ func GetServiceBusQueue(ctx context.Context, v *armservicebus.SBQueue) *models.R ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{Value: v}, + Description: v, } return &resource } @@ -156,7 +156,7 @@ func GetServiceBusTopic(ctx context.Context, v *armservicebus.SBTopic) *models.R ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{Value: v}, + Description: v, } return &resource } @@ -266,15 +266,13 @@ func GetServicebusNamespace(ctx context.Context, namespaceClient *armservicebus. ID: *namespace.ID, Name: *namespace.Name, Location: *namespace.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ServicebusNamespaceDescription{ - SBNamespace: *namespace, - DiagnosticSettingsResources: insightsListOp, - NetworkRuleSet: servicebusGetNetworkRuleSetOp, - PrivateEndpointConnections: servicebusListOp, - AuthorizationRules: servicebusAuthorizationRules, - ResourceGroup: resourceGroup, - }, + Description: model.ServicebusNamespaceDescription{ + SBNamespace: *namespace, + DiagnosticSettingsResources: insightsListOp, + NetworkRuleSet: servicebusGetNetworkRuleSetOp, + PrivateEndpointConnections: servicebusListOp, + AuthorizationRules: servicebusAuthorizationRules, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/servicefabric.go b/provider/describer/servicefabric.go index 92ec276e..74a3185a 100644 --- a/provider/describer/servicefabric.go +++ b/provider/describer/servicefabric.go @@ -39,11 +39,10 @@ func GetServiceFabricCluster(ctx context.Context, cluster *armservicefabric.Clus resourceGroup := strings.Split(*cluster.ID, "/")[4] resource := models.Resource{ - ID: *cluster.ID, - Name: *cluster.Name, - Location: *cluster.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ServiceFabricClusterDescription{Cluster: *cluster, ResourceGroup: resourceGroup}, - }} + ID: *cluster.ID, + Name: *cluster.Name, + Location: *cluster.Location, + Description: model.ServiceFabricClusterDescription{Cluster: *cluster, ResourceGroup: resourceGroup}, + } return &resource } diff --git a/provider/describer/signalr.go b/provider/describer/signalr.go index c2debad5..6acb72e0 100644 --- a/provider/describer/signalr.go +++ b/provider/describer/signalr.go @@ -65,12 +65,10 @@ func GetSignalrService(ctx context.Context, diagnosticClient *armmonitor.Diagnos ID: *service.ID, Name: *service.Name, Location: *service.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SignalrServiceDescription{ - ResourceInfo: *service, - DiagnosticSettingsResources: signalrListOp, - ResourceGroup: resourceGroup, - }, + Description: model.SignalrServiceDescription{ + ResourceInfo: *service, + DiagnosticSettingsResources: signalrListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil diff --git a/provider/describer/sql.go b/provider/describer/sql.go index e8f3f759..03cf47aa 100644 --- a/provider/describer/sql.go +++ b/provider/describer/sql.go @@ -84,15 +84,13 @@ func GetMssqlManagedInstance(ctx context.Context, managedInstanceClient *armsql. ID: *managedInstance.ID, Name: *managedInstance.Name, Location: *managedInstance.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MssqlManagedInstanceDescription{ + Description: model.MssqlManagedInstanceDescription{ ManagedInstance: *managedInstance, ManagedInstanceVulnerabilityAssessments: viop, ManagedDatabaseSecurityAlertPolicies: vsop, ManagedInstanceEncryptionProtectors: veop, ResourceGroup: resourceGroup, }, - }, } return &resource, nil @@ -157,13 +155,11 @@ func GetManagedInstanceDatabases(ctx context.Context, managedInstance *armsql.Ma ID: *db.ID, Name: *db.Name, Location: *db.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.MssqlManagedInstanceDatabasesDescription{ + Description: model.MssqlManagedInstanceDatabasesDescription{ ManagedInstance: *managedInstance, Database: *db, ResourceGroup: resourceGroup, }, - }, } return &resource } @@ -307,8 +303,7 @@ func GetSqlDatabase(ctx context.Context, recoverableClient *armsql.RecoverableDa ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlDatabaseDescription{ + Description: model.SqlDatabaseDescription{ Database: getOp.Database, LongTermRetentionPolicy: longTermRetentionPolicy, TransparentDataEncryption: transparentDataOp, @@ -318,7 +313,6 @@ func GetSqlDatabase(ctx context.Context, recoverableClient *armsql.RecoverableDa AuditPolicies: auditPolicies, ResourceGroup: resourceGroupName, }, - }, } return &resource, nil } @@ -354,12 +348,10 @@ func GetSqlInstancePool(ctx context.Context, clientFactory *armsql.ClientFactory ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlInstancePoolDescription{ + Description: model.SqlInstancePoolDescription{ InstancePool: *v, ResourceGroup: resourceGroupName, }, - }, } return &resource, nil } diff --git a/provider/describer/sqlv3.go b/provider/describer/sqlv3.go index a75e2a8d..302cb184 100644 --- a/provider/describer/sqlv3.go +++ b/provider/describer/sqlv3.go @@ -155,21 +155,19 @@ func GetSqlServer(ctx context.Context, automaticTuningClient *armsql.ServerAutom ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlServerDescription{ - Server: *server, - ServerBlobAuditingPolicies: bop, - ServerSecurityAlertPolicies: sop, - ServerAzureADAdministrators: adminOp, - ServerVulnerabilityAssessments: vop, - FirewallRules: firewallOp, - EncryptionProtectors: eop, - PrivateEndpointConnections: pop, - VirtualNetworkRules: nop, - FailoverGroups: fop, - AutomaticTuning: automaticTuning.ServerAutomaticTuning, - ResourceGroup: resourceGroupName, - }, + Description: model.SqlServerDescription{ + Server: *server, + ServerBlobAuditingPolicies: bop, + ServerSecurityAlertPolicies: sop, + ServerAzureADAdministrators: adminOp, + ServerVulnerabilityAssessments: vop, + FirewallRules: firewallOp, + EncryptionProtectors: eop, + PrivateEndpointConnections: pop, + VirtualNetworkRules: nop, + FailoverGroups: fop, + AutomaticTuning: automaticTuning.ServerAutomaticTuning, + ResourceGroup: resourceGroupName, }, } return &resource, nil @@ -235,12 +233,10 @@ func GetSqlServerJobAgent(ctx context.Context, server *armsql.Server, job *armsq ID: *job.ID, Name: *job.Name, Location: *job.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlServerJobAgentDescription{ - Server: *server, - JobAgent: *job, - ResourceGroup: jobResourceGroupName, - }, + Description: model.SqlServerJobAgentDescription{ + Server: *server, + JobAgent: *job, + ResourceGroup: jobResourceGroupName, }, } return &resource @@ -282,11 +278,9 @@ func GetSqlVirtualCluster(ctx context.Context, v *armsql.VirtualCluster) *models ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlVirtualClustersDescription{ - VirtualClusters: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.SqlVirtualClustersDescription{ + VirtualClusters: *v, + ResourceGroup: resourceGroupName, }, } @@ -392,13 +386,11 @@ func GetSqlServerElasticPool(ctx context.Context, server *armsql.Server, activit ID: *elasticPool.ID, Name: *elasticPool.Name, Location: *elasticPool.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlServerElasticPoolDescription{ - TotalDTU: totalDTU, - Pool: *elasticPool, - ServerName: name, - ResourceGroup: resourceGroup, - }, + Description: model.SqlServerElasticPoolDescription{ + TotalDTU: totalDTU, + Pool: *elasticPool, + ServerName: name, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -438,11 +430,9 @@ func GetSqlServerVirtualMachine(ctx context.Context, vm *armsqlvirtualmachine.SQ ID: *vm.ID, Name: *vm.Name, Location: *vm.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlServerVirtualMachineDescription{ - VirtualMachine: *vm, - ResourceGroup: resourceGroup, - }, + Description: model.SqlServerVirtualMachineDescription{ + VirtualMachine: *vm, + ResourceGroup: resourceGroup, }, } return &resource @@ -483,11 +473,9 @@ func GetSqlServerVirtualMachineGroups(ctx context.Context, vm *armsqlvirtualmach ID: *vm.ID, Name: *vm.Name, Location: *vm.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlServerVirtualMachineGroupDescription{ - Group: *vm, - ResourceGroup: resourceGroup, - }, + Description: model.SqlServerVirtualMachineGroupDescription{ + Group: *vm, + ResourceGroup: resourceGroup, }, } return &resource @@ -527,11 +515,9 @@ func GetSqlServerFlexibleServer(ctx context.Context, fs *armmysqlflexibleservers ID: *fs.ID, Name: *fs.Name, Location: *fs.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SqlServerFlexibleServerDescription{ - FlexibleServer: *fs, - ResourceGroup: resourceGroup, - }, + Description: model.SqlServerFlexibleServerDescription{ + FlexibleServer: *fs, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/storage.go b/provider/describer/storage.go index eea7e538..5e4515a5 100644 --- a/provider/describer/storage.go +++ b/provider/describer/storage.go @@ -106,13 +106,11 @@ func GetAccountStorageContainter(ctx context.Context, client *armstorage.BlobCon ID: *v.ID, Name: *v.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.StorageContainerDescription{ - AccountName: *acc.Name, - ListContainerItem: *v, - ImmutabilityPolicy: op.ImmutabilityPolicy, - ResourceGroup: resourceGroup, - }, + Description: model.StorageContainerDescription{ + AccountName: *acc.Name, + ListContainerItem: *v, + ImmutabilityPolicy: op.ImmutabilityPolicy, + ResourceGroup: resourceGroup, }, }, nil } @@ -332,20 +330,18 @@ func GetStorageAccount(ctx context.Context, storageClient *armstorage.AccountsCl ID: *account.ID, Name: *account.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageAccountDescription{ - Account: *account, - ManagementPolicy: managementPolicy, - BlobServiceProperties: blobServicesProperties, - Logging: logging, - StorageServiceProperties: storageProperties, - FileServiceProperties: storageGetServicePropertiesOp, - DiagnosticSettingsResources: diagSettingsOp, - EncryptionScopes: vsop, - TableProperties: tableProperties, - AccessKeys: keysMap, - ResourceGroup: *resourceGroup, - }, + Description: model.StorageAccountDescription{ + Account: *account, + ManagementPolicy: managementPolicy, + BlobServiceProperties: blobServicesProperties, + Logging: logging, + StorageServiceProperties: storageProperties, + FileServiceProperties: storageGetServicePropertiesOp, + DiagnosticSettingsResources: diagSettingsOp, + EncryptionScopes: vsop, + TableProperties: tableProperties, + AccessKeys: keysMap, + ResourceGroup: *resourceGroup, }, } return &resource, nil @@ -536,12 +532,10 @@ func ListAccountStorageBlobs(ctx context.Context, containerClient *armstorage.Bl } resource := models.Resource{ - ID: *blob.Name, - Name: *blob.Name, - Location: *storageAccount.Location, - Description: JSONAllFieldsMarshaller{ - Value: desc, - }, + ID: *blob.Name, + Name: *blob.Name, + Location: *storageAccount.Location, + Description: desc, } values = append(values, resource) } @@ -609,13 +603,11 @@ func GetStorageBlobService(ctx context.Context, account *armstorage.Account, res ID: *blobService.ID, Name: *blobService.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageBlobServiceDescription{ - BlobService: *blobService, - AccountName: *account.Name, - Location: *account.Location, - ResourceGroup: *resourceGroup.Name, - }, + Description: model.StorageBlobServiceDescription{ + BlobService: *blobService, + AccountName: *account.Name, + Location: *account.Location, + ResourceGroup: *resourceGroup.Name, }, } return &resource @@ -695,13 +687,11 @@ func GetStorageQueue(ctx context.Context, account *armstorage.Account, resourceG ID: *queue.ID, Name: *queue.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageQueueDescription{ - Queue: *queue, - AccountName: *account.Name, - Location: *account.Location, - ResourceGroup: *resourceGroup.Name, - }, + Description: model.StorageQueueDescription{ + Queue: *queue, + AccountName: *account.Name, + Location: *account.Location, + ResourceGroup: *resourceGroup.Name, }, } return &resource @@ -774,13 +764,11 @@ func GetStorageFileShares(ctx context.Context, account *armstorage.Account, reso ID: *fileShareItem.ID, Name: *fileShareItem.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageFileShareDescription{ - FileShare: *fileShareItem, - AccountName: *account.Name, - Location: *account.Location, - ResourceGroup: *resourceGroup.Name, - }, + Description: model.StorageFileShareDescription{ + FileShare: *fileShareItem, + AccountName: *account.Name, + Location: *account.Location, + ResourceGroup: *resourceGroup.Name, }, } return &resource @@ -862,13 +850,11 @@ func GetStorageTable(ctx context.Context, account *armstorage.Account, resourceG ID: *table.ID, Name: *table.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageTableDescription{ - Table: *table, - AccountName: *account.Name, - Location: *account.Location, - ResourceGroup: *resourceGroup.Name, - }, + Description: model.StorageTableDescription{ + Table: *table, + AccountName: *account.Name, + Location: *account.Location, + ResourceGroup: *resourceGroup.Name, }, } return &resource @@ -943,13 +929,11 @@ func GetAccountStorageTableService(ctx context.Context, resourceGroup armresourc ID: *tableService.ID, Name: *tableService.Name, Location: *account.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageTableServiceDescription{ - TableService: *tableService, - AccountName: *account.Name, - Location: *account.Location, - ResourceGroup: *resourceGroup.Name, - }, + Description: model.StorageTableServiceDescription{ + TableService: *tableService, + AccountName: *account.Name, + Location: *account.Location, + ResourceGroup: *resourceGroup.Name, }, } return &resource diff --git a/provider/describer/storagecache.go b/provider/describer/storagecache.go index 1342f3ad..4d82e5f0 100644 --- a/provider/describer/storagecache.go +++ b/provider/describer/storagecache.go @@ -44,11 +44,9 @@ func GetHpcCache(ctx context.Context, v *armstoragecache.Cache) *models.Resource ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.HpcCacheDescription{ - Cache: *v, - ResourceGroup: resourceGroup, - }, + Description: model.HpcCacheDescription{ + Cache: *v, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/storagesync.go b/provider/describer/storagesync.go index 0a791395..06c32156 100644 --- a/provider/describer/storagesync.go +++ b/provider/describer/storagesync.go @@ -45,11 +45,9 @@ func GetStorageSync(ctx context.Context, storage *armstoragesync.Service) *model ID: *storage.ID, Name: *storage.Name, Location: *storage.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StorageSyncDescription{ - Service: *storage, - ResourceGroup: resourceGroup, - }, + Description: model.StorageSyncDescription{ + Service: *storage, + ResourceGroup: resourceGroup, }} return &resource } diff --git a/provider/describer/streamanalytics.go b/provider/describer/streamanalytics.go index c3506fc1..e84cf35e 100644 --- a/provider/describer/streamanalytics.go +++ b/provider/describer/streamanalytics.go @@ -65,12 +65,10 @@ func GetStreamAnalyticsJob(ctx context.Context, diagnosticClient *armmonitor.Dia ID: *streamingJob.ID, Name: *streamingJob.Name, Location: *streamingJob.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StreamAnalyticsJobDescription{ - StreamingJob: *streamingJob, - DiagnosticSettingsResources: streamanalyticsListOp, - ResourceGroup: resourceGroup, - }, + Description: model.StreamAnalyticsJobDescription{ + StreamingJob: *streamingJob, + DiagnosticSettingsResources: streamanalyticsListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -111,11 +109,9 @@ func GetStreamAnalyticsCluster(ctx context.Context, streamingJob *armstreamanaly ID: *streamingJob.ID, Name: *streamingJob.Name, Location: *streamingJob.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.StreamAnalyticsClusterDescription{ - StreamingJob: *streamingJob, - ResourceGroup: resourceGroup, - }, + Description: model.StreamAnalyticsClusterDescription{ + StreamingJob: *streamingJob, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/sub.go b/provider/describer/sub.go index a131098a..edaaf507 100644 --- a/provider/describer/sub.go +++ b/provider/describer/sub.go @@ -45,11 +45,9 @@ func GetLocation(ctx context.Context, location *armsubscription.Location) *model ID: *location.ID, Name: *location.Name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.LocationDescription{ - Location: *location, - ResourceGroup: resourceGroup, - }, + Description: model.LocationDescription{ + Location: *location, + ResourceGroup: resourceGroup, }, } diff --git a/provider/describer/subscriptions.go b/provider/describer/subscriptions.go index 897a5033..c71ba3c8 100644 --- a/provider/describer/subscriptions.go +++ b/provider/describer/subscriptions.go @@ -44,10 +44,8 @@ func GetTenand(ctx context.Context, v *armsubscription.TenantIDDescription) *mod ID: *v.ID, Name: name, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.TenantDescription{ - TenantIDDescription: *v, // TODO has much less values - }, + Description: model.TenantDescription{ + TenantIDDescription: *v, // TODO has much less values }, } @@ -101,11 +99,9 @@ func Subscription(ctx context.Context, cred *azidentity.ClientSecretCredential, ID: *op.ID, Name: *op.DisplayName, Location: "global", - Description: JSONAllFieldsMarshaller{ - Value: model.SubscriptionDescription{ - Subscription: op.Subscription, - Tags: tags, - }, + Description: model.SubscriptionDescription{ + Subscription: op.Subscription, + Tags: tags, }, } if stream != nil { diff --git a/provider/describer/synapse.go b/provider/describer/synapse.go index 7df3e028..a360b58d 100644 --- a/provider/describer/synapse.go +++ b/provider/describer/synapse.go @@ -86,13 +86,11 @@ func GetSynapseWorkspace(ctx context.Context, synapseClient *armsynapse.Workspac ID: *config.ID, Name: *config.Name, Location: *config.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SynapseWorkspaceDescription{ - Workspace: *config, - ServerVulnerabilityAssessments: serverVulnerabilityAssessments, - DiagnosticSettingsResources: synapseListOp, - ResourceGroup: resourceGroup, - }, + Description: model.SynapseWorkspaceDescription{ + Workspace: *config, + ServerVulnerabilityAssessments: serverVulnerabilityAssessments, + DiagnosticSettingsResources: synapseListOp, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -147,12 +145,10 @@ func GetSynapseWorkspaceBigdataPools(ctx context.Context, resourceGroup string, ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SynapseWorkspaceBigdatapoolsDescription{ - Workspace: *v, - BigDataPool: *bp, - ResourceGroup: resourceGroup, - }, + Description: model.SynapseWorkspaceBigdatapoolsDescription{ + Workspace: *v, + BigDataPool: *bp, + ResourceGroup: resourceGroup, }, } return &resource @@ -220,12 +216,10 @@ func GetSynapseWorkspaceSqlpools(ctx context.Context, v *armsynapse.Workspace, b ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.SynapseWorkspaceSqlpoolsDescription{ - Workspace: *v, - SqlPool: *bp, - ResourceGroup: resourceGroup, - }, + Description: model.SynapseWorkspaceSqlpoolsDescription{ + Workspace: *v, + SqlPool: *bp, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/timeseriesinsights.go b/provider/describer/timeseriesinsights.go index 882d97a5..ae88d9df 100644 --- a/provider/describer/timeseriesinsights.go +++ b/provider/describer/timeseriesinsights.go @@ -44,11 +44,9 @@ func GetTimeSeriesInsightsEnvironments(ctx context.Context, record armtimeseries ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.TimeSeriesInsightsEnvironmentsDescription{ - Environment: v, - ResourceGroup: resourceGroup, - }, + Description: model.TimeSeriesInsightsEnvironmentsDescription{ + Environment: v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/virtualmachineimage.go b/provider/describer/virtualmachineimage.go index 05dfb55d..9647537f 100644 --- a/provider/describer/virtualmachineimage.go +++ b/provider/describer/virtualmachineimage.go @@ -45,11 +45,9 @@ func GetVirtualMachineImagesImageTemplates(ctx context.Context, v *armvirtualmac ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.VirtualMachineImagesImageTemplatesDescription{ - ImageTemplate: *v, - ResourceGroup: resourceGroup, - }, + Description: model.VirtualMachineImagesImageTemplatesDescription{ + ImageTemplate: *v, + ResourceGroup: resourceGroup, }, } return &resource diff --git a/provider/describer/web.go b/provider/describer/web.go index d767d2a0..0f3ea9a2 100644 --- a/provider/describer/web.go +++ b/provider/describer/web.go @@ -45,11 +45,9 @@ func GetAppServiceEnvironment(ctx context.Context, v *appservice.EnvironmentReso ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AppServiceEnvironmentDescription{ - AppServiceEnvironmentResource: *v, - ResourceGroup: resourceGroup, - }, + Description: model.AppServiceEnvironmentDescription{ + AppServiceEnvironmentResource: *v, + ResourceGroup: resourceGroup, }, } @@ -106,13 +104,11 @@ func GetAppServiceFunctionApp(ctx context.Context, webClient *appservice.WebApps ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AppServiceFunctionAppDescription{ - Site: *v, - SiteAuthSettings: authSettings.SiteAuthSettings, - SiteConfigResource: configuration.SiteConfigResource, - ResourceGroup: resourceGroup, - }, + Description: model.AppServiceFunctionAppDescription{ + Site: *v, + SiteAuthSettings: authSettings.SiteAuthSettings, + SiteConfigResource: configuration.SiteConfigResource, + ResourceGroup: resourceGroup, }, } return &resource, nil @@ -207,16 +203,14 @@ func GetAppServiceWebApp(ctx context.Context, webClient *appservice.WebAppsClien ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.AppServiceWebAppDescription{ - Site: *v, - SiteConfigResource: configuration.SiteConfigResource, - SiteAuthSettings: authSettings.SiteAuthSettings, - SiteLogConfig: diagnosticLogConfiguration.SiteLogsConfig, - VnetInfo: vnet.VnetInfoResource, - StorageAccounts: storageAccounts.Properties, - ResourceGroup: resourceGroup, - }, + Description: model.AppServiceWebAppDescription{ + Site: *v, + SiteConfigResource: configuration.SiteConfigResource, + SiteAuthSettings: authSettings.SiteAuthSettings, + SiteLogConfig: diagnosticLogConfiguration.SiteLogsConfig, + VnetInfo: vnet.VnetInfoResource, + StorageAccounts: storageAccounts.Properties, + ResourceGroup: resourceGroup, }, } @@ -278,12 +272,10 @@ func GetAppServiceWebAppSlot(ctx context.Context, app *appservice.Site, v *appse ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.AppServiceWebAppSlotDescription{ - Site: *v, - AppName: *app.Name, - ResourceGroup: resourceGroup, - }, + Description: model.AppServiceWebAppSlotDescription{ + Site: *v, + AppName: *app.Name, + ResourceGroup: resourceGroup, }, } @@ -343,12 +335,10 @@ func GetAppServicePlan(ctx context.Context, client *appservice.PlansClient, v *a ID: *v.ID, Name: *v.Name, Location: location, - Description: JSONAllFieldsMarshaller{ - Value: model.AppServicePlanDescription{ - Plan: *v, - Apps: webApps, - ResourceGroup: resourceGroup, - }, + Description: model.AppServicePlanDescription{ + Plan: *v, + Apps: webApps, + ResourceGroup: resourceGroup, }, } @@ -389,11 +379,9 @@ func GetAppContainerApps(ctx context.Context, server *appservice.ContainerApp) * ID: *server.ID, Name: *server.Name, Location: *server.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.ContainerAppDescription{ - Server: *server, - ResourceGroup: resourceGroupName, - }, + Description: model.ContainerAppDescription{ + Server: *server, + ResourceGroup: resourceGroupName, }, } @@ -434,11 +422,9 @@ func GetWebServerFarm(ctx context.Context, v *appservice.Plan) *models.Resource ID: *v.ID, Name: *v.Name, Location: *v.Location, - Description: JSONAllFieldsMarshaller{ - Value: model.WebServerFarmsDescription{ - ServerFarm: *v, - ResourceGroup: resourceGroupName, - }, + Description: model.WebServerFarmsDescription{ + ServerFarm: *v, + ResourceGroup: resourceGroupName, }, } return &resource