sdk/resourcemanager/postgresql/armpostgresql/models_serde.go (2,301 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 armpostgresql import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" ) // MarshalJSON implements the json.Marshaller interface for type Configuration. func (c Configuration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Configuration. func (c *Configuration) 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 "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &c.Properties) 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 ConfigurationListResult. func (c ConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationListResult. func (c *ConfigurationListResult) 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 "value": err = unpopulate(val, "Value", &c.Value) 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 ConfigurationProperties. func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedValues", c.AllowedValues) populate(objectMap, "dataType", c.DataType) populate(objectMap, "defaultValue", c.DefaultValue) populate(objectMap, "description", c.Description) populate(objectMap, "source", c.Source) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationProperties. func (c *ConfigurationProperties) 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 "allowedValues": err = unpopulate(val, "AllowedValues", &c.AllowedValues) delete(rawMsg, key) case "dataType": err = unpopulate(val, "DataType", &c.DataType) delete(rawMsg, key) case "defaultValue": err = unpopulate(val, "DefaultValue", &c.DefaultValue) delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &c.Description) delete(rawMsg, key) case "source": err = unpopulate(val, "Source", &c.Source) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) 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 Database. func (d Database) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Database. func (d *Database) 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 "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 "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 DatabaseListResult. func (d DatabaseListResult) 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 DatabaseListResult. func (d *DatabaseListResult) 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 DatabaseProperties. func (d DatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "charset", d.Charset) populate(objectMap, "collation", d.Collation) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseProperties. func (d *DatabaseProperties) 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 "charset": err = unpopulate(val, "Charset", &d.Charset) delete(rawMsg, key) case "collation": err = unpopulate(val, "Collation", &d.Collation) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateAny(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "info": err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) 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 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 "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 FirewallRule. func (f FirewallRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", f.ID) populate(objectMap, "name", f.Name) populate(objectMap, "properties", f.Properties) populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRule. func (f *FirewallRule) 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 "id": err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &f.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleListResult. func (f *FirewallRuleListResult) 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 "value": err = unpopulate(val, "Value", &f.Value) 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 FirewallRuleProperties. func (f FirewallRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "endIpAddress", f.EndIPAddress) populate(objectMap, "startIpAddress", f.StartIPAddress) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleProperties. func (f *FirewallRuleProperties) 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 "endIpAddress": err = unpopulate(val, "EndIPAddress", &f.EndIPAddress) delete(rawMsg, key) case "startIpAddress": err = unpopulate(val, "StartIPAddress", &f.StartIPAddress) 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 LogFile. func (l LogFile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", l.ID) populate(objectMap, "name", l.Name) populate(objectMap, "properties", l.Properties) populate(objectMap, "type", l.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LogFile. func (l *LogFile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &l.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &l.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type LogFileListResult. func (l LogFileListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LogFileListResult. func (l *LogFileListResult) 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 "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 LogFileProperties. func (l LogFileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "createdTime", l.CreatedTime) populateDateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) populate(objectMap, "sizeInKB", l.SizeInKB) populate(objectMap, "type", l.Type) populate(objectMap, "url", l.URL) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type LogFileProperties. func (l *LogFileProperties) 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 "createdTime": err = unpopulateDateTimeRFC3339(val, "CreatedTime", &l.CreatedTime) delete(rawMsg, key) case "lastModifiedTime": err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &l.LastModifiedTime) delete(rawMsg, key) case "sizeInKB": err = unpopulate(val, "SizeInKB", &l.SizeInKB) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &l.Type) delete(rawMsg, key) case "url": err = unpopulate(val, "URL", &l.URL) 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 NameAvailability. func (n NameAvailability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "message", n.Message) populate(objectMap, "nameAvailable", n.NameAvailable) populate(objectMap, "reason", n.Reason) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailability. func (n *NameAvailability) 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 "message": err = unpopulate(val, "Message", &n.Message) delete(rawMsg, key) case "nameAvailable": err = unpopulate(val, "NameAvailable", &n.NameAvailable) delete(rawMsg, key) case "reason": err = unpopulate(val, "Reason", &n.Reason) 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 NameAvailabilityRequest. func (n NameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", n.Name) populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityRequest. func (n *NameAvailabilityRequest) 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 "name": err = unpopulate(val, "Name", &n.Name) 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 Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) populate(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 "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, "value", o.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "value": err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PerformanceTierListResult. func (p PerformanceTierListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceTierListResult. func (p *PerformanceTierListResult) 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 "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PerformanceTierProperties. func (p PerformanceTierProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "maxBackupRetentionDays", p.MaxBackupRetentionDays) populate(objectMap, "maxLargeStorageMB", p.MaxLargeStorageMB) populate(objectMap, "maxStorageMB", p.MaxStorageMB) populate(objectMap, "minBackupRetentionDays", p.MinBackupRetentionDays) populate(objectMap, "minLargeStorageMB", p.MinLargeStorageMB) populate(objectMap, "minStorageMB", p.MinStorageMB) populate(objectMap, "serviceLevelObjectives", p.ServiceLevelObjectives) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceTierProperties. func (p *PerformanceTierProperties) 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 "maxBackupRetentionDays": err = unpopulate(val, "MaxBackupRetentionDays", &p.MaxBackupRetentionDays) delete(rawMsg, key) case "maxLargeStorageMB": err = unpopulate(val, "MaxLargeStorageMB", &p.MaxLargeStorageMB) delete(rawMsg, key) case "maxStorageMB": err = unpopulate(val, "MaxStorageMB", &p.MaxStorageMB) delete(rawMsg, key) case "minBackupRetentionDays": err = unpopulate(val, "MinBackupRetentionDays", &p.MinBackupRetentionDays) delete(rawMsg, key) case "minLargeStorageMB": err = unpopulate(val, "MinLargeStorageMB", &p.MinLargeStorageMB) delete(rawMsg, key) case "minStorageMB": err = unpopulate(val, "MinStorageMB", &p.MinStorageMB) delete(rawMsg, key) case "serviceLevelObjectives": err = unpopulate(val, "ServiceLevelObjectives", &p.ServiceLevelObjectives) 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 PerformanceTierServiceLevelObjectives. func (p PerformanceTierServiceLevelObjectives) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "edition", p.Edition) populate(objectMap, "hardwareGeneration", p.HardwareGeneration) populate(objectMap, "id", p.ID) populate(objectMap, "maxBackupRetentionDays", p.MaxBackupRetentionDays) populate(objectMap, "maxStorageMB", p.MaxStorageMB) populate(objectMap, "minBackupRetentionDays", p.MinBackupRetentionDays) populate(objectMap, "minStorageMB", p.MinStorageMB) populate(objectMap, "vCore", p.VCore) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceTierServiceLevelObjectives. func (p *PerformanceTierServiceLevelObjectives) 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 "edition": err = unpopulate(val, "Edition", &p.Edition) delete(rawMsg, key) case "hardwareGeneration": err = unpopulate(val, "HardwareGeneration", &p.HardwareGeneration) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "maxBackupRetentionDays": err = unpopulate(val, "MaxBackupRetentionDays", &p.MaxBackupRetentionDays) delete(rawMsg, key) case "maxStorageMB": err = unpopulate(val, "MaxStorageMB", &p.MaxStorageMB) delete(rawMsg, key) case "minBackupRetentionDays": err = unpopulate(val, "MinBackupRetentionDays", &p.MinBackupRetentionDays) delete(rawMsg, key) case "minStorageMB": err = unpopulate(val, "MinStorageMB", &p.MinStorageMB) delete(rawMsg, key) case "vCore": err = unpopulate(val, "VCore", &p.VCore) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "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 "privateEndpoint": err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) case "privateLinkServiceConnectionState": err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "groupId", p.GroupID) populate(objectMap, "requiredMembers", p.RequiredMembers) 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) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionsRequired", p.ActionsRequired) populate(objectMap, "description", p.Description) populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "actionsRequired": err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) 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 "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 RecoverableServerProperties. func (r RecoverableServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "edition", r.Edition) populate(objectMap, "hardwareGeneration", r.HardwareGeneration) populate(objectMap, "lastAvailableBackupDateTime", r.LastAvailableBackupDateTime) populate(objectMap, "serviceLevelObjective", r.ServiceLevelObjective) populate(objectMap, "vCore", r.VCore) populate(objectMap, "version", r.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableServerProperties. func (r *RecoverableServerProperties) 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 "edition": err = unpopulate(val, "Edition", &r.Edition) delete(rawMsg, key) case "hardwareGeneration": err = unpopulate(val, "HardwareGeneration", &r.HardwareGeneration) delete(rawMsg, key) case "lastAvailableBackupDateTime": err = unpopulate(val, "LastAvailableBackupDateTime", &r.LastAvailableBackupDateTime) delete(rawMsg, key) case "serviceLevelObjective": err = unpopulate(val, "ServiceLevelObjective", &r.ServiceLevelObjective) delete(rawMsg, key) case "vCore": err = unpopulate(val, "VCore", &r.VCore) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &r.Version) 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 RecoverableServerResource. func (r RecoverableServerResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableServerResource. func (r *RecoverableServerResource) 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 "properties": err = unpopulate(val, "Properties", &r.Properties) 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 Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) 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 "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 ResourceIdentity. func (r ResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", r.PrincipalID) populate(objectMap, "tenantId", r.TenantID) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. func (r *ResourceIdentity) 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 "principalId": err = unpopulate(val, "PrincipalID", &r.PrincipalID) delete(rawMsg, key) case "tenantId": err = unpopulate(val, "TenantID", &r.TenantID) 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 SKU. func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacity", s.Capacity) populate(objectMap, "family", s.Family) populate(objectMap, "name", s.Name) populate(objectMap, "size", s.Size) populate(objectMap, "tier", s.Tier) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SKU. func (s *SKU) 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 "capacity": err = unpopulate(val, "Capacity", &s.Capacity) delete(rawMsg, key) case "family": err = unpopulate(val, "Family", &s.Family) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "size": err = unpopulate(val, "Size", &s.Size) delete(rawMsg, key) case "tier": err = unpopulate(val, "Tier", &s.Tier) 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 SecurityAlertPolicyProperties. func (s SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "disabledAlerts", s.DisabledAlerts) populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) populate(objectMap, "emailAddresses", s.EmailAddresses) populate(objectMap, "retentionDays", s.RetentionDays) populate(objectMap, "state", s.State) populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) populate(objectMap, "storageEndpoint", s.StorageEndpoint) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertPolicyProperties. func (s *SecurityAlertPolicyProperties) 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 "disabledAlerts": err = unpopulate(val, "DisabledAlerts", &s.DisabledAlerts) delete(rawMsg, key) case "emailAccountAdmins": err = unpopulate(val, "EmailAccountAdmins", &s.EmailAccountAdmins) delete(rawMsg, key) case "emailAddresses": err = unpopulate(val, "EmailAddresses", &s.EmailAddresses) delete(rawMsg, key) case "retentionDays": err = unpopulate(val, "RetentionDays", &s.RetentionDays) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &s.State) delete(rawMsg, key) case "storageAccountAccessKey": err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) delete(rawMsg, key) case "storageEndpoint": err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) 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 Server. func (s Server) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "sku", s.SKU) populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type Server. func (s *Server) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "identity": err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &s.SKU) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServerAdministratorProperties. func (s ServerAdministratorProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["administratorType"] = "ActiveDirectory" populate(objectMap, "login", s.Login) populate(objectMap, "sid", s.Sid) populate(objectMap, "tenantId", s.TenantID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerAdministratorProperties. func (s *ServerAdministratorProperties) 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 "administratorType": err = unpopulate(val, "AdministratorType", &s.AdministratorType) delete(rawMsg, key) case "login": err = unpopulate(val, "Login", &s.Login) delete(rawMsg, key) case "sid": err = unpopulate(val, "Sid", &s.Sid) delete(rawMsg, key) case "tenantId": err = unpopulate(val, "TenantID", &s.TenantID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServerAdministratorResource. func (s ServerAdministratorResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerAdministratorResource. func (s *ServerAdministratorResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServerAdministratorResourceListResult. func (s ServerAdministratorResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerAdministratorResourceListResult. func (s *ServerAdministratorResourceListResult) 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 "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 ServerForCreate. func (s ServerForCreate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "properties", s.Properties) populate(objectMap, "sku", s.SKU) populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerForCreate. func (s *ServerForCreate) 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 "identity": err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "properties": s.Properties, err = unmarshalServerPropertiesForCreateClassification(val) delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &s.SKU) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &s.Tags) 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 ServerKey. func (s ServerKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "kind", s.Kind) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerKey. func (s *ServerKey) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &s.Kind) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServerKeyListResult. func (s ServerKeyListResult) 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 ServerKeyListResult. func (s *ServerKeyListResult) 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 ServerKeyProperties. func (s ServerKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populateDateTimeRFC3339(objectMap, "creationDate", s.CreationDate) populate(objectMap, "serverKeyType", s.ServerKeyType) populate(objectMap, "uri", s.URI) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerKeyProperties. func (s *ServerKeyProperties) 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 "creationDate": err = unpopulateDateTimeRFC3339(val, "CreationDate", &s.CreationDate) delete(rawMsg, key) case "serverKeyType": err = unpopulate(val, "ServerKeyType", &s.ServerKeyType) delete(rawMsg, key) case "uri": err = unpopulate(val, "URI", &s.URI) 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 ServerListResult. func (s ServerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerListResult. func (s *ServerListResult) 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 "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 ServerPrivateEndpointConnection. func (s ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPrivateEndpointConnection. func (s *ServerPrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) 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 ServerPrivateEndpointConnectionProperties. func (s ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "privateEndpoint", s.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", s.PrivateLinkServiceConnectionState) populate(objectMap, "provisioningState", s.ProvisioningState) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPrivateEndpointConnectionProperties. func (s *ServerPrivateEndpointConnectionProperties) 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 "privateEndpoint": err = unpopulate(val, "PrivateEndpoint", &s.PrivateEndpoint) delete(rawMsg, key) case "privateLinkServiceConnectionState": err = unpopulate(val, "PrivateLinkServiceConnectionState", &s.PrivateLinkServiceConnectionState) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) 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 ServerPrivateLinkServiceConnectionStateProperty. func (s ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionsRequired", s.ActionsRequired) populate(objectMap, "description", s.Description) populate(objectMap, "status", s.Status) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPrivateLinkServiceConnectionStateProperty. func (s *ServerPrivateLinkServiceConnectionStateProperty) 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 "actionsRequired": err = unpopulate(val, "ActionsRequired", &s.ActionsRequired) delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServerProperties. func (s ServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "administratorLogin", s.AdministratorLogin) populate(objectMap, "byokEnforcement", s.ByokEnforcement) populateDateTimeRFC3339(objectMap, "earliestRestoreDate", s.EarliestRestoreDate) populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "masterServerId", s.MasterServerID) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "replicaCapacity", s.ReplicaCapacity) populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "userVisibleState", s.UserVisibleState) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. func (s *ServerProperties) 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 "administratorLogin": err = unpopulate(val, "AdministratorLogin", &s.AdministratorLogin) delete(rawMsg, key) case "byokEnforcement": err = unpopulate(val, "ByokEnforcement", &s.ByokEnforcement) delete(rawMsg, key) case "earliestRestoreDate": err = unpopulateDateTimeRFC3339(val, "EarliestRestoreDate", &s.EarliestRestoreDate) delete(rawMsg, key) case "fullyQualifiedDomainName": err = unpopulate(val, "FullyQualifiedDomainName", &s.FullyQualifiedDomainName) delete(rawMsg, key) case "infrastructureEncryption": err = unpopulate(val, "InfrastructureEncryption", &s.InfrastructureEncryption) delete(rawMsg, key) case "masterServerId": err = unpopulate(val, "MasterServerID", &s.MasterServerID) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &s.PrivateEndpointConnections) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "replicaCapacity": err = unpopulate(val, "ReplicaCapacity", &s.ReplicaCapacity) delete(rawMsg, key) case "replicationRole": err = unpopulate(val, "ReplicationRole", &s.ReplicationRole) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "userVisibleState": err = unpopulate(val, "UserVisibleState", &s.UserVisibleState) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) 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 ServerPropertiesForCreate. func (s ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["createMode"] = s.CreateMode populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForCreate. func (s *ServerPropertiesForCreate) 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 "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) case "infrastructureEncryption": err = unpopulate(val, "InfrastructureEncryption", &s.InfrastructureEncryption) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) 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 ServerPropertiesForDefaultCreate. func (s ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "administratorLogin", s.AdministratorLogin) populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) objectMap["createMode"] = CreateModeDefault populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForDefaultCreate. func (s *ServerPropertiesForDefaultCreate) 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 "administratorLogin": err = unpopulate(val, "AdministratorLogin", &s.AdministratorLogin) delete(rawMsg, key) case "administratorLoginPassword": err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) delete(rawMsg, key) case "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) case "infrastructureEncryption": err = unpopulate(val, "InfrastructureEncryption", &s.InfrastructureEncryption) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) 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 ServerPropertiesForGeoRestore. func (s ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["createMode"] = CreateModeGeoRestore populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "sourceServerId", s.SourceServerID) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForGeoRestore. func (s *ServerPropertiesForGeoRestore) 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 "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) case "infrastructureEncryption": err = unpopulate(val, "InfrastructureEncryption", &s.InfrastructureEncryption) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "sourceServerId": err = unpopulate(val, "SourceServerID", &s.SourceServerID) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) 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 ServerPropertiesForReplica. func (s ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["createMode"] = CreateModeReplica populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "sourceServerId", s.SourceServerID) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForReplica. func (s *ServerPropertiesForReplica) 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 "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) case "infrastructureEncryption": err = unpopulate(val, "InfrastructureEncryption", &s.InfrastructureEncryption) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "sourceServerId": err = unpopulate(val, "SourceServerID", &s.SourceServerID) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) 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 ServerPropertiesForRestore. func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) objectMap["createMode"] = CreateModePointInTimeRestore populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populateDateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "sourceServerId", s.SourceServerID) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerPropertiesForRestore. func (s *ServerPropertiesForRestore) 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 "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) case "infrastructureEncryption": err = unpopulate(val, "InfrastructureEncryption", &s.InfrastructureEncryption) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "restorePointInTime": err = unpopulateDateTimeRFC3339(val, "RestorePointInTime", &s.RestorePointInTime) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "sourceServerId": err = unpopulate(val, "SourceServerID", &s.SourceServerID) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) 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 ServerSecurityAlertPolicy. func (s ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerSecurityAlertPolicy. func (s *ServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type ServerSecurityAlertPolicyListResult. func (s ServerSecurityAlertPolicyListResult) 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 ServerSecurityAlertPolicyListResult. func (s *ServerSecurityAlertPolicyListResult) 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 ServerUpdateParameters. func (s ServerUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", s.Identity) populate(objectMap, "properties", s.Properties) populate(objectMap, "sku", s.SKU) populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerUpdateParameters. func (s *ServerUpdateParameters) 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 "identity": err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &s.SKU) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &s.Tags) 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 ServerUpdateParametersProperties. func (s ServerUpdateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "sslEnforcement", s.SSLEnforcement) populate(objectMap, "storageProfile", s.StorageProfile) populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ServerUpdateParametersProperties. func (s *ServerUpdateParametersProperties) 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 "administratorLoginPassword": err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) delete(rawMsg, key) case "minimalTlsVersion": err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) delete(rawMsg, key) case "replicationRole": err = unpopulate(val, "ReplicationRole", &s.ReplicationRole) delete(rawMsg, key) case "sslEnforcement": err = unpopulate(val, "SSLEnforcement", &s.SSLEnforcement) delete(rawMsg, key) case "storageProfile": err = unpopulate(val, "StorageProfile", &s.StorageProfile) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &s.Version) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type StorageProfile. func (s StorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "backupRetentionDays", s.BackupRetentionDays) populate(objectMap, "geoRedundantBackup", s.GeoRedundantBackup) populate(objectMap, "storageAutogrow", s.StorageAutogrow) populate(objectMap, "storageMB", s.StorageMB) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. func (s *StorageProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "backupRetentionDays": err = unpopulate(val, "BackupRetentionDays", &s.BackupRetentionDays) delete(rawMsg, key) case "geoRedundantBackup": err = unpopulate(val, "GeoRedundantBackup", &s.GeoRedundantBackup) delete(rawMsg, key) case "storageAutogrow": err = unpopulate(val, "StorageAutogrow", &s.StorageAutogrow) delete(rawMsg, key) case "storageMB": err = unpopulate(val, "StorageMB", &s.StorageMB) 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 TagsObject. func (t TagsObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type TagsObject. func (t *TagsObject) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. func (t *TrackedResource) 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 "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) 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 VirtualNetworkRule. func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRule. func (v *VirtualNetworkRule) 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 "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &v.Type) 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 VirtualNetworkRuleListResult. func (v VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRuleListResult. func (v *VirtualNetworkRuleListResult) 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 "nextLink": err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &v.Value) 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 VirtualNetworkRuleProperties. func (v VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "ignoreMissingVnetServiceEndpoint", v.IgnoreMissingVnetServiceEndpoint) populate(objectMap, "state", v.State) populate(objectMap, "virtualNetworkSubnetId", v.VirtualNetworkSubnetID) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRuleProperties. func (v *VirtualNetworkRuleProperties) 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 "ignoreMissingVnetServiceEndpoint": err = unpopulate(val, "IgnoreMissingVnetServiceEndpoint", &v.IgnoreMissingVnetServiceEndpoint) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &v.State) delete(rawMsg, key) case "virtualNetworkSubnetId": err = unpopulate(val, "VirtualNetworkSubnetID", &v.VirtualNetworkSubnetID) delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, 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 { return nil } if err := json.Unmarshal(data, v); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } return nil }