sdk/resourcemanager/batch/armbatch/models_serde.go (4,553 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 armbatch 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) populate(objectMap, "emailAddresses", a.EmailAddresses) populate(objectMap, "fullyQualifiedDomainNames", a.FullyQualifiedDomainNames) populate(objectMap, "networkSecurityPerimeters", a.NetworkSecurityPerimeters) populate(objectMap, "phoneNumbers", a.PhoneNumbers) populate(objectMap, "subscriptions", a.Subscriptions) 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) case "emailAddresses": err = unpopulate(val, "EmailAddresses", &a.EmailAddresses) delete(rawMsg, key) case "fullyQualifiedDomainNames": err = unpopulate(val, "FullyQualifiedDomainNames", &a.FullyQualifiedDomainNames) delete(rawMsg, key) case "networkSecurityPerimeters": err = unpopulate(val, "NetworkSecurityPerimeters", &a.NetworkSecurityPerimeters) delete(rawMsg, key) case "phoneNumbers": err = unpopulate(val, "PhoneNumbers", &a.PhoneNumbers) delete(rawMsg, key) case "subscriptions": err = unpopulate(val, "Subscriptions", &a.Subscriptions) 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 AccessRulePropertiesSubscriptionsItem. func (a AccessRulePropertiesSubscriptionsItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccessRulePropertiesSubscriptionsItem. func (a *AccessRulePropertiesSubscriptionsItem) 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 "id": err = unpopulate(val, "ID", &a.ID) 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 Account. func (a Account) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Account. func (a *Account) 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 "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "identity": err = unpopulate(val, "Identity", &a.Identity) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) 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 AccountCreateParameters. func (a AccountCreateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountCreateParameters. func (a *AccountCreateParameters) 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 "identity": err = unpopulate(val, "Identity", &a.Identity) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) 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 AccountCreateProperties. func (a AccountCreateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) populate(objectMap, "autoStorage", a.AutoStorage) populate(objectMap, "encryption", a.Encryption) populate(objectMap, "keyVaultReference", a.KeyVaultReference) populate(objectMap, "networkProfile", a.NetworkProfile) populate(objectMap, "poolAllocationMode", a.PoolAllocationMode) populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountCreateProperties. func (a *AccountCreateProperties) 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 "allowedAuthenticationModes": err = unpopulate(val, "AllowedAuthenticationModes", &a.AllowedAuthenticationModes) delete(rawMsg, key) case "autoStorage": err = unpopulate(val, "AutoStorage", &a.AutoStorage) delete(rawMsg, key) case "encryption": err = unpopulate(val, "Encryption", &a.Encryption) delete(rawMsg, key) case "keyVaultReference": err = unpopulate(val, "KeyVaultReference", &a.KeyVaultReference) delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &a.NetworkProfile) delete(rawMsg, key) case "poolAllocationMode": err = unpopulate(val, "PoolAllocationMode", &a.PoolAllocationMode) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) 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 AccountIdentity. func (a AccountIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", a.PrincipalID) populate(objectMap, "tenantId", a.TenantID) populate(objectMap, "type", a.Type) populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountIdentity. func (a *AccountIdentity) 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 "principalId": err = unpopulate(val, "PrincipalID", &a.PrincipalID) delete(rawMsg, key) case "tenantId": err = unpopulate(val, "TenantID", &a.TenantID) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) case "userAssignedIdentities": err = unpopulate(val, "UserAssignedIdentities", &a.UserAssignedIdentities) 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 AccountKeys. func (a AccountKeys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accountName", a.AccountName) populate(objectMap, "primary", a.Primary) populate(objectMap, "secondary", a.Secondary) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountKeys. func (a *AccountKeys) 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 "accountName": err = unpopulate(val, "AccountName", &a.AccountName) delete(rawMsg, key) case "primary": err = unpopulate(val, "Primary", &a.Primary) delete(rawMsg, key) case "secondary": err = unpopulate(val, "Secondary", &a.Secondary) 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 AccountListResult. func (a AccountListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountListResult. func (a *AccountListResult) 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 "nextLink": err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &a.Value) 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 AccountProperties. func (a AccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accountEndpoint", a.AccountEndpoint) populate(objectMap, "activeJobAndJobScheduleQuota", a.ActiveJobAndJobScheduleQuota) populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) populate(objectMap, "autoStorage", a.AutoStorage) populate(objectMap, "dedicatedCoreQuota", a.DedicatedCoreQuota) populate(objectMap, "dedicatedCoreQuotaPerVMFamily", a.DedicatedCoreQuotaPerVMFamily) populate(objectMap, "dedicatedCoreQuotaPerVMFamilyEnforced", a.DedicatedCoreQuotaPerVMFamilyEnforced) populate(objectMap, "encryption", a.Encryption) populate(objectMap, "keyVaultReference", a.KeyVaultReference) populate(objectMap, "lowPriorityCoreQuota", a.LowPriorityCoreQuota) populate(objectMap, "networkProfile", a.NetworkProfile) populate(objectMap, "nodeManagementEndpoint", a.NodeManagementEndpoint) populate(objectMap, "poolAllocationMode", a.PoolAllocationMode) populate(objectMap, "poolQuota", a.PoolQuota) populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountProperties. func (a *AccountProperties) 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 "accountEndpoint": err = unpopulate(val, "AccountEndpoint", &a.AccountEndpoint) delete(rawMsg, key) case "activeJobAndJobScheduleQuota": err = unpopulate(val, "ActiveJobAndJobScheduleQuota", &a.ActiveJobAndJobScheduleQuota) delete(rawMsg, key) case "allowedAuthenticationModes": err = unpopulate(val, "AllowedAuthenticationModes", &a.AllowedAuthenticationModes) delete(rawMsg, key) case "autoStorage": err = unpopulate(val, "AutoStorage", &a.AutoStorage) delete(rawMsg, key) case "dedicatedCoreQuota": err = unpopulate(val, "DedicatedCoreQuota", &a.DedicatedCoreQuota) delete(rawMsg, key) case "dedicatedCoreQuotaPerVMFamily": err = unpopulate(val, "DedicatedCoreQuotaPerVMFamily", &a.DedicatedCoreQuotaPerVMFamily) delete(rawMsg, key) case "dedicatedCoreQuotaPerVMFamilyEnforced": err = unpopulate(val, "DedicatedCoreQuotaPerVMFamilyEnforced", &a.DedicatedCoreQuotaPerVMFamilyEnforced) delete(rawMsg, key) case "encryption": err = unpopulate(val, "Encryption", &a.Encryption) delete(rawMsg, key) case "keyVaultReference": err = unpopulate(val, "KeyVaultReference", &a.KeyVaultReference) delete(rawMsg, key) case "lowPriorityCoreQuota": err = unpopulate(val, "LowPriorityCoreQuota", &a.LowPriorityCoreQuota) delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &a.NetworkProfile) delete(rawMsg, key) case "nodeManagementEndpoint": err = unpopulate(val, "NodeManagementEndpoint", &a.NodeManagementEndpoint) delete(rawMsg, key) case "poolAllocationMode": err = unpopulate(val, "PoolAllocationMode", &a.PoolAllocationMode) delete(rawMsg, key) case "poolQuota": err = unpopulate(val, "PoolQuota", &a.PoolQuota) delete(rawMsg, key) case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) 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 AccountRegenerateKeyParameters. func (a AccountRegenerateKeyParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "keyName", a.KeyName) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountRegenerateKeyParameters. func (a *AccountRegenerateKeyParameters) 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 "keyName": err = unpopulate(val, "KeyName", &a.KeyName) 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 AccountUpdateParameters. func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", a.Identity) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountUpdateParameters. func (a *AccountUpdateParameters) 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 "identity": err = unpopulate(val, "Identity", &a.Identity) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) 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 AccountUpdateProperties. func (a AccountUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationModes", a.AllowedAuthenticationModes) populate(objectMap, "autoStorage", a.AutoStorage) populate(objectMap, "encryption", a.Encryption) populate(objectMap, "networkProfile", a.NetworkProfile) populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AccountUpdateProperties. func (a *AccountUpdateProperties) 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 "allowedAuthenticationModes": err = unpopulate(val, "AllowedAuthenticationModes", &a.AllowedAuthenticationModes) delete(rawMsg, key) case "autoStorage": err = unpopulate(val, "AutoStorage", &a.AutoStorage) delete(rawMsg, key) case "encryption": err = unpopulate(val, "Encryption", &a.Encryption) delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &a.NetworkProfile) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &a.PublicNetworkAccess) 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 ActivateApplicationPackageParameters. func (a ActivateApplicationPackageParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "format", a.Format) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ActivateApplicationPackageParameters. func (a *ActivateApplicationPackageParameters) 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 "format": err = unpopulate(val, "Format", &a.Format) 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 Application. func (a Application) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", a.Etag) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Application. func (a *Application) 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 "etag": err = unpopulate(val, "Etag", &a.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) 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 ApplicationPackage. func (a ApplicationPackage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", a.Etag) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackage. func (a *ApplicationPackage) 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 "etag": err = unpopulate(val, "Etag", &a.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) 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 ApplicationPackageProperties. func (a ApplicationPackageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "format", a.Format) populateDateTimeRFC3339(objectMap, "lastActivationTime", a.LastActivationTime) populate(objectMap, "state", a.State) populate(objectMap, "storageUrl", a.StorageURL) populateDateTimeRFC3339(objectMap, "storageUrlExpiry", a.StorageURLExpiry) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackageProperties. func (a *ApplicationPackageProperties) 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 "format": err = unpopulate(val, "Format", &a.Format) delete(rawMsg, key) case "lastActivationTime": err = unpopulateDateTimeRFC3339(val, "LastActivationTime", &a.LastActivationTime) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &a.State) delete(rawMsg, key) case "storageUrl": err = unpopulate(val, "StorageURL", &a.StorageURL) delete(rawMsg, key) case "storageUrlExpiry": err = unpopulateDateTimeRFC3339(val, "StorageURLExpiry", &a.StorageURLExpiry) 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 ApplicationPackageReference. func (a ApplicationPackageReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "version", a.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationPackageReference. func (a *ApplicationPackageReference) 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 "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &a.Version) 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 ApplicationProperties. func (a ApplicationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowUpdates", a.AllowUpdates) populate(objectMap, "defaultVersion", a.DefaultVersion) populate(objectMap, "displayName", a.DisplayName) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProperties. func (a *ApplicationProperties) 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 "allowUpdates": err = unpopulate(val, "AllowUpdates", &a.AllowUpdates) delete(rawMsg, key) case "defaultVersion": err = unpopulate(val, "DefaultVersion", &a.DefaultVersion) delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &a.DisplayName) 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 AutoScaleRun. func (a AutoScaleRun) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", a.Error) populateDateTimeRFC3339(objectMap, "evaluationTime", a.EvaluationTime) populate(objectMap, "results", a.Results) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleRun. func (a *AutoScaleRun) 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 "error": err = unpopulate(val, "Error", &a.Error) delete(rawMsg, key) case "evaluationTime": err = unpopulateDateTimeRFC3339(val, "EvaluationTime", &a.EvaluationTime) delete(rawMsg, key) case "results": err = unpopulate(val, "Results", &a.Results) 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 AutoScaleRunError. func (a AutoScaleRunError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", a.Code) populate(objectMap, "details", a.Details) populate(objectMap, "message", a.Message) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleRunError. func (a *AutoScaleRunError) 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 "code": err = unpopulate(val, "Code", &a.Code) delete(rawMsg, key) case "details": err = unpopulate(val, "Details", &a.Details) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &a.Message) 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 AutoScaleSettings. func (a AutoScaleSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "evaluationInterval", a.EvaluationInterval) populate(objectMap, "formula", a.Formula) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleSettings. func (a *AutoScaleSettings) 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 "evaluationInterval": err = unpopulate(val, "EvaluationInterval", &a.EvaluationInterval) delete(rawMsg, key) case "formula": err = unpopulate(val, "Formula", &a.Formula) 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 AutoStorageBaseProperties. func (a AutoStorageBaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "authenticationMode", a.AuthenticationMode) populate(objectMap, "nodeIdentityReference", a.NodeIdentityReference) populate(objectMap, "storageAccountId", a.StorageAccountID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutoStorageBaseProperties. func (a *AutoStorageBaseProperties) 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 "authenticationMode": err = unpopulate(val, "AuthenticationMode", &a.AuthenticationMode) delete(rawMsg, key) case "nodeIdentityReference": err = unpopulate(val, "NodeIdentityReference", &a.NodeIdentityReference) delete(rawMsg, key) case "storageAccountId": err = unpopulate(val, "StorageAccountID", &a.StorageAccountID) 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 AutoStorageProperties. func (a AutoStorageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "authenticationMode", a.AuthenticationMode) populateDateTimeRFC3339(objectMap, "lastKeySync", a.LastKeySync) populate(objectMap, "nodeIdentityReference", a.NodeIdentityReference) populate(objectMap, "storageAccountId", a.StorageAccountID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutoStorageProperties. func (a *AutoStorageProperties) 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 "authenticationMode": err = unpopulate(val, "AuthenticationMode", &a.AuthenticationMode) delete(rawMsg, key) case "lastKeySync": err = unpopulateDateTimeRFC3339(val, "LastKeySync", &a.LastKeySync) delete(rawMsg, key) case "nodeIdentityReference": err = unpopulate(val, "NodeIdentityReference", &a.NodeIdentityReference) delete(rawMsg, key) case "storageAccountId": err = unpopulate(val, "StorageAccountID", &a.StorageAccountID) 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 AutoUserSpecification. func (a AutoUserSpecification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "elevationLevel", a.ElevationLevel) populate(objectMap, "scope", a.Scope) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutoUserSpecification. func (a *AutoUserSpecification) 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 "elevationLevel": err = unpopulate(val, "ElevationLevel", &a.ElevationLevel) delete(rawMsg, key) case "scope": err = unpopulate(val, "Scope", &a.Scope) 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 AutomaticOSUpgradePolicy. func (a AutomaticOSUpgradePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "disableAutomaticRollback", a.DisableAutomaticRollback) populate(objectMap, "enableAutomaticOSUpgrade", a.EnableAutomaticOSUpgrade) populate(objectMap, "osRollingUpgradeDeferral", a.OSRollingUpgradeDeferral) populate(objectMap, "useRollingUpgradePolicy", a.UseRollingUpgradePolicy) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AutomaticOSUpgradePolicy. func (a *AutomaticOSUpgradePolicy) 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 "disableAutomaticRollback": err = unpopulate(val, "DisableAutomaticRollback", &a.DisableAutomaticRollback) delete(rawMsg, key) case "enableAutomaticOSUpgrade": err = unpopulate(val, "EnableAutomaticOSUpgrade", &a.EnableAutomaticOSUpgrade) delete(rawMsg, key) case "osRollingUpgradeDeferral": err = unpopulate(val, "OSRollingUpgradeDeferral", &a.OSRollingUpgradeDeferral) delete(rawMsg, key) case "useRollingUpgradePolicy": err = unpopulate(val, "UseRollingUpgradePolicy", &a.UseRollingUpgradePolicy) 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 AzureBlobFileSystemConfiguration. func (a AzureBlobFileSystemConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accountKey", a.AccountKey) populate(objectMap, "accountName", a.AccountName) populate(objectMap, "blobfuseOptions", a.BlobfuseOptions) populate(objectMap, "containerName", a.ContainerName) populate(objectMap, "identityReference", a.IdentityReference) populate(objectMap, "relativeMountPath", a.RelativeMountPath) populate(objectMap, "sasKey", a.SasKey) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AzureBlobFileSystemConfiguration. func (a *AzureBlobFileSystemConfiguration) 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 "accountKey": err = unpopulate(val, "AccountKey", &a.AccountKey) delete(rawMsg, key) case "accountName": err = unpopulate(val, "AccountName", &a.AccountName) delete(rawMsg, key) case "blobfuseOptions": err = unpopulate(val, "BlobfuseOptions", &a.BlobfuseOptions) delete(rawMsg, key) case "containerName": err = unpopulate(val, "ContainerName", &a.ContainerName) delete(rawMsg, key) case "identityReference": err = unpopulate(val, "IdentityReference", &a.IdentityReference) delete(rawMsg, key) case "relativeMountPath": err = unpopulate(val, "RelativeMountPath", &a.RelativeMountPath) delete(rawMsg, key) case "sasKey": err = unpopulate(val, "SasKey", &a.SasKey) 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 AzureFileShareConfiguration. func (a AzureFileShareConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accountKey", a.AccountKey) populate(objectMap, "accountName", a.AccountName) populate(objectMap, "azureFileUrl", a.AzureFileURL) populate(objectMap, "mountOptions", a.MountOptions) populate(objectMap, "relativeMountPath", a.RelativeMountPath) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileShareConfiguration. func (a *AzureFileShareConfiguration) 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 "accountKey": err = unpopulate(val, "AccountKey", &a.AccountKey) delete(rawMsg, key) case "accountName": err = unpopulate(val, "AccountName", &a.AccountName) delete(rawMsg, key) case "azureFileUrl": err = unpopulate(val, "AzureFileURL", &a.AzureFileURL) delete(rawMsg, key) case "mountOptions": err = unpopulate(val, "MountOptions", &a.MountOptions) delete(rawMsg, key) case "relativeMountPath": err = unpopulate(val, "RelativeMountPath", &a.RelativeMountPath) 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 AzureProxyResource. func (a AzureProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", a.Etag) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AzureProxyResource. func (a *AzureProxyResource) 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 "etag": err = unpopulate(val, "Etag", &a.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) 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 AzureResource. func (a AzureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. func (a *AzureResource) 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 "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) 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 CIFSMountConfiguration. func (c CIFSMountConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "mountOptions", c.MountOptions) populate(objectMap, "password", c.Password) populate(objectMap, "relativeMountPath", c.RelativeMountPath) populate(objectMap, "source", c.Source) populate(objectMap, "userName", c.Username) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CIFSMountConfiguration. func (c *CIFSMountConfiguration) 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 "mountOptions": err = unpopulate(val, "MountOptions", &c.MountOptions) delete(rawMsg, key) case "password": err = unpopulate(val, "Password", &c.Password) delete(rawMsg, key) case "relativeMountPath": err = unpopulate(val, "RelativeMountPath", &c.RelativeMountPath) delete(rawMsg, key) case "source": err = unpopulate(val, "Source", &c.Source) delete(rawMsg, key) case "userName": err = unpopulate(val, "Username", &c.Username) 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 Certificate. func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", c.Etag) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. func (c *Certificate) 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 "etag": err = unpopulate(val, "Etag", &c.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &c.Tags) 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 CertificateBaseProperties. func (c CertificateBaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "format", c.Format) populate(objectMap, "thumbprint", c.Thumbprint) populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CertificateBaseProperties. func (c *CertificateBaseProperties) 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 "format": err = unpopulate(val, "Format", &c.Format) delete(rawMsg, key) case "thumbprint": err = unpopulate(val, "Thumbprint", &c.Thumbprint) delete(rawMsg, key) case "thumbprintAlgorithm": err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) 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 CertificateCreateOrUpdateParameters. func (c CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", c.Etag) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateParameters. func (c *CertificateCreateOrUpdateParameters) 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 "etag": err = unpopulate(val, "Etag", &c.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &c.Tags) 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 CertificateCreateOrUpdateProperties. func (c CertificateCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "data", c.Data) populate(objectMap, "format", c.Format) populate(objectMap, "password", c.Password) populate(objectMap, "thumbprint", c.Thumbprint) populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CertificateCreateOrUpdateProperties. func (c *CertificateCreateOrUpdateProperties) 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 "data": err = unpopulate(val, "Data", &c.Data) delete(rawMsg, key) case "format": err = unpopulate(val, "Format", &c.Format) delete(rawMsg, key) case "password": err = unpopulate(val, "Password", &c.Password) delete(rawMsg, key) case "thumbprint": err = unpopulate(val, "Thumbprint", &c.Thumbprint) delete(rawMsg, key) case "thumbprintAlgorithm": err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) 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 CertificateProperties. func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "deleteCertificateError", c.DeleteCertificateError) populate(objectMap, "format", c.Format) populate(objectMap, "previousProvisioningState", c.PreviousProvisioningState) populateDateTimeRFC3339(objectMap, "previousProvisioningStateTransitionTime", c.PreviousProvisioningStateTransitionTime) populate(objectMap, "provisioningState", c.ProvisioningState) populateDateTimeRFC3339(objectMap, "provisioningStateTransitionTime", c.ProvisioningStateTransitionTime) populate(objectMap, "publicData", c.PublicData) populate(objectMap, "thumbprint", c.Thumbprint) populate(objectMap, "thumbprintAlgorithm", c.ThumbprintAlgorithm) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. func (c *CertificateProperties) 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 "deleteCertificateError": err = unpopulate(val, "DeleteCertificateError", &c.DeleteCertificateError) delete(rawMsg, key) case "format": err = unpopulate(val, "Format", &c.Format) delete(rawMsg, key) case "previousProvisioningState": err = unpopulate(val, "PreviousProvisioningState", &c.PreviousProvisioningState) delete(rawMsg, key) case "previousProvisioningStateTransitionTime": err = unpopulateDateTimeRFC3339(val, "PreviousProvisioningStateTransitionTime", &c.PreviousProvisioningStateTransitionTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) case "provisioningStateTransitionTime": err = unpopulateDateTimeRFC3339(val, "ProvisioningStateTransitionTime", &c.ProvisioningStateTransitionTime) delete(rawMsg, key) case "publicData": err = unpopulate(val, "PublicData", &c.PublicData) delete(rawMsg, key) case "thumbprint": err = unpopulate(val, "Thumbprint", &c.Thumbprint) delete(rawMsg, key) case "thumbprintAlgorithm": err = unpopulate(val, "ThumbprintAlgorithm", &c.ThumbprintAlgorithm) 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 CertificateReference. func (c CertificateReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "storeLocation", c.StoreLocation) populate(objectMap, "storeName", c.StoreName) populate(objectMap, "visibility", c.Visibility) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CertificateReference. func (c *CertificateReference) 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 "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) case "storeLocation": err = unpopulate(val, "StoreLocation", &c.StoreLocation) delete(rawMsg, key) case "storeName": err = unpopulate(val, "StoreName", &c.StoreName) delete(rawMsg, key) case "visibility": err = unpopulate(val, "Visibility", &c.Visibility) 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 CheckNameAvailabilityParameters. func (c CheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", c.Name) objectMap["type"] = "Microsoft.Batch/batchAccounts" return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityParameters. func (c *CheckNameAvailabilityParameters) 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 "name": err = unpopulate(val, "Name", &c.Name) 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 CheckNameAvailabilityResult. func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "message", c.Message) populate(objectMap, "nameAvailable", c.NameAvailable) populate(objectMap, "reason", c.Reason) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. func (c *CheckNameAvailabilityResult) 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 "message": err = unpopulate(val, "Message", &c.Message) delete(rawMsg, key) case "nameAvailable": err = unpopulate(val, "NameAvailable", &c.NameAvailable) delete(rawMsg, key) case "reason": err = unpopulate(val, "Reason", &c.Reason) 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 ComputeNodeIdentityReference. func (c ComputeNodeIdentityReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceId", c.ResourceID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ComputeNodeIdentityReference. func (c *ComputeNodeIdentityReference) 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 "resourceId": err = unpopulate(val, "ResourceID", &c.ResourceID) 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 ContainerConfiguration. func (c ContainerConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "containerImageNames", c.ContainerImageNames) populate(objectMap, "containerRegistries", c.ContainerRegistries) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ContainerConfiguration. func (c *ContainerConfiguration) 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 "containerImageNames": err = unpopulate(val, "ContainerImageNames", &c.ContainerImageNames) delete(rawMsg, key) case "containerRegistries": err = unpopulate(val, "ContainerRegistries", &c.ContainerRegistries) 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 ContainerHostBatchBindMountEntry. func (c ContainerHostBatchBindMountEntry) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "isReadOnly", c.IsReadOnly) populate(objectMap, "source", c.Source) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ContainerHostBatchBindMountEntry. func (c *ContainerHostBatchBindMountEntry) 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 "isReadOnly": err = unpopulate(val, "IsReadOnly", &c.IsReadOnly) delete(rawMsg, key) case "source": err = unpopulate(val, "Source", &c.Source) 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 ContainerRegistry. func (c ContainerRegistry) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identityReference", c.IdentityReference) populate(objectMap, "password", c.Password) populate(objectMap, "registryServer", c.RegistryServer) populate(objectMap, "username", c.UserName) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistry. func (c *ContainerRegistry) 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 "identityReference": err = unpopulate(val, "IdentityReference", &c.IdentityReference) delete(rawMsg, key) case "password": err = unpopulate(val, "Password", &c.Password) delete(rawMsg, key) case "registryServer": err = unpopulate(val, "RegistryServer", &c.RegistryServer) delete(rawMsg, key) case "username": err = unpopulate(val, "UserName", &c.UserName) 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 DataDisk. func (d DataDisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "caching", d.Caching) populate(objectMap, "diskSizeGB", d.DiskSizeGB) populate(objectMap, "lun", d.Lun) populate(objectMap, "storageAccountType", d.StorageAccountType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DataDisk. func (d *DataDisk) 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 "caching": err = unpopulate(val, "Caching", &d.Caching) delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &d.DiskSizeGB) delete(rawMsg, key) case "lun": err = unpopulate(val, "Lun", &d.Lun) delete(rawMsg, key) case "storageAccountType": err = unpopulate(val, "StorageAccountType", &d.StorageAccountType) 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 DeleteCertificateError. func (d DeleteCertificateError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", d.Code) populate(objectMap, "details", d.Details) populate(objectMap, "message", d.Message) populate(objectMap, "target", d.Target) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DeleteCertificateError. func (d *DeleteCertificateError) 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 "code": err = unpopulate(val, "Code", &d.Code) delete(rawMsg, key) case "details": err = unpopulate(val, "Details", &d.Details) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &d.Message) delete(rawMsg, key) case "target": err = unpopulate(val, "Target", &d.Target) 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 DeploymentConfiguration. func (d DeploymentConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "virtualMachineConfiguration", d.VirtualMachineConfiguration) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentConfiguration. func (d *DeploymentConfiguration) 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 "virtualMachineConfiguration": err = unpopulate(val, "VirtualMachineConfiguration", &d.VirtualMachineConfiguration) 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 DetectorListResult. func (d DetectorListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DetectorListResult. func (d *DetectorListResult) 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 "nextLink": err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &d.Value) 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 DetectorResponse. func (d DetectorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", d.Etag) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) populate(objectMap, "tags", d.Tags) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DetectorResponse. func (d *DetectorResponse) 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 "etag": err = unpopulate(val, "Etag", &d.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) 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 DetectorResponseProperties. func (d DetectorResponseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DetectorResponseProperties. func (d *DetectorResponseProperties) 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 "value": err = unpopulate(val, "Value", &d.Value) 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 DiffDiskSettings. func (d DiffDiskSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["placement"] = "CacheDisk" return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DiffDiskSettings. func (d *DiffDiskSettings) 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 "placement": err = unpopulate(val, "Placement", &d.Placement) 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 DiskEncryptionConfiguration. func (d DiskEncryptionConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "targets", d.Targets) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DiskEncryptionConfiguration. func (d *DiskEncryptionConfiguration) 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 "targets": err = unpopulate(val, "Targets", &d.Targets) 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 EncryptionProperties. func (e EncryptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "keySource", e.KeySource) populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperties. func (e *EncryptionProperties) 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 "keySource": err = unpopulate(val, "KeySource", &e.KeySource) delete(rawMsg, key) case "keyVaultProperties": err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) 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 EndpointAccessProfile. func (e EndpointAccessProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "defaultAction", e.DefaultAction) populate(objectMap, "ipRules", e.IPRules) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EndpointAccessProfile. func (e *EndpointAccessProfile) 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 "defaultAction": err = unpopulate(val, "DefaultAction", &e.DefaultAction) delete(rawMsg, key) case "ipRules": err = unpopulate(val, "IPRules", &e.IPRules) 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 EndpointDependency. func (e EndpointDependency) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", e.Description) populate(objectMap, "domainName", e.DomainName) populate(objectMap, "endpointDetails", e.EndpointDetails) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. func (e *EndpointDependency) 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 "description": err = unpopulate(val, "Description", &e.Description) delete(rawMsg, key) case "domainName": err = unpopulate(val, "DomainName", &e.DomainName) delete(rawMsg, key) case "endpointDetails": err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) 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 EndpointDetail. func (e EndpointDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "port", e.Port) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. func (e *EndpointDetail) 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 "port": err = unpopulate(val, "Port", &e.Port) 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 EnvironmentSetting. func (e EnvironmentSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", e.Name) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentSetting. func (e *EnvironmentSetting) 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 "name": err = unpopulate(val, "Name", &e.Name) delete(rawMsg, 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 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 ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. func (e *ErrorResponse) 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 "error": err = unpopulate(val, "Error", &e.Error) 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 FixedScaleSettings. func (f FixedScaleSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nodeDeallocationOption", f.NodeDeallocationOption) populate(objectMap, "resizeTimeout", f.ResizeTimeout) populate(objectMap, "targetDedicatedNodes", f.TargetDedicatedNodes) populate(objectMap, "targetLowPriorityNodes", f.TargetLowPriorityNodes) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type FixedScaleSettings. func (f *FixedScaleSettings) 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 "nodeDeallocationOption": err = unpopulate(val, "NodeDeallocationOption", &f.NodeDeallocationOption) delete(rawMsg, key) case "resizeTimeout": err = unpopulate(val, "ResizeTimeout", &f.ResizeTimeout) delete(rawMsg, key) case "targetDedicatedNodes": err = unpopulate(val, "TargetDedicatedNodes", &f.TargetDedicatedNodes) delete(rawMsg, key) case "targetLowPriorityNodes": err = unpopulate(val, "TargetLowPriorityNodes", &f.TargetLowPriorityNodes) 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 IPRule. func (i IPRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["action"] = "Allow" populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. func (i *IPRule) 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 "action": err = unpopulate(val, "Action", &i.Action) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &i.Value) 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 ImageReference. func (i ImageReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "communityGalleryImageId", i.CommunityGalleryImageID) populate(objectMap, "id", i.ID) populate(objectMap, "offer", i.Offer) populate(objectMap, "publisher", i.Publisher) populate(objectMap, "sku", i.SKU) populate(objectMap, "sharedGalleryImageId", i.SharedGalleryImageID) populate(objectMap, "version", i.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference. func (i *ImageReference) 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 "communityGalleryImageId": err = unpopulate(val, "CommunityGalleryImageID", &i.CommunityGalleryImageID) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) case "offer": err = unpopulate(val, "Offer", &i.Offer) delete(rawMsg, key) case "publisher": err = unpopulate(val, "Publisher", &i.Publisher) delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &i.SKU) delete(rawMsg, key) case "sharedGalleryImageId": err = unpopulate(val, "SharedGalleryImageID", &i.SharedGalleryImageID) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &i.Version) 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 InboundNatPool. func (i InboundNatPool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "backendPort", i.BackendPort) populate(objectMap, "frontendPortRangeEnd", i.FrontendPortRangeEnd) populate(objectMap, "frontendPortRangeStart", i.FrontendPortRangeStart) populate(objectMap, "name", i.Name) populate(objectMap, "networkSecurityGroupRules", i.NetworkSecurityGroupRules) populate(objectMap, "protocol", i.Protocol) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type InboundNatPool. func (i *InboundNatPool) 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 "backendPort": err = unpopulate(val, "BackendPort", &i.BackendPort) delete(rawMsg, key) case "frontendPortRangeEnd": err = unpopulate(val, "FrontendPortRangeEnd", &i.FrontendPortRangeEnd) delete(rawMsg, key) case "frontendPortRangeStart": err = unpopulate(val, "FrontendPortRangeStart", &i.FrontendPortRangeStart) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) case "networkSecurityGroupRules": err = unpopulate(val, "NetworkSecurityGroupRules", &i.NetworkSecurityGroupRules) delete(rawMsg, key) case "protocol": err = unpopulate(val, "Protocol", &i.Protocol) 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 KeyVaultProperties. func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "keyIdentifier", k.KeyIdentifier) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. func (k *KeyVaultProperties) 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", k, err) } for key, val := range rawMsg { var err error switch key { case "keyIdentifier": err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type KeyVaultReference. func (k KeyVaultReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", k.ID) populate(objectMap, "url", k.URL) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultReference. func (k *KeyVaultReference) 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", k, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &k.ID) delete(rawMsg, key) case "url": err = unpopulate(val, "URL", &k.URL) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LinuxUserConfiguration. func (l LinuxUserConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "gid", l.Gid) populate(objectMap, "sshPrivateKey", l.SSHPrivateKey) populate(objectMap, "uid", l.UID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LinuxUserConfiguration. func (l *LinuxUserConfiguration) 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 "gid": err = unpopulate(val, "Gid", &l.Gid) delete(rawMsg, key) case "sshPrivateKey": err = unpopulate(val, "SSHPrivateKey", &l.SSHPrivateKey) delete(rawMsg, key) case "uid": err = unpopulate(val, "UID", &l.UID) 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 ListApplicationPackagesResult. func (l ListApplicationPackagesResult) 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 ListApplicationPackagesResult. func (l *ListApplicationPackagesResult) 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 ListApplicationsResult. func (l ListApplicationsResult) 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 ListApplicationsResult. func (l *ListApplicationsResult) 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 ListCertificatesResult. func (l ListCertificatesResult) 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 ListCertificatesResult. func (l *ListCertificatesResult) 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 ListPoolsResult. func (l ListPoolsResult) 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 ListPoolsResult. func (l *ListPoolsResult) 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 ListPrivateEndpointConnectionsResult. func (l ListPrivateEndpointConnectionsResult) 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 ListPrivateEndpointConnectionsResult. func (l *ListPrivateEndpointConnectionsResult) 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 ListPrivateLinkResourcesResult. func (l ListPrivateLinkResourcesResult) 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 ListPrivateLinkResourcesResult. func (l *ListPrivateLinkResourcesResult) 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 LocationQuota. func (l LocationQuota) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accountQuota", l.AccountQuota) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LocationQuota. func (l *LocationQuota) 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 "accountQuota": err = unpopulate(val, "AccountQuota", &l.AccountQuota) 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 ManagedDisk. func (m ManagedDisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "securityProfile", m.SecurityProfile) populate(objectMap, "storageAccountType", m.StorageAccountType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDisk. func (m *ManagedDisk) 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 "securityProfile": err = unpopulate(val, "SecurityProfile", &m.SecurityProfile) delete(rawMsg, key) case "storageAccountType": err = unpopulate(val, "StorageAccountType", &m.StorageAccountType) 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 MetadataItem. func (m MetadataItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", m.Name) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MetadataItem. func (m *MetadataItem) 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 "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 MountConfiguration. func (m MountConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "azureBlobFileSystemConfiguration", m.AzureBlobFileSystemConfiguration) populate(objectMap, "azureFileShareConfiguration", m.AzureFileShareConfiguration) populate(objectMap, "cifsMountConfiguration", m.CifsMountConfiguration) populate(objectMap, "nfsMountConfiguration", m.NfsMountConfiguration) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type MountConfiguration. func (m *MountConfiguration) 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 "azureBlobFileSystemConfiguration": err = unpopulate(val, "AzureBlobFileSystemConfiguration", &m.AzureBlobFileSystemConfiguration) delete(rawMsg, key) case "azureFileShareConfiguration": err = unpopulate(val, "AzureFileShareConfiguration", &m.AzureFileShareConfiguration) delete(rawMsg, key) case "cifsMountConfiguration": err = unpopulate(val, "CifsMountConfiguration", &m.CifsMountConfiguration) delete(rawMsg, key) case "nfsMountConfiguration": err = unpopulate(val, "NfsMountConfiguration", &m.NfsMountConfiguration) 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 NFSMountConfiguration. func (n NFSMountConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "mountOptions", n.MountOptions) populate(objectMap, "relativeMountPath", n.RelativeMountPath) populate(objectMap, "source", n.Source) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NFSMountConfiguration. func (n *NFSMountConfiguration) 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 "mountOptions": err = unpopulate(val, "MountOptions", &n.MountOptions) delete(rawMsg, key) case "relativeMountPath": err = unpopulate(val, "RelativeMountPath", &n.RelativeMountPath) delete(rawMsg, key) case "source": err = unpopulate(val, "Source", &n.Source) 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 NetworkConfiguration. func (n NetworkConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "dynamicVnetAssignmentScope", n.DynamicVNetAssignmentScope) populate(objectMap, "enableAcceleratedNetworking", n.EnableAcceleratedNetworking) populate(objectMap, "endpointConfiguration", n.EndpointConfiguration) populate(objectMap, "publicIPAddressConfiguration", n.PublicIPAddressConfiguration) populate(objectMap, "subnetId", n.SubnetID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConfiguration. func (n *NetworkConfiguration) 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 "dynamicVnetAssignmentScope": err = unpopulate(val, "DynamicVNetAssignmentScope", &n.DynamicVNetAssignmentScope) delete(rawMsg, key) case "enableAcceleratedNetworking": err = unpopulate(val, "EnableAcceleratedNetworking", &n.EnableAcceleratedNetworking) delete(rawMsg, key) case "endpointConfiguration": err = unpopulate(val, "EndpointConfiguration", &n.EndpointConfiguration) delete(rawMsg, key) case "publicIPAddressConfiguration": err = unpopulate(val, "PublicIPAddressConfiguration", &n.PublicIPAddressConfiguration) delete(rawMsg, key) case "subnetId": err = unpopulate(val, "SubnetID", &n.SubnetID) 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, "accountAccess", n.AccountAccess) populate(objectMap, "nodeManagementAccess", n.NodeManagementAccess) 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 "accountAccess": err = unpopulate(val, "AccountAccess", &n.AccountAccess) delete(rawMsg, key) case "nodeManagementAccess": err = unpopulate(val, "NodeManagementAccess", &n.NodeManagementAccess) 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 NetworkSecurityGroupRule. func (n NetworkSecurityGroupRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "access", n.Access) populate(objectMap, "priority", n.Priority) populate(objectMap, "sourceAddressPrefix", n.SourceAddressPrefix) populate(objectMap, "sourcePortRanges", n.SourcePortRanges) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityGroupRule. func (n *NetworkSecurityGroupRule) 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 "access": err = unpopulate(val, "Access", &n.Access) delete(rawMsg, key) case "priority": err = unpopulate(val, "Priority", &n.Priority) delete(rawMsg, key) case "sourceAddressPrefix": err = unpopulate(val, "SourceAddressPrefix", &n.SourceAddressPrefix) delete(rawMsg, key) case "sourcePortRanges": err = unpopulate(val, "SourcePortRanges", &n.SourcePortRanges) 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, "systemData", n.SystemData) 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 "systemData": err = unpopulate(val, "SystemData", &n.SystemData) 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 NetworkSecurityProfile. func (n NetworkSecurityProfile) 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 NetworkSecurityProfile. func (n *NetworkSecurityProfile) 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 NodePlacementConfiguration. func (n NodePlacementConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "policy", n.Policy) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NodePlacementConfiguration. func (n *NodePlacementConfiguration) 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 "policy": err = unpopulate(val, "Policy", &n.Policy) 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 OSDisk. func (o OSDisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "caching", o.Caching) populate(objectMap, "diskSizeGB", o.DiskSizeGB) populate(objectMap, "ephemeralOSDiskSettings", o.EphemeralOSDiskSettings) populate(objectMap, "managedDisk", o.ManagedDisk) populate(objectMap, "writeAcceleratorEnabled", o.WriteAcceleratorEnabled) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OSDisk. func (o *OSDisk) 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 "caching": err = unpopulate(val, "Caching", &o.Caching) delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &o.DiskSizeGB) delete(rawMsg, key) case "ephemeralOSDiskSettings": err = unpopulate(val, "EphemeralOSDiskSettings", &o.EphemeralOSDiskSettings) delete(rawMsg, key) case "managedDisk": err = unpopulate(val, "ManagedDisk", &o.ManagedDisk) delete(rawMsg, key) case "writeAcceleratorEnabled": err = unpopulate(val, "WriteAcceleratorEnabled", &o.WriteAcceleratorEnabled) 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 Operation. func (o Operation) 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) populateAny(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Operation. func (o *Operation) 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) case "properties": err = unpopulate(val, "Properties", &o.Properties) 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 OperationDisplay. func (o OperationDisplay) 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 OperationDisplay. func (o *OperationDisplay) 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 OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) 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 "nextLink": err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, 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 OutboundEnvironmentEndpoint. func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "category", o.Category) populate(objectMap, "endpoints", o.Endpoints) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. func (o *OutboundEnvironmentEndpoint) 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 "category": err = unpopulate(val, "Category", &o.Category) delete(rawMsg, key) case "endpoints": err = unpopulate(val, "Endpoints", &o.Endpoints) 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 OutboundEnvironmentEndpointCollection. func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. func (o *OutboundEnvironmentEndpointCollection) 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 "nextLink": err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, 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 Pool. func (p Pool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", p.Etag) populate(objectMap, "id", p.ID) populate(objectMap, "identity", p.Identity) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Pool. func (p *Pool) 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 "etag": err = unpopulate(val, "Etag", &p.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "identity": err = unpopulate(val, "Identity", &p.Identity) 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 "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 PoolEndpointConfiguration. func (p PoolEndpointConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "inboundNatPools", p.InboundNatPools) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PoolEndpointConfiguration. func (p *PoolEndpointConfiguration) 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 "inboundNatPools": err = unpopulate(val, "InboundNatPools", &p.InboundNatPools) 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 PoolIdentity. func (p PoolIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "type", p.Type) populate(objectMap, "userAssignedIdentities", p.UserAssignedIdentities) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PoolIdentity. func (p *PoolIdentity) 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 "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) case "userAssignedIdentities": err = unpopulate(val, "UserAssignedIdentities", &p.UserAssignedIdentities) 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 PoolProperties. func (p PoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allocationState", p.AllocationState) populateDateTimeRFC3339(objectMap, "allocationStateTransitionTime", p.AllocationStateTransitionTime) populate(objectMap, "applicationLicenses", p.ApplicationLicenses) populate(objectMap, "applicationPackages", p.ApplicationPackages) populate(objectMap, "autoScaleRun", p.AutoScaleRun) populate(objectMap, "certificates", p.Certificates) populateDateTimeRFC3339(objectMap, "creationTime", p.CreationTime) populate(objectMap, "currentDedicatedNodes", p.CurrentDedicatedNodes) populate(objectMap, "currentLowPriorityNodes", p.CurrentLowPriorityNodes) populate(objectMap, "currentNodeCommunicationMode", p.CurrentNodeCommunicationMode) populate(objectMap, "deploymentConfiguration", p.DeploymentConfiguration) populate(objectMap, "displayName", p.DisplayName) populate(objectMap, "interNodeCommunication", p.InterNodeCommunication) populateDateTimeRFC3339(objectMap, "lastModified", p.LastModified) populate(objectMap, "metadata", p.Metadata) populate(objectMap, "mountConfiguration", p.MountConfiguration) populate(objectMap, "networkConfiguration", p.NetworkConfiguration) populate(objectMap, "provisioningState", p.ProvisioningState) populateDateTimeRFC3339(objectMap, "provisioningStateTransitionTime", p.ProvisioningStateTransitionTime) populate(objectMap, "resizeOperationStatus", p.ResizeOperationStatus) populate(objectMap, "resourceTags", p.ResourceTags) populate(objectMap, "scaleSettings", p.ScaleSettings) populate(objectMap, "startTask", p.StartTask) populate(objectMap, "targetNodeCommunicationMode", p.TargetNodeCommunicationMode) populate(objectMap, "taskSchedulingPolicy", p.TaskSchedulingPolicy) populate(objectMap, "taskSlotsPerNode", p.TaskSlotsPerNode) populate(objectMap, "upgradePolicy", p.UpgradePolicy) populate(objectMap, "userAccounts", p.UserAccounts) populate(objectMap, "vmSize", p.VMSize) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PoolProperties. func (p *PoolProperties) 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 "allocationState": err = unpopulate(val, "AllocationState", &p.AllocationState) delete(rawMsg, key) case "allocationStateTransitionTime": err = unpopulateDateTimeRFC3339(val, "AllocationStateTransitionTime", &p.AllocationStateTransitionTime) delete(rawMsg, key) case "applicationLicenses": err = unpopulate(val, "ApplicationLicenses", &p.ApplicationLicenses) delete(rawMsg, key) case "applicationPackages": err = unpopulate(val, "ApplicationPackages", &p.ApplicationPackages) delete(rawMsg, key) case "autoScaleRun": err = unpopulate(val, "AutoScaleRun", &p.AutoScaleRun) delete(rawMsg, key) case "certificates": err = unpopulate(val, "Certificates", &p.Certificates) delete(rawMsg, key) case "creationTime": err = unpopulateDateTimeRFC3339(val, "CreationTime", &p.CreationTime) delete(rawMsg, key) case "currentDedicatedNodes": err = unpopulate(val, "CurrentDedicatedNodes", &p.CurrentDedicatedNodes) delete(rawMsg, key) case "currentLowPriorityNodes": err = unpopulate(val, "CurrentLowPriorityNodes", &p.CurrentLowPriorityNodes) delete(rawMsg, key) case "currentNodeCommunicationMode": err = unpopulate(val, "CurrentNodeCommunicationMode", &p.CurrentNodeCommunicationMode) delete(rawMsg, key) case "deploymentConfiguration": err = unpopulate(val, "DeploymentConfiguration", &p.DeploymentConfiguration) delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) case "interNodeCommunication": err = unpopulate(val, "InterNodeCommunication", &p.InterNodeCommunication) delete(rawMsg, key) case "lastModified": err = unpopulateDateTimeRFC3339(val, "LastModified", &p.LastModified) delete(rawMsg, key) case "metadata": err = unpopulate(val, "Metadata", &p.Metadata) delete(rawMsg, key) case "mountConfiguration": err = unpopulate(val, "MountConfiguration", &p.MountConfiguration) delete(rawMsg, key) case "networkConfiguration": err = unpopulate(val, "NetworkConfiguration", &p.NetworkConfiguration) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) case "provisioningStateTransitionTime": err = unpopulateDateTimeRFC3339(val, "ProvisioningStateTransitionTime", &p.ProvisioningStateTransitionTime) delete(rawMsg, key) case "resizeOperationStatus": err = unpopulate(val, "ResizeOperationStatus", &p.ResizeOperationStatus) delete(rawMsg, key) case "resourceTags": err = unpopulate(val, "ResourceTags", &p.ResourceTags) delete(rawMsg, key) case "scaleSettings": err = unpopulate(val, "ScaleSettings", &p.ScaleSettings) delete(rawMsg, key) case "startTask": err = unpopulate(val, "StartTask", &p.StartTask) delete(rawMsg, key) case "targetNodeCommunicationMode": err = unpopulate(val, "TargetNodeCommunicationMode", &p.TargetNodeCommunicationMode) delete(rawMsg, key) case "taskSchedulingPolicy": err = unpopulate(val, "TaskSchedulingPolicy", &p.TaskSchedulingPolicy) delete(rawMsg, key) case "taskSlotsPerNode": err = unpopulate(val, "TaskSlotsPerNode", &p.TaskSlotsPerNode) delete(rawMsg, key) case "upgradePolicy": err = unpopulate(val, "UpgradePolicy", &p.UpgradePolicy) delete(rawMsg, key) case "userAccounts": err = unpopulate(val, "UserAccounts", &p.UserAccounts) delete(rawMsg, key) case "vmSize": err = unpopulate(val, "VMSize", &p.VMSize) 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 PrivateEndpoint. func (p PrivateEndpoint) 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 PrivateEndpoint. func (p *PrivateEndpoint) 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 PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", p.Etag) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) 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 "etag": err = unpopulate(val, "Etag", &p.Etag) delete(rawMsg, 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 "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 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 PrivateLinkResource. func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", p.Etag) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) 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 "etag": err = unpopulate(val, "Etag", &p.Etag) delete(rawMsg, 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 "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 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 PrivateLinkServiceConnectionState. func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionsRequired", p.ActionRequired) populate(objectMap, "description", p.Description) populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. func (p *PrivateLinkServiceConnectionState) 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, "ActionRequired", &p.ActionRequired) 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 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 ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. func (p *ProxyResource) 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 "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 PublicIPAddressConfiguration. func (p PublicIPAddressConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "ipAddressIds", p.IPAddressIDs) populate(objectMap, "provision", p.Provision) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressConfiguration. func (p *PublicIPAddressConfiguration) 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 "ipAddressIds": err = unpopulate(val, "IPAddressIDs", &p.IPAddressIDs) delete(rawMsg, key) case "provision": err = unpopulate(val, "Provision", &p.Provision) 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 ResizeError. func (r ResizeError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", r.Code) populate(objectMap, "details", r.Details) populate(objectMap, "message", r.Message) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ResizeError. func (r *ResizeError) 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 "code": err = unpopulate(val, "Code", &r.Code) delete(rawMsg, key) case "details": err = unpopulate(val, "Details", &r.Details) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &r.Message) 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 ResizeOperationStatus. func (r ResizeOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "errors", r.Errors) populate(objectMap, "nodeDeallocationOption", r.NodeDeallocationOption) populate(objectMap, "resizeTimeout", r.ResizeTimeout) populateDateTimeRFC3339(objectMap, "startTime", r.StartTime) populate(objectMap, "targetDedicatedNodes", r.TargetDedicatedNodes) populate(objectMap, "targetLowPriorityNodes", r.TargetLowPriorityNodes) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ResizeOperationStatus. func (r *ResizeOperationStatus) 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 "errors": err = unpopulate(val, "Errors", &r.Errors) delete(rawMsg, key) case "nodeDeallocationOption": err = unpopulate(val, "NodeDeallocationOption", &r.NodeDeallocationOption) delete(rawMsg, key) case "resizeTimeout": err = unpopulate(val, "ResizeTimeout", &r.ResizeTimeout) delete(rawMsg, key) case "startTime": err = unpopulateDateTimeRFC3339(val, "StartTime", &r.StartTime) delete(rawMsg, key) case "targetDedicatedNodes": err = unpopulate(val, "TargetDedicatedNodes", &r.TargetDedicatedNodes) delete(rawMsg, key) case "targetLowPriorityNodes": err = unpopulate(val, "TargetLowPriorityNodes", &r.TargetLowPriorityNodes) 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 Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Resource. func (r *Resource) 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 "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) 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 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 ResourceFile. func (r ResourceFile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoStorageContainerName", r.AutoStorageContainerName) populate(objectMap, "blobPrefix", r.BlobPrefix) populate(objectMap, "fileMode", r.FileMode) populate(objectMap, "filePath", r.FilePath) populate(objectMap, "httpUrl", r.HTTPURL) populate(objectMap, "identityReference", r.IdentityReference) populate(objectMap, "storageContainerUrl", r.StorageContainerURL) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ResourceFile. func (r *ResourceFile) 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 "autoStorageContainerName": err = unpopulate(val, "AutoStorageContainerName", &r.AutoStorageContainerName) delete(rawMsg, key) case "blobPrefix": err = unpopulate(val, "BlobPrefix", &r.BlobPrefix) delete(rawMsg, key) case "fileMode": err = unpopulate(val, "FileMode", &r.FileMode) delete(rawMsg, key) case "filePath": err = unpopulate(val, "FilePath", &r.FilePath) delete(rawMsg, key) case "httpUrl": err = unpopulate(val, "HTTPURL", &r.HTTPURL) delete(rawMsg, key) case "identityReference": err = unpopulate(val, "IdentityReference", &r.IdentityReference) delete(rawMsg, key) case "storageContainerUrl": err = unpopulate(val, "StorageContainerURL", &r.StorageContainerURL) 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 RollingUpgradePolicy. func (r RollingUpgradePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "enableCrossZoneUpgrade", r.EnableCrossZoneUpgrade) populate(objectMap, "maxBatchInstancePercent", r.MaxBatchInstancePercent) populate(objectMap, "maxUnhealthyInstancePercent", r.MaxUnhealthyInstancePercent) populate(objectMap, "maxUnhealthyUpgradedInstancePercent", r.MaxUnhealthyUpgradedInstancePercent) populate(objectMap, "pauseTimeBetweenBatches", r.PauseTimeBetweenBatches) populate(objectMap, "prioritizeUnhealthyInstances", r.PrioritizeUnhealthyInstances) populate(objectMap, "rollbackFailedInstancesOnPolicyBreach", r.RollbackFailedInstancesOnPolicyBreach) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type RollingUpgradePolicy. func (r *RollingUpgradePolicy) 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 "enableCrossZoneUpgrade": err = unpopulate(val, "EnableCrossZoneUpgrade", &r.EnableCrossZoneUpgrade) delete(rawMsg, key) case "maxBatchInstancePercent": err = unpopulate(val, "MaxBatchInstancePercent", &r.MaxBatchInstancePercent) delete(rawMsg, key) case "maxUnhealthyInstancePercent": err = unpopulate(val, "MaxUnhealthyInstancePercent", &r.MaxUnhealthyInstancePercent) delete(rawMsg, key) case "maxUnhealthyUpgradedInstancePercent": err = unpopulate(val, "MaxUnhealthyUpgradedInstancePercent", &r.MaxUnhealthyUpgradedInstancePercent) delete(rawMsg, key) case "pauseTimeBetweenBatches": err = unpopulate(val, "PauseTimeBetweenBatches", &r.PauseTimeBetweenBatches) delete(rawMsg, key) case "prioritizeUnhealthyInstances": err = unpopulate(val, "PrioritizeUnhealthyInstances", &r.PrioritizeUnhealthyInstances) delete(rawMsg, key) case "rollbackFailedInstancesOnPolicyBreach": err = unpopulate(val, "RollbackFailedInstancesOnPolicyBreach", &r.RollbackFailedInstancesOnPolicyBreach) 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 SKUCapability. func (s SKUCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", s.Name) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability. func (s *SKUCapability) 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 "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) 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 ScaleSettings. func (s ScaleSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoScale", s.AutoScale) populate(objectMap, "fixedScale", s.FixedScale) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ScaleSettings. func (s *ScaleSettings) 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 "autoScale": err = unpopulate(val, "AutoScale", &s.AutoScale) delete(rawMsg, key) case "fixedScale": err = unpopulate(val, "FixedScale", &s.FixedScale) 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 SecurityProfile. func (s SecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "encryptionAtHost", s.EncryptionAtHost) populate(objectMap, "securityType", s.SecurityType) populate(objectMap, "uefiSettings", s.UefiSettings) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SecurityProfile. func (s *SecurityProfile) 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 "encryptionAtHost": err = unpopulate(val, "EncryptionAtHost", &s.EncryptionAtHost) delete(rawMsg, key) case "securityType": err = unpopulate(val, "SecurityType", &s.SecurityType) delete(rawMsg, key) case "uefiSettings": err = unpopulate(val, "UefiSettings", &s.UefiSettings) 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 ServiceArtifactReference. func (s ServiceArtifactReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServiceArtifactReference. func (s *ServiceArtifactReference) 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) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type StartTask. func (s StartTask) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "commandLine", s.CommandLine) populate(objectMap, "containerSettings", s.ContainerSettings) populate(objectMap, "environmentSettings", s.EnvironmentSettings) populate(objectMap, "maxTaskRetryCount", s.MaxTaskRetryCount) populate(objectMap, "resourceFiles", s.ResourceFiles) populate(objectMap, "userIdentity", s.UserIdentity) populate(objectMap, "waitForSuccess", s.WaitForSuccess) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type StartTask. func (s *StartTask) 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 "commandLine": err = unpopulate(val, "CommandLine", &s.CommandLine) delete(rawMsg, key) case "containerSettings": err = unpopulate(val, "ContainerSettings", &s.ContainerSettings) delete(rawMsg, key) case "environmentSettings": err = unpopulate(val, "EnvironmentSettings", &s.EnvironmentSettings) delete(rawMsg, key) case "maxTaskRetryCount": err = unpopulate(val, "MaxTaskRetryCount", &s.MaxTaskRetryCount) delete(rawMsg, key) case "resourceFiles": err = unpopulate(val, "ResourceFiles", &s.ResourceFiles) delete(rawMsg, key) case "userIdentity": err = unpopulate(val, "UserIdentity", &s.UserIdentity) delete(rawMsg, key) case "waitForSuccess": err = unpopulate(val, "WaitForSuccess", &s.WaitForSuccess) 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 SupportedSKU. func (s SupportedSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "batchSupportEndOfLife", s.BatchSupportEndOfLife) populate(objectMap, "capabilities", s.Capabilities) populate(objectMap, "familyName", s.FamilyName) populate(objectMap, "name", s.Name) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SupportedSKU. func (s *SupportedSKU) 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 "batchSupportEndOfLife": err = unpopulateDateTimeRFC3339(val, "BatchSupportEndOfLife", &s.BatchSupportEndOfLife) delete(rawMsg, key) case "capabilities": err = unpopulate(val, "Capabilities", &s.Capabilities) delete(rawMsg, key) case "familyName": err = unpopulate(val, "FamilyName", &s.FamilyName) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) 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 SupportedSKUsResult. func (s SupportedSKUsResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SupportedSKUsResult. func (s *SupportedSKUsResult) 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 "nextLink": err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) 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 TaskContainerSettings. func (t TaskContainerSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "containerHostBatchBindMounts", t.ContainerHostBatchBindMounts) populate(objectMap, "containerRunOptions", t.ContainerRunOptions) populate(objectMap, "imageName", t.ImageName) populate(objectMap, "registry", t.Registry) populate(objectMap, "workingDirectory", t.WorkingDirectory) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type TaskContainerSettings. func (t *TaskContainerSettings) 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 "containerHostBatchBindMounts": err = unpopulate(val, "ContainerHostBatchBindMounts", &t.ContainerHostBatchBindMounts) delete(rawMsg, key) case "containerRunOptions": err = unpopulate(val, "ContainerRunOptions", &t.ContainerRunOptions) delete(rawMsg, key) case "imageName": err = unpopulate(val, "ImageName", &t.ImageName) delete(rawMsg, key) case "registry": err = unpopulate(val, "Registry", &t.Registry) delete(rawMsg, key) case "workingDirectory": err = unpopulate(val, "WorkingDirectory", &t.WorkingDirectory) 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 TaskSchedulingPolicy. func (t TaskSchedulingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nodeFillType", t.NodeFillType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type TaskSchedulingPolicy. func (t *TaskSchedulingPolicy) 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 "nodeFillType": err = unpopulate(val, "NodeFillType", &t.NodeFillType) 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 UefiSettings. func (u UefiSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "secureBootEnabled", u.SecureBootEnabled) populate(objectMap, "vTpmEnabled", u.VTpmEnabled) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type UefiSettings. func (u *UefiSettings) 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", u, err) } for key, val := range rawMsg { var err error switch key { case "secureBootEnabled": err = unpopulate(val, "SecureBootEnabled", &u.SecureBootEnabled) delete(rawMsg, key) case "vTpmEnabled": err = unpopulate(val, "VTpmEnabled", &u.VTpmEnabled) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type UpgradePolicy. func (u UpgradePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "automaticOSUpgradePolicy", u.AutomaticOSUpgradePolicy) populate(objectMap, "mode", u.Mode) populate(objectMap, "rollingUpgradePolicy", u.RollingUpgradePolicy) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type UpgradePolicy. func (u *UpgradePolicy) 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", u, err) } for key, val := range rawMsg { var err error switch key { case "automaticOSUpgradePolicy": err = unpopulate(val, "AutomaticOSUpgradePolicy", &u.AutomaticOSUpgradePolicy) delete(rawMsg, key) case "mode": err = unpopulate(val, "Mode", &u.Mode) delete(rawMsg, key) case "rollingUpgradePolicy": err = unpopulate(val, "RollingUpgradePolicy", &u.RollingUpgradePolicy) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type UserAccount. func (u UserAccount) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "elevationLevel", u.ElevationLevel) populate(objectMap, "linuxUserConfiguration", u.LinuxUserConfiguration) populate(objectMap, "name", u.Name) populate(objectMap, "password", u.Password) populate(objectMap, "windowsUserConfiguration", u.WindowsUserConfiguration) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type UserAccount. func (u *UserAccount) 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", u, err) } for key, val := range rawMsg { var err error switch key { case "elevationLevel": err = unpopulate(val, "ElevationLevel", &u.ElevationLevel) delete(rawMsg, key) case "linuxUserConfiguration": err = unpopulate(val, "LinuxUserConfiguration", &u.LinuxUserConfiguration) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &u.Name) delete(rawMsg, key) case "password": err = unpopulate(val, "Password", &u.Password) delete(rawMsg, key) case "windowsUserConfiguration": err = unpopulate(val, "WindowsUserConfiguration", &u.WindowsUserConfiguration) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentities. func (u UserAssignedIdentities) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "clientId", u.ClientID) populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentities. func (u *UserAssignedIdentities) 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", u, err) } for key, val := range rawMsg { var err error switch key { case "clientId": err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) case "principalId": err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type UserIdentity. func (u UserIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUser", u.AutoUser) populate(objectMap, "userName", u.UserName) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentity. func (u *UserIdentity) 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", u, err) } for key, val := range rawMsg { var err error switch key { case "autoUser": err = unpopulate(val, "AutoUser", &u.AutoUser) delete(rawMsg, key) case "userName": err = unpopulate(val, "UserName", &u.UserName) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type VMDiskSecurityProfile. func (v VMDiskSecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "securityEncryptionType", v.SecurityEncryptionType) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VMDiskSecurityProfile. func (v *VMDiskSecurityProfile) 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 "securityEncryptionType": err = unpopulate(val, "SecurityEncryptionType", &v.SecurityEncryptionType) 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 VMExtension. func (v VMExtension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUpgradeMinorVersion", v.AutoUpgradeMinorVersion) populate(objectMap, "enableAutomaticUpgrade", v.EnableAutomaticUpgrade) populate(objectMap, "name", v.Name) populateAny(objectMap, "protectedSettings", v.ProtectedSettings) populate(objectMap, "provisionAfterExtensions", v.ProvisionAfterExtensions) populate(objectMap, "publisher", v.Publisher) populateAny(objectMap, "settings", v.Settings) populate(objectMap, "type", v.Type) populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VMExtension. func (v *VMExtension) 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 "autoUpgradeMinorVersion": err = unpopulate(val, "AutoUpgradeMinorVersion", &v.AutoUpgradeMinorVersion) delete(rawMsg, key) case "enableAutomaticUpgrade": err = unpopulate(val, "EnableAutomaticUpgrade", &v.EnableAutomaticUpgrade) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) case "protectedSettings": err = unpopulate(val, "ProtectedSettings", &v.ProtectedSettings) delete(rawMsg, key) case "provisionAfterExtensions": err = unpopulate(val, "ProvisionAfterExtensions", &v.ProvisionAfterExtensions) delete(rawMsg, key) case "publisher": err = unpopulate(val, "Publisher", &v.Publisher) delete(rawMsg, key) case "settings": err = unpopulate(val, "Settings", &v.Settings) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) case "typeHandlerVersion": err = unpopulate(val, "TypeHandlerVersion", &v.TypeHandlerVersion) 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 VirtualMachineConfiguration. func (v VirtualMachineConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "containerConfiguration", v.ContainerConfiguration) populate(objectMap, "dataDisks", v.DataDisks) populate(objectMap, "diskEncryptionConfiguration", v.DiskEncryptionConfiguration) populate(objectMap, "extensions", v.Extensions) populate(objectMap, "imageReference", v.ImageReference) populate(objectMap, "licenseType", v.LicenseType) populate(objectMap, "nodeAgentSkuId", v.NodeAgentSKUID) populate(objectMap, "nodePlacementConfiguration", v.NodePlacementConfiguration) populate(objectMap, "osDisk", v.OSDisk) populate(objectMap, "securityProfile", v.SecurityProfile) populate(objectMap, "serviceArtifactReference", v.ServiceArtifactReference) populate(objectMap, "windowsConfiguration", v.WindowsConfiguration) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineConfiguration. func (v *VirtualMachineConfiguration) 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 "containerConfiguration": err = unpopulate(val, "ContainerConfiguration", &v.ContainerConfiguration) delete(rawMsg, key) case "dataDisks": err = unpopulate(val, "DataDisks", &v.DataDisks) delete(rawMsg, key) case "diskEncryptionConfiguration": err = unpopulate(val, "DiskEncryptionConfiguration", &v.DiskEncryptionConfiguration) delete(rawMsg, key) case "extensions": err = unpopulate(val, "Extensions", &v.Extensions) delete(rawMsg, key) case "imageReference": err = unpopulate(val, "ImageReference", &v.ImageReference) delete(rawMsg, key) case "licenseType": err = unpopulate(val, "LicenseType", &v.LicenseType) delete(rawMsg, key) case "nodeAgentSkuId": err = unpopulate(val, "NodeAgentSKUID", &v.NodeAgentSKUID) delete(rawMsg, key) case "nodePlacementConfiguration": err = unpopulate(val, "NodePlacementConfiguration", &v.NodePlacementConfiguration) delete(rawMsg, key) case "osDisk": err = unpopulate(val, "OSDisk", &v.OSDisk) delete(rawMsg, key) case "securityProfile": err = unpopulate(val, "SecurityProfile", &v.SecurityProfile) delete(rawMsg, key) case "serviceArtifactReference": err = unpopulate(val, "ServiceArtifactReference", &v.ServiceArtifactReference) delete(rawMsg, key) case "windowsConfiguration": err = unpopulate(val, "WindowsConfiguration", &v.WindowsConfiguration) 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 VirtualMachineFamilyCoreQuota. func (v VirtualMachineFamilyCoreQuota) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "coreQuota", v.CoreQuota) populate(objectMap, "name", v.Name) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineFamilyCoreQuota. func (v *VirtualMachineFamilyCoreQuota) 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 "coreQuota": err = unpopulate(val, "CoreQuota", &v.CoreQuota) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) 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 WindowsConfiguration. func (w WindowsConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "enableAutomaticUpdates", w.EnableAutomaticUpdates) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type WindowsConfiguration. func (w *WindowsConfiguration) 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 "enableAutomaticUpdates": err = unpopulate(val, "EnableAutomaticUpdates", &w.EnableAutomaticUpdates) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type WindowsUserConfiguration. func (w WindowsUserConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "loginMode", w.LoginMode) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type WindowsUserConfiguration. func (w *WindowsUserConfiguration) 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 "loginMode": err = unpopulate(val, "LoginMode", &w.LoginMode) 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 }