sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go (4,208 lines of code) (raw):

//go:build go1.18 // +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. package armhybridcompute import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" ) // MarshalJSON implements the json.Marshaller interface for type AccessRule. func (a AccessRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccessRule. func (a *AccessRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type AccessRuleProperties. func (a AccessRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "addressPrefixes", a.AddressPrefixes) populate(objectMap, "direction", a.Direction) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccessRuleProperties. func (a *AccessRuleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "addressPrefixes": err = unpopulate(val, "AddressPrefixes", &a.AddressPrefixes) delete(rawMsg, key) case "direction": err = unpopulate(val, "Direction", &a.Direction) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type AgentConfiguration. func (a AgentConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "configMode", a.ConfigMode) populate(objectMap, "extensionsAllowList", a.ExtensionsAllowList) populate(objectMap, "extensionsBlockList", a.ExtensionsBlockList) populate(objectMap, "extensionsEnabled", a.ExtensionsEnabled) populate(objectMap, "guestConfigurationEnabled", a.GuestConfigurationEnabled) populate(objectMap, "incomingConnectionsPorts", a.IncomingConnectionsPorts) populate(objectMap, "proxyBypass", a.ProxyBypass) populate(objectMap, "proxyUrl", a.ProxyURL) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AgentConfiguration. func (a *AgentConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "configMode": err = unpopulate(val, "ConfigMode", &a.ConfigMode) delete(rawMsg, key) case "extensionsAllowList": err = unpopulate(val, "ExtensionsAllowList", &a.ExtensionsAllowList) delete(rawMsg, key) case "extensionsBlockList": err = unpopulate(val, "ExtensionsBlockList", &a.ExtensionsBlockList) delete(rawMsg, key) case "extensionsEnabled": err = unpopulate(val, "ExtensionsEnabled", &a.ExtensionsEnabled) delete(rawMsg, key) case "guestConfigurationEnabled": err = unpopulate(val, "GuestConfigurationEnabled", &a.GuestConfigurationEnabled) delete(rawMsg, key) case "incomingConnectionsPorts": err = unpopulate(val, "IncomingConnectionsPorts", &a.IncomingConnectionsPorts) delete(rawMsg, key) case "proxyBypass": err = unpopulate(val, "ProxyBypass", &a.ProxyBypass) delete(rawMsg, key) case "proxyUrl": err = unpopulate(val, "ProxyURL", &a.ProxyURL) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type AgentUpgrade. func (a AgentUpgrade) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "correlationId", a.CorrelationID) populate(objectMap, "desiredVersion", a.DesiredVersion) populate(objectMap, "enableAutomaticUpgrade", a.EnableAutomaticUpgrade) populate(objectMap, "lastAttemptDesiredVersion", a.LastAttemptDesiredVersion) populate(objectMap, "lastAttemptMessage", a.LastAttemptMessage) populate(objectMap, "lastAttemptStatus", a.LastAttemptStatus) populateDateTimeRFC3339(objectMap, "lastAttemptTimestamp", a.LastAttemptTimestamp) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AgentUpgrade. func (a *AgentUpgrade) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "correlationId": err = unpopulate(val, "CorrelationID", &a.CorrelationID) delete(rawMsg, key) case "desiredVersion": err = unpopulate(val, "DesiredVersion", &a.DesiredVersion) delete(rawMsg, key) case "enableAutomaticUpgrade": err = unpopulate(val, "EnableAutomaticUpgrade", &a.EnableAutomaticUpgrade) delete(rawMsg, key) case "lastAttemptDesiredVersion": err = unpopulate(val, "LastAttemptDesiredVersion", &a.LastAttemptDesiredVersion) delete(rawMsg, key) case "lastAttemptMessage": err = unpopulate(val, "LastAttemptMessage", &a.LastAttemptMessage) delete(rawMsg, key) case "lastAttemptStatus": err = unpopulate(val, "LastAttemptStatus", &a.LastAttemptStatus) delete(rawMsg, key) case "lastAttemptTimestamp": err = unpopulateDateTimeRFC3339(val, "LastAttemptTimestamp", &a.LastAttemptTimestamp) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type AvailablePatchCountByClassification. func (a AvailablePatchCountByClassification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "critical", a.Critical) populate(objectMap, "definition", a.Definition) populate(objectMap, "featurePack", a.FeaturePack) populate(objectMap, "other", a.Other) populate(objectMap, "security", a.Security) populate(objectMap, "servicePack", a.ServicePack) populate(objectMap, "tools", a.Tools) populate(objectMap, "updateRollup", a.UpdateRollup) populate(objectMap, "updates", a.Updates) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePatchCountByClassification. func (a *AvailablePatchCountByClassification) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "critical": err = unpopulate(val, "Critical", &a.Critical) delete(rawMsg, key) case "definition": err = unpopulate(val, "Definition", &a.Definition) delete(rawMsg, key) case "featurePack": err = unpopulate(val, "FeaturePack", &a.FeaturePack) delete(rawMsg, key) case "other": err = unpopulate(val, "Other", &a.Other) delete(rawMsg, key) case "security": err = unpopulate(val, "Security", &a.Security) delete(rawMsg, key) case "servicePack": err = unpopulate(val, "ServicePack", &a.ServicePack) delete(rawMsg, key) case "tools": err = unpopulate(val, "Tools", &a.Tools) delete(rawMsg, key) case "updateRollup": err = unpopulate(val, "UpdateRollup", &a.UpdateRollup) delete(rawMsg, key) case "updates": err = unpopulate(val, "Updates", &a.Updates) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type CloudMetadata. func (c CloudMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "provider", c.Provider) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CloudMetadata. func (c *CloudMetadata) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { case "provider": err = unpopulate(val, "Provider", &c.Provider) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ConfigurationExtension. func (c ConfigurationExtension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "publisher", c.Publisher) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationExtension. func (c *ConfigurationExtension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { case "publisher": err = unpopulate(val, "Publisher", &c.Publisher) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ConnectionDetail. func (c ConnectionDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "groupId", c.GroupID) populate(objectMap, "id", c.ID) populate(objectMap, "linkIdentifier", c.LinkIdentifier) populate(objectMap, "memberName", c.MemberName) populate(objectMap, "privateIpAddress", c.PrivateIPAddress) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionDetail. func (c *ConnectionDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { case "groupId": err = unpopulate(val, "GroupID", &c.GroupID) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) case "linkIdentifier": err = unpopulate(val, "LinkIdentifier", &c.LinkIdentifier) delete(rawMsg, key) case "memberName": err = unpopulate(val, "MemberName", &c.MemberName) delete(rawMsg, key) case "privateIpAddress": err = unpopulate(val, "PrivateIPAddress", &c.PrivateIPAddress) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Disk. func (d Disk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "diskType", d.DiskType) populate(objectMap, "generatedId", d.GeneratedID) populate(objectMap, "id", d.ID) populate(objectMap, "maxSizeInBytes", d.MaxSizeInBytes) populate(objectMap, "name", d.Name) populate(objectMap, "path", d.Path) populate(objectMap, "usedSpaceInBytes", d.UsedSpaceInBytes) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Disk. func (d *Disk) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "diskType": err = unpopulate(val, "DiskType", &d.DiskType) delete(rawMsg, key) case "generatedId": err = unpopulate(val, "GeneratedID", &d.GeneratedID) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "maxSizeInBytes": err = unpopulate(val, "MaxSizeInBytes", &d.MaxSizeInBytes) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "path": err = unpopulate(val, "Path", &d.Path) delete(rawMsg, key) case "usedSpaceInBytes": err = unpopulate(val, "UsedSpaceInBytes", &d.UsedSpaceInBytes) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateAny(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "info": err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ErrorDetail. func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "additionalInfo": err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) case "details": err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) case "target": err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type EsuKey. func (e EsuKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "licenseStatus", e.LicenseStatus) populate(objectMap, "sku", e.SKU) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EsuKey. func (e *EsuKey) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "licenseStatus": err = unpopulate(val, "LicenseStatus", &e.LicenseStatus) delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &e.SKU) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type EsuProfileUpdateProperties. func (e EsuProfileUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assignedLicense", e.AssignedLicense) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EsuProfileUpdateProperties. func (e *EsuProfileUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "assignedLicense": err = unpopulate(val, "AssignedLicense", &e.AssignedLicense) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ExtensionTargetProperties. func (e ExtensionTargetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "targetVersion", e.TargetVersion) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTargetProperties. func (e *ExtensionTargetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "targetVersion": err = unpopulate(val, "TargetVersion", &e.TargetVersion) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ExtensionValue. func (e ExtensionValue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", e.ID) populate(objectMap, "name", e.Name) populate(objectMap, "properties", e.Properties) populate(objectMap, "systemData", e.SystemData) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionValue. func (e *ExtensionValue) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ExtensionValueListResult. func (e ExtensionValueListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionValueListResult. func (e *ExtensionValueListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "value": err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ExtensionValueProperties. func (e ExtensionValueProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "extensionType", e.ExtensionType) populate(objectMap, "publisher", e.Publisher) populate(objectMap, "version", e.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionValueProperties. func (e *ExtensionValueProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "extensionType": err = unpopulate(val, "ExtensionType", &e.ExtensionType) delete(rawMsg, key) case "publisher": err = unpopulate(val, "Publisher", &e.Publisher) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ExtensionsResourceStatus. func (e ExtensionsResourceStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", e.Code) populate(objectMap, "displayStatus", e.DisplayStatus) populate(objectMap, "level", e.Level) populate(objectMap, "message", e.Message) populateDateTimeRFC3339(objectMap, "time", e.Time) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionsResourceStatus. func (e *ExtensionsResourceStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) case "displayStatus": err = unpopulate(val, "DisplayStatus", &e.DisplayStatus) delete(rawMsg, key) case "level": err = unpopulate(val, "Level", &e.Level) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) case "time": err = unpopulateDateTimeRFC3339(val, "Time", &e.Time) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type FirmwareProfile. func (f FirmwareProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "serialNumber", f.SerialNumber) populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type FirmwareProfile. func (f *FirmwareProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { case "serialNumber": err = unpopulate(val, "SerialNumber", &f.SerialNumber) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Gateway. func (g Gateway) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", g.ID) populate(objectMap, "location", g.Location) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) populate(objectMap, "systemData", g.SystemData) populate(objectMap, "tags", g.Tags) populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Gateway. func (g *Gateway) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &g.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &g.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &g.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type GatewayProperties. func (g GatewayProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedFeatures", g.AllowedFeatures) populate(objectMap, "gatewayEndpoint", g.GatewayEndpoint) populate(objectMap, "gatewayId", g.GatewayID) populate(objectMap, "gatewayType", g.GatewayType) populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type GatewayProperties. func (g *GatewayProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "allowedFeatures": err = unpopulate(val, "AllowedFeatures", &g.AllowedFeatures) delete(rawMsg, key) case "gatewayEndpoint": err = unpopulate(val, "GatewayEndpoint", &g.GatewayEndpoint) delete(rawMsg, key) case "gatewayId": err = unpopulate(val, "GatewayID", &g.GatewayID) delete(rawMsg, key) case "gatewayType": err = unpopulate(val, "GatewayType", &g.GatewayType) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type GatewayUpdate. func (g GatewayUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "properties", g.Properties) populate(objectMap, "tags", g.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type GatewayUpdate. func (g *GatewayUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "properties": err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &g.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type GatewayUpdateProperties. func (g GatewayUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedFeatures", g.AllowedFeatures) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type GatewayUpdateProperties. func (g *GatewayUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "allowedFeatures": err = unpopulate(val, "AllowedFeatures", &g.AllowedFeatures) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type GatewaysListResult. func (g GatewaysListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", g.NextLink) populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type GatewaysListResult. func (g *GatewaysListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type HardwareProfile. func (h HardwareProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "numberOfCpuSockets", h.NumberOfCPUSockets) populate(objectMap, "processors", h.Processors) populate(objectMap, "totalPhysicalMemoryInBytes", h.TotalPhysicalMemoryInBytes) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfile. func (h *HardwareProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { case "numberOfCpuSockets": err = unpopulate(val, "NumberOfCPUSockets", &h.NumberOfCPUSockets) delete(rawMsg, key) case "processors": err = unpopulate(val, "Processors", &h.Processors) delete(rawMsg, key) case "totalPhysicalMemoryInBytes": err = unpopulate(val, "TotalPhysicalMemoryInBytes", &h.TotalPhysicalMemoryInBytes) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type IPAddress. func (i IPAddress) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "address", i.Address) populate(objectMap, "ipAddressVersion", i.IPAddressVersion) populate(objectMap, "subnet", i.Subnet) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. func (i *IPAddress) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "address": err = unpopulate(val, "Address", &i.Address) delete(rawMsg, key) case "ipAddressVersion": err = unpopulate(val, "IPAddressVersion", &i.IPAddressVersion) delete(rawMsg, key) case "subnet": err = unpopulate(val, "Subnet", &i.Subnet) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Identity. func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", i.PrincipalID) populate(objectMap, "tenantId", i.TenantID) objectMap["type"] = "SystemAssigned" return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Identity. func (i *Identity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "principalId": err = unpopulate(val, "PrincipalID", &i.PrincipalID) delete(rawMsg, key) case "tenantId": err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type License. func (l License) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", l.ID) populate(objectMap, "location", l.Location) populate(objectMap, "name", l.Name) populate(objectMap, "properties", l.Properties) populate(objectMap, "systemData", l.SystemData) populate(objectMap, "tags", l.Tags) populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type License. func (l *License) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &l.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &l.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &l.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &l.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseDetails. func (l LicenseDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assignedLicenses", l.AssignedLicenses) populate(objectMap, "edition", l.Edition) populate(objectMap, "immutableId", l.ImmutableID) populate(objectMap, "processors", l.Processors) populate(objectMap, "state", l.State) populate(objectMap, "target", l.Target) populate(objectMap, "type", l.Type) populate(objectMap, "volumeLicenseDetails", l.VolumeLicenseDetails) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseDetails. func (l *LicenseDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "assignedLicenses": err = unpopulate(val, "AssignedLicenses", &l.AssignedLicenses) delete(rawMsg, key) case "edition": err = unpopulate(val, "Edition", &l.Edition) delete(rawMsg, key) case "immutableId": err = unpopulate(val, "ImmutableID", &l.ImmutableID) delete(rawMsg, key) case "processors": err = unpopulate(val, "Processors", &l.Processors) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &l.State) delete(rawMsg, key) case "target": err = unpopulate(val, "Target", &l.Target) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) case "volumeLicenseDetails": err = unpopulate(val, "VolumeLicenseDetails", &l.VolumeLicenseDetails) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfile. func (l LicenseProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", l.ID) populate(objectMap, "location", l.Location) populate(objectMap, "name", l.Name) populate(objectMap, "properties", l.Properties) populate(objectMap, "systemData", l.SystemData) populate(objectMap, "tags", l.Tags) populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfile. func (l *LicenseProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &l.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &l.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &l.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &l.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileArmEsuProperties. func (l LicenseProfileArmEsuProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assignedLicense", l.AssignedLicense) populate(objectMap, "assignedLicenseImmutableId", l.AssignedLicenseImmutableID) populate(objectMap, "esuEligibility", l.EsuEligibility) populate(objectMap, "esuKeyState", l.EsuKeyState) populate(objectMap, "esuKeys", l.EsuKeys) populate(objectMap, "serverType", l.ServerType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileArmEsuProperties. func (l *LicenseProfileArmEsuProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "assignedLicense": err = unpopulate(val, "AssignedLicense", &l.AssignedLicense) delete(rawMsg, key) case "assignedLicenseImmutableId": err = unpopulate(val, "AssignedLicenseImmutableID", &l.AssignedLicenseImmutableID) delete(rawMsg, key) case "esuEligibility": err = unpopulate(val, "EsuEligibility", &l.EsuEligibility) delete(rawMsg, key) case "esuKeyState": err = unpopulate(val, "EsuKeyState", &l.EsuKeyState) delete(rawMsg, key) case "esuKeys": err = unpopulate(val, "EsuKeys", &l.EsuKeys) delete(rawMsg, key) case "serverType": err = unpopulate(val, "ServerType", &l.ServerType) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileArmProductProfileProperties. func (l LicenseProfileArmProductProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "billingEndDate", l.BillingEndDate) populateDateTimeRFC3339(objectMap, "billingStartDate", l.BillingStartDate) populateDateTimeRFC3339(objectMap, "disenrollmentDate", l.DisenrollmentDate) populateDateTimeRFC3339(objectMap, "enrollmentDate", l.EnrollmentDate) populate(objectMap, "error", l.Error) populate(objectMap, "productFeatures", l.ProductFeatures) populate(objectMap, "productType", l.ProductType) populate(objectMap, "subscriptionStatus", l.SubscriptionStatus) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileArmProductProfileProperties. func (l *LicenseProfileArmProductProfileProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "billingEndDate": err = unpopulateDateTimeRFC3339(val, "BillingEndDate", &l.BillingEndDate) delete(rawMsg, key) case "billingStartDate": err = unpopulateDateTimeRFC3339(val, "BillingStartDate", &l.BillingStartDate) delete(rawMsg, key) case "disenrollmentDate": err = unpopulateDateTimeRFC3339(val, "DisenrollmentDate", &l.DisenrollmentDate) delete(rawMsg, key) case "enrollmentDate": err = unpopulateDateTimeRFC3339(val, "EnrollmentDate", &l.EnrollmentDate) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &l.Error) delete(rawMsg, key) case "productFeatures": err = unpopulate(val, "ProductFeatures", &l.ProductFeatures) delete(rawMsg, key) case "productType": err = unpopulate(val, "ProductType", &l.ProductType) delete(rawMsg, key) case "subscriptionStatus": err = unpopulate(val, "SubscriptionStatus", &l.SubscriptionStatus) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileMachineInstanceView. func (l LicenseProfileMachineInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "esuProfile", l.EsuProfile) populate(objectMap, "licenseChannel", l.LicenseChannel) populate(objectMap, "licenseStatus", l.LicenseStatus) populate(objectMap, "productProfile", l.ProductProfile) populate(objectMap, "softwareAssurance", l.SoftwareAssurance) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileMachineInstanceView. func (l *LicenseProfileMachineInstanceView) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "esuProfile": err = unpopulate(val, "EsuProfile", &l.EsuProfile) delete(rawMsg, key) case "licenseChannel": err = unpopulate(val, "LicenseChannel", &l.LicenseChannel) delete(rawMsg, key) case "licenseStatus": err = unpopulate(val, "LicenseStatus", &l.LicenseStatus) delete(rawMsg, key) case "productProfile": err = unpopulate(val, "ProductProfile", &l.ProductProfile) delete(rawMsg, key) case "softwareAssurance": err = unpopulate(val, "SoftwareAssurance", &l.SoftwareAssurance) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileMachineInstanceViewEsuProperties. func (l LicenseProfileMachineInstanceViewEsuProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assignedLicense", l.AssignedLicense) populate(objectMap, "assignedLicenseImmutableId", l.AssignedLicenseImmutableID) populate(objectMap, "esuEligibility", l.EsuEligibility) populate(objectMap, "esuKeyState", l.EsuKeyState) populate(objectMap, "esuKeys", l.EsuKeys) populate(objectMap, "licenseAssignmentState", l.LicenseAssignmentState) populate(objectMap, "serverType", l.ServerType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileMachineInstanceViewEsuProperties. func (l *LicenseProfileMachineInstanceViewEsuProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "assignedLicense": err = unpopulate(val, "AssignedLicense", &l.AssignedLicense) delete(rawMsg, key) case "assignedLicenseImmutableId": err = unpopulate(val, "AssignedLicenseImmutableID", &l.AssignedLicenseImmutableID) delete(rawMsg, key) case "esuEligibility": err = unpopulate(val, "EsuEligibility", &l.EsuEligibility) delete(rawMsg, key) case "esuKeyState": err = unpopulate(val, "EsuKeyState", &l.EsuKeyState) delete(rawMsg, key) case "esuKeys": err = unpopulate(val, "EsuKeys", &l.EsuKeys) delete(rawMsg, key) case "licenseAssignmentState": err = unpopulate(val, "LicenseAssignmentState", &l.LicenseAssignmentState) delete(rawMsg, key) case "serverType": err = unpopulate(val, "ServerType", &l.ServerType) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileMachineInstanceViewSoftwareAssurance. func (l LicenseProfileMachineInstanceViewSoftwareAssurance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "softwareAssuranceCustomer", l.SoftwareAssuranceCustomer) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileMachineInstanceViewSoftwareAssurance. func (l *LicenseProfileMachineInstanceViewSoftwareAssurance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "softwareAssuranceCustomer": err = unpopulate(val, "SoftwareAssuranceCustomer", &l.SoftwareAssuranceCustomer) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileProperties. func (l LicenseProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "esuProfile", l.EsuProfile) populate(objectMap, "productProfile", l.ProductProfile) populate(objectMap, "provisioningState", l.ProvisioningState) populate(objectMap, "softwareAssurance", l.SoftwareAssurance) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileProperties. func (l *LicenseProfileProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "esuProfile": err = unpopulate(val, "EsuProfile", &l.EsuProfile) delete(rawMsg, key) case "productProfile": err = unpopulate(val, "ProductProfile", &l.ProductProfile) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) delete(rawMsg, key) case "softwareAssurance": err = unpopulate(val, "SoftwareAssurance", &l.SoftwareAssurance) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfilePropertiesSoftwareAssurance. func (l LicenseProfilePropertiesSoftwareAssurance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "softwareAssuranceCustomer", l.SoftwareAssuranceCustomer) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfilePropertiesSoftwareAssurance. func (l *LicenseProfilePropertiesSoftwareAssurance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "softwareAssuranceCustomer": err = unpopulate(val, "SoftwareAssuranceCustomer", &l.SoftwareAssuranceCustomer) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdate. func (l LicenseProfileUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "properties", l.Properties) populate(objectMap, "tags", l.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdate. func (l *LicenseProfileUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "properties": err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdateProperties. func (l LicenseProfileUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "esuProfile", l.EsuProfile) populate(objectMap, "productProfile", l.ProductProfile) populate(objectMap, "softwareAssurance", l.SoftwareAssurance) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdateProperties. func (l *LicenseProfileUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "esuProfile": err = unpopulate(val, "EsuProfile", &l.EsuProfile) delete(rawMsg, key) case "productProfile": err = unpopulate(val, "ProductProfile", &l.ProductProfile) delete(rawMsg, key) case "softwareAssurance": err = unpopulate(val, "SoftwareAssurance", &l.SoftwareAssurance) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdatePropertiesSoftwareAssurance. func (l LicenseProfileUpdatePropertiesSoftwareAssurance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "softwareAssuranceCustomer", l.SoftwareAssuranceCustomer) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdatePropertiesSoftwareAssurance. func (l *LicenseProfileUpdatePropertiesSoftwareAssurance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "softwareAssuranceCustomer": err = unpopulate(val, "SoftwareAssuranceCustomer", &l.SoftwareAssuranceCustomer) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProfilesListResult. func (l LicenseProfilesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfilesListResult. func (l *LicenseProfilesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &l.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseProperties. func (l LicenseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "licenseDetails", l.LicenseDetails) populate(objectMap, "licenseType", l.LicenseType) populate(objectMap, "provisioningState", l.ProvisioningState) populate(objectMap, "tenantId", l.TenantID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProperties. func (l *LicenseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "licenseDetails": err = unpopulate(val, "LicenseDetails", &l.LicenseDetails) delete(rawMsg, key) case "licenseType": err = unpopulate(val, "LicenseType", &l.LicenseType) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) delete(rawMsg, key) case "tenantId": err = unpopulate(val, "TenantID", &l.TenantID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseUpdate. func (l LicenseUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "properties", l.Properties) populate(objectMap, "tags", l.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseUpdate. func (l *LicenseUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "properties": err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &l.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseUpdateProperties. func (l LicenseUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "licenseDetails", l.LicenseDetails) populate(objectMap, "licenseType", l.LicenseType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseUpdateProperties. func (l *LicenseUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "licenseDetails": err = unpopulate(val, "LicenseDetails", &l.LicenseDetails) delete(rawMsg, key) case "licenseType": err = unpopulate(val, "LicenseType", &l.LicenseType) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicenseUpdatePropertiesLicenseDetails. func (l LicenseUpdatePropertiesLicenseDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "edition", l.Edition) populate(objectMap, "processors", l.Processors) populate(objectMap, "state", l.State) populate(objectMap, "target", l.Target) populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicenseUpdatePropertiesLicenseDetails. func (l *LicenseUpdatePropertiesLicenseDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "edition": err = unpopulate(val, "Edition", &l.Edition) delete(rawMsg, key) case "processors": err = unpopulate(val, "Processors", &l.Processors) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &l.State) delete(rawMsg, key) case "target": err = unpopulate(val, "Target", &l.Target) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LicensesListResult. func (l LicensesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LicensesListResult. func (l *LicensesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &l.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LinuxParameters. func (l LinuxParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "classificationsToInclude", l.ClassificationsToInclude) populate(objectMap, "packageNameMasksToExclude", l.PackageNameMasksToExclude) populate(objectMap, "packageNameMasksToInclude", l.PackageNameMasksToInclude) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LinuxParameters. func (l *LinuxParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "classificationsToInclude": err = unpopulate(val, "ClassificationsToInclude", &l.ClassificationsToInclude) delete(rawMsg, key) case "packageNameMasksToExclude": err = unpopulate(val, "PackageNameMasksToExclude", &l.PackageNameMasksToExclude) delete(rawMsg, key) case "packageNameMasksToInclude": err = unpopulate(val, "PackageNameMasksToInclude", &l.PackageNameMasksToInclude) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LocationData. func (l LocationData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "city", l.City) populate(objectMap, "countryOrRegion", l.CountryOrRegion) populate(objectMap, "district", l.District) populate(objectMap, "name", l.Name) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LocationData. func (l *LocationData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "city": err = unpopulate(val, "City", &l.City) delete(rawMsg, key) case "countryOrRegion": err = unpopulate(val, "CountryOrRegion", &l.CountryOrRegion) delete(rawMsg, key) case "district": err = unpopulate(val, "District", &l.District) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &l.Name) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Machine. func (m Machine) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "identity", m.Identity) populate(objectMap, "kind", m.Kind) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) populate(objectMap, "resources", m.Resources) populate(objectMap, "systemData", m.SystemData) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Machine. func (m *Machine) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "identity": err = unpopulate(val, "Identity", &m.Identity) delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &m.Kind) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) case "resources": err = unpopulate(val, "Resources", &m.Resources) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineAssessPatchesResult. func (m MachineAssessPatchesResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assessmentActivityId", m.AssessmentActivityID) populate(objectMap, "availablePatchCountByClassification", m.AvailablePatchCountByClassification) populate(objectMap, "errorDetails", m.ErrorDetails) populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", m.LastModifiedDateTime) populate(objectMap, "osType", m.OSType) populate(objectMap, "patchServiceUsed", m.PatchServiceUsed) populate(objectMap, "rebootPending", m.RebootPending) populateDateTimeRFC3339(objectMap, "startDateTime", m.StartDateTime) populate(objectMap, "startedBy", m.StartedBy) populate(objectMap, "status", m.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessPatchesResult. func (m *MachineAssessPatchesResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "assessmentActivityId": err = unpopulate(val, "AssessmentActivityID", &m.AssessmentActivityID) delete(rawMsg, key) case "availablePatchCountByClassification": err = unpopulate(val, "AvailablePatchCountByClassification", &m.AvailablePatchCountByClassification) delete(rawMsg, key) case "errorDetails": err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) delete(rawMsg, key) case "lastModifiedDateTime": err = unpopulateDateTimeRFC3339(val, "LastModifiedDateTime", &m.LastModifiedDateTime) delete(rawMsg, key) case "osType": err = unpopulate(val, "OSType", &m.OSType) delete(rawMsg, key) case "patchServiceUsed": err = unpopulate(val, "PatchServiceUsed", &m.PatchServiceUsed) delete(rawMsg, key) case "rebootPending": err = unpopulate(val, "RebootPending", &m.RebootPending) delete(rawMsg, key) case "startDateTime": err = unpopulateDateTimeRFC3339(val, "StartDateTime", &m.StartDateTime) delete(rawMsg, key) case "startedBy": err = unpopulate(val, "StartedBy", &m.StartedBy) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtension. func (m MachineExtension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) populate(objectMap, "systemData", m.SystemData) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtension. func (m *MachineExtension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionInstanceView. func (m MachineExtensionInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", m.Name) populate(objectMap, "status", m.Status) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceView. func (m *MachineExtensionInstanceView) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) case "typeHandlerVersion": err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionInstanceViewStatus. func (m MachineExtensionInstanceViewStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", m.Code) populate(objectMap, "displayStatus", m.DisplayStatus) populate(objectMap, "level", m.Level) populate(objectMap, "message", m.Message) populateDateTimeRFC3339(objectMap, "time", m.Time) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceViewStatus. func (m *MachineExtensionInstanceViewStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "code": err = unpopulate(val, "Code", &m.Code) delete(rawMsg, key) case "displayStatus": err = unpopulate(val, "DisplayStatus", &m.DisplayStatus) delete(rawMsg, key) case "level": err = unpopulate(val, "Level", &m.Level) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &m.Message) delete(rawMsg, key) case "time": err = unpopulateDateTimeRFC3339(val, "Time", &m.Time) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionProperties. func (m MachineExtensionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) populate(objectMap, "instanceView", m.InstanceView) populate(objectMap, "protectedSettings", m.ProtectedSettings) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "publisher", m.Publisher) populate(objectMap, "settings", m.Settings) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionProperties. func (m *MachineExtensionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "autoUpgradeMinorVersion": err = unpopulate(val, "AutoUpgradeMinorVersion", &m.AutoUpgradeMinorVersion) delete(rawMsg, key) case "enableAutomaticUpgrade": err = unpopulate(val, "EnableAutomaticUpgrade", &m.EnableAutomaticUpgrade) delete(rawMsg, key) case "forceUpdateTag": err = unpopulate(val, "ForceUpdateTag", &m.ForceUpdateTag) delete(rawMsg, key) case "instanceView": err = unpopulate(val, "InstanceView", &m.InstanceView) delete(rawMsg, key) case "protectedSettings": err = unpopulate(val, "ProtectedSettings", &m.ProtectedSettings) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) delete(rawMsg, key) case "publisher": err = unpopulate(val, "Publisher", &m.Publisher) delete(rawMsg, key) case "settings": err = unpopulate(val, "Settings", &m.Settings) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) case "typeHandlerVersion": err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionUpdate. func (m MachineExtensionUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "properties", m.Properties) populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpdate. func (m *MachineExtensionUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionUpdateProperties. func (m MachineExtensionUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) populate(objectMap, "protectedSettings", m.ProtectedSettings) populate(objectMap, "publisher", m.Publisher) populate(objectMap, "settings", m.Settings) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpdateProperties. func (m *MachineExtensionUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "autoUpgradeMinorVersion": err = unpopulate(val, "AutoUpgradeMinorVersion", &m.AutoUpgradeMinorVersion) delete(rawMsg, key) case "enableAutomaticUpgrade": err = unpopulate(val, "EnableAutomaticUpgrade", &m.EnableAutomaticUpgrade) delete(rawMsg, key) case "forceUpdateTag": err = unpopulate(val, "ForceUpdateTag", &m.ForceUpdateTag) delete(rawMsg, key) case "protectedSettings": err = unpopulate(val, "ProtectedSettings", &m.ProtectedSettings) delete(rawMsg, key) case "publisher": err = unpopulate(val, "Publisher", &m.Publisher) delete(rawMsg, key) case "settings": err = unpopulate(val, "Settings", &m.Settings) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) case "typeHandlerVersion": err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionUpgrade. func (m MachineExtensionUpgrade) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "extensionTargets", m.ExtensionTargets) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpgrade. func (m *MachineExtensionUpgrade) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "extensionTargets": err = unpopulate(val, "ExtensionTargets", &m.ExtensionTargets) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineExtensionsListResult. func (m MachineExtensionsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionsListResult. func (m *MachineExtensionsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineInstallPatchesParameters. func (m MachineInstallPatchesParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "linuxParameters", m.LinuxParameters) populate(objectMap, "maximumDuration", m.MaximumDuration) populate(objectMap, "rebootSetting", m.RebootSetting) populate(objectMap, "windowsParameters", m.WindowsParameters) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineInstallPatchesParameters. func (m *MachineInstallPatchesParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "linuxParameters": err = unpopulate(val, "LinuxParameters", &m.LinuxParameters) delete(rawMsg, key) case "maximumDuration": err = unpopulate(val, "MaximumDuration", &m.MaximumDuration) delete(rawMsg, key) case "rebootSetting": err = unpopulate(val, "RebootSetting", &m.RebootSetting) delete(rawMsg, key) case "windowsParameters": err = unpopulate(val, "WindowsParameters", &m.WindowsParameters) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineInstallPatchesResult. func (m MachineInstallPatchesResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "errorDetails", m.ErrorDetails) populate(objectMap, "excludedPatchCount", m.ExcludedPatchCount) populate(objectMap, "failedPatchCount", m.FailedPatchCount) populate(objectMap, "installationActivityId", m.InstallationActivityID) populate(objectMap, "installedPatchCount", m.InstalledPatchCount) populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", m.LastModifiedDateTime) populate(objectMap, "maintenanceWindowExceeded", m.MaintenanceWindowExceeded) populate(objectMap, "notSelectedPatchCount", m.NotSelectedPatchCount) populate(objectMap, "osType", m.OSType) populate(objectMap, "patchServiceUsed", m.PatchServiceUsed) populate(objectMap, "pendingPatchCount", m.PendingPatchCount) populate(objectMap, "rebootStatus", m.RebootStatus) populateDateTimeRFC3339(objectMap, "startDateTime", m.StartDateTime) populate(objectMap, "startedBy", m.StartedBy) populate(objectMap, "status", m.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineInstallPatchesResult. func (m *MachineInstallPatchesResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "errorDetails": err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) delete(rawMsg, key) case "excludedPatchCount": err = unpopulate(val, "ExcludedPatchCount", &m.ExcludedPatchCount) delete(rawMsg, key) case "failedPatchCount": err = unpopulate(val, "FailedPatchCount", &m.FailedPatchCount) delete(rawMsg, key) case "installationActivityId": err = unpopulate(val, "InstallationActivityID", &m.InstallationActivityID) delete(rawMsg, key) case "installedPatchCount": err = unpopulate(val, "InstalledPatchCount", &m.InstalledPatchCount) delete(rawMsg, key) case "lastModifiedDateTime": err = unpopulateDateTimeRFC3339(val, "LastModifiedDateTime", &m.LastModifiedDateTime) delete(rawMsg, key) case "maintenanceWindowExceeded": err = unpopulate(val, "MaintenanceWindowExceeded", &m.MaintenanceWindowExceeded) delete(rawMsg, key) case "notSelectedPatchCount": err = unpopulate(val, "NotSelectedPatchCount", &m.NotSelectedPatchCount) delete(rawMsg, key) case "osType": err = unpopulate(val, "OSType", &m.OSType) delete(rawMsg, key) case "patchServiceUsed": err = unpopulate(val, "PatchServiceUsed", &m.PatchServiceUsed) delete(rawMsg, key) case "pendingPatchCount": err = unpopulate(val, "PendingPatchCount", &m.PendingPatchCount) delete(rawMsg, key) case "rebootStatus": err = unpopulate(val, "RebootStatus", &m.RebootStatus) delete(rawMsg, key) case "startDateTime": err = unpopulateDateTimeRFC3339(val, "StartDateTime", &m.StartDateTime) delete(rawMsg, key) case "startedBy": err = unpopulate(val, "StartedBy", &m.StartedBy) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineListResult. func (m MachineListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineListResult. func (m *MachineListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineProperties. func (m MachineProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adFqdn", m.AdFqdn) populate(objectMap, "agentConfiguration", m.AgentConfiguration) populate(objectMap, "agentUpgrade", m.AgentUpgrade) populate(objectMap, "agentVersion", m.AgentVersion) populate(objectMap, "clientPublicKey", m.ClientPublicKey) populate(objectMap, "cloudMetadata", m.CloudMetadata) populate(objectMap, "dnsFqdn", m.DNSFqdn) populate(objectMap, "detectedProperties", m.DetectedProperties) populate(objectMap, "displayName", m.DisplayName) populate(objectMap, "domainName", m.DomainName) populate(objectMap, "errorDetails", m.ErrorDetails) populate(objectMap, "extensions", m.Extensions) populate(objectMap, "firmwareProfile", m.FirmwareProfile) populate(objectMap, "hardwareProfile", m.HardwareProfile) populateDateTimeRFC3339(objectMap, "lastStatusChange", m.LastStatusChange) populate(objectMap, "licenseProfile", m.LicenseProfile) populate(objectMap, "locationData", m.LocationData) populate(objectMap, "machineFqdn", m.MachineFqdn) populate(objectMap, "mssqlDiscovered", m.MssqlDiscovered) populate(objectMap, "networkProfile", m.NetworkProfile) populate(objectMap, "osEdition", m.OSEdition) populate(objectMap, "osName", m.OSName) populate(objectMap, "osProfile", m.OSProfile) populate(objectMap, "osSku", m.OSSKU) populate(objectMap, "osType", m.OSType) populate(objectMap, "osVersion", m.OSVersion) populate(objectMap, "parentClusterResourceId", m.ParentClusterResourceID) populate(objectMap, "privateLinkScopeResourceId", m.PrivateLinkScopeResourceID) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "serviceStatuses", m.ServiceStatuses) populate(objectMap, "status", m.Status) populate(objectMap, "storageProfile", m.StorageProfile) populate(objectMap, "vmId", m.VMID) populate(objectMap, "vmUuid", m.VMUUID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. func (m *MachineProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "adFqdn": err = unpopulate(val, "AdFqdn", &m.AdFqdn) delete(rawMsg, key) case "agentConfiguration": err = unpopulate(val, "AgentConfiguration", &m.AgentConfiguration) delete(rawMsg, key) case "agentUpgrade": err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) delete(rawMsg, key) case "agentVersion": err = unpopulate(val, "AgentVersion", &m.AgentVersion) delete(rawMsg, key) case "clientPublicKey": err = unpopulate(val, "ClientPublicKey", &m.ClientPublicKey) delete(rawMsg, key) case "cloudMetadata": err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) delete(rawMsg, key) case "dnsFqdn": err = unpopulate(val, "DNSFqdn", &m.DNSFqdn) delete(rawMsg, key) case "detectedProperties": err = unpopulate(val, "DetectedProperties", &m.DetectedProperties) delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &m.DisplayName) delete(rawMsg, key) case "domainName": err = unpopulate(val, "DomainName", &m.DomainName) delete(rawMsg, key) case "errorDetails": err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) delete(rawMsg, key) case "extensions": err = unpopulate(val, "Extensions", &m.Extensions) delete(rawMsg, key) case "firmwareProfile": err = unpopulate(val, "FirmwareProfile", &m.FirmwareProfile) delete(rawMsg, key) case "hardwareProfile": err = unpopulate(val, "HardwareProfile", &m.HardwareProfile) delete(rawMsg, key) case "lastStatusChange": err = unpopulateDateTimeRFC3339(val, "LastStatusChange", &m.LastStatusChange) delete(rawMsg, key) case "licenseProfile": err = unpopulate(val, "LicenseProfile", &m.LicenseProfile) delete(rawMsg, key) case "locationData": err = unpopulate(val, "LocationData", &m.LocationData) delete(rawMsg, key) case "machineFqdn": err = unpopulate(val, "MachineFqdn", &m.MachineFqdn) delete(rawMsg, key) case "mssqlDiscovered": err = unpopulate(val, "MssqlDiscovered", &m.MssqlDiscovered) delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) delete(rawMsg, key) case "osEdition": err = unpopulate(val, "OSEdition", &m.OSEdition) delete(rawMsg, key) case "osName": err = unpopulate(val, "OSName", &m.OSName) delete(rawMsg, key) case "osProfile": err = unpopulate(val, "OSProfile", &m.OSProfile) delete(rawMsg, key) case "osSku": err = unpopulate(val, "OSSKU", &m.OSSKU) delete(rawMsg, key) case "osType": err = unpopulate(val, "OSType", &m.OSType) delete(rawMsg, key) case "osVersion": err = unpopulate(val, "OSVersion", &m.OSVersion) delete(rawMsg, key) case "parentClusterResourceId": err = unpopulate(val, "ParentClusterResourceID", &m.ParentClusterResourceID) delete(rawMsg, key) case "privateLinkScopeResourceId": err = unpopulate(val, "PrivateLinkScopeResourceID", &m.PrivateLinkScopeResourceID) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) delete(rawMsg, key) case "serviceStatuses": err = unpopulate(val, "ServiceStatuses", &m.ServiceStatuses) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &m.StorageProfile) delete(rawMsg, key) case "vmId": err = unpopulate(val, "VMID", &m.VMID) delete(rawMsg, key) case "vmUuid": err = unpopulate(val, "VMUUID", &m.VMUUID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineRunCommand. func (m MachineRunCommand) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) populate(objectMap, "systemData", m.SystemData) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommand. func (m *MachineRunCommand) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineRunCommandInstanceView. func (m MachineRunCommandInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "endTime", m.EndTime) populate(objectMap, "error", m.Error) populate(objectMap, "executionMessage", m.ExecutionMessage) populate(objectMap, "executionState", m.ExecutionState) populate(objectMap, "exitCode", m.ExitCode) populate(objectMap, "output", m.Output) populateDateTimeRFC3339(objectMap, "startTime", m.StartTime) populate(objectMap, "statuses", m.Statuses) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandInstanceView. func (m *MachineRunCommandInstanceView) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "endTime": err = unpopulateDateTimeRFC3339(val, "EndTime", &m.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &m.Error) delete(rawMsg, key) case "executionMessage": err = unpopulate(val, "ExecutionMessage", &m.ExecutionMessage) delete(rawMsg, key) case "executionState": err = unpopulate(val, "ExecutionState", &m.ExecutionState) delete(rawMsg, key) case "exitCode": err = unpopulate(val, "ExitCode", &m.ExitCode) delete(rawMsg, key) case "output": err = unpopulate(val, "Output", &m.Output) delete(rawMsg, key) case "startTime": err = unpopulateDateTimeRFC3339(val, "StartTime", &m.StartTime) delete(rawMsg, key) case "statuses": err = unpopulate(val, "Statuses", &m.Statuses) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineRunCommandProperties. func (m MachineRunCommandProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "asyncExecution", m.AsyncExecution) populate(objectMap, "errorBlobManagedIdentity", m.ErrorBlobManagedIdentity) populate(objectMap, "errorBlobUri", m.ErrorBlobURI) populate(objectMap, "instanceView", m.InstanceView) populate(objectMap, "outputBlobManagedIdentity", m.OutputBlobManagedIdentity) populate(objectMap, "outputBlobUri", m.OutputBlobURI) populate(objectMap, "parameters", m.Parameters) populate(objectMap, "protectedParameters", m.ProtectedParameters) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "runAsPassword", m.RunAsPassword) populate(objectMap, "runAsUser", m.RunAsUser) populate(objectMap, "source", m.Source) populate(objectMap, "timeoutInSeconds", m.TimeoutInSeconds) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandProperties. func (m *MachineRunCommandProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "asyncExecution": err = unpopulate(val, "AsyncExecution", &m.AsyncExecution) delete(rawMsg, key) case "errorBlobManagedIdentity": err = unpopulate(val, "ErrorBlobManagedIdentity", &m.ErrorBlobManagedIdentity) delete(rawMsg, key) case "errorBlobUri": err = unpopulate(val, "ErrorBlobURI", &m.ErrorBlobURI) delete(rawMsg, key) case "instanceView": err = unpopulate(val, "InstanceView", &m.InstanceView) delete(rawMsg, key) case "outputBlobManagedIdentity": err = unpopulate(val, "OutputBlobManagedIdentity", &m.OutputBlobManagedIdentity) delete(rawMsg, key) case "outputBlobUri": err = unpopulate(val, "OutputBlobURI", &m.OutputBlobURI) delete(rawMsg, key) case "parameters": err = unpopulate(val, "Parameters", &m.Parameters) delete(rawMsg, key) case "protectedParameters": err = unpopulate(val, "ProtectedParameters", &m.ProtectedParameters) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) delete(rawMsg, key) case "runAsPassword": err = unpopulate(val, "RunAsPassword", &m.RunAsPassword) delete(rawMsg, key) case "runAsUser": err = unpopulate(val, "RunAsUser", &m.RunAsUser) delete(rawMsg, key) case "source": err = unpopulate(val, "Source", &m.Source) delete(rawMsg, key) case "timeoutInSeconds": err = unpopulate(val, "TimeoutInSeconds", &m.TimeoutInSeconds) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineRunCommandScriptSource. func (m MachineRunCommandScriptSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "commandId", m.CommandID) populate(objectMap, "script", m.Script) populate(objectMap, "scriptUri", m.ScriptURI) populate(objectMap, "scriptUriManagedIdentity", m.ScriptURIManagedIdentity) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandScriptSource. func (m *MachineRunCommandScriptSource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "commandId": err = unpopulate(val, "CommandID", &m.CommandID) delete(rawMsg, key) case "script": err = unpopulate(val, "Script", &m.Script) delete(rawMsg, key) case "scriptUri": err = unpopulate(val, "ScriptURI", &m.ScriptURI) delete(rawMsg, key) case "scriptUriManagedIdentity": err = unpopulate(val, "ScriptURIManagedIdentity", &m.ScriptURIManagedIdentity) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineRunCommandsListResult. func (m MachineRunCommandsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandsListResult. func (m *MachineRunCommandsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineUpdate. func (m MachineUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", m.Identity) populate(objectMap, "kind", m.Kind) populate(objectMap, "properties", m.Properties) populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineUpdate. func (m *MachineUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "identity": err = unpopulate(val, "Identity", &m.Identity) delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &m.Kind) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &m.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type MachineUpdateProperties. func (m MachineUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "agentUpgrade", m.AgentUpgrade) populate(objectMap, "cloudMetadata", m.CloudMetadata) populate(objectMap, "locationData", m.LocationData) populate(objectMap, "osProfile", m.OSProfile) populate(objectMap, "parentClusterResourceId", m.ParentClusterResourceID) populate(objectMap, "privateLinkScopeResourceId", m.PrivateLinkScopeResourceID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MachineUpdateProperties. func (m *MachineUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "agentUpgrade": err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) delete(rawMsg, key) case "cloudMetadata": err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) delete(rawMsg, key) case "locationData": err = unpopulate(val, "LocationData", &m.LocationData) delete(rawMsg, key) case "osProfile": err = unpopulate(val, "OSProfile", &m.OSProfile) delete(rawMsg, key) case "parentClusterResourceId": err = unpopulate(val, "ParentClusterResourceID", &m.ParentClusterResourceID) delete(rawMsg, key) case "privateLinkScopeResourceId": err = unpopulate(val, "PrivateLinkScopeResourceID", &m.PrivateLinkScopeResourceID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkInterface. func (n NetworkInterface) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", n.ID) populate(objectMap, "ipAddresses", n.IPAddresses) populate(objectMap, "macAddress", n.MacAddress) populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. func (n *NetworkInterface) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) case "ipAddresses": err = unpopulate(val, "IPAddresses", &n.IPAddresses) delete(rawMsg, key) case "macAddress": err = unpopulate(val, "MacAddress", &n.MacAddress) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkProfile. func (n NetworkProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "networkInterfaces", n.NetworkInterfaces) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. func (n *NetworkProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "networkInterfaces": err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeter. func (n NetworkSecurityPerimeter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", n.ID) populate(objectMap, "location", n.Location) populate(objectMap, "perimeterGuid", n.PerimeterGUID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeter. func (n *NetworkSecurityPerimeter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) case "perimeterGuid": err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfiguration. func (n NetworkSecurityPerimeterConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", n.ID) populate(objectMap, "name", n.Name) populate(objectMap, "properties", n.Properties) populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfiguration. func (n *NetworkSecurityPerimeterConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationListResult. func (n NetworkSecurityPerimeterConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", n.NextLink) populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationListResult. func (n *NetworkSecurityPerimeterConfigurationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &n.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationProperties. func (n NetworkSecurityPerimeterConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) populate(objectMap, "profile", n.Profile) populate(objectMap, "provisioningIssues", n.ProvisioningIssues) populate(objectMap, "provisioningState", n.ProvisioningState) populate(objectMap, "resourceAssociation", n.ResourceAssociation) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProperties. func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "networkSecurityPerimeter": err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) delete(rawMsg, key) case "profile": err = unpopulate(val, "Profile", &n.Profile) delete(rawMsg, key) case "provisioningIssues": err = unpopulate(val, "ProvisioningIssues", &n.ProvisioningIssues) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) delete(rawMsg, key) case "resourceAssociation": err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationReconcileResult. func (n NetworkSecurityPerimeterConfigurationReconcileResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "location", n.Location) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationReconcileResult. func (n *NetworkSecurityPerimeterConfigurationReconcileResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "location": err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterProfile. func (n NetworkSecurityPerimeterProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accessRules", n.AccessRules) populate(objectMap, "accessRulesVersion", n.AccessRulesVersion) populate(objectMap, "diagnosticSettingsVersion", n.DiagnosticSettingsVersion) populate(objectMap, "enabledLogCategories", n.EnabledLogCategories) populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterProfile. func (n *NetworkSecurityPerimeterProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "accessRules": err = unpopulate(val, "AccessRules", &n.AccessRules) delete(rawMsg, key) case "accessRulesVersion": err = unpopulate(val, "AccessRulesVersion", &n.AccessRulesVersion) delete(rawMsg, key) case "diagnosticSettingsVersion": err = unpopulate(val, "DiagnosticSettingsVersion", &n.DiagnosticSettingsVersion) delete(rawMsg, key) case "enabledLogCategories": err = unpopulate(val, "EnabledLogCategories", &n.EnabledLogCategories) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type OSProfile. func (o OSProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "computerName", o.ComputerName) populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OSProfile. func (o *OSProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "computerName": err = unpopulate(val, "ComputerName", &o.ComputerName) delete(rawMsg, key) case "linuxConfiguration": err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) delete(rawMsg, key) case "windowsConfiguration": err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type OSProfileLinuxConfiguration. func (o OSProfileLinuxConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "patchSettings", o.PatchSettings) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OSProfileLinuxConfiguration. func (o *OSProfileLinuxConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "patchSettings": err = unpopulate(val, "PatchSettings", &o.PatchSettings) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type OSProfileWindowsConfiguration. func (o OSProfileWindowsConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "patchSettings", o.PatchSettings) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OSProfileWindowsConfiguration. func (o *OSProfileWindowsConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "patchSettings": err = unpopulate(val, "PatchSettings", &o.PatchSettings) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "value": err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type OperationValue. func (o OperationValue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OperationValue. func (o *OperationValue) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "display": err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) case "isDataAction": err = unpopulate(val, "IsDataAction", &o.IsDataAction) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "origin": err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type OperationValueDisplay. func (o OperationValueDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OperationValueDisplay. func (o *OperationValueDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "description": err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) case "operation": err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) case "provider": err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) case "resource": err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PatchSettings. func (p PatchSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assessmentMode", p.AssessmentMode) populate(objectMap, "enableHotpatching", p.EnableHotpatching) populate(objectMap, "patchMode", p.PatchMode) populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PatchSettings. func (p *PatchSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "assessmentMode": err = unpopulate(val, "AssessmentMode", &p.AssessmentMode) delete(rawMsg, key) case "enableHotpatching": err = unpopulate(val, "EnableHotpatching", &p.EnableHotpatching) delete(rawMsg, key) case "patchMode": err = unpopulate(val, "PatchMode", &p.PatchMode) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PatchSettingsStatus. func (p PatchSettingsStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", p.Error) populate(objectMap, "hotpatchEnablementStatus", p.HotpatchEnablementStatus) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PatchSettingsStatus. func (p *PatchSettingsStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "error": err = unpopulate(val, "Error", &p.Error) delete(rawMsg, key) case "hotpatchEnablementStatus": err = unpopulate(val, "HotpatchEnablementStatus", &p.HotpatchEnablementStatus) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionDataModel. func (p PrivateEndpointConnectionDataModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionDataModel. func (p *PrivateEndpointConnectionDataModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "groupIds", p.GroupIDs) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "groupIds": err = unpopulate(val, "GroupIDs", &p.GroupIDs) delete(rawMsg, key) case "privateEndpoint": err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) case "privateLinkServiceConnectionState": err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "groupId", p.GroupID) populate(objectMap, "requiredMembers", p.RequiredMembers) populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "groupId": err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) case "requiredMembers": err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) delete(rawMsg, key) case "requiredZoneNames": err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkScope. func (p PrivateLinkScope) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "systemData", p.SystemData) populate(objectMap, "tags", p.Tags) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScope. func (p *PrivateLinkScope) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &p.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopeListResult. func (p PrivateLinkScopeListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopeListResult. func (p *PrivateLinkScopeListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopeProperties. func (p PrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) populate(objectMap, "privateLinkScopeId", p.PrivateLinkScopeID) populate(objectMap, "provisioningState", p.ProvisioningState) populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopeProperties. func (p *PrivateLinkScopeProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) delete(rawMsg, key) case "privateLinkScopeId": err = unpopulate(val, "PrivateLinkScopeID", &p.PrivateLinkScopeID) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopeValidationDetails. func (p PrivateLinkScopeValidationDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "connectionDetails", p.ConnectionDetails) populate(objectMap, "id", p.ID) populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopeValidationDetails. func (p *PrivateLinkScopeValidationDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "connectionDetails": err = unpopulate(val, "ConnectionDetails", &p.ConnectionDetails) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionsRequired", p.ActionsRequired) populate(objectMap, "description", p.Description) populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "actionsRequired": err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Processor. func (p Processor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", p.Name) populate(objectMap, "numberOfCores", p.NumberOfCores) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Processor. func (p *Processor) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "numberOfCores": err = unpopulate(val, "NumberOfCores", &p.NumberOfCores) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ProductFeature. func (p ProductFeature) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "billingEndDate", p.BillingEndDate) populateDateTimeRFC3339(objectMap, "billingStartDate", p.BillingStartDate) populateDateTimeRFC3339(objectMap, "disenrollmentDate", p.DisenrollmentDate) populateDateTimeRFC3339(objectMap, "enrollmentDate", p.EnrollmentDate) populate(objectMap, "error", p.Error) populate(objectMap, "name", p.Name) populate(objectMap, "subscriptionStatus", p.SubscriptionStatus) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ProductFeature. func (p *ProductFeature) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "billingEndDate": err = unpopulateDateTimeRFC3339(val, "BillingEndDate", &p.BillingEndDate) delete(rawMsg, key) case "billingStartDate": err = unpopulateDateTimeRFC3339(val, "BillingStartDate", &p.BillingStartDate) delete(rawMsg, key) case "disenrollmentDate": err = unpopulateDateTimeRFC3339(val, "DisenrollmentDate", &p.DisenrollmentDate) delete(rawMsg, key) case "enrollmentDate": err = unpopulateDateTimeRFC3339(val, "EnrollmentDate", &p.EnrollmentDate) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &p.Error) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "subscriptionStatus": err = unpopulate(val, "SubscriptionStatus", &p.SubscriptionStatus) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ProductFeatureUpdate. func (p ProductFeatureUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", p.Name) populate(objectMap, "subscriptionStatus", p.SubscriptionStatus) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ProductFeatureUpdate. func (p *ProductFeatureUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "subscriptionStatus": err = unpopulate(val, "SubscriptionStatus", &p.SubscriptionStatus) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ProductProfileUpdateProperties. func (p ProductProfileUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "productFeatures", p.ProductFeatures) populate(objectMap, "productType", p.ProductType) populate(objectMap, "subscriptionStatus", p.SubscriptionStatus) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ProductProfileUpdateProperties. func (p *ProductProfileUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "productFeatures": err = unpopulate(val, "ProductFeatures", &p.ProductFeatures) delete(rawMsg, key) case "productType": err = unpopulate(val, "ProductType", &p.ProductType) delete(rawMsg, key) case "subscriptionStatus": err = unpopulate(val, "SubscriptionStatus", &p.SubscriptionStatus) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ProvisioningIssue. func (p ProvisioningIssue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssue. func (p *ProvisioningIssue) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ProvisioningIssueProperties. func (p ProvisioningIssueProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", p.Description) populate(objectMap, "issueType", p.IssueType) populate(objectMap, "severity", p.Severity) populate(objectMap, "suggestedAccessRules", p.SuggestedAccessRules) populate(objectMap, "suggestedResourceIds", p.SuggestedResourceIDs) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssueProperties. func (p *ProvisioningIssueProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "description": err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) case "issueType": err = unpopulate(val, "IssueType", &p.IssueType) delete(rawMsg, key) case "severity": err = unpopulate(val, "Severity", &p.Severity) delete(rawMsg, key) case "suggestedAccessRules": err = unpopulate(val, "SuggestedAccessRules", &p.SuggestedAccessRules) delete(rawMsg, key) case "suggestedResourceIds": err = unpopulate(val, "SuggestedResourceIDs", &p.SuggestedResourceIDs) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ResourceAssociation. func (r ResourceAssociation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accessMode", r.AccessMode) populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAssociation. func (r *ResourceAssociation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "accessMode": err = unpopulate(val, "AccessMode", &r.AccessMode) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type RunCommandInputParameter. func (r RunCommandInputParameter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", r.Name) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandInputParameter. func (r *RunCommandInputParameter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type RunCommandManagedIdentity. func (r RunCommandManagedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "clientId", r.ClientID) populate(objectMap, "objectId", r.ObjectID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandManagedIdentity. func (r *RunCommandManagedIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "clientId": err = unpopulate(val, "ClientID", &r.ClientID) delete(rawMsg, key) case "objectId": err = unpopulate(val, "ObjectID", &r.ObjectID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServiceStatus. func (s ServiceStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "startupType", s.StartupType) populate(objectMap, "status", s.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServiceStatus. func (s *ServiceStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "startupType": err = unpopulate(val, "StartupType", &s.StartupType) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServiceStatuses. func (s ServiceStatuses) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "extensionService", s.ExtensionService) populate(objectMap, "guestConfigurationService", s.GuestConfigurationService) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServiceStatuses. func (s *ServiceStatuses) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "extensionService": err = unpopulate(val, "ExtensionService", &s.ExtensionService) delete(rawMsg, key) case "guestConfigurationService": err = unpopulate(val, "GuestConfigurationService", &s.GuestConfigurationService) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Settings. func (s Settings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Settings. func (s *Settings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type SettingsGatewayProperties. func (s SettingsGatewayProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "gatewayResourceId", s.GatewayResourceID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SettingsGatewayProperties. func (s *SettingsGatewayProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "gatewayResourceId": err = unpopulate(val, "GatewayResourceID", &s.GatewayResourceID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type SettingsProperties. func (s SettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "gatewayProperties", s.GatewayProperties) populate(objectMap, "tenantId", s.TenantID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SettingsProperties. func (s *SettingsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "gatewayProperties": err = unpopulate(val, "GatewayProperties", &s.GatewayProperties) delete(rawMsg, key) case "tenantId": err = unpopulate(val, "TenantID", &s.TenantID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type StorageProfile. func (s StorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "disks", s.Disks) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. func (s *StorageProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "disks": err = unpopulate(val, "Disks", &s.Disks) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type Subnet. func (s Subnet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "addressPrefix", s.AddressPrefix) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. func (s *Subnet) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "addressPrefix": err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "createdAt": err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) case "createdByType": err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) case "lastModifiedByType": err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type TagsResource. func (t TagsResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. func (t *TagsResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type VolumeLicenseDetails. func (v VolumeLicenseDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "invoiceId", v.InvoiceID) populate(objectMap, "programYear", v.ProgramYear) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VolumeLicenseDetails. func (v *VolumeLicenseDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { case "invoiceId": err = unpopulate(val, "InvoiceID", &v.InvoiceID) delete(rawMsg, key) case "programYear": err = unpopulate(val, "ProgramYear", &v.ProgramYear) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type WindowsParameters. func (w WindowsParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "classificationsToInclude", w.ClassificationsToInclude) populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) populateDateTimeRFC3339(objectMap, "maxPatchPublishDate", w.MaxPatchPublishDate) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type WindowsParameters. func (w *WindowsParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { case "classificationsToInclude": err = unpopulate(val, "ClassificationsToInclude", &w.ClassificationsToInclude) delete(rawMsg, key) case "excludeKbsRequiringReboot": err = unpopulate(val, "ExcludeKbsRequiringReboot", &w.ExcludeKbsRequiringReboot) delete(rawMsg, key) case "kbNumbersToExclude": err = unpopulate(val, "KbNumbersToExclude", &w.KbNumbersToExclude) delete(rawMsg, key) case "kbNumbersToInclude": err = unpopulate(val, "KbNumbersToInclude", &w.KbNumbersToInclude) delete(rawMsg, key) case "maxPatchPublishDate": err = unpopulateDateTimeRFC3339(val, "MaxPatchPublishDate", &w.MaxPatchPublishDate) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { m[k] = nil } else if !reflect.ValueOf(v).IsNil() { m[k] = v } } func populateAny(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { m[k] = nil } else { m[k] = v } } func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } return nil }