diff --git a/go.mod b/go.mod index 62f015d..809beee 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/spf13/cobra v1.3.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.10.1 + github.com/stretchr/testify v1.7.0 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a go.uber.org/mock v0.2.0 golang.org/x/net v0.17.0 @@ -20,12 +21,14 @@ require ( require ( github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/magiconair/properties v1.8.5 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/pelletier/go-toml v1.9.4 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -34,4 +37,5 @@ require ( golang.org/x/text v0.13.0 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/models/app-member.go b/models/app-member.go index 84f2ac7..c56b3f6 100644 --- a/models/app-member.go +++ b/models/app-member.go @@ -25,3 +25,14 @@ type AppMember struct { json.RawMessage AppId string `json:"appId"` } + +func (s *AppMember) MarshalJSON() ([]byte, error) { + var data map[string]any + if err := json.Unmarshal(s.RawMessage, &data); err != nil { + return nil, err + } else { + StripEmptyEntries(data) + data["appId"] = s.AppId + return json.Marshal(data) + } +} diff --git a/models/app-owner.go b/models/app-owner.go index 3f98471..ec3ac64 100644 --- a/models/app-owner.go +++ b/models/app-owner.go @@ -26,6 +26,18 @@ type AppOwner struct { AppId string `json:"appId"` } +func (s *AppOwner) MarshalJSON() ([]byte, error) { + output := make(map[string]any) + output["appId"] = s.AppId + + if owner, err := OmitEmpty(s.Owner); err != nil { + return nil, err + } else { + output["owner"] = owner + return json.Marshal(output) + } +} + type AppOwners struct { Owners []AppOwner `json:"owners"` AppId string `json:"appId"` diff --git a/models/azure/access_policy_entry.go b/models/azure/access_policy_entry.go index aa4c55e..5477af0 100644 --- a/models/azure/access_policy_entry.go +++ b/models/azure/access_policy_entry.go @@ -21,15 +21,15 @@ package azure // vault's tenant ID. type AccessPolicyEntry struct { // Application ID of the client making request on behalf of a principal - ApplicationId string `json:"applicationId"` + ApplicationId string `json:"applicationId,omitempty"` // The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. // The object ID must be unique for the list of access policies. - ObjectId string `json:"objectId"` + ObjectId string `json:"objectId,omitempty"` // Permissions the identity has for keys, secrets and certificates. - Permissions KeyVaultPermissions `json:"permissions"` + Permissions KeyVaultPermissions `json:"permissions,omitempty"` // The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantId string `json:"tenantId"` + TenantId string `json:"tenantId,omitempty"` } diff --git a/models/azure/addin.go b/models/azure/addin.go index b8d3bc5..84faafb 100644 --- a/models/azure/addin.go +++ b/models/azure/addin.go @@ -24,6 +24,6 @@ import "github.com/gofrs/uuid" // Microsoft 365 call the application in the context of a document the user is working on. type AddIn struct { Id uuid.UUID `json:"id,omitempty"` - Properties []KeyValue `json:"properties"` - Type string `json:"type"` + Properties []KeyValue `json:"properties,omitempty"` + Type string `json:"type,omitempty"` } diff --git a/models/azure/additional_capabilities.go b/models/azure/additional_capabilities.go index 8cd49e0..e91dabe 100644 --- a/models/azure/additional_capabilities.go +++ b/models/azure/additional_capabilities.go @@ -20,10 +20,10 @@ package azure // Enables or disables a capability on the virtual machine or virtual machine scale set. type AdditionalCapabilities struct { // The flag that enables or disables hibernation capability on the VM. - HibernationEnabled bool `json:"hibernationEnabled"` + HibernationEnabled bool `json:"hibernationEnabled,omitempty"` // The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage // account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual // machine or virtual machine scale set only if this property is enabled. - UltraSSDEnabled bool `json:"ultraSSDEnabled"` + UltraSSDEnabled bool `json:"ultraSSDEnabled,omitempty"` } diff --git a/models/azure/additional_unattend_content.go b/models/azure/additional_unattend_content.go index b8a9859..7545bea 100644 --- a/models/azure/additional_unattend_content.go +++ b/models/azure/additional_unattend_content.go @@ -21,16 +21,16 @@ package azure // Windows Setup. Contents are defined by setting name, component name, and the pass in which the content is applied. type AdditionalUnattendContent struct { // The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. - ComponentName string `json:"componentName"` + ComponentName string `json:"componentName,omitempty"` // Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. // The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted. - Content string `json:"content"` + Content string `json:"content,omitempty"` // The pass name. Currently, the only allowable value is OobeSystem. - PassName string `json:"passName"` + PassName string `json:"passName,omitempty"` // Specifies the name of the setting to which the content applies. // Possible values are: FirstLogonCommands and AutoLogon. - SettingName string `json:"settingName"` + SettingName string `json:"settingName,omitempty"` } diff --git a/models/azure/alt_security_id.go b/models/azure/alt_security_id.go index 8d396ca..1134353 100644 --- a/models/azure/alt_security_id.go +++ b/models/azure/alt_security_id.go @@ -19,9 +19,9 @@ package azure // For internal use only. This complex type will be deprecated in the future. type AlternativeSecurityId struct { - Type int32 `json:"type"` - IdentityProvider string `json:"identity_provider"` + Type int32 `json:"type,omitempty"` + IdentityProvider string `json:"identity_provider,omitempty"` // Base64Url encoded. - Key string `json:"key"` + Key string `json:"key,omitempty"` } diff --git a/models/azure/api_application.go b/models/azure/api_application.go index 3c0062f..d282da4 100644 --- a/models/azure/api_application.go +++ b/models/azure/api_application.go @@ -23,25 +23,25 @@ import "github.com/gofrs/uuid" // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/apiapplication?view=graph-rest-1.0 type ApiApplication struct { // When true, allows an application to use claims mapping without specifying a custom signing key. - AcceptMappedClaims bool `json:"acceptMappedClaims"` + AcceptMappedClaims bool `json:"acceptMappedClaims,omitempty"` // Used for bundling consent if you have a solution that contains two parts: a client app and a custom web API app. // If you set the appID of the client app to this value, the user only consents once to the client app. Azure AD // knows that consenting to the client means implicitly consenting to the web API and automatically provisions // service principals for both APIs at the same time. Both the client and the web API app must be registered in the // same tenant. - KnownClientApplications []uuid.UUID `json:"knownClientApplications"` + KnownClientApplications []uuid.UUID `json:"knownClientApplications,omitempty"` // The definition of the delegated permissions exposed by the web API represented by this application registration. // These delegated permissions may be requested by a client application, and may be granted by users or // administrators during consent. Delegated permissions are sometimes referred to as OAuth 2.0 scopes. - OAuth2PermissionScopes []PermissionScope `json:"oauth2PermissionScopes"` + OAuth2PermissionScopes []PermissionScope `json:"oauth2PermissionScopes,omitempty"` // Lists the client applications that are pre-authorized with the specified delegated permissions to access this // application's APIs. Users are not required to consent to any pre-authorized application (for the permissions // specified). However, any additional permissions not listed in preAuthorizedApplications (requested through // incremental consent for example) will require user consent. - PreAuthorizedApplications []PreAuthorizedApplication `json:"preAuthorizedApplications"` + PreAuthorizedApplications []PreAuthorizedApplication `json:"preAuthorizedApplications,omitempty"` // Specifies the access token version expected by this resource. // This changes the version and format of the JWT produced independent of the endpoint or client used to request the @@ -55,5 +55,5 @@ type ApiApplication struct { // // If signInAudience on the application is configured as AzureADandPersonalMicrosoftAccount, the value for this //property must be 2 - RequestedAccessTokenVersion int32 `json:"requestedAccessTokenVersion"` + RequestedAccessTokenVersion int32 `json:"requestedAccessTokenVersion,omitempty"` } diff --git a/models/azure/app_profile.go b/models/azure/app_profile.go index 3b0cd39..874235f 100644 --- a/models/azure/app_profile.go +++ b/models/azure/app_profile.go @@ -20,5 +20,5 @@ package azure // Contains the list of gallery applications that should be made available to the VM/VMSS. type ApplicationProfile struct { // Specifies the gallery applications that should be made available to the VM/VMSS - GalleryApplications []VMGalleryApplication `json:"galleryApplications"` + GalleryApplications []VMGalleryApplication `json:"galleryApplications,omitempty"` } diff --git a/models/azure/app_role.go b/models/azure/app_role.go index f48b159..fd82fe6 100644 --- a/models/azure/app_role.go +++ b/models/azure/app_role.go @@ -31,11 +31,11 @@ import "github.com/gofrs/uuid" // With appRoleAssignments, app roles can be assigned to users, groups, or other applications' service principals. // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/approle?view=graph-rest-1.0 type AppRole struct { - AllowedMemberTypes []string `json:"allowedMemberTypes"` - Description string `json:"description"` - DisplayName string `json:"displayName"` - Id uuid.UUID `json:"id"` - IsEnabled bool `json:"isEnabled"` - Origin string `json:"origin"` - Value string `json:"value"` + AllowedMemberTypes []string `json:"allowedMemberTypes,omitempty"` + Description string `json:"description,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Id uuid.UUID `json:"id,omitempty"` + IsEnabled bool `json:"isEnabled,omitempty"` + Origin string `json:"origin,omitempty"` + Value string `json:"value,omitempty"` } diff --git a/models/azure/app_role_assignment.go b/models/azure/app_role_assignment.go index dab358b..59c0234 100644 --- a/models/azure/app_role_assignment.go +++ b/models/azure/app_role_assignment.go @@ -22,21 +22,20 @@ import "github.com/gofrs/uuid" // Represents an application role that can be requested by (and granted to) a client application, or that can be used to // assign an application to users or groups in a specified role. // -// // An app role assignment is a relationship between the assigned principal (a user, a group, or a service principal), // a resource application (the app's service principal) and an app role defined on the resource application. // // With appRoleAssignments, app roles can be assigned to users, groups, or other applications' service principals. // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/approleassignment?view=graph-rest-1.0 type AppRoleAssignment struct { - AppRoleId uuid.UUID `json:"appRoleId"` - CreatedDateTime string `json:"createdDateTime"` - Id string `json:"id"` - PrincipalDisplayName string `json:"principalDisplayName"` - PrincipalId uuid.UUID `json:"principalId"` - PrincipalType string `json:"principalType"` - ResourceDisplayName string `json:"resourceDisplayName"` - ResourceId string `json:"resourceId"` + AppRoleId uuid.UUID `json:"appRoleId,omitempty"` + CreatedDateTime string `json:"createdDateTime,omitempty"` + Id string `json:"id,omitempty"` + PrincipalDisplayName string `json:"principalDisplayName,omitempty"` + PrincipalId uuid.UUID `json:"principalId,omitempty"` + PrincipalType string `json:"principalType,omitempty"` + ResourceDisplayName string `json:"resourceDisplayName,omitempty"` + ResourceId string `json:"resourceId,omitempty"` } type AppRoleAssignmentList struct { diff --git a/models/azure/app_scope.go b/models/azure/app_scope.go index de8f8fb..45908ac 100644 --- a/models/azure/app_scope.go +++ b/models/azure/app_scope.go @@ -31,11 +31,11 @@ type AppScope struct { // Provides the display name of the app-specific resource represented by the app scope. // Provided for display purposes since appScopeId is often an immutable, non-human-readable id. // Read-only. - DisplayName string `json:"display_name"` + DisplayName string `json:"display_name,omitempty"` // Describes the type of app-specific resource represented by the app scope. // Provided for display purposes, so a user interface can convey to the user the kind of app specific resource // represented by the app scope. // Read-only. - Type string `json:"type"` + Type string `json:"type,omitempty"` } diff --git a/models/azure/assigned_label.go b/models/azure/assigned_label.go index 0375061..c5e2f84 100644 --- a/models/azure/assigned_label.go +++ b/models/azure/assigned_label.go @@ -24,8 +24,8 @@ package azure // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/assignedlabel?view=graph-rest-1.0 type AssignedLabel struct { // The unique identifier of the label. - LabelId string `json:"labelId"` + LabelId string `json:"labelId,omitempty"` // The display name of the label. Read-only. - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName,omitempty"` } diff --git a/models/azure/assigned_license.go b/models/azure/assigned_license.go index 7abd8f6..71cd310 100644 --- a/models/azure/assigned_license.go +++ b/models/azure/assigned_license.go @@ -22,8 +22,8 @@ import "github.com/gofrs/uuid" // Represents a license assigned to a user. type AssignedLicense struct { // A collection of the unique identifiers for plans that have been disabled. - DisabledPlans []uuid.UUID `json:"disabledPlans"` + DisabledPlans []uuid.UUID `json:"disabledPlans,omitempty"` // The unique identifier for the SKU. - SkuId uuid.UUID `json:"skuId"` + SkuId uuid.UUID `json:"skuId,omitempty"` } diff --git a/models/azure/assigned_plan.go b/models/azure/assigned_plan.go index c3992ae..fa5809f 100644 --- a/models/azure/assigned_plan.go +++ b/models/azure/assigned_plan.go @@ -25,14 +25,14 @@ import ( // Represents a plan assigned to user and organization entities. type AssignedPlan struct { // The date and time at which the plan was assigned using ISO 8601 format. - AssignedDateTime string `json:"assignedDateTime"` + AssignedDateTime string `json:"assignedDateTime,omitempty"` // Condition of the capability assignment. - CapabilityStatus enums.CapabiltyStatus `json:"capabilityStatus"` + CapabilityStatus enums.CapabiltyStatus `json:"capabilityStatus,omitempty"` // The name of the service. - Service string `json:"service"` + Service string `json:"service,omitempty"` // A GUID that identifies the service plan. - ServicePlanId uuid.UUID `json:"servicePlanId"` + ServicePlanId uuid.UUID `json:"servicePlanId,omitempty"` } diff --git a/models/azure/automatic_replies_setting.go b/models/azure/automatic_replies_setting.go index 4d7b4b3..f500ce6 100644 --- a/models/azure/automatic_replies_setting.go +++ b/models/azure/automatic_replies_setting.go @@ -26,20 +26,20 @@ import ( type AutomaticRepliesSetting struct { // The set of audience external to the signed-in user's organization who will receive the {@link // ExternalReplyMessage}. - ExternalAudience enums.ExternalAudienceScope `json:"externalAudience"` + ExternalAudience enums.ExternalAudienceScope `json:"externalAudience,omitempty"` // The automatic reply to send to the specified eternal audience. - ExternalReplyMessage string `json:"externalReplyMessage"` + ExternalReplyMessage string `json:"externalReplyMessage,omitempty"` // The automatic reply to send to the audience internal to the signed-in user's organization. - InternalReplyMessage string `json:"internalReplyMessage"` + InternalReplyMessage string `json:"internalReplyMessage,omitempty"` // The date and time that automatic replies are set to end. - ScheduledEndDateTime DateTimeTimeZone `json:"scheduledEndDateTime"` + ScheduledEndDateTime DateTimeTimeZone `json:"scheduledEndDateTime,omitempty"` // The date and time that automatic replies are set to begin. - ScheduledStartDateTime DateTimeTimeZone `json:"scheduledStartDateTime"` + ScheduledStartDateTime DateTimeTimeZone `json:"scheduledStartDateTime,omitempty"` // Configuration status for automatic replies. - Status enums.AutoReplyStatus `json:"status"` + Status enums.AutoReplyStatus `json:"status,omitempty"` } diff --git a/models/azure/available_patch_summary.go b/models/azure/available_patch_summary.go index 420ac8b..e3a10fe 100644 --- a/models/azure/available_patch_summary.go +++ b/models/azure/available_patch_summary.go @@ -24,28 +24,28 @@ import ( // Describes the properties of a virtual machine instance view for available patch summary. type AvailablePatchSummary struct { // The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. - AssessmentActivityId string `json:"assessmentActivityId"` + AssessmentActivityId string `json:"assessmentActivityId,omitempty"` // The number of critical or security patches that have been detected as available and not yet installed. - CriticalAndSecurityPatchCount int `json:"criticalAndSecurityPatchCount"` + CriticalAndSecurityPatchCount int `json:"criticalAndSecurityPatchCount,omitempty"` // The errors that were encountered during execution of the operation. The details array contains the list of them. - Error ODataError `json:"error"` + Error ODataError `json:"error,omitempty"` // The UTC timestamp when the operation began. - LastModifiedTime string `json:"lastModifiedTime"` + LastModifiedTime string `json:"lastModifiedTime,omitempty"` // The number of all available patches excluding critical and security. - OtherPatchCount int `json:"otherPatchCount"` + OtherPatchCount int `json:"otherPatchCount,omitempty"` // The overall reboot status of the VM. It will be true when partially installed patches require a reboot to // complete installation but the reboot has not yet occurred. - RebootPending bool `json:"rebootPending"` + RebootPending bool `json:"rebootPending,omitempty"` // The UTC timestamp when the operation began. - StartTime string `json:"startTime"` + StartTime string `json:"startTime,omitempty"` // The overall success or failure status of the operation. It remains "InProgress" until the operation completes. // At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings." - Status enums.PatchStatus `json:"status"` + Status enums.PatchStatus `json:"status,omitempty"` } diff --git a/models/azure/billing_profile.go b/models/azure/billing_profile.go index 559246d..d8d19e8 100644 --- a/models/azure/billing_profile.go +++ b/models/azure/billing_profile.go @@ -36,5 +36,5 @@ type BillingProfile struct { // Also, the default max price is -1 if it is not provided by you. // // Minimum api-version: 2019-03-01. - MaxPrice float64 `json:"maxPrice"` + MaxPrice float64 `json:"maxPrice,omitempty"` } diff --git a/models/azure/boot_diagnostics.go b/models/azure/boot_diagnostics.go index 147ed3d..532e481 100644 --- a/models/azure/boot_diagnostics.go +++ b/models/azure/boot_diagnostics.go @@ -19,9 +19,9 @@ package azure type BootDiagnotics struct { // Whether boot diagnostics should be enabled on the virtual machine. - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled,omitempty"` // Uri of the storage account to use for placing the console output and screenshot. // If storageUri is not specified while enabling boot diagnostics, managed storage will be used. - StorageUri string `json:"storageUri"` + StorageUri string `json:"storageUri,omitempty"` } diff --git a/models/azure/boot_diagnostics_instance_view.go b/models/azure/boot_diagnostics_instance_view.go index f1886e1..997c782 100644 --- a/models/azure/boot_diagnostics_instance_view.go +++ b/models/azure/boot_diagnostics_instance_view.go @@ -21,13 +21,13 @@ package azure type BootDiagnoticsInstanceView struct { // The console screenshot blob URI. // NOTE: This will not be set if boot diagnostics is currently enabled with managed storage. - ConsoleScreenshotBlobUri string `json:"consoleScreenshotBlobUri"` + ConsoleScreenshotBlobUri string `json:"consoleScreenshotBlobUri,omitempty"` // The serial console log blob Uri. // NOTE: This will not be set if boot diagnostics is currently enabled with managed storage. - SerialConsoleLogBlobUri string `json:"serialConsoleLogBlobUri"` + SerialConsoleLogBlobUri string `json:"serialConsoleLogBlobUri,omitempty"` // The boot diagnostics status information for the VM. // NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. - Status InstanceViewStatus `json:"status"` + Status InstanceViewStatus `json:"status,omitempty"` } diff --git a/models/azure/capacity_reservation_profile.go b/models/azure/capacity_reservation_profile.go index bb0e5df..5d5325d 100644 --- a/models/azure/capacity_reservation_profile.go +++ b/models/azure/capacity_reservation_profile.go @@ -22,5 +22,5 @@ type CapacityReservationProfile struct { // Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or // scaleset vm instances provided enough capacity has been reserved. Please refer to // https://aka.ms/CapacityReservation for more details. - CapacityReservationGroup SubResource `json:"capacityReservationGroup"` + CapacityReservationGroup SubResource `json:"capacityReservationGroup,omitempty"` } diff --git a/models/azure/connection_item_properties.go b/models/azure/connection_item_properties.go index 136a024..a691f0e 100644 --- a/models/azure/connection_item_properties.go +++ b/models/azure/connection_item_properties.go @@ -21,11 +21,11 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type ConnectionItemProperties struct { //Properties of the private endpoint object. - PrivateEndpoint PrivateEndpoint `json:"privateEndpoint"` + PrivateEndpoint PrivateEndpoint `json:"privateEndpoint,omitempty"` // Approval state of the private link connection. - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` // Provisioning state of the private endpoint connection. - ProvisioningState enums.EndpointProvisioningState `json:"provisioningState"` + ProvisioningState enums.EndpointProvisioningState `json:"provisioningState,omitempty"` } diff --git a/models/azure/data_disk.go b/models/azure/data_disk.go index 11a851e..5c77116 100644 --- a/models/azure/data_disk.go +++ b/models/azure/data_disk.go @@ -26,20 +26,20 @@ type DataDisk struct { // ReadWrite // // Default: None for Standard storage. ReadOnly for Premium storage - Caching string `json:"caching"` + Caching string `json:"caching,omitempty"` // Specifies how the virtual machine should be created. // Possible values are: // Attach - This value is used when you are using a specialized disk to create the virtual machine. // FromImage - This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. - CreateOption string `json:"createOption"` + CreateOption string `json:"createOption,omitempty"` // Specifies whether data disk should be deleted or detached upon VM deletion. // Possible values: // Delete - If this value is used, the data disk is deleted when VM is deleted. // Detach - If this value is used, the data disk is retained after VM is deleted. // The default value is set to detach - DeleteOption string `json:"deleteOption"` + DeleteOption string `json:"deleteOption,omitempty"` // Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment // from the virtual machine. @@ -52,44 +52,44 @@ type DataDisk struct { // // This feature is still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk // update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. - DetachOption string `json:"detachOption"` + DetachOption string `json:"detachOption,omitempty"` // Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS. // Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the // VirtualMachine Scale Set. - DiskIOPSReadWrite int `json:"diskIOPSReadWrite"` + DiskIOPSReadWrite int `json:"diskIOPSReadWrite,omitempty"` // Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS. // Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the // VirtualMachine Scale Set. - DiskMBpsReadWrite int `json:"diskMBpsReadWrite"` + DiskMBpsReadWrite int `json:"diskMBpsReadWrite,omitempty"` // Specifies the size of an empty data disk in gigabytes. // This element can be used to overwrite the size of the disk in a virtual machine image. // This value cannot be larger than 1023 GB - DiskSizeGB int `json:"diskSizeGB"` + DiskSizeGB int `json:"diskSizeGB,omitempty"` // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the // virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. - Image VirtualHardDisk `json:"image"` + Image VirtualHardDisk `json:"image,omitempty"` // Specifies the logical unit number of the data disk. // This value is used to identify data disks within the VM and therefore must be unique for each data disk attached // to a VM. - Lun int `json:"lun"` + Lun int `json:"lun,omitempty"` // The managed disk parameters. - ManagedDisk ManagedDiskParameters `json:"managedDisk"` + ManagedDisk ManagedDiskParameters `json:"managedDisk,omitempty"` // The disk name. - Name string `json:"name"` + Name string `json:"name,omitempty"` // Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset. - ToBeDetached bool `json:"toBeDetached"` + ToBeDetached bool `json:"toBeDetached,omitempty"` // The virtual hard disk. - Vhd VirtualHardDisk `json:"vhd"` + Vhd VirtualHardDisk `json:"vhd,omitempty"` // Specifies whether writeAccelerator should be enabled or disabled on the disk. - WriteAcceleratorEnabled bool `json:"writeAcceleratorEnabled"` + WriteAcceleratorEnabled bool `json:"writeAcceleratorEnabled,omitempty"` } diff --git a/models/azure/datetime_timezone.go b/models/azure/datetime_timezone.go index dafab83..426ef21 100644 --- a/models/azure/datetime_timezone.go +++ b/models/azure/datetime_timezone.go @@ -20,8 +20,8 @@ package azure // Describes the date, time and time zone of a point in time. type DateTimeTimeZone struct { // A single point of time in a combined date and time representation `{date}T{time} - DateTime string `json:"dateTime"` + DateTime string `json:"dateTime,omitempty"` // Represents a time zone - TimeZone string `json:"timeZone"` + TimeZone string `json:"timeZone,omitempty"` } diff --git a/models/azure/descendant-info.go b/models/azure/descendant-info.go index 22fa196..003cf91 100644 --- a/models/azure/descendant-info.go +++ b/models/azure/descendant-info.go @@ -19,49 +19,46 @@ package azure // The properties of the parent management group. type DescendantParentGroupInfo struct { - // The fully qualified ID for the parent management group. // // For example: // - /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - Id string `json:"id"` + Id string `json:"id,omitempty"` } // DescendantInfoProperties describes the properties of the management group descendant. type DescendantInfoProperties struct { - // The friendly name of the management group. - DisplayName string `json:"display_name"` + DisplayName string `json:"display_name,omitempty"` // The properties of the parent management group. - Parent DescendantParentGroupInfo `json:"parent"` + Parent DescendantParentGroupInfo `json:"parent,omitempty"` } // DescendantInfo is a management group descendant. type DescendantInfo struct { - // The fully qualified ID for the descendant. // // For example: // - /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 // - /subscriptions/0000000-0000-0000-0000-000000000000 - Id string `json:"id"` + Id string `json:"id,omitempty"` // The name of the descendant. // // For example: // - 00000000-0000-0000-0000-000000000000 - Name string `json:"name"` + Name string `json:"name,omitempty"` // The properties of the management group descendant. - Properties DescendantInfoProperties `json:"properties"` + Properties DescendantInfoProperties `json:"properties,omitempty"` // The type of the resource. // // For example: // - Microsoft.Management/managementGroups // - /subscriptions - Type string `json:"type"` + Type string `json:"type,omitempty"` } type DescendantInfoList struct { diff --git a/models/azure/device.go b/models/azure/device.go index 0f24c49..503f022 100644 --- a/models/azure/device.go +++ b/models/azure/device.go @@ -67,7 +67,7 @@ type Device struct { // The individual extension attributes are not selectable. // These properties are mastered in cloud and can be set during creation or update of a device object in Azure AD. // Supports $filter (eq, NOT, startsWith). - ExtensionAttributes OnPremisesExtensionAttributes `json:"onPremisesExtensionAttributes"` + ExtensionAttributes OnPremisesExtensionAttributes `json:"onPremisesExtensionAttributes,omitempty"` // true if the device complies with Mobile Device Management (MDM) policies; otherwise, false. // Read-only. diff --git a/models/azure/diagnostics_profile.go b/models/azure/diagnostics_profile.go index 863a23a..4dcd781 100644 --- a/models/azure/diagnostics_profile.go +++ b/models/azure/diagnostics_profile.go @@ -23,5 +23,5 @@ type DiagnosticsProfile struct { // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM // status. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM // from the hypervisor. - BootDiagnotics BootDiagnotics `json:"bootDiagnotics"` + BootDiagnotics BootDiagnotics `json:"bootDiagnotics,omitempty"` } diff --git a/models/azure/diff_disk_settings.go b/models/azure/diff_disk_settings.go index 35421ea..d1f7e5c 100644 --- a/models/azure/diff_disk_settings.go +++ b/models/azure/diff_disk_settings.go @@ -21,7 +21,7 @@ package azure // NOTE: The ephemeral disk settings can only be specified for managed disk. type DiffDiskSettings struct { // Specifies the ephemeral disk settings for operating system disk. - Option string `json:"option"` + Option string `json:"option,omitempty"` // Specifies the ephemeral disk placement for operating system disk. // Possible values are: @@ -32,5 +32,5 @@ type DiffDiskSettings struct { // Refer to VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes // and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a // cache disk. - Placement string `json:"placement"` + Placement string `json:"placement,omitempty"` } diff --git a/models/azure/directory_object.go b/models/azure/directory_object.go index 905781a..68e1aa7 100644 --- a/models/azure/directory_object.go +++ b/models/azure/directory_object.go @@ -17,7 +17,9 @@ package azure -import "encoding/json" +import ( + "encoding/json" +) // Represents an Azure Active Directory object. The directoryObject type is the base type for many other directory entity types. type DirectoryObject struct { diff --git a/models/azure/disk_encryption_set_params.go b/models/azure/disk_encryption_set_params.go index 6c4c64a..90f7368 100644 --- a/models/azure/disk_encryption_set_params.go +++ b/models/azure/disk_encryption_set_params.go @@ -22,5 +22,5 @@ package azure // Please refer https://aka.ms/mdssewithcmkoverview for more details. type DiskEncryptionSetParameters struct { // Resource ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` } diff --git a/models/azure/disk_encryption_settings.go b/models/azure/disk_encryption_settings.go index f4b3fec..9a2f627 100644 --- a/models/azure/disk_encryption_settings.go +++ b/models/azure/disk_encryption_settings.go @@ -20,11 +20,11 @@ package azure // Describes an encryption setting for a disk type DiskEncryptionSettings struct { // Specifies the location of the disk encryption key, which is a Key Vault Secret. - DiskEncryptionKey KeyVaultSecretReference `json:"diskEncryptionKey"` + DiskEncryptionKey KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` // Specifies whether disk encryption should be enabled on the virtual machine. - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled,omitempty"` // Specifies the location of the key encryption key in Key Vault. - KeyEncryptionKey KeyVaultKeyReference `json:"keyEncryptionKey"` + KeyEncryptionKey KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` } diff --git a/models/azure/disk_instance_view.go b/models/azure/disk_instance_view.go index 879e5c5..400bd75 100644 --- a/models/azure/disk_instance_view.go +++ b/models/azure/disk_instance_view.go @@ -21,11 +21,11 @@ package azure type DiskInstanceView struct { // Specifies the encryption settings for the OS Disk. // Minimum api-version: 2015-06-15 - EncryptionSettings []DiskEncryptionSettings `json:"encryptionSettings"` + EncryptionSettings []DiskEncryptionSettings `json:"encryptionSettings,omitempty"` // The disk name. - Name string `json:"name"` + Name string `json:"name,omitempty"` // The resource status information. - Statuses []InstanceViewStatus `json:"statuses"` + Statuses []InstanceViewStatus `json:"statuses,omitempty"` } diff --git a/models/azure/employee_org_data.go b/models/azure/employee_org_data.go index 5134dbb..97bf5de 100644 --- a/models/azure/employee_org_data.go +++ b/models/azure/employee_org_data.go @@ -23,11 +23,11 @@ type EmployeeOrgData struct { // // Returned only on `$select` // Supports `$filter` - Division string `json:"division"` + Division string `json:"division,omitempty"` // The cost center assoicated with the user. // // Returned only on `$select` // Supports `$filter` - CostCenter string `json:"costCenter"` + CostCenter string `json:"costCenter,omitempty"` } diff --git a/models/azure/extended_location.go b/models/azure/extended_location.go index 298295c..76e94bc 100644 --- a/models/azure/extended_location.go +++ b/models/azure/extended_location.go @@ -18,6 +18,6 @@ package azure type ExtendedLocation struct { - Name string `json:"name"` - Type string `json:"type"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` } diff --git a/models/azure/hardware_profile.go b/models/azure/hardware_profile.go index 9371d41..e63a5fc 100644 --- a/models/azure/hardware_profile.go +++ b/models/azure/hardware_profile.go @@ -30,11 +30,11 @@ type HardwareProfile struct { // For more information about virtual machine sizes, see Sizes for virtual machines. // // The available VM sizes depend on region and availability set. - VMSize string `json:"vmSize"` + VMSize string `json:"vmSize,omitempty"` // Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. // // This feature is still in preview mode and is not supported for VirtualMachineScaleSet. // Please follow the instructions in VM Customization for more details. - VMSizeProperties VMSizeProperties `json:"vmSizeProperties"` + VMSizeProperties VMSizeProperties `json:"vmSizeProperties,omitempty"` } diff --git a/models/azure/image_reference.go b/models/azure/image_reference.go index 5a7f470..05b4f4a 100644 --- a/models/azure/image_reference.go +++ b/models/azure/image_reference.go @@ -24,27 +24,27 @@ package azure type ImageReference struct { // Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual // machine. This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'. - ExactVersion string `json:"exactVersion"` + ExactVersion string `json:"exactVersion,omitempty"` // Resource ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` // Specifies the offer of the platform image or marketplace image used to create the virtual machine. - Offer string `json:"offer"` + Offer string `json:"offer,omitempty"` // The image publisher - Publisher string `json:"publisher"` + Publisher string `json:"publisher,omitempty"` // Specified the shared gallery image unique id for vm deployment. // This can be fetched from shared gallery image GET call. - SharedGalleryImageId string `json:"sharedGalleryImageId"` + SharedGalleryImageId string `json:"sharedGalleryImageId,omitempty"` // The image SKU. - Sku string `json:"sku"` + Sku string `json:"sku,omitempty"` // Specifies the version of the platform image or marketplace image used to create the virtual machine. // The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. // Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', // the VM image will not automatically update after deploy time even if a new version becomes available. - Version string `json:"version"` + Version string `json:"version,omitempty"` } diff --git a/models/azure/immutability_policy.go b/models/azure/immutability_policy.go index e24c2f9..febe7ac 100644 --- a/models/azure/immutability_policy.go +++ b/models/azure/immutability_policy.go @@ -19,6 +19,6 @@ package azure type ImmutabilityPolicy struct { Etag string `json:"etag,omitempty"` - Properties ImmutabilityPolicyProperties `json:"properties"` + Properties ImmutabilityPolicyProperties `json:"properties,omitempty"` UpdateHistory ImmutablePolicyUpdateHistory `json:"updateHistory,omitempty"` } diff --git a/models/azure/implicit_grant_settings.go b/models/azure/implicit_grant_settings.go index 8b88a6e..e17b472 100644 --- a/models/azure/implicit_grant_settings.go +++ b/models/azure/implicit_grant_settings.go @@ -22,8 +22,8 @@ package azure // following properties must be set to true. type ImplicitGrantSettings struct { // Specifies whether this web application can request an ID token using the OAuth 2.0 implicit flow. - EnableIdTokenIssuance bool `json:"enableIdTokenIssuance"` + EnableIdTokenIssuance bool `json:"enableIdTokenIssuance,omitempty"` // Specifies whether this web application can request an access token using the OAuth 2.0 implicit flow. - EnableAccessTokenIssuance bool `json:"enableAccessTokenIssuance"` + EnableAccessTokenIssuance bool `json:"enableAccessTokenIssuance,omitempty"` } diff --git a/models/azure/informational_url.go b/models/azure/informational_url.go index 1a4525d..d4f7ea0 100644 --- a/models/azure/informational_url.go +++ b/models/azure/informational_url.go @@ -21,17 +21,17 @@ package azure // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/informationalurl?view=graph-rest-1.0 type InformationalUrl struct { // CDN URL to the application's logo, Read-only. - LogoUrl string `json:"logoUrl"` + LogoUrl string `json:"logoUrl,omitempty"` // Link to the application's marketing page. For example, https://www.contoso.com/app/marketing - MarketingUrl string `json:"marketingUrl"` + MarketingUrl string `json:"marketingUrl,omitempty"` // Link to the application's privacy statement. For example, https://www.contoso.com/app/privacy - PrivacyStatementUrl string `json:"privacyStatementUrl"` + PrivacyStatementUrl string `json:"privacyStatementUrl,omitempty"` // Link to the application's support page. For example, https://www.contoso.com/app/support - SupportUrl string `json:"supportUrl"` + SupportUrl string `json:"supportUrl,omitempty"` // Link to the application's terms of service statement. For example, https://www.contoso.com/app/termsofservice - TermsOfServiceUrl string `json:"termsOfServiceUrl"` + TermsOfServiceUrl string `json:"termsOfServiceUrl,omitempty"` } diff --git a/models/azure/instance_view_status.go b/models/azure/instance_view_status.go index f59c12d..8665276 100644 --- a/models/azure/instance_view_status.go +++ b/models/azure/instance_view_status.go @@ -21,17 +21,17 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type InstanceViewStatus struct { // The status code. - Code string `json:"code"` + Code string `json:"code,omitempty"` // The short localizable label for the status. - DisplayStatus string `json:"displayStatus"` + DisplayStatus string `json:"displayStatus,omitempty"` // The level code. - Level enums.StatusLevel `json:"level"` + Level enums.StatusLevel `json:"level,omitempty"` // The detailed status message, including for alerts and error messages. - Message string `json:"message"` + Message string `json:"message,omitempty"` // The time of the status. - Time string `json:"time"` + Time string `json:"time,omitempty"` } diff --git a/models/azure/ip_rule.go b/models/azure/ip_rule.go index 46582f3..481b5df 100644 --- a/models/azure/ip_rule.go +++ b/models/azure/ip_rule.go @@ -21,5 +21,5 @@ package azure type IPRule struct { // An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) // or '124.56.78.0/24' (all addresses that start with 124.56.78). - Value string `json:"value"` + Value string `json:"value,omitempty"` } diff --git a/models/azure/key_credential.go b/models/azure/key_credential.go index 02cafc5..e81bdef 100644 --- a/models/azure/key_credential.go +++ b/models/azure/key_credential.go @@ -24,33 +24,33 @@ import "github.com/gofrs/uuid" type KeyCredential struct { // Custom key identifier // Base64Url encoded. - CustomKeyIdentifier string `json:"customKeyIdentifier"` + CustomKeyIdentifier string `json:"customKeyIdentifier,omitempty"` // Friendly name for the key. // Optional. - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName,omitempty"` // The date and time at which the credential expires. // The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. // For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. - EndDateTime string `json:"endDateTime"` + EndDateTime string `json:"endDateTime,omitempty"` // The certificate's raw data in byte array converted to Base64 string; // For example, [System.Convert]::ToBase64String($Cert.GetRawCertData()). // Base64Url encoded. - Key []byte `json:"key"` + Key []byte `json:"key,omitempty"` // The unique identifier (GUID) for the key. - KeyId uuid.UUID `json:"keyId"` + KeyId uuid.UUID `json:"keyId,omitempty"` // The date and time at which the credential becomes valid.The Timestamp type represents date and time information // using ISO 8601 format and is always in UTC time. // For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. - StartDateTime string `json:"startDateTime"` + StartDateTime string `json:"startDateTime,omitempty"` // The type of key credential; for example, Symmetric. - Type string `json:"type"` + Type string `json:"type,omitempty"` // A string that describes the purpose for which the key can be used; for example, Verify. - Usage string `json:"usage"` + Usage string `json:"usage,omitempty"` } diff --git a/models/azure/key_value.go b/models/azure/key_value.go index a298298..a814ba5 100644 --- a/models/azure/key_value.go +++ b/models/azure/key_value.go @@ -18,6 +18,6 @@ package azure type KeyValue struct { - Key string `json:"key"` - Value string `json:"value"` + Key string `json:"key,omitempty"` + Value string `json:"value,omitempty"` } diff --git a/models/azure/key_vault_key_ref.go b/models/azure/key_vault_key_ref.go index e8e38fb..871bf9a 100644 --- a/models/azure/key_vault_key_ref.go +++ b/models/azure/key_vault_key_ref.go @@ -20,8 +20,8 @@ package azure // Describes a reference to a Key Vault Key type KeyVaultKeyReference struct { // The URL referencing a key encryption key in Key Vault. - KeyUrl string `json:"keyUrl"` + KeyUrl string `json:"keyUrl,omitempty"` // The relative URL of the Key Vault containing the key. - SourceVault SubResource `json:"sourceVault"` + SourceVault SubResource `json:"sourceVault,omitempty"` } diff --git a/models/azure/key_vault_secret_ref.go b/models/azure/key_vault_secret_ref.go index eef7c2a..603487b 100644 --- a/models/azure/key_vault_secret_ref.go +++ b/models/azure/key_vault_secret_ref.go @@ -20,8 +20,8 @@ package azure // Describes a reference to a Key Vault Secret. type KeyVaultSecretReference struct { // The URL referencing a secret in a Key Vault. - SecretUrl string `json:"secretUrl"` + SecretUrl string `json:"secretUrl,omitempty"` // The relative URL of the Key Vault containing the secret. - SourceVault SubResource `json:"sourceVault"` + SourceVault SubResource `json:"sourceVault,omitempty"` } diff --git a/models/azure/keyvault_permissions.go b/models/azure/keyvault_permissions.go index bf07496..e76aba9 100644 --- a/models/azure/keyvault_permissions.go +++ b/models/azure/keyvault_permissions.go @@ -20,14 +20,14 @@ package azure // Permissions the identity has for keys, secrets, certificates and storage. type KeyVaultPermissions struct { // Permissions to certificates - Certificates []string `json:"certificates"` + Certificates []string `json:"certificates,omitempty"` // Permissions to keys - Keys []string `json:"keys"` + Keys []string `json:"keys,omitempty"` // Permissions to secrets - Secrets []string `json:"secrets"` + Secrets []string `json:"secrets,omitempty"` // Permissions to storage accounts - Storage []string `json:"storage"` + Storage []string `json:"storage,omitempty"` } diff --git a/models/azure/last_patch_installation_summary.go b/models/azure/last_patch_installation_summary.go index a6631d4..2a2122c 100644 --- a/models/azure/last_patch_installation_summary.go +++ b/models/azure/last_patch_installation_summary.go @@ -24,37 +24,37 @@ import ( // Describes the properties of the last installed patch summary. type LastPatchInstallationSummary struct { // The errors that were encountered during execution of the operation. The details array contains the list of them. - Error ODataError `json:"error"` + Error ODataError `json:"error,omitempty"` // The number of all available patches but excluded explicitly by a customer-specified exclusion list match. - ExcludedPatchCount int `json:"excludedPatchCount"` + ExcludedPatchCount int `json:"excludedPatchCount,omitempty"` // The count of patches that failed installation. - FailedPatchCount int `json:"failedPatchCount"` + FailedPatchCount int `json:"failedPatchCount,omitempty"` // The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. - InstallationActivityId string `json:"installationActivityId"` + InstallationActivityId string `json:"installationActivityId,omitempty"` // The count of patches that successfully installed. - InstalledPatchCount int `json:"installedPatchCount"` + InstalledPatchCount int `json:"installedPatchCount,omitempty"` // The UTC timestamp when the operation began. - LastModifiedTime string `json:"lastModifiedTime"` + LastModifiedTime string `json:"lastModifiedTime,omitempty"` // Describes whether the operation ran out of time before it completed all its intended actions. - MaintenanceWindowExceeded bool `json:"maintenanceWindowExceeded"` + MaintenanceWindowExceeded bool `json:"maintenanceWindowExceeded,omitempty"` // The number of all available patches but not going to be installed because it didn't match a classification or // inclusion list entry. - NotSelectedPatchCount int `json:"notSelectedPatchCount"` + NotSelectedPatchCount int `json:"notSelectedPatchCount,omitempty"` // The number of all available patches expected to be installed over the course of the patch installation operation. - PendingPatchCount int `json:"pendingPatchCount"` + PendingPatchCount int `json:"pendingPatchCount,omitempty"` // The UTC timestamp when the operation began. - StartTime string `json:"startTime"` + StartTime string `json:"startTime,omitempty"` // The overall success or failure status of the operation. It remains "InProgress" until the operation completes. // At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings." - Status enums.PatchStatus `json:"status"` + Status enums.PatchStatus `json:"status,omitempty"` } diff --git a/models/azure/license_assignment_state.go b/models/azure/license_assignment_state.go index 1e1b6af..5e1850e 100644 --- a/models/azure/license_assignment_state.go +++ b/models/azure/license_assignment_state.go @@ -26,23 +26,23 @@ type LicenseAssignmentState struct { // The id of the group that assigns this license. If direct-assigned this field will be null. // // Read-only - AssignedByGroup string `json:"assignedByGroup"` + AssignedByGroup string `json:"assignedByGroup,omitempty"` // The service plans that are disabled in this assignment. // // Read-only - DisabledPlans string `json:"disabledPlans"` + DisabledPlans string `json:"disabledPlans,omitempty"` // License assignment failure error. - Error enums.LicenseError `json:"error"` + Error enums.LicenseError `json:"error,omitempty"` // The unique identifier for the SKU // // Read-only - SkuId string `json:"skuId"` + SkuId string `json:"skuId,omitempty"` // Indicates the current state of this assignment. // // Read-only - State enums.LicenseState `json:"state"` + State enums.LicenseState `json:"state,omitempty"` } diff --git a/models/azure/linux_config.go b/models/azure/linux_config.go index 1e315b8..acee070 100644 --- a/models/azure/linux_config.go +++ b/models/azure/linux_config.go @@ -21,16 +21,16 @@ package azure // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions. type LinuxConfiguration struct { // Specifies whether password authentication should be disabled. - DisablePasswordAuthentication bool `json:"disablePasswordAuthentication"` + DisablePasswordAuthentication bool `json:"disablePasswordAuthentication,omitempty"` // [Preview Feature] Specifies settings related to VM Guest Patching on Linux. - PatchSettings LinuxPatchSettings `json:"patchSettings"` + PatchSettings LinuxPatchSettings `json:"patchSettings,omitempty"` // Indicates whether virtual machine agent should be provisioned on the virtual machine. // When this property is not specified in the request body, default behavior is to set it to true. This will ensure // that VM Agent is installed on the VM so that extensions can be added to the VM later. - ProvisionVMAgent bool `json:"provisionVMAgent"` + ProvisionVMAgent bool `json:"provisionVMAgent,omitempty"` // Specifies the ssh key configuration for a Linux OS. - Ssh SshConfiguration `json:"ssh"` + Ssh SshConfiguration `json:"ssh,omitempty"` } diff --git a/models/azure/linux_patch_settings.go b/models/azure/linux_patch_settings.go index 63f9a62..8b64672 100644 --- a/models/azure/linux_patch_settings.go +++ b/models/azure/linux_patch_settings.go @@ -23,11 +23,11 @@ type LinuxPatchSettings struct { // Possible values are: // ImageDefault - You control the timing of patch assessments on a virtual machine. // AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. - AssessmentMode string `json:"assessmentMode"` + AssessmentMode string `json:"assessmentMode,omitempty"` // Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible. // Possible values are: // ImageDefault - The virtual machine's default patching configuration is used. // AutomaticByPlatform - The virtual machine will be automatically updated by the platform. The property provisionVMAgent must be true - PatchMode string `json:"patchMode"` + PatchMode string `json:"patchMode,omitempty"` } diff --git a/models/azure/locale_info.go b/models/azure/locale_info.go index eed08fe..859e680 100644 --- a/models/azure/locale_info.go +++ b/models/azure/locale_info.go @@ -20,8 +20,8 @@ package azure type LocaleInfo struct { // A locale code for the user, which includes the user's perferred language and country/region as defined // in ISO 639-1 and ISO 3166-1 alpha-2. E.g. "en-us" - Locale string `json:"locale"` + Locale string `json:"locale,omitempty"` // A name representing the user's locale in natural language. E.g. "English (United States)" - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName,omitempty"` } diff --git a/models/azure/mailbox_settings.go b/models/azure/mailbox_settings.go index 9dc5df9..e395786 100644 --- a/models/azure/mailbox_settings.go +++ b/models/azure/mailbox_settings.go @@ -21,28 +21,28 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type MailboxSettings struct { // Folder ID of an archive folder for the user. - ArchiveFolder string `json:"archiveFolder"` + ArchiveFolder string `json:"archiveFolder,omitempty"` // Configuration settings to automatically notify the sender of an incoming email with a message from the signed-in // user. - AutomaticRepliesSetting AutomaticRepliesSetting `json:"automaticRepliesSetting"` + AutomaticRepliesSetting AutomaticRepliesSetting `json:"automaticRepliesSetting,omitempty"` // The date format for the user's mailbox. - DateFormat string `json:"dateFormat"` + DateFormat string `json:"dateFormat,omitempty"` // If the user has a calendar delegate, this specifies whether the delegate, mailbox owner, or both receive meeting // messages and meeting responses. - DelegateMeetingMessageDeliveryOptions enums.MessageDeliveryOptions `json:"delegateMeetingMessageDeliveryOptions"` + DelegateMeetingMessageDeliveryOptions enums.MessageDeliveryOptions `json:"delegateMeetingMessageDeliveryOptions,omitempty"` // The locale information for the user, including the preferred language and country/region. - Language LocaleInfo `json:"language"` + Language LocaleInfo `json:"language,omitempty"` // The time format for the user's mailbox. - TimeFormat string `json:"timeFormat"` + TimeFormat string `json:"timeFormat,omitempty"` // The default time zone for the user's mailbox. - TimeZone string `json:"timeZone"` + TimeZone string `json:"timeZone,omitempty"` // The days of the week and hours in a specific time zone that the user works. - WorkingHours WorkingHours `json:"workingHours"` + WorkingHours WorkingHours `json:"workingHours,omitempty"` } diff --git a/models/azure/maintenance_redeploy_status.go b/models/azure/maintenance_redeploy_status.go index 36561cf..2932bf4 100644 --- a/models/azure/maintenance_redeploy_status.go +++ b/models/azure/maintenance_redeploy_status.go @@ -22,23 +22,23 @@ import "github.com/bloodhoundad/azurehound/v2/enums" // Maintenance operations status. type MaintenanceRedeployStatus struct { // True if customer is allowed to perform maintenance. - IsCustomerInitiatedMaintenanceAllowed bool `json:"isCustomerInitiatedMaintenanceAllowed"` + IsCustomerInitiatedMaintenanceAllowed bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` // Message returned for the last maintenance operation. - LastOperationMessage string `json:"lastOperationMessage"` + LastOperationMessage string `json:"lastOperationMessage,omitempty"` // The last maintenance operation result code. - LastOperationResultCode enums.MaintenanceOperationCode `json:"lastOperationResultCode"` + LastOperationResultCode enums.MaintenanceOperationCode `json:"lastOperationResultCode,omitempty"` // End time for the maintenance window. - MaintenanceWindowEndTime string `json:"maintenanceWindowEndTime"` + MaintenanceWindowEndTime string `json:"maintenanceWindowEndTime,omitempty"` // Start time for the maintenance window. - MaintenanceWindowStartTime string `json:"maintenanceWindowStartTime"` + MaintenanceWindowStartTime string `json:"maintenanceWindowStartTime,omitempty"` // End time for the pre maintenance window. - PreMaintenanceWindowEndTime string `json:"preMaintenanceWindowEndTime"` + PreMaintenanceWindowEndTime string `json:"preMaintenanceWindowEndTime,omitempty"` // Start time for the pre maintenance window. - PreMaintenanceWindowStartTime string `json:"preMaintenanceWindowStartTime"` + PreMaintenanceWindowStartTime string `json:"preMaintenanceWindowStartTime,omitempty"` } diff --git a/models/azure/managed_by_tenant.go b/models/azure/managed_by_tenant.go index 61499ed..50b2087 100644 --- a/models/azure/managed_by_tenant.go +++ b/models/azure/managed_by_tenant.go @@ -22,5 +22,5 @@ import "github.com/gofrs/uuid" // Information about a tenant managing the subscription. type ManagedByTenant struct { // The tenant ID of the managing tenant. - TenantId uuid.UUID `json:"tenantId"` + TenantId uuid.UUID `json:"tenantId,omitempty"` } diff --git a/models/azure/managed_cluster_properties.go b/models/azure/managed_cluster_properties.go index c249ff3..59d5bf7 100644 --- a/models/azure/managed_cluster_properties.go +++ b/models/azure/managed_cluster_properties.go @@ -20,5 +20,5 @@ package azure // Properties of the vault type ManagedClusterProperties struct { // The name of the AzureRM Resource Group the Managed Cluster's Virtual Machine Scale Set resides - NodeResourceGroup string `json:"nodeResourceGroup"` + NodeResourceGroup string `json:"nodeResourceGroup,omitempty"` } diff --git a/models/azure/managed_disk_params.go b/models/azure/managed_disk_params.go index d0395db..f48da6f 100644 --- a/models/azure/managed_disk_params.go +++ b/models/azure/managed_disk_params.go @@ -22,12 +22,12 @@ import "github.com/bloodhoundad/azurehound/v2/enums" // The parameters of a managed disk. type ManagedDiskParameters struct { // Specifies the customer managed disk encryption set resource id for the managed disk. - DiskEncryptionSet DiskEncryptionSetParameters `json:"diskEncryptionSet"` + DiskEncryptionSet DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` // Resource ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` // Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, // it cannot be used with OS Disk. - StorageAccountType enums.StorageType `json:"storageAccountType"` + StorageAccountType enums.StorageType `json:"storageAccountType,omitempty"` } diff --git a/models/azure/managed_identity.go b/models/azure/managed_identity.go index 1569fc4..ff0f946 100644 --- a/models/azure/managed_identity.go +++ b/models/azure/managed_identity.go @@ -26,17 +26,17 @@ type VirtualMachineIdentity ManagedIdentity type ManagedIdentity struct { // The principal id of the managed identity. The property will only be provided for a system assigned // identity. - PrincipalId string `json:"principalId"` + PrincipalId string `json:"principalId,omitempty"` // The tenant id associated with the managed identity. This property will only be provided for a system assigned // identity. - TenantId string `json:"tenantId"` + TenantId string `json:"tenantId,omitempty"` // The type of identity used. - Type enums.Identity `json:"type"` + Type enums.Identity `json:"type,omitempty"` // The list of user identities associated with the Managed identity. The user identity dictionary key references will be // ARM resource ids in the form: // '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' - UserAssignedIdentities map[string]UserAssignedIdentity `json:"userAssignedIdentities"` + UserAssignedIdentities map[string]UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` } diff --git a/models/azure/network_interface_ref.go b/models/azure/network_interface_ref.go index 70c0be9..b43c6df 100644 --- a/models/azure/network_interface_ref.go +++ b/models/azure/network_interface_ref.go @@ -20,7 +20,7 @@ package azure // Describes a network interface reference. type NetworkInterfaceReference struct { // Resource ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` - Properties NetworkInterfaceReferenceProperties `json:"properties"` + Properties NetworkInterfaceReferenceProperties `json:"properties,omitempty"` } diff --git a/models/azure/network_interface_reference_props.go b/models/azure/network_interface_reference_props.go index ebade3d..7737191 100644 --- a/models/azure/network_interface_reference_props.go +++ b/models/azure/network_interface_reference_props.go @@ -21,8 +21,8 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type NetworkInterfaceReferenceProperties struct { // Specify what happens to the network interface when the VM is deleted. - DeleteOption enums.VMDeleteOption `json:"deleteOption"` + DeleteOption enums.VMDeleteOption `json:"deleteOption,omitempty"` // Specifies the primary network interface in case the virtual machine has more than 1 network interface. - Primary bool `json:"primary"` + Primary bool `json:"primary,omitempty"` } diff --git a/models/azure/network_profile.go b/models/azure/network_profile.go index 7ea22a6..8c6ff82 100644 --- a/models/azure/network_profile.go +++ b/models/azure/network_profile.go @@ -21,11 +21,11 @@ package azure type NetworkProfile struct { // Specifies the Microsoft.Network API version used when creating networking resources in the Network Interface // Configurations. - NetworkApiVersion string `json:"networkApiVersion"` + NetworkApiVersion string `json:"networkApiVersion,omitempty"` // Specifies the networking configurations that will be used to create the virtual machine networking resources. - NetworkInterfaceConfigurations []VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations"` + NetworkInterfaceConfigurations []VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` // Specifies the list of resource Ids for the network interfaces associated with the virtual machine. - NetworkInterfaces []NetworkInterfaceReference `json:"networkInterfaces"` + NetworkInterfaces []NetworkInterfaceReference `json:"networkInterfaces,omitempty"` } diff --git a/models/azure/network_rule_set.go b/models/azure/network_rule_set.go index 03f31db..5f27fe0 100644 --- a/models/azure/network_rule_set.go +++ b/models/azure/network_rule_set.go @@ -25,15 +25,15 @@ import ( type NetworkRuleSet struct { // Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. // If not specified the default is 'AzureServices'. - Bypass enums.BypassOption `json:"bypass"` + Bypass enums.BypassOption `json:"bypass,omitempty"` // The default action when no rule from ipRules and from virtualNetworkRules match. // This is only used after the bypass property has been evaluated. - DefaultAction enums.NetworkAction `json:"defaultAction"` + DefaultAction enums.NetworkAction `json:"defaultAction,omitempty"` // The list of IP address rules. - IPRules []IPRule `json:"ipRules"` + IPRules []IPRule `json:"ipRules,omitempty"` // The list of virtual network rules. - VirtualNetworkRules []VirtualNetworkRule `json:"virtualNetworkRules"` + VirtualNetworkRules []VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` } diff --git a/models/azure/object_identity.go b/models/azure/object_identity.go index 8cabb27..44569bb 100644 --- a/models/azure/object_identity.go +++ b/models/azure/object_identity.go @@ -35,7 +35,7 @@ type ObjectIdentity struct { // Additional validation is enforced on issuerAssignedId when the sign-in type is set to Email or UserName. // This property can also be set to any custom string; use string(SignInType) or enums.signintype(someValue) to // convert appropriately. - SignInType enums.SigninType `json:"signInType"` + SignInType enums.SigninType `json:"signInType,omitempty"` // Specifies the issuer of the identity. // **Notes:** @@ -44,12 +44,12 @@ type ObjectIdentity struct { // * For external users from other Azure AD organizations, this will be the domain of the federated organization. // // Supports `$filter` w/ 512 character limit. - Issuer string `json:"issuer"` + Issuer string `json:"issuer,omitempty"` // Specifies the unique identifier assigned to the user by the issuer. The combination of issuer and // issuerAssignedId must be unique within the organization. // For more detail, see https://docs.microsoft.com/en-us/graph/api/resources/objectidentity?view=graph-rest-1.0 // // Supports `$filter` w/ 100 character limit - IssuerAssignedId string `json:"issuerAssignedId"` + IssuerAssignedId string `json:"issuerAssignedId,omitempty"` } diff --git a/models/azure/onprem_ext_attributes.go b/models/azure/onprem_ext_attributes.go index 0c63bfc..d5019c0 100644 --- a/models/azure/onprem_ext_attributes.go +++ b/models/azure/onprem_ext_attributes.go @@ -30,19 +30,19 @@ package azure // The extensionAttributes property of the device entity is managed only in Azure AD during device creation or update. // Note: These extension attributes are also known as Exchange custom attributes 1-15. type OnPremisesExtensionAttributes struct { - ExtensionAttribute1 string `json:"extensionAttribute1"` - ExtensionAttribute2 string `json:"extensionAttribute2"` - ExtensionAttribute3 string `json:"extensionAttribute3"` - ExtensionAttribute4 string `json:"extensionAttribute4"` - ExtensionAttribute5 string `json:"extensionAttribute5"` - ExtensionAttribute6 string `json:"extensionAttribute6"` - ExtensionAttribute7 string `json:"extensionAttribute7"` - ExtensionAttribute8 string `json:"extensionAttribute8"` - ExtensionAttribute9 string `json:"extensionAttribute9"` - ExtensionAttribute10 string `json:"extensionAttribute10"` - ExtensionAttribute11 string `json:"extensionAttribute11"` - ExtensionAttribute12 string `json:"extensionAttribute12"` - ExtensionAttribute13 string `json:"extensionAttribute13"` - ExtensionAttribute14 string `json:"extensionAttribute14"` - ExtensionAttribute15 string `json:"extensionAttribute15"` + ExtensionAttribute1 string `json:"extensionAttribute1,omitempty"` + ExtensionAttribute2 string `json:"extensionAttribute2,omitempty"` + ExtensionAttribute3 string `json:"extensionAttribute3,omitempty"` + ExtensionAttribute4 string `json:"extensionAttribute4,omitempty"` + ExtensionAttribute5 string `json:"extensionAttribute5,omitempty"` + ExtensionAttribute6 string `json:"extensionAttribute6,omitempty"` + ExtensionAttribute7 string `json:"extensionAttribute7,omitempty"` + ExtensionAttribute8 string `json:"extensionAttribute8,omitempty"` + ExtensionAttribute9 string `json:"extensionAttribute9,omitempty"` + ExtensionAttribute10 string `json:"extensionAttribute10,omitempty"` + ExtensionAttribute11 string `json:"extensionAttribute11,omitempty"` + ExtensionAttribute12 string `json:"extensionAttribute12,omitempty"` + ExtensionAttribute13 string `json:"extensionAttribute13,omitempty"` + ExtensionAttribute14 string `json:"extensionAttribute14,omitempty"` + ExtensionAttribute15 string `json:"extensionAttribute15,omitempty"` } diff --git a/models/azure/onprem_provisioning_error.go b/models/azure/onprem_provisioning_error.go index 38f7dd6..8bc1b4a 100644 --- a/models/azure/onprem_provisioning_error.go +++ b/models/azure/onprem_provisioning_error.go @@ -23,14 +23,14 @@ type OnPremisesProvisioningError struct { // Category of the provisioning error. Note: Currently, there is only one possible value. // Possible value: PropertyConflict - indicates a property value is not unique. Other objects contain the same value // for the property. - Category string `json:"category"` + Category string `json:"category,omitempty"` // The date and time at which the error occurred. - OccurredDateTime string `json:"occurredDateTime"` + OccurredDateTime string `json:"occurredDateTime,omitempty"` // Name of the directory property causing the error. Current possible values: UserPrincipalName or ProxyAddress. - PropertyCausingError string `json:"propertyCausingError"` + PropertyCausingError string `json:"propertyCausingError,omitempty"` // Value of the property causing the error. - Value string `json:"value"` + Value string `json:"value,omitempty"` } diff --git a/models/azure/optional_claims.go b/models/azure/optional_claims.go index b1a7d63..542840a 100644 --- a/models/azure/optional_claims.go +++ b/models/azure/optional_claims.go @@ -24,20 +24,20 @@ package azure type OptionalClaim struct { // Additional properties of the claim. If a property exists in this collection, it modifies the behavior of the // optional claim specified in the name property. - AdditionalProperties []string `json:"additionalProperties"` + AdditionalProperties []string `json:"additionalProperties,omitempty"` // If the value is true, the claim specified by the client is necessary to ensure a smooth authorization experience // for the specific task requested by the end user. The default value is false. - Essential bool `json:"essential"` + Essential bool `json:"essential,omitempty"` // The name of the optional claim. - Name string `json:"name"` + Name string `json:"name,omitempty"` // The source (directory object) of the claim. // There are predefined claims and user-defined claims from extension properties. If the source value is null, the // claim is a predefined optional claim. If the source value is user, the value in the name property is the // extension property from the user object. - Source string `json:"source"` + Source string `json:"source,omitempty"` } // Declares the optional claims requested by an application. An application can configure optional claims to be returned @@ -49,11 +49,11 @@ type OptionalClaim struct { // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/optionalclaims?view=graph-rest-1.0 type OptionalClaims struct { // The optional claims returned in the JWT ID token. - IdToken []OptionalClaim `json:"idToken"` + IdToken []OptionalClaim `json:"idToken,omitempty"` // The optional claims returned in the JWT access token. - AccessToken []OptionalClaim `json:"accessToken"` + AccessToken []OptionalClaim `json:"accessToken,omitempty"` // The optional claims returned in the SAML token. - Saml2Token []OptionalClaim `json:"saml2Token"` + Saml2Token []OptionalClaim `json:"saml2Token,omitempty"` } diff --git a/models/azure/organization.go b/models/azure/organization.go index c7231e6..f3d4aeb 100644 --- a/models/azure/organization.go +++ b/models/azure/organization.go @@ -63,7 +63,7 @@ type Organization struct { // Read-only. IsMultipleDataLocationsForServicesEnabled bool `json:"isMultipleDataLocationsForServicesEnabled,omitempty"` - MarketingNotificationEmails []string + MarketingNotificationEmails []string `json:"marketingNotificationEmails,omitempty"` // The time and date at which the tenant was last synced with the on-premises directory. // The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. diff --git a/models/azure/os_disk.go b/models/azure/os_disk.go index 328b994..d43e47e 100644 --- a/models/azure/os_disk.go +++ b/models/azure/os_disk.go @@ -27,52 +27,52 @@ type OSDisk struct { // ReadWrite // // Default: None for Standard storage. ReadOnly for Premium storage. - Caching string `json:"caching"` + Caching string `json:"caching,omitempty"` // Specifies how the virtual machine should be created. // Possible values are: // Attach - This value is used when you are using a specialized disk to create the virtual machine. // FromImage - This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. - CreateOption string `json:"createOption"` + CreateOption string `json:"createOption,omitempty"` // Specifies whether data disk should be deleted or detached upon VM deletion. // Possible values: // Delete - If this value is used, the data disk is deleted when VM is deleted. // Detach - If this value is used, the data disk is retained after VM is deleted. // The default value is set to detach. For an ephemeral OS Disk, the default value is set to Delete. User cannot change the delete option for ephemeral OS Disk. - DeleteOption string `json:"deleteOption"` + DeleteOption string `json:"deleteOption,omitempty"` // Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. - DiffDiskSettings DiffDiskSettings `json:"diffDiskSettings"` + DiffDiskSettings DiffDiskSettings `json:"diffDiskSettings,omitempty"` // Specifies the size of an empty data disk in gigabytes. // This element can be used to overwrite the size of the disk in a virtual machine image. // This value cannot be larger than 1023 GB - DiskSizeGB int `json:"diskSizeGB"` + DiskSizeGB int `json:"diskSizeGB,omitempty"` // Specifies the encryption settings for the OS Disk. // Minimum api-version: 2015-06-15 - EncryptionSettings DiskEncryptionSettings `json:"encryptionSettings"` + EncryptionSettings DiskEncryptionSettings `json:"encryptionSettings,omitempty"` // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the // virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. - Image VirtualHardDisk `json:"image"` + Image VirtualHardDisk `json:"image,omitempty"` // The managed disk parameters. - ManagedDisk ManagedDiskParameters `json:"managedDisk"` + ManagedDisk ManagedDiskParameters `json:"managedDisk,omitempty"` // The disk name. - Name string `json:"name"` + Name string `json:"name,omitempty"` // This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. // Possible values are: // - Windows // - Linux - OSType string `json:"osType"` + OSType string `json:"osType,omitempty"` // The virtual hard disk. - Vhd VirtualHardDisk `json:"vhd"` + Vhd VirtualHardDisk `json:"vhd,omitempty"` // Specifies whether writeAccelerator should be enabled or disabled on the disk. - WriteAcceleratorEnabled bool `json:"writeAcceleratorEnabled"` + WriteAcceleratorEnabled bool `json:"writeAcceleratorEnabled,omitempty"` } diff --git a/models/azure/os_profile.go b/models/azure/os_profile.go index 3806284..3b95fc6 100644 --- a/models/azure/os_profile.go +++ b/models/azure/os_profile.go @@ -33,7 +33,7 @@ type OSProfile struct { // Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" // For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM // For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - AdminPassword string `json:"adminPassword"` + AdminPassword string `json:"adminPassword,omitempty,omitempty"` // Specifies the name of the administrator account. // This property cannot be updated after the VM is created. @@ -42,39 +42,39 @@ type OSProfile struct { // Minimum-length (Linux): 1 character // Max-length (Linux): 64 characters // Max-length (Windows): 20 characters. - AdminUsername string `json:"adminUsername"` + AdminUsername string `json:"adminUsername,omitempty,omitempty"` // Specifies whether extension operations should be allowed on the virtual machine. // This may only be set to False when no extensions are present on the virtual machine. - AllowExtensionOperations bool `json:"allowExtensionOperations"` + AllowExtensionOperations bool `json:"allowExtensionOperations,omitempty,omitempty"` // Specifies the host OS name of the virtual machine. // This name cannot be updated after the VM is created. // Max-length (Windows): 15 characters // Max-length (Linux): 64 characters. // For naming conventions and restrictions see Azure infrastructure services implementation guidelines. - ComputerName string `json:"computerName"` + ComputerName string `json:"computerName,omitempty,omitempty"` // Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. // Note: Do not pass any secrets or passwords in customData property // This property cannot be updated after the VM is created. // customData is passed to the VM to be saved as a file, for more information see Custom Data on Azure VMs // For using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation - CustomData string `json:"customData"` + CustomData string `json:"customData,omitempty,omitempty"` // Specifies the Linux operating system settings on the virtual machine. // For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions. - LinuxConfiguration LinuxConfiguration `json:"linuxConfiguration,omitempty"` + LinuxConfiguration LinuxConfiguration `json:"linuxConfiguration,omitempty,omitempty"` // Specifies whether the guest provision signal is required to infer provision success of the virtual machine. // Note: This property is for private testing only, and all customers must not set the property to false. - RequireGuestProvisionSignal bool `json:"requireGuestProvisionSignal"` + RequireGuestProvisionSignal bool `json:"requireGuestProvisionSignal,omitempty,omitempty"` // Specifies set of certificates that should be installed onto the virtual machine. To install certificates on a // virtual machine it is recommended to use the Azure Key Vault virtual machine extension for Linux or the // Azure Key Vault virtual machine extension for Windows. - Secrets []VaultSecretGroup `json:"secrets"` + Secrets []VaultSecretGroup `json:"secrets,omitempty,omitempty"` // Specifies Windows operating system settings on the virtual machine. - WindowsConfiguration WindowsConfiguration `json:"windowsConfiguration"` + WindowsConfiguration WindowsConfiguration `json:"windowsConfiguration,omitempty,omitempty"` } diff --git a/models/azure/parental_controls_settings.go b/models/azure/parental_controls_settings.go index 51ca0a5..a18ebbd 100644 --- a/models/azure/parental_controls_settings.go +++ b/models/azure/parental_controls_settings.go @@ -23,7 +23,7 @@ import "github.com/bloodhoundad/azurehound/v2/enums" // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/parentalcontrolsettings?view=graph-rest-1.0 type ParentalControlSettings struct { // Specifies the ISO 3166 country codes for which access to the application will be blocked for minors. - CountriesBlockedForMinors []string `json:"countriesBlockedForMinors"` + CountriesBlockedForMinors []string `json:"countriesBlockedForMinors,omitempty"` // Specifies the legal age group rule that applies to users of the app. - LegalAgeGroupRule enums.LegalAgeGroupRule `json:"legalAgeGroupRule"` + LegalAgeGroupRule enums.LegalAgeGroupRule `json:"legalAgeGroupRule,omitempty"` } diff --git a/models/azure/password_credential.go b/models/azure/password_credential.go index 7d87566..b67b96d 100644 --- a/models/azure/password_credential.go +++ b/models/azure/password_credential.go @@ -22,19 +22,18 @@ import "github.com/gofrs/uuid" // Represents a password credential associated with an application or a service principal. // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/passwordcredential?view=graph-rest-1.0 type PasswordCredential struct { - // Friendly name for the password. Optional. - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName,omitempty"` // The date and time at which the password expires represented using ISO 8601 format and is always in UTC time. // For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Optional. - EndDateTime string `json:"endDateTime"` + EndDateTime string `json:"endDateTime,omitempty"` // Contains the first three characters of the password. Read-only. - Hint string `json:"hint"` + Hint string `json:"hint,omitempty"` // The unique identifier for the password. - KeyId uuid.UUID `json:"keyId"` + KeyId uuid.UUID `json:"keyId,omitempty"` // Read-only; Contains the strong passwords generated by Azure AD that are 16-64 characters in length. // The generated password value is only returned during the initial POST request to addPassword. There is no way to @@ -44,5 +43,5 @@ type PasswordCredential struct { // The date and time at which the password becomes valid. The Timestamp type represents date and time information // using ISO 8601 format and is always in UTC time. // For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Optional. - StartDateTime string `json:"startDateTime"` + StartDateTime string `json:"startDateTime,omitempty"` } diff --git a/models/azure/password_profile.go b/models/azure/password_profile.go index cdd716a..9e84fa6 100644 --- a/models/azure/password_profile.go +++ b/models/azure/password_profile.go @@ -22,17 +22,17 @@ type PasswordProfile struct { // true if the user must change her password on the next login; otherwise false. If not set, default is false. // NOTE: For Azure B2C tenants, set to false and instead use custom policies and user flows to force password reset // at first sign in. - ForceChangePasswordNextSignIn bool `json:"forceChangePasswordNextSignIn"` + ForceChangePasswordNextSignIn bool `json:"forceChangePasswordNextSignIn,omitempty"` // If true, at next sign-in, the user must perform a multi-factor authentication (MFA) before being forced to change // their password. The behavior is identical to forceChangePasswordNextSignIn except that the user is required to // first perform a multi-factor authentication before password change. After a password change, this property will // be automatically reset to false. If not set, default is false. - ForceChangePasswordNextSignInWithMfa bool `json:"forceChangePasswordNextSignInWithMfa"` + ForceChangePasswordNextSignInWithMfa bool `json:"forceChangePasswordNextSignInWithMfa,omitempty"` // The password for the user. This property is required when a user is created. // It can be updated, but the user will be required to change the password on the next login. // The password must satisfy minimum requirements as specified by the user’s passwordPolicies property. // By default, a strong password is required. - Password string `json:"password"` + Password string `json:"password,omitempty"` } diff --git a/models/azure/permission_scope.go b/models/azure/permission_scope.go index c6fd343..e3f02c2 100644 --- a/models/azure/permission_scope.go +++ b/models/azure/permission_scope.go @@ -29,33 +29,33 @@ import "github.com/gofrs/uuid" type PermissionScope struct { // A description of the delegated permissions, intended to be read by an administrator granting the permission on // behalf of all users. This text appears in tenant-wide admin consent experiences. - AdminConsentDescription string `json:"adminConsentDescription"` + AdminConsentDescription string `json:"adminConsentDescription,omitempty"` // The permission's title, intended to be read by an administrator granting the permission on behalf of all users. - AdminConsentDisplayName string `json:"adminConsentDisplayName"` + AdminConsentDisplayName string `json:"adminConsentDisplayName,omitempty"` // Unique delegated permission identifier inside the collection of delegated permissions defined for a resource // application. - Id uuid.UUID `json:"id"` + Id uuid.UUID `json:"id,omitempty"` // When creating or updating a permission, this property must be set to true (which is the default). To delete a // permission, this property must first be set to false. At that point, in a subsequent call, the permission may be // removed. - IsEnabled bool `json:"isEnabled"` + IsEnabled bool `json:"isEnabled,omitempty"` // Specifies whether this delegated permission should be considered safe for non-admin users to consent to on behalf // of themselves, or whether an administrator should be required for consent to the permissions. This will be the // default behavior, but each customer can choose to customize the behavior in their organization (by allowing, // restricting or limiting user consent to this delegated permission.) - Type string `json:"type"` + Type string `json:"type,omitempty"` // A description of the delegated permissions, intended to be read by a user granting the permission on their own // behalf. This text appears in consent experiences where the user is consenting only on behalf of themselves. - UserConsentDescription string `json:"userConsentDescription"` + UserConsentDescription string `json:"userConsentDescription,omitempty"` // A title for the permission, intended to be read by a user granting the permission on their own behalf. This text // appears in consent experiences where the user is consenting only on behalf of themselves. - UserConsentDisplayName string `json:"userConsentDisplayName"` + UserConsentDisplayName string `json:"userConsentDisplayName,omitempty"` // Specifies the value to include in the scp (scope) claim in access tokens. // Must not exceed 120 characters in length. @@ -63,5 +63,5 @@ type PermissionScope struct { // the ranges 0-9, A-Z and a-z. // Any other character, including the space character, are not allowed. // May not begin with .. - Value string `json:"value"` + Value string `json:"value,omitempty"` } diff --git a/models/azure/plan.go b/models/azure/plan.go index de951db..b529be5 100644 --- a/models/azure/plan.go +++ b/models/azure/plan.go @@ -23,15 +23,15 @@ package azure // programmatically, Get Started ->. Enter any required information and then click Save. type Plan struct { // The plan ID. - Name string `json:"name"` + Name string `json:"name,omitempty"` // Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference // element. - Product string `json:"product"` + Product string `json:"product,omitempty"` // The promotion code. - PromotionCode string `json:"promotionCode"` + PromotionCode string `json:"promotionCode,omitempty"` // The publisher ID. - Publisher string `json:"publisher"` + Publisher string `json:"publisher,omitempty"` } diff --git a/models/azure/preauthorized_application.go b/models/azure/preauthorized_application.go index 3486287..f4561ee 100644 --- a/models/azure/preauthorized_application.go +++ b/models/azure/preauthorized_application.go @@ -23,9 +23,9 @@ package azure // example) will require user consent. type PreAuthorizedApplication struct { // The unique identifier for the application. - AppId string `json:"appId"` + AppId string `json:"appId,omitempty"` // The unique identifiers for the OAuth2PermissionScopes the application requires. - PermissionIds []string `json:"permissionIds"` + PermissionIds []string `json:"permissionIds,omitempty"` // The unique identifiers for the OAuth2PermissionScopes the application requires. - DelegatedPermissionIds []string `json:"delegatedPermissionIds"` + DelegatedPermissionIds []string `json:"delegatedPermissionIds,omitempty"` } diff --git a/models/azure/private_endpoint.go b/models/azure/private_endpoint.go index 550cbd9..1f48810 100644 --- a/models/azure/private_endpoint.go +++ b/models/azure/private_endpoint.go @@ -19,5 +19,5 @@ package azure type PrivateEndpoint struct { // Full identifier of the private endpoint resource. - Id string `json:"id"` + Id string `json:"id,omitempty"` } diff --git a/models/azure/private_endpoint_connection.go b/models/azure/private_endpoint_connection.go index 6921b48..83e31a4 100644 --- a/models/azure/private_endpoint_connection.go +++ b/models/azure/private_endpoint_connection.go @@ -21,8 +21,8 @@ package azure type PrivateEndpointConnection struct { Entity - Name string `json:"name"` - Type string `json:"type"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` Properties PrivateEndpointConnectionProperties `json:"properties,omitempty"` } diff --git a/models/azure/private_endpoint_connection_item.go b/models/azure/private_endpoint_connection_item.go index 8b87b50..7a74555 100644 --- a/models/azure/private_endpoint_connection_item.go +++ b/models/azure/private_endpoint_connection_item.go @@ -20,10 +20,10 @@ package azure // Private endpoint connection item. type PrivateEndpointConnectionItem struct { // Modified whenever there is a change in the state of private endpoint connection. - Etag string `json:"etag"` + Etag string `json:"etag,omitempty"` // Id of private endpoint connection. - Id string `json:"id"` + Id string `json:"id,omitempty"` - Properties ConnectionItemProperties `json:"properties"` + Properties ConnectionItemProperties `json:"properties,omitempty"` } diff --git a/models/azure/private_endpoint_connection_resource.go b/models/azure/private_endpoint_connection_resource.go index 784e90b..f883ab8 100644 --- a/models/azure/private_endpoint_connection_resource.go +++ b/models/azure/private_endpoint_connection_resource.go @@ -19,8 +19,8 @@ package azure // Private endpoint connection item. type PrivateEndpointConnectionResource struct { - Id string `json:"id"` + Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` - Properties ConnectionItemProperties `json:"properties"` + Properties ConnectionItemProperties `json:"properties,omitempty"` Type string `json:"type,omitempty"` } diff --git a/models/azure/private_link_service_connection_state.go b/models/azure/private_link_service_connection_state.go index 56ed702..419bd10 100644 --- a/models/azure/private_link_service_connection_state.go +++ b/models/azure/private_link_service_connection_state.go @@ -22,11 +22,11 @@ import "github.com/bloodhoundad/azurehound/v2/enums" // An object that represents the approval state of the private link connection. type PrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired string `json:"actionsRequired"` + ActionsRequired string `json:"actionsRequired,omitempty"` // The reason for approval or rejection. - Description string `json:"description"` + Description string `json:"description,omitempty"` // Indicates whether the connection has been approved, rejected or removed by the key vault owner. - Status enums.EndpointConnectionStatus `json:"status"` + Status enums.EndpointConnectionStatus `json:"status,omitempty"` } diff --git a/models/azure/provisioned_plan.go b/models/azure/provisioned_plan.go index 99f37ab..c16b43e 100644 --- a/models/azure/provisioned_plan.go +++ b/models/azure/provisioned_plan.go @@ -19,11 +19,11 @@ package azure type ProvisionedPlan struct { // For example, “Enabled”. - CapabilityStatus string `json:"capabilityStatus"` + CapabilityStatus string `json:"capabilityStatus,omitempty"` // For example, “Success”. - ProvisioningStatus string `json:"provisioningStatus"` + ProvisioningStatus string `json:"provisioningStatus,omitempty"` // The name of the service; for example, “AccessControlS2S” - Service string `json:"service"` + Service string `json:"service,omitempty"` } diff --git a/models/azure/public_client_application.go b/models/azure/public_client_application.go index ca67e21..71356d8 100644 --- a/models/azure/public_client_application.go +++ b/models/azure/public_client_application.go @@ -22,5 +22,5 @@ package azure type PublicClientApplication struct { // Specifies the URLs where user tokens are sent for sign-in, or the redirect URIs where OAuth 2.0 authorization // codes and access tokens are sent. - RedirectUris []string `json:"redirectUris"` + RedirectUris []string `json:"redirectUris,omitempty"` } diff --git a/models/azure/required_resource_access.go b/models/azure/required_resource_access.go index 30b6cfd..1df51f4 100644 --- a/models/azure/required_resource_access.go +++ b/models/azure/required_resource_access.go @@ -26,10 +26,10 @@ import ( type ResourceAccess struct { // The unique identifier for one of the OAuth2PermissionScopes or AppRole instances that the resource application // exposes. - Id uuid.UUID `json:"id"` + Id uuid.UUID `json:"id,omitempty"` // Specifies whether the {@link Id} property references an OAuth2PermissionScope or AppRole. - Type enums.AccessType `json:"type"` + Type enums.AccessType `json:"type,omitempty"` } // Specifies the set of OAuth 2.0 permission scopes and app roles under the specified resource that an application @@ -37,9 +37,9 @@ type ResourceAccess struct { // requiredResourceAccess property. type RequiredResourceAccess struct { // The list of OAuth2.0 permission scopes and app roles that the application requires from the specified resource. - ResourceAccess []ResourceAccess `json:"resourceAccess"` + ResourceAccess []ResourceAccess `json:"resourceAccess,omitempty"` // The unique identifier for the resource that the application requires access to. This should be equal to the // {@link AppId} declared on the target resource application. - ResourceAppId string `json:"resourceAppId"` + ResourceAppId string `json:"resourceAppId,omitempty"` } diff --git a/models/azure/resource_group_props.go b/models/azure/resource_group_props.go index e960227..29c60f1 100644 --- a/models/azure/resource_group_props.go +++ b/models/azure/resource_group_props.go @@ -18,5 +18,5 @@ package azure type ResourceGroupProperties struct { - ProvisioningState string `json:"provisioningState"` + ProvisioningState string `json:"provisioningState,omitempty"` } diff --git a/models/azure/role_assignment.go b/models/azure/role_assignment.go index 5419354..10948c3 100644 --- a/models/azure/role_assignment.go +++ b/models/azure/role_assignment.go @@ -19,27 +19,27 @@ package azure type RoleAssignmentPropertiesWithScope struct { // The principal ID. - PrincipalId string `json:"principalId"` + PrincipalId string `json:"principalId,omitempty"` // The role definition ID. - RoleDefinitionId string `json:"roleDefinitionId"` + RoleDefinitionId string `json:"roleDefinitionId,omitempty"` // The role assignment scope. - Scope string `json:"scope"` + Scope string `json:"scope,omitempty"` } type RoleAssignment struct { // The role assignment ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` // The role assignment name. - Name string `json:"name"` + Name string `json:"name,omitempty"` // The role assignment type. - Type string `json:"type"` + Type string `json:"type,omitempty"` // Role assignment properties - Properties RoleAssignmentPropertiesWithScope `json:"properties"` + Properties RoleAssignmentPropertiesWithScope `json:"properties,omitempty"` } type RoleAssignmentList struct { diff --git a/models/azure/role_permission.go b/models/azure/role_permission.go index 6fed794..190059d 100644 --- a/models/azure/role_permission.go +++ b/models/azure/role_permission.go @@ -24,12 +24,12 @@ type RolePermission struct { // Set of tasks that can be performed on a resource. // // Required - AllowedResourceActions []string `json:"allowedResourceActions"` + AllowedResourceActions []string `json:"allowedResourceActions,omitempty"` // Optional constraints that must be met for the permission to be effective. - Condition string `json:"condition"` + Condition string `json:"condition,omitempty"` // Set of tasks that may not be performed on a resource. // Not yet supported by MS Graph API. - ExcludedResourceActions []string `json:"excludedResourceActions"` + ExcludedResourceActions []string `json:"excludedResourceActions,omitempty"` } diff --git a/models/azure/saml_sso_settings.go b/models/azure/saml_sso_settings.go index 9df37b5..94d54e0 100644 --- a/models/azure/saml_sso_settings.go +++ b/models/azure/saml_sso_settings.go @@ -20,5 +20,5 @@ package azure // Represents a container for settings related to SAML single sign-on. type SamlSingleSignOnSettings struct { // The relative URI the service provider would redirect to after completion of the single sign-on flow. - RelayState string `json:"relayState"` + RelayState string `json:"relayState,omitempty"` } diff --git a/models/azure/scheduled_events_profile.go b/models/azure/scheduled_events_profile.go index 17cbaa2..e9f35f9 100644 --- a/models/azure/scheduled_events_profile.go +++ b/models/azure/scheduled_events_profile.go @@ -19,5 +19,5 @@ package azure type ScheduledEventsProfile struct { // Specifies Terminate Scheduled Event related configurations. - TerminateNotificationProfile TerminateNotificationProfile `json:"terminateNotificationProfile"` + TerminateNotificationProfile TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` } diff --git a/models/azure/security_profile.go b/models/azure/security_profile.go index c4ef2ec..64e259d 100644 --- a/models/azure/security_profile.go +++ b/models/azure/security_profile.go @@ -23,13 +23,13 @@ type SecurityProfile struct { // or virtual machine scale set. This will enable the encryption for all the disks including Resource/Temp disk at // host itself. // Default: The Encryption at host will be disabled unless this property is set to true for the resource. - EncryptionAtHost bool `json:"encryptionAtHost"` + EncryptionAtHost bool `json:"encryptionAtHost,omitempty"` // Specifies the SecurityType of the virtual machine. It is set as TrustedLaunch to enable UefiSettings. // Default: UefiSettings will not be enabled unless this property is set as TrustedLaunch. - SecurityType string `json:"securityType"` + SecurityType string `json:"securityType,omitempty"` // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. // Minimum api-version: 2020-12-01 - UefiSettings UefiSettings `json:"uefiSettings"` + UefiSettings UefiSettings `json:"uefiSettings,omitempty"` } diff --git a/models/azure/service_principal.go b/models/azure/service_principal.go index ec450e6..3a422c0 100644 --- a/models/azure/service_principal.go +++ b/models/azure/service_principal.go @@ -146,7 +146,7 @@ type ServicePrincipal struct { ReplyUrls []string `json:"replyUrls,omitempty"` // The collection for settings related to saml single sign-on. - SamlSingleSignOnSettings SamlSingleSignOnSettings `json:"samlSingleSignOnSettings"` + SamlSingleSignOnSettings SamlSingleSignOnSettings `json:"samlSingleSignOnSettings,omitempty"` // Contains the list of identifiersUris, copied over from the associated application. // Additional values can be added to hybrid applications. diff --git a/models/azure/sku.go b/models/azure/sku.go index c6bef10..960bc27 100644 --- a/models/azure/sku.go +++ b/models/azure/sku.go @@ -22,8 +22,8 @@ import "github.com/bloodhoundad/azurehound/v2/enums" // SKU details type Sku struct { // The SKU family name. Only available option is "A" - Family string `json:"family"` + Family string `json:"family,omitempty"` // SKU name to specify whether the key vault is a standard vault or a premium vault. - Name enums.VaultSku `json:"name"` + Name enums.VaultSku `json:"name,omitempty"` } diff --git a/models/azure/spa_application.go b/models/azure/spa_application.go index 5656b9a..40817f0 100644 --- a/models/azure/spa_application.go +++ b/models/azure/spa_application.go @@ -21,5 +21,5 @@ package azure type SPAApplication struct { // Specifies the URLs where user tokens are sent for sign-in, or the redirect URIs where OAuth 2.0 authorization // codes and access tokens are sent. - RedirectUris []string `json:"redirectUris"` + RedirectUris []string `json:"redirectUris,omitempty"` } diff --git a/models/azure/ssh_config.go b/models/azure/ssh_config.go index d2757f5..c7dcad5 100644 --- a/models/azure/ssh_config.go +++ b/models/azure/ssh_config.go @@ -20,5 +20,5 @@ package azure // SSH configuration for Linux based VMs running on Azure. type SshConfiguration struct { // The list of SSH public keys used to authenticate with linux based VMs. - PublicKeys []SshPublicKey `json:"publicKeys"` + PublicKeys []SshPublicKey `json:"publicKeys,omitempty"` } diff --git a/models/azure/ssh_public_key.go b/models/azure/ssh_public_key.go index f28a9d1..17d8ff2 100644 --- a/models/azure/ssh_public_key.go +++ b/models/azure/ssh_public_key.go @@ -22,9 +22,9 @@ type SshPublicKey struct { // SSH public key certificate used to authenticate with the VM through ssh. // The key needs to be at least 2048-bit and in ssh-rsa format. // For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - KeyData string `json:"keyData"` + KeyData string `json:"keyData,omitempty"` // Specifies the full path on the created VM where ssh public key is stored. // If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys - Path string `json:"path"` + Path string `json:"path,omitempty"` } diff --git a/models/azure/storage_container_legal_hold.go b/models/azure/storage_container_legal_hold.go index 162e73b..3c59ce3 100644 --- a/models/azure/storage_container_legal_hold.go +++ b/models/azure/storage_container_legal_hold.go @@ -18,9 +18,9 @@ package azure type LegalHoldProperties struct { - HasLegalHold bool `json:"hasLegalHold,omitempty"` - ProtectedAppendWritesHistory ProtectedAppendWritesHistory - Tags []TagProperty `json:"tags,omitempty"` + HasLegalHold bool `json:"hasLegalHold,omitempty"` + ProtectedAppendWritesHistory ProtectedAppendWritesHistory `json:"protectedAppendWritesHistory,omitempty"` + Tags []TagProperty `json:"tags,omitempty"` } type ProtectedAppendWritesHistory struct { diff --git a/models/azure/storage_profile.go b/models/azure/storage_profile.go index ee6bd0c..5c9e2a5 100644 --- a/models/azure/storage_profile.go +++ b/models/azure/storage_profile.go @@ -21,14 +21,14 @@ package azure type StorageProfile struct { // Specifies the parameters that are used to add a data disk to a virtual machine. // For more information about disks, see About disks and VHDs for Azure virtual machines. - DataDisks []DataDisk `json:"dataDisks"` + DataDisks []DataDisk `json:"dataDisks,omitempty"` // Specifies information about the image to use. You can specify information about platform images, marketplace // images, or virtual machine images. This element is required when you want to use a platform image, marketplace // image, or virtual machine image, but is not used in other creation operations. - ImageReference ImageReference `json:"imageReference"` + ImageReference ImageReference `json:"imageReference,omitempty"` // Specifies information about the operating system disk used by the virtual machine. // For more information about disks, see About disks and VHDs for Azure virtual machines. - OSDisk OSDisk `json:"osDisk"` + OSDisk OSDisk `json:"osDisk,omitempty"` } diff --git a/models/azure/sub_resource.go b/models/azure/sub_resource.go index 7d37c8c..37e5041 100644 --- a/models/azure/sub_resource.go +++ b/models/azure/sub_resource.go @@ -19,5 +19,5 @@ package azure type SubResource struct { // The resource ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` } diff --git a/models/azure/subscription_policies.go b/models/azure/subscription_policies.go index 3a56e9b..dec658f 100644 --- a/models/azure/subscription_policies.go +++ b/models/azure/subscription_policies.go @@ -23,11 +23,11 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type SubscriptionPolicies struct { // The subscription location placement ID. The ID indicates which regions are visible for a subscription. // For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. - LocationPlacementId string `json:"locationPlacementId"` + LocationPlacementId string `json:"locationPlacementId,omitempty"` // The subscription quota ID. - QuotaId string `json:"quotaId"` + QuotaId string `json:"quotaId,omitempty"` // The subscription spending limit. - SpendingLimit enums.SpendingLimit `json:"spendingLimit"` + SpendingLimit enums.SpendingLimit `json:"spendingLimit,omitempty"` } diff --git a/models/azure/terminate_notification_profile.go b/models/azure/terminate_notification_profile.go index c4a95c6..900d4b1 100644 --- a/models/azure/terminate_notification_profile.go +++ b/models/azure/terminate_notification_profile.go @@ -19,10 +19,10 @@ package azure type TerminateNotificationProfile struct { // Specifies whether the Terminate Scheduled event is enabled or disabled. - Enable bool `json:"enable"` + Enable bool `json:"enable,omitempty"` // Configurable length of time a Virtual Machine being deleted will have to potentially approve the // Terminate Scheduled Event before the event is auto approved (timed out). // The configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M) - NotBeforeTimeout string `json:"notBeforeTimeout"` + NotBeforeTimeout string `json:"notBeforeTimeout,omitempty"` } diff --git a/models/azure/timezone_base.go b/models/azure/timezone_base.go index 478c138..69019ef 100644 --- a/models/azure/timezone_base.go +++ b/models/azure/timezone_base.go @@ -19,5 +19,5 @@ package azure type TimeZoneBase struct { // The name of the time zone. - Name string `json:"name"` + Name string `json:"name,omitempty"` } diff --git a/models/azure/uefi_settings.go b/models/azure/uefi_settings.go index d802ca1..6d00da0 100644 --- a/models/azure/uefi_settings.go +++ b/models/azure/uefi_settings.go @@ -21,8 +21,8 @@ package azure // Minimum api-version: 2020-12-01 type UefiSettings struct { // Specifies whether secure boot should be enabled on the virtual machine. - SecureBootEnabled bool `json:"secureBootEnabled"` + SecureBootEnabled bool `json:"secureBootEnabled,omitempty"` // Specifies whether vTPM should be enabled on the virtual machine. - VTpmEnabled bool `json:"vTpmEnabled"` + VTpmEnabled bool `json:"vTpmEnabled,omitempty"` } diff --git a/models/azure/unified_role_assignment.go b/models/azure/unified_role_assignment.go index 0607c25..5e075f4 100644 --- a/models/azure/unified_role_assignment.go +++ b/models/azure/unified_role_assignment.go @@ -25,11 +25,11 @@ type UnifiedRoleAssignment struct { // Identifier of the role definition the assignment is for. // Read only. // Supports $filer (eq, in). - RoleDefinitionId string `json:"roleDefinitionId"` + RoleDefinitionId string `json:"roleDefinitionId,omitempty"` // Identifier of the principal to which the assignment is granted. // Supports $filter (eq, in). - PrincipalId string `json:"principalId"` + PrincipalId string `json:"principalId,omitempty"` // Identifier of the directory object representing the scope of the assignment. // Either this property or appScopeId is required. diff --git a/models/azure/unified_role_definition.go b/models/azure/unified_role_definition.go index 0f917d7..1f12ec4 100644 --- a/models/azure/unified_role_definition.go +++ b/models/azure/unified_role_definition.go @@ -22,24 +22,24 @@ type UnifiedRoleDefinition struct { // The description for the unifiedRoleDefinition. // Read-only when isBuiltIn is true. - Description string `json:"description"` + Description string `json:"description,omitempty"` // The display name for the unifiedRoleDefinition. // Read-only when isBuiltIn is true. // Required. // Supports $filter (eq, in). - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName,omitempty"` // Flag indicating whether the role definition is part of the default set included in // Azure Active Directory (Azure AD) or a custom definition. // Read-only. // Supports $filter (eq, in). - IsBuiltIn bool `json:"isBuiltIn"` + IsBuiltIn bool `json:"isBuiltIn,omitempty"` // Flag indicating whether the role is enabled for assignment. // If false the role is not available for assignment. // Read-only when isBuiltIn is true. - IsEnabled bool `json:"isEnabled"` + IsEnabled bool `json:"isEnabled,omitempty"` // List of the scopes or permissions the role definition applies to. // Currently only / is supported. @@ -50,7 +50,7 @@ type UnifiedRoleDefinition struct { // List of permissions included in the role. // Read-only when isBuiltIn is true. // Required. - RolePermisions []UnifiedRolePermission `json:"rolePermisions"` + RolePermisions []UnifiedRolePermission `json:"rolePermisions,omitempty"` // Custom template identifier that can be set when isBuiltIn is false but is read-only when isBuiltIn is true. // This identifier is typically used if one needs an identifier to be the same across different directories. @@ -58,5 +58,5 @@ type UnifiedRoleDefinition struct { // Indicates version of the role definition. // Read-only when isBuiltIn is true. - Version string `json:"version"` + Version string `json:"version,omitempty"` } diff --git a/models/azure/unified_role_permission.go b/models/azure/unified_role_permission.go index 41286b8..c60b1e9 100644 --- a/models/azure/unified_role_permission.go +++ b/models/azure/unified_role_permission.go @@ -21,7 +21,6 @@ package azure // Resource actions are tasks that can be performed on a resource. For example, an application resource may support // create, update, delete, and reset password actions. type UnifiedRolePermission struct { - // Set of tasks that can be performed on a resource. // Required. // @@ -42,7 +41,7 @@ type UnifiedRolePermission struct { // * Update - The ability to update a given property set (including allProperties). // * Delete - The ability to delete a given entity. // * AllTasks - Represents all CRUD operations (create, read, update, and delete). - AllowedResourceActions []string `json:"allowedResourceActions"` + AllowedResourceActions []string `json:"allowedResourceActions,omitempty"` // Optional constraints that must be met for the permission to be effective. // diff --git a/models/azure/user.go b/models/azure/user.go index 4ebaf06..8106d12 100644 --- a/models/azure/user.go +++ b/models/azure/user.go @@ -28,7 +28,7 @@ type User struct { // A freeform text entry field for the user to describe themselves. // // Returned only on `$select` - AboutMe string `json:"aboutMe"` + AboutMe string `json:"aboutMe,omitempty"` // `true` if the account is enabled; otherwise `false`. This property is required when a user is created. // @@ -153,7 +153,7 @@ type User struct { // // Returned only on `$select` // Supports `$filter` (eq,ne,NOT,ge,le,in,startsWith) - EmployeeType string `json:"employeeType"` + EmployeeType string `json:"employeeType,omitempty"` // For an external user invited to the tenant, this represents the invited user's invitation status. // diff --git a/models/azure/user_assigned_identity.go b/models/azure/user_assigned_identity.go index 7ad5b49..2439cf4 100644 --- a/models/azure/user_assigned_identity.go +++ b/models/azure/user_assigned_identity.go @@ -18,6 +18,6 @@ package azure type UserAssignedIdentity struct { - ClientId string `json:"clientId"` - PrincipalId string `json:"principalId"` + ClientId string `json:"clientId,omitempty"` + PrincipalId string `json:"principalId,omitempty"` } diff --git a/models/azure/vault_certificate.go b/models/azure/vault_certificate.go index a3c5a65..41c9124 100644 --- a/models/azure/vault_certificate.go +++ b/models/azure/vault_certificate.go @@ -24,7 +24,7 @@ type VaultCertificate struct { // For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name // .crt for the X509 certificate file and .prv for private key. // Both of these files are .pem formatted. - CertificateStore string `json:"certificateStore"` + CertificateStore string `json:"certificateStore,omitempty"` // This is the URL of a certificate that has been uploaded to Key Vault as a secret. // For adding a secret to the Key Vault, see Add a key or secret to the key vault. In this case, your certificate @@ -40,5 +40,5 @@ type VaultCertificate struct { // // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine // extension for Linux or the Azure Key Vault virtual machine extension for Windows. - CertificateUrl string `json:"certificateUrl"` + CertificateUrl string `json:"certificateUrl,omitempty"` } diff --git a/models/azure/vault_props.go b/models/azure/vault_props.go index 1eb5278..d944473 100644 --- a/models/azure/vault_props.go +++ b/models/azure/vault_props.go @@ -26,17 +26,17 @@ type VaultProperties struct { // An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same // tenant ID as the key vault's tenant ID. When createMode is set to recover, access policies are not required. // Otherwise, access policies are required. - AccessPolicies []AccessPolicyEntry `json:"accessPolicies"` + AccessPolicies []AccessPolicyEntry `json:"accessPolicies,omitempty"` // The vault's create mode to indicate whether the vault need to be recovered or not. - CreateMode enums.CreateMode `json:"createMode"` + CreateMode enums.CreateMode `json:"createMode,omitempty"` // Property specifying whether protection against purge is enabled for this vault. // Setting this property to true activates protection against purge for this vault and its content - only the // Key Vault service may initiate a hard, irrecoverable deletion. // The setting is effective only if soft delete is also enabled. // Enabling this functionality is irreversible - that is, the property does not accept false as its value. - EnablePurgeProtection bool `json:"enablePurgeProtection"` + EnablePurgeProtection bool `json:"enablePurgeProtection,omitempty"` // Property that controls how data actions are authorized. // When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the @@ -44,44 +44,44 @@ type VaultProperties struct { // policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null // or not specified, the vault is created with the default value of false. // Note that management actions are always authorized with RBAC. - EnableRbacAuthorization bool `json:"enableRbacAuthorization"` + EnableRbacAuthorization bool `json:"enableRbacAuthorization,omitempty"` // Property to specify whether the 'soft delete' functionality is enabled for this key vault. // If it's not set to any value(true or false) when creating new key vault, it will be set to true by default. // Once set to true, it cannot be reverted to false. - EnableSoftDelete bool `json:"enableSoftDelete"` + EnableSoftDelete bool `json:"enableSoftDelete,omitempty"` // Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from // the key vault. - EnabledForDeployment bool `json:"enabledForDeployment"` + EnabledForDeployment bool `json:"enabledForDeployment,omitempty"` // Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - EnabledForDiskEncryption bool `json:"enabledForDiskEncryption"` + EnabledForDiskEncryption bool `json:"enabledForDiskEncryption,omitempty"` // Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - EnabledForTemplateDeployment bool `json:"enabledForTemplateDeployment"` + EnabledForTemplateDeployment bool `json:"enabledForTemplateDeployment,omitempty"` // The resource ID of HSM Pool. - HsmPoolResourceId string `json:"hsmPoolResourceId"` + HsmPoolResourceId string `json:"hsmPoolResourceId,omitempty"` // Rules governing the accessibility of the key vault from specific network locations. - NetworkAcls NetworkRuleSet `json:"networkAcls"` + NetworkAcls NetworkRuleSet `json:"networkAcls,omitempty"` // List of private endpoint connections associated with the key vault. - PrivateEndpointConnections []PrivateEndpointConnectionItem `json:"privateEndpointConnections"` + PrivateEndpointConnections []PrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty"` // Provisioning state of the vault. - ProvisioningState enums.VaultProvisioningState `json:"provisioningState"` + ProvisioningState enums.VaultProvisioningState `json:"provisioningState,omitempty"` // SKU details - Sku Sku `json:"sku"` + Sku Sku `json:"sku,omitempty"` // softDelete data retention days. It accepts >=7 and <=90. - SoftDeleteRetentionInDays int `json:"softDeleteRetentionInDays"` + SoftDeleteRetentionInDays int `json:"softDeleteRetentionInDays,omitempty"` // The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - TenantId string `json:"tenantId"` + TenantId string `json:"tenantId,omitempty"` // The URI of the vault for performing operations on keys and secrets. This property is readonly. - VaultUri string `json:"vaultUri"` + VaultUri string `json:"vaultUri,omitempty"` } diff --git a/models/azure/vault_secret_group.go b/models/azure/vault_secret_group.go index 6e16113..77c3e97 100644 --- a/models/azure/vault_secret_group.go +++ b/models/azure/vault_secret_group.go @@ -20,8 +20,8 @@ package azure // Describes a set of certificates which are all in the same Key Vault. type VaultSecretGroup struct { // The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - SourceVault SubResource `json:"sourceVault"` + SourceVault SubResource `json:"sourceVault,omitempty"` // The list of key vault references in SourceVault which contain certificates. - VaultCertificates []VaultCertificate `json:"vaultCertificates"` + VaultCertificates []VaultCertificate `json:"vaultCertificates,omitempty"` } diff --git a/models/azure/verified_publisher.go b/models/azure/verified_publisher.go index 58f56ba..c8369a9 100644 --- a/models/azure/verified_publisher.go +++ b/models/azure/verified_publisher.go @@ -21,11 +21,11 @@ package azure // For more detail see https://docs.microsoft.com/en-us/graph/api/resources/verifiedpublisher?view=graph-rest-1.0 type VerifiedPublisher struct { // The verified publisher name from the app publisher's Partner Center account. - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName,omitempty"` // The ID of the verified publisher from the app publisher's Partner Center account. - VerifiedPublisherId string `json:"verifiedPublisherId"` + VerifiedPublisherId string `json:"verifiedPublisherId,omitempty"` // The timestamp when the verified publisher was first added or most recently updated. - AddedDateTime string `json:"addedDateTime"` + AddedDateTime string `json:"addedDateTime,omitempty"` } diff --git a/models/azure/virtual_hard_disk.go b/models/azure/virtual_hard_disk.go index 10619f6..ed9c205 100644 --- a/models/azure/virtual_hard_disk.go +++ b/models/azure/virtual_hard_disk.go @@ -19,5 +19,5 @@ package azure // Describes the uri of a disk. type VirtualHardDisk struct { - Uri string `json:"uri"` + Uri string `json:"uri,omitempty"` } diff --git a/models/azure/virtual_machine_agent_instance_view.go b/models/azure/virtual_machine_agent_instance_view.go index 906163d..939cd8e 100644 --- a/models/azure/virtual_machine_agent_instance_view.go +++ b/models/azure/virtual_machine_agent_instance_view.go @@ -20,11 +20,11 @@ package azure // The instance view of the the VM Agent running on the virtual machine. type VirtualMachineAgentInstanceView struct { // The virtual machine extension handler instance view. - ExtensionHandlers []VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers"` + ExtensionHandlers []VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` // The resource status information. - Statuses []InstanceViewStatus `json:"statuses"` + Statuses []InstanceViewStatus `json:"statuses,omitempty"` // The VM Agent full version. - VMAgentVersion string `json:"vmAgentVersion"` + VMAgentVersion string `json:"vmAgentVersion,omitempty"` } diff --git a/models/azure/virtual_machine_extension.go b/models/azure/virtual_machine_extension.go index bab2383..be223d7 100644 --- a/models/azure/virtual_machine_extension.go +++ b/models/azure/virtual_machine_extension.go @@ -20,19 +20,19 @@ package azure // Describes a Virtual Machine Extension. type VirtualMachineExtension struct { // Resource ID. - Id string `json:"id"` + Id string `json:"id,omitempty"` // Resource location. - Location string `json:"location"` + Location string `json:"location,omitempty"` // Resource name. - Name string `json:"name"` + Name string `json:"name,omitempty"` - Properties VMExtensionProperties `json:"properties"` + Properties VMExtensionProperties `json:"properties,omitempty"` // Resource tags. - Tags map[string]string `json:"tags"` + Tags map[string]string `json:"tags,omitempty"` // Resource type. - Type string `json:"type"` + Type string `json:"type,omitempty"` } diff --git a/models/azure/virtual_machine_extension_handler_instance_view.go b/models/azure/virtual_machine_extension_handler_instance_view.go index ff2de59..9dbe4fc 100644 --- a/models/azure/virtual_machine_extension_handler_instance_view.go +++ b/models/azure/virtual_machine_extension_handler_instance_view.go @@ -20,11 +20,11 @@ package azure // The instance view of a virtual machine extension handler. type VirtualMachineExtensionHandlerInstanceView struct { // The extension handler status. - Status InstanceViewStatus `json:"status"` + Status InstanceViewStatus `json:"status,omitempty"` // Specifies the type of the extension; an example is "CustomScriptExtension". - Type string `json:"type"` + Type string `json:"type,omitempty"` // Specifies the version of the script handler. - TypeHandlerVersion string `json:"typeHandlerVersion"` + TypeHandlerVersion string `json:"typeHandlerVersion,omitempty"` } diff --git a/models/azure/virtual_machine_extension_instance_view.go b/models/azure/virtual_machine_extension_instance_view.go index 64d15eb..ce5bf18 100644 --- a/models/azure/virtual_machine_extension_instance_view.go +++ b/models/azure/virtual_machine_extension_instance_view.go @@ -20,17 +20,17 @@ package azure // The instance view of a virtual machine extension. type VirtualMachineExtensionInstanceView struct { // The virtual machine extension name. - Name string `json:"name"` + Name string `json:"name,omitempty"` // The resource status information. - Statuses []InstanceViewStatus `json:"statuses"` + Statuses []InstanceViewStatus `json:"statuses,omitempty"` // The resource status information. - Substatuses []InstanceViewStatus `json:"substatuses"` + Substatuses []InstanceViewStatus `json:"substatuses,omitempty"` // Specifies the type of the extension; e.g. "CustomScriptExtension" - Type string `json:"type"` + Type string `json:"type,omitempty"` // Specifies the version of the script handler. - TypeHandlerVersion string `json:"typeHandlerVersion"` + TypeHandlerVersion string `json:"typeHandlerVersion,omitempty"` } diff --git a/models/azure/virtual_machine_health_status.go b/models/azure/virtual_machine_health_status.go index 17dee91..2bb8233 100644 --- a/models/azure/virtual_machine_health_status.go +++ b/models/azure/virtual_machine_health_status.go @@ -20,5 +20,5 @@ package azure // The health status of the VM. type VirtualMachineHealthStatus struct { // The health status information for the VM. - Status InstanceViewStatus `json:"status"` + Status InstanceViewStatus `json:"status,omitempty"` } diff --git a/models/azure/virtual_machine_instance_view.go b/models/azure/virtual_machine_instance_view.go index cf8a03f..f0c9b36 100644 --- a/models/azure/virtual_machine_instance_view.go +++ b/models/azure/virtual_machine_instance_view.go @@ -24,53 +24,53 @@ type VirtualMachineInstanceView struct { // Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when // the virtual machine is associated with a dedicated host group that has automatic placement enabled. // Minimum api-version: 2020-06-01. - AssignedHost string `json:"assignedHost"` + AssignedHost string `json:"assignedHost,omitempty"` // Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM // status. // You can easily view the output of your console log. // Azure also enables you to see a screenshot of the VM from the hypervisor. - BootDiagnotics BootDiagnoticsInstanceView `json:"bootDiagnotics"` + BootDiagnotics BootDiagnoticsInstanceView `json:"bootDiagnotics,omitempty"` // The computer name assigned to the virtual machine. - ComputerName string `json:"computerName"` + ComputerName string `json:"computerName,omitempty"` // The virtual machine disk information. - Disks []DiskInstanceView `json:"disks"` + Disks []DiskInstanceView `json:"disks,omitempty"` // The extensions information. - Extensions []VirtualMachineExtensionInstanceView `json:"extensions"` + Extensions []VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` // Specifies the HyperVGeneration Type associated with a resource. - HyperVGeneration enums.HyperVGeneration `json:"hyperVGeneration"` + HyperVGeneration enums.HyperVGeneration `json:"hyperVGeneration,omitempty"` // The Maintenance Operation status on the virtual machine. - MaintenanceRedeployStatus MaintenanceRedeployStatus `json:"maintenanceRedeployStatus"` + MaintenanceRedeployStatus MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` // The Operating System running on the virtual machine. - OSName string `json:"osName"` + OSName string `json:"osName,omitempty"` // The version of Operating System running on the virtual machine. - OSVersion string `json:"osVersion"` + OSVersion string `json:"osVersion,omitempty"` // [Preview Feature] The status of the virtual machine patch operations. - PatchStatus VirtualMachinePatchStatus `json:"patchStatus"` + PatchStatus VirtualMachinePatchStatus `json:"patchStatus,omitempty"` // Specifies the fault domain of the virtual machine. - PlatformFaultDomain int `json:"platformFaultDomain"` + PlatformFaultDomain int `json:"platformFaultDomain,omitempty"` // Specifies the update domain of the virtual machine. - PlatformUpdateDomain int `json:"platformUpdateDomain"` + PlatformUpdateDomain int `json:"platformUpdateDomain,omitempty"` // The remote desktop certificate thumbprint. - RDPThumbPrint string `json:"rdpThumbPrint"` + RDPThumbPrint string `json:"rdpThumbPrint,omitempty"` // The resource status information. - Statuses []InstanceViewStatus `json:"statuses"` + Statuses []InstanceViewStatus `json:"statuses,omitempty"` // The VM Agent running on the virtual machine. - VMAgent VirtualMachineAgentInstanceView `json:"vmAgent"` + VMAgent VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` // The health status for the VM. - VMHealth VirtualMachineHealthStatus `json:"vmHealth"` + VMHealth VirtualMachineHealthStatus `json:"vmHealth,omitempty"` } diff --git a/models/azure/virtual_machine_network_interface_config.go b/models/azure/virtual_machine_network_interface_config.go index b7922a9..64a61e7 100644 --- a/models/azure/virtual_machine_network_interface_config.go +++ b/models/azure/virtual_machine_network_interface_config.go @@ -20,7 +20,7 @@ package azure // Describes a virtual machine network interface configuration. type VirtualMachineNetworkInterfaceConfiguration struct { // The network interface configuration name. - Name string `json:"name"` + Name string `json:"name,omitempty"` - Properties VMNetworkInterfaceConfigurationProperties `json:"properties"` + Properties VMNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` } diff --git a/models/azure/virtual_machine_patch_status.go b/models/azure/virtual_machine_patch_status.go index 18cf820..800b32a 100644 --- a/models/azure/virtual_machine_patch_status.go +++ b/models/azure/virtual_machine_patch_status.go @@ -20,11 +20,11 @@ package azure // The status ov virtual machine patch operations. type VirtualMachinePatchStatus struct { // The available patch summary of the latest assessment operation for the virtual machine. - AvailablePatchSummary AvailablePatchSummary `json:"availablePatchSummary"` + AvailablePatchSummary AvailablePatchSummary `json:"availablePatchSummary,omitempty"` // The enablement status of the specified patchMode. - ConfigurationStatuses []InstanceViewStatus `json:"configurationStatuses"` + ConfigurationStatuses []InstanceViewStatus `json:"configurationStatuses,omitempty"` // The installation summary of the latest installation operation for the virtual machine. - LastPatchInstallationSummary LastPatchInstallationSummary `json:"lastPatchInstallationSummary"` + LastPatchInstallationSummary LastPatchInstallationSummary `json:"lastPatchInstallationSummary,omitempty"` } diff --git a/models/azure/virtual_network_rule.go b/models/azure/virtual_network_rule.go index 5102102..80ee922 100644 --- a/models/azure/virtual_network_rule.go +++ b/models/azure/virtual_network_rule.go @@ -21,8 +21,8 @@ package azure type VirtualNetworkRule struct { // Full resource id of a vnet subnet, such as // '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - Id string `json:"id"` + Id string `json:"id,omitempty"` // Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - IgnoreMissingVnetServiceEndpoint bool `json:"ignoreMissingVnetServiceEndpoint"` + IgnoreMissingVnetServiceEndpoint bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` } diff --git a/models/azure/vm_extension_props.go b/models/azure/vm_extension_props.go index 419b751..1fdcb3b 100644 --- a/models/azure/vm_extension_props.go +++ b/models/azure/vm_extension_props.go @@ -21,39 +21,39 @@ type VMExtensionProperties struct { // Indicates whether the extension should use a newer minor version if one is available at deployment time. // Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property // set to true. - AutoUpgradeMinorVersion bool `json:"autoUpgradeMinorVersion"` + AutoUpgradeMinorVersion bool `json:"autoUpgradeMinorVersion,omitempty"` // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of // the extension available. - EnabledAutomaticUpgrade bool `json:"enabledAutomaticUpgrade"` + EnabledAutomaticUpgrade bool `json:"enabledAutomaticUpgrade,omitempty"` // How the extension handler should be forced to update even if the extension configuration has not changed. - ForceUpdateTag string `json:"forceUpdateTag"` + ForceUpdateTag string `json:"forceUpdateTag,omitempty"` // The virtual machine extension instance view. - InstanceView VirtualMachineExtensionInstanceView `json:"instanceView"` + InstanceView VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at // all. - ProtectedSettings map[string]string `json:"protectedSettings"` + ProtectedSettings map[string]string `json:"protectedSettings,omitempty"` // The provisioning state, which only appears in the response. - ProvisioningState string `json:"provisioningState"` + ProvisioningState string `json:"provisioningState,omitempty"` // The name of the extension handler publisher. - Publisher string `json:"publisher"` + Publisher string `json:"publisher,omitempty"` // Json formatted public settings for the extension. - Settings map[string]string `json:"settings"` + Settings map[string]string `json:"settings,omitempty"` // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not // connecting to the VM will not be suppressed regardless of this value). // The default is false. - SuppressFailures bool `json:"suppressFailures"` + SuppressFailures bool `json:"suppressFailures,omitempty"` // Specifies the type of the extension; an example is "CustomScriptExtension". - Type string `json:"type"` + Type string `json:"type,omitempty"` // Specifies the version of the script handler. - TypeHandlerVersion string `json:"typeHandlerVersion"` + TypeHandlerVersion string `json:"typeHandlerVersion,omitempty"` } diff --git a/models/azure/vm_gallery_app.go b/models/azure/vm_gallery_app.go index 867e189..40838fd 100644 --- a/models/azure/vm_gallery_app.go +++ b/models/azure/vm_gallery_app.go @@ -21,7 +21,7 @@ package azure type VMGalleryApplication struct { // Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if // provided. - ConfigurationReference string `json:"configurationReference"` + ConfigurationReference string `json:"configurationReference,omitempty"` // Optional, Specifies the order in which the packages have to be installed. Order int `json:"order,omitempty"` @@ -31,5 +31,5 @@ type VMGalleryApplication struct { PackageReferenceId string `json:"packageReferenceId,omitempty"` // Optional, Specifies a passthrough value for more generic context. - Tags string `json:"tags"` + Tags string `json:"tags,omitempty"` } diff --git a/models/azure/vm_ip_config_props.go b/models/azure/vm_ip_config_props.go index 1df2fd7..8b1751d 100644 --- a/models/azure/vm_ip_config_props.go +++ b/models/azure/vm_ip_config_props.go @@ -21,26 +21,26 @@ type VMIPConfigProperties struct { // Specifies an array of references to backend address pools of application gateways. A virtual machine can // reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same // application gateway. - ApplicationGatewayBackendAddressPools []SubResource `json:"applicationGatewayBackendAddressPools"` + ApplicationGatewayBackendAddressPools []SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` // Specifies an array of references to application security group. - ApplicationSecurityGroups []SubResource `json:"applicationSecurityGroups"` + ApplicationSecurityGroups []SubResource `json:"applicationSecurityGroups,omitempty"` // Specifies an array of references to backend address pools of load balancers. A virtual machine can reference // backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the // same basic sku load balancer]. - LoadBalancerBackendAddressPools []SubResource `json:"loadBalancerBackendAddressPools"` + LoadBalancerBackendAddressPools []SubResource `json:"loadBalancerBackendAddressPools,omitempty"` // Specifies the primary network interface in case the virtual machine has more than 1 network interface. - Primary bool `json:"primary"` + Primary bool `json:"primary,omitempty"` // Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. // Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. - PrivateIPAddressVersion string `json:"privateIpAddressVersion"` + PrivateIPAddressVersion string `json:"privateIpAddressVersion,omitempty"` // The publicIPAddressConfiguration. - PublicIPAddressConfiguration VMPublicIPConfig `json:"publicIpAddressConfiguration"` + PublicIPAddressConfiguration VMPublicIPConfig `json:"publicIpAddressConfiguration,omitempty"` // Specifies the identifier of the subnet. - Subnet SubResource `json:"subnet"` + Subnet SubResource `json:"subnet,omitempty"` } diff --git a/models/azure/vm_ip_tag.go b/models/azure/vm_ip_tag.go index 248cf18..98cfadc 100644 --- a/models/azure/vm_ip_tag.go +++ b/models/azure/vm_ip_tag.go @@ -20,8 +20,8 @@ package azure // Contains the IP tag associated with the public IP address. type VMIPTag struct { // IP tag type. Example: FirstPartyUsage. - IPTagType string `json:"ipTagType"` + IPTagType string `json:"ipTagType,omitempty"` // IP tag associated with the public IP. Example: SQL, Storage etc. - Tag string `json:"tag"` + Tag string `json:"tag,omitempty"` } diff --git a/models/azure/vm_network_interface_config_props.go b/models/azure/vm_network_interface_config_props.go index 3282161..c19f8c3 100644 --- a/models/azure/vm_network_interface_config_props.go +++ b/models/azure/vm_network_interface_config_props.go @@ -21,29 +21,29 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type VMNetworkInterfaceConfigurationProperties struct { // Specify what happens to the network interface when the VM is deleted. - DeleteOption enums.VMDeleteOption `json:"deleteOption"` + DeleteOption enums.VMDeleteOption `json:"deleteOption,omitempty"` // The dns settings to be applied on the network interfaces. - DNSSettings VMNetworkInterfaceDNSSettings `json:"dnsSettings"` + DNSSettings VMNetworkInterfaceDNSSettings `json:"dnsSettings,omitempty"` // The DSCP resource to be applied to the network interfaces. - DSCPConfiguration SubResource `json:"dscpConfiguration"` + DSCPConfiguration SubResource `json:"dscpConfiguration,omitempty"` // Specifies whether the network interface is accelerated networking-enabled. - EnabledAcceleratedNetworking bool `json:"enabledAcceleratedNetworking"` + EnabledAcceleratedNetworking bool `json:"enabledAcceleratedNetworking,omitempty"` // Specifies whether the network is FPGA networking-enabled - EnableFpga bool `json:"enableFpga"` + EnableFpga bool `json:"enableFpga,omitempty"` // Whether IP forwarding is enabled on this NIC. - EnableIPForwarding bool `json:"enableIPForwarding"` + EnableIPForwarding bool `json:"enableIPForwarding,omitempty"` // Specifies the IP configurations of the network interface. - IPConfigurations []VMNetworkInterfaceIPConfig `json:"ipConfigurations"` + IPConfigurations []VMNetworkInterfaceIPConfig `json:"ipConfigurations,omitempty"` // The network security group. - NetworkSecurityGroup SubResource `json:"networkSecurityGroup"` + NetworkSecurityGroup SubResource `json:"networkSecurityGroup,omitempty"` // Specifies the primary network interface in case the virtual machine has more than one. - Primary bool `json:"primary"` + Primary bool `json:"primary,omitempty"` } diff --git a/models/azure/vm_network_interface_dns_settings.go b/models/azure/vm_network_interface_dns_settings.go index f11e46d..c318659 100644 --- a/models/azure/vm_network_interface_dns_settings.go +++ b/models/azure/vm_network_interface_dns_settings.go @@ -20,5 +20,5 @@ package azure // Describes a virtual machine network configuration's DNS settings. type VMNetworkInterfaceDNSSettings struct { // List of DNS server IP addresses - DNSServers []string `json:"dnsServers"` + DNSServers []string `json:"dnsServers,omitempty"` } diff --git a/models/azure/vm_network_interface_ip_config.go b/models/azure/vm_network_interface_ip_config.go index 2bb055c..0a15ba0 100644 --- a/models/azure/vm_network_interface_ip_config.go +++ b/models/azure/vm_network_interface_ip_config.go @@ -19,5 +19,5 @@ package azure // Describes a virtual machine network profile's IP configuration. type VMNetworkInterfaceIPConfig struct { - Properties VMIPConfigProperties `json:"properties"` + Properties VMIPConfigProperties `json:"properties,omitempty"` } diff --git a/models/azure/vm_public_ip_config.go b/models/azure/vm_public_ip_config.go index 0b20bb1..23d8b72 100644 --- a/models/azure/vm_public_ip_config.go +++ b/models/azure/vm_public_ip_config.go @@ -20,10 +20,10 @@ package azure // Describes a virtual machines IP Configuration's PublicIPAddress configuration. type VMPublicIPConfig struct { // The public IP address configuration name. - Name string `json:"name"` + Name string `json:"name,omitempty"` - Properties VMPublicIPConfigProperties `json:"properties"` + Properties VMPublicIPConfigProperties `json:"properties,omitempty"` // Describes the public IP Sku - Sku VMPublicIPSku `json:"sku"` + Sku VMPublicIPSku `json:"sku,omitempty"` } diff --git a/models/azure/vm_public_ip_config_props.go b/models/azure/vm_public_ip_config_props.go index 6705593..21dfc25 100644 --- a/models/azure/vm_public_ip_config_props.go +++ b/models/azure/vm_public_ip_config_props.go @@ -23,21 +23,21 @@ import ( type VMPublicIPConfigProperties struct { // Specify what happens to the public IP address when the VM is deleted. - DeleteOption enums.VMDeleteOption `json:"deleteOption"` + DeleteOption enums.VMDeleteOption `json:"deleteOption,omitempty"` // The dns settings to be applied on the publicIP addresses. - DNSSettings VMPublicIPDNSSettings `json:"dnsSettings"` + DNSSettings VMPublicIPDNSSettings `json:"dnsSettings,omitempty"` // The idle timeout of the public IP address. - IdleTimeoutInMinutes int `json:"idleTimeoutInMinutes"` + IdleTimeoutInMinutes int `json:"idleTimeoutInMinutes,omitempty"` // The list of IP tags associated with the public IP address. - IPTags []VMIPTag `json:"ipTags"` + IPTags []VMIPTag `json:"ipTags,omitempty"` // Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. // Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. - PublicIPAddressVersion string `json:"publicIpAddressVersion"` + PublicIPAddressVersion string `json:"publicIpAddressVersion,omitempty"` // Specify the public IP allocation type. - PublicIPAllocationMethod enums.IPAllocationMethod `json:"publicIpAllocationMethod"` + PublicIPAllocationMethod enums.IPAllocationMethod `json:"publicIpAllocationMethod,omitempty"` } diff --git a/models/azure/vm_public_ip_dns_settings.go b/models/azure/vm_public_ip_dns_settings.go index 1c6d495..ae085ac 100644 --- a/models/azure/vm_public_ip_dns_settings.go +++ b/models/azure/vm_public_ip_dns_settings.go @@ -21,5 +21,5 @@ package azure type VMPublicIPDNSSettings struct { // The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is // the concatenation of the domain name label and vm network profile unique ID. - DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabel string `json:"domainNameLabel,omitempty"` } diff --git a/models/azure/vm_public_ip_sku.go b/models/azure/vm_public_ip_sku.go index 6416edd..9251d77 100644 --- a/models/azure/vm_public_ip_sku.go +++ b/models/azure/vm_public_ip_sku.go @@ -24,8 +24,8 @@ import ( // Describes the public IP Sku type VMPublicIPSku struct { // Specify the public IP sku name. - Name enums.IPSku `json:"name"` + Name enums.IPSku `json:"name,omitempty"` // Specify the public IP sky tier. - Tier enums.IPSkuTier `json:"tier"` + Tier enums.IPSkuTier `json:"tier,omitempty"` } diff --git a/models/azure/vm_size_props.go b/models/azure/vm_size_props.go index 06d4df3..ce7f01e 100644 --- a/models/azure/vm_size_props.go +++ b/models/azure/vm_size_props.go @@ -22,11 +22,11 @@ type VMSizeProperties struct { // Specifies the number of vCPUs available for the VM. // When this property is not specified in the request body the default behavior is to set it to the value of vCPUs // available for that VM size exposed in api response of List all available virtual machine sizes in a region. - VCPUsAvailable int `json:"vCPUsAvailable"` + VCPUsAvailable int `json:"vCPUsAvailable,omitempty"` // Specifies the vCPU to physical core ratio. // When this property is not specified in the request body the default behavior is set to the value of vCPUsPerCore // for the VM Size exposed in api response of List all available virtual machine sizes in a region. // Setting this property to 1 also means that hyper-threading is disabled. - VCPUsPerCore int `json:"vCPUsPerCore"` + VCPUsPerCore int `json:"vCPUsPerCore,omitempty"` } diff --git a/models/azure/web_application.go b/models/azure/web_application.go index d91eeb4..f379aa8 100644 --- a/models/azure/web_application.go +++ b/models/azure/web_application.go @@ -20,16 +20,16 @@ package azure // Specifies settings for a web application. type WebApplication struct { // Home page or landing page of the application. - HomePageUrl string `json:"homePageUrl"` + HomePageUrl string `json:"homePageUrl,omitempty"` // Specifies whether this web application can request tokens using the OAuth 2.0 implicit flow. - ImplicitGrantSettings ImplicitGrantSettings `json:"implicitGrantSettings"` + ImplicitGrantSettings ImplicitGrantSettings `json:"implicitGrantSettings,omitempty"` // Specifies the URL that will be used by Microsoft's authorization service to logout a user using front-channel, // back-channel or SAML logout protocols. - LogoutUrl string `json:"logoutUrl"` + LogoutUrl string `json:"logoutUrl,omitempty"` // Specifies the URLs where user tokens are sent for sign-in, or the redirect URIs where OAuth 2.0 authorization // codes and access tokens are sent. - RedirectUris []string `json:"redirectUris"` + RedirectUris []string `json:"redirectUris,omitempty"` } diff --git a/models/azure/win_rm_config.go b/models/azure/win_rm_config.go index c54c2e0..8b37c41 100644 --- a/models/azure/win_rm_config.go +++ b/models/azure/win_rm_config.go @@ -20,5 +20,5 @@ package azure // Describes Windows Remote Management configuration of the VM. type WinRMConfiguration struct { // The list of Windows Remote Management listeners. - Listeners []WinRMListener `json:"listeners"` + Listeners []WinRMListener `json:"listeners,omitempty"` } diff --git a/models/azure/win_rm_listener.go b/models/azure/win_rm_listener.go index f115249..8544408 100644 --- a/models/azure/win_rm_listener.go +++ b/models/azure/win_rm_listener.go @@ -32,11 +32,11 @@ type WinRMListener struct { // ``` // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine // extension for Linux or the Azure Key Vault virtual machine extension for Windows. - CertificateUrl string `json:"certificateUrl"` + CertificateUrl string `json:"certificateUrl,omitempty"` // Specifies the protocol of WinRM listener. // Possible values are: // - http // - https - Protocol string `json:"protocol"` + Protocol string `json:"protocol,omitempty"` } diff --git a/models/azure/windows_config.go b/models/azure/windows_config.go index 3361cc6..0cacb0b 100644 --- a/models/azure/windows_config.go +++ b/models/azure/windows_config.go @@ -21,23 +21,23 @@ package azure type WindowsConfiguration struct { // Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, // which is used by Windows Setup. - AdditionalUnattendContent []AdditionalUnattendContent `json:"additionalUnattendContent"` + AdditionalUnattendContent []AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` // Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. // For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. - EnableAutomaticUpdates bool `json:"enableAutomaticUpdates"` + EnableAutomaticUpdates bool `json:"enableAutomaticUpdates,omitempty"` // [Preview Feature] Specifies settings related to VM Guest Patching on Windows. - PatchSettings WindowsPatchSettings `json:"patchSettings"` + PatchSettings WindowsPatchSettings `json:"patchSettings,omitempty"` // Indicates whether virtual machine agent should be provisioned on the virtual machine. // When this property is not specified in the request body, default behavior is to set it to true. This will ensure // that VM Agent is installed on the VM so that extensions can be added to the VM later. - ProvisionVMAgent bool `json:"provisionVMAgent"` + ProvisionVMAgent bool `json:"provisionVMAgent,omitempty"` // Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time" - TimeZone string `json:"timeZone"` + TimeZone string `json:"timeZone,omitempty"` // Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. - WinRM WinRMConfiguration `json:"winRM"` + WinRM WinRMConfiguration `json:"winRM,omitempty"` } diff --git a/models/azure/windows_patch_settings.go b/models/azure/windows_patch_settings.go index b5e436a..e309056 100644 --- a/models/azure/windows_patch_settings.go +++ b/models/azure/windows_patch_settings.go @@ -23,11 +23,11 @@ type WindowsPatchSettings struct { // Possible values are: // ImageDefault - You control the timing of patch assessments on a virtual machine. // AutomaticByPlatform - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. - AssessmentMode string `json:"assessmentMode"` + AssessmentMode string `json:"assessmentMode,omitempty"` // Enables customers to patch their Azure VMs without requiring a reboot. // For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to 'AutomaticByPlatform'. - EnableHotpatching bool `json:"enableHotpatching"` + EnableHotpatching bool `json:"enableHotpatching,omitempty"` // Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine // scale set with OrchestrationMode as Flexible. @@ -35,5 +35,5 @@ type WindowsPatchSettings struct { // Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates must be false // AutomaticByOS - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be true. // AutomaticByPlatform - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true - PatchMode string `json:"patchMode"` + PatchMode string `json:"patchMode,omitempty"` } diff --git a/models/azure/working_hours.go b/models/azure/working_hours.go index ac2584f..7844674 100644 --- a/models/azure/working_hours.go +++ b/models/azure/working_hours.go @@ -21,14 +21,14 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type WorkingHours struct { // The days of the week on which the user works. - DaysOfWeek []enums.DayOfWeek `json:"daysOfWeek"` + DaysOfWeek []enums.DayOfWeek `json:"daysOfWeek,omitempty"` // The time of the day that the user starts working. - StartTime string `json:"startTime"` + StartTime string `json:"startTime,omitempty"` // The time of the day that the user stops working. - EndTime string `json:"endTime"` + EndTime string `json:"endTime,omitempty"` // The time zone to which the working hours apply. - TimeZone TimeZoneBase `json:"timeZoneBase"` + TimeZone TimeZoneBase `json:"timeZoneBase,omitempty"` } diff --git a/models/device-owner.go b/models/device-owner.go index 4871b08..5183ce7 100644 --- a/models/device-owner.go +++ b/models/device-owner.go @@ -26,6 +26,18 @@ type DeviceOwner struct { DeviceId string `json:"deviceId"` } +func (s *DeviceOwner) MarshalJSON() ([]byte, error) { + output := make(map[string]any) + output["deviceId"] = s.DeviceId + + if owner, err := OmitEmpty(s.Owner); err != nil { + return nil, err + } else { + output["owner"] = owner + return json.Marshal(output) + } +} + type DeviceOwners struct { Owners []DeviceOwner `json:"owners"` DeviceId string `json:"deviceId"` diff --git a/models/group-member.go b/models/group-member.go index a346ec5..2d08eba 100644 --- a/models/group-member.go +++ b/models/group-member.go @@ -26,6 +26,18 @@ type GroupMember struct { GroupId string `json:"groupId"` } +func (s *GroupMember) MarshalJSON() ([]byte, error) { + output := make(map[string]any) + output["groupId"] = s.GroupId + + if member, err := OmitEmpty(s.Member); err != nil { + return nil, err + } else { + output["member"] = member + return json.Marshal(output) + } +} + type GroupMembers struct { Members []GroupMember `json:"members"` GroupId string `json:"groupId"` diff --git a/models/group-owner.go b/models/group-owner.go index f631982..a7a48fe 100644 --- a/models/group-owner.go +++ b/models/group-owner.go @@ -26,6 +26,18 @@ type GroupOwner struct { GroupId string `json:"groupId"` } +func (s *GroupOwner) MarshalJSON() ([]byte, error) { + output := make(map[string]any) + output["groupId"] = s.GroupId + + if owner, err := OmitEmpty(s.Owner); err != nil { + return nil, err + } else { + output["owner"] = owner + return json.Marshal(output) + } +} + type GroupOwners struct { Owners []GroupOwner `json:"owners"` GroupId string `json:"groupId"` diff --git a/models/service-principal-owner.go b/models/service-principal-owner.go index 57543df..bb44eb0 100644 --- a/models/service-principal-owner.go +++ b/models/service-principal-owner.go @@ -26,6 +26,18 @@ type ServicePrincipalOwner struct { ServicePrincipalId string `json:"servicePrincipalId"` } +func (s *ServicePrincipalOwner) MarshalJSON() ([]byte, error) { + output := make(map[string]any) + output["servicePrincipalId"] = s.ServicePrincipalId + + if owner, err := OmitEmpty(s.Owner); err != nil { + return nil, err + } else { + output["owner"] = owner + return json.Marshal(output) + } +} + type ServicePrincipalOwners struct { Owners []ServicePrincipalOwner `json:"owners"` ServicePrincipalId string `json:"servicePrincipalId"` diff --git a/models/utils.go b/models/utils.go new file mode 100644 index 0000000..ea210a2 --- /dev/null +++ b/models/utils.go @@ -0,0 +1,53 @@ +package models + +import ( + "encoding/json" + "reflect" +) + +func OmitEmpty(raw json.RawMessage) (json.RawMessage, error) { + var data map[string]any + if err := json.Unmarshal(raw, &data); err != nil { + return nil, err + } else { + StripEmptyEntries(data) + return json.Marshal(data) + } +} + +func StripEmptyEntries(data map[string]any) { + for key, value := range data { + if isEmpty(reflect.ValueOf(value)) { + delete(data, key) + } else if nested, ok := value.(map[string]any); ok { // recursively strip nested maps + StripEmptyEntries(nested) + } else if slice, ok := value.([]any); ok { + for _, item := range slice { + if mapValue, ok := item.(map[string]any); ok { + StripEmptyEntries(mapValue) + } + } + } + } +} + +func isEmpty(value reflect.Value) bool { + switch value.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return value.Len() == 0 + case reflect.Bool: + return value.Bool() == false + case reflect.Float32, reflect.Float64: + return value.Float() == 0 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return value.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return value.Uint() == 0 + case reflect.Interface, reflect.Pointer: + return value.IsNil() + case reflect.Invalid: + return true + default: + return false + } +} diff --git a/models/utils_test.go b/models/utils_test.go new file mode 100644 index 0000000..841bd66 --- /dev/null +++ b/models/utils_test.go @@ -0,0 +1,207 @@ +package models_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/bloodhoundad/azurehound/v2/models" + "github.com/stretchr/testify/require" +) + +type Foo struct { + Bar string +} + +func TestStripEmptyEntries(t *testing.T) { + t.Run("should omit empty basic types", func(t *testing.T) { + var pointer *Foo + + data := map[string]any{ + "array": [0]any{}, + "map": map[string]any{}, + "slice": []any{}, + "string": "", + "bool": false, + "float32": float32(0), + "float64": float64(0), + "int": int(0), + "int8": int8(0), + "int16": int16(0), + "int32": int32(0), + "int64": int64(0), + "uint": uint(0), + "uint8": uint8(0), + "uint16": uint16(0), + "uint32": uint32(0), + "uint64": uint64(0), + "pointer": pointer, + "nil": nil, + } + + require.NotEmpty(t, data) + models.StripEmptyEntries(data) + require.Empty(t, data) + }) + + t.Run("should not omit non-empty basic types", func(t *testing.T) { + data := map[string]any{ + "array": [1]any{1}, + "map": map[any]any{"foo": "bar"}, + "slice": []any{1}, + "string": "foo", + "bool": true, + "float32": float32(1), + "float64": float64(1), + "int": int(1), + "int8": int8(1), + "int16": int16(1), + "int32": int32(1), + "int64": int64(1), + "uint": uint(1), + "uint8": uint8(1), + "uint16": uint16(1), + "uint32": uint32(1), + "uint64": uint64(1), + "pointer": &Foo{}, + } + + require.NotEmpty(t, data) + numKeys := len(data) + models.StripEmptyEntries(data) + require.NotEmpty(t, data) + require.Equal(t, numKeys, len(data)) + }) + + t.Run("should not omit empty struct types", func(t *testing.T) { + data := map[string]any{ + "struct": Foo{Bar: "baz"}, + } + + require.NotEmpty(t, data) + numKeys := len(data) + models.StripEmptyEntries(data) + require.NotEmpty(t, data) + require.Equal(t, numKeys, len(data)) + require.NotEmpty(t, data["struct"]) + require.Equal(t, data["struct"].(Foo).Bar, "baz") + }) + + t.Run("should recursively strip non-empty, nested map[string]any entries", func(t *testing.T) { + data := map[string]any{ + "empty": map[string]any{}, + "nonempty": map[string]any{ + "emptyprop": 0, + "nonemptyprop": 1, + }, + } + + models.StripEmptyEntries(data) + require.Nil(t, data["empty"]) + require.NotNil(t, data["nonempty"]) + require.IsType(t, map[string]any{}, data["nonempty"]) + nested := data["nonempty"].(map[string]any) + require.Equal(t, 1, len(nested)) + require.Nil(t, nested["emptyprop"]) + require.Equal(t, 1, nested["nonemptyprop"]) + }) + + t.Run("should strip non-empty slice entries of type map[string]any", func(t *testing.T) { + data := map[string]any{ + "empty": []any{}, + "nonempty": []any{ + map[string]any{ + "emptyprop": 0, + "nonemptyprop": 1, + }, + }, + } + + fmt.Println(data["nonempty"]) + models.StripEmptyEntries(data) + require.Nil(t, data["empty"]) + require.NotNil(t, data["nonempty"]) + require.IsType(t, []any{}, data["nonempty"]) + slice := data["nonempty"].([]any) + fmt.Println(slice) + require.IsType(t, map[string]any{}, slice[0]) + entry := slice[0].(map[string]any) + require.Nil(t, entry["emptyprop"]) + require.Equal(t, 1, entry["nonemptyprop"]) + }) +} + +func TestOmitEmpty(t *testing.T) { + t.Run("should omit empty basic types", func(t *testing.T) { + data := json.RawMessage(`{ + "string": "", + "number": 0, + "object": {}, + "array": [], + "boolean": false, + "null": null + }`) + + filtered, err := models.OmitEmpty(data) + require.Nil(t, err) + require.Equal(t, `{}`, string(filtered)) + }) + + t.Run("should not omit non-empty basic types", func(t *testing.T) { + data := json.RawMessage(`{ + "string": "foo", + "number": 1, + "object": { "bar": "" }, + "array": [1], + "boolean": true + }`) + + filtered, err := models.OmitEmpty(data) + require.Nil(t, err) + require.Equal(t, `{"array":[1],"boolean":true,"number":1,"object":{},"string":"foo"}`, string(filtered)) + }) + + t.Run("should not omit empty struct/object types, just their empty properties", func(t *testing.T) { + data := json.RawMessage(`{ + "object": { "bar": "" } + }`) + + filtered, err := models.OmitEmpty(data) + require.Nil(t, err) + require.Equal(t, `{"object":{}}`, string(filtered)) + }) + + t.Run("should recursively strip non-empty, nested object entries", func(t *testing.T) { + data := json.RawMessage(`{ + "empty": {}, + "nonempty": { + "emptyprop": 0, + "nonemptyprop": 1 + } + }`) + + filtered, err := models.OmitEmpty(data) + require.Nil(t, err) + require.Equal(t, `{"nonempty":{"nonemptyprop":1}}`, string(filtered)) + }) + + t.Run("should strip non-empty array entries of type object", func(t *testing.T) { + data := json.RawMessage(`{ + "empty": [], + "nonempty": [{ + "emptyprop": 0, + "nonemptyprop": 1 + }] + }`) + + filtered, err := models.OmitEmpty(data) + require.Nil(t, err) + require.Equal(t, `{"nonempty":[{"nonemptyprop":1}]}`, string(filtered)) + }) + + t.Run("should return an error", func(t *testing.T) { + invalidJson := json.RawMessage(`{]}`) + _, err := models.OmitEmpty(invalidJson) + require.Error(t, err) + }) +}