sdk/resourcemanager/mariadb/armmariadb/models_serde.go (2,720 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 armmariadb
import (
"encoding/json"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
)
// MarshalJSON implements the json.Marshaller interface for type Advisor.
func (a Advisor) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", a.ID)
populate(objectMap, "name", a.Name)
populateAny(objectMap, "properties", a.Properties)
populate(objectMap, "type", a.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Advisor.
func (a *Advisor) UnmarshalJSON(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 "name":
err = unpopulate(val, "Name", &a.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &a.Properties)
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 AdvisorsResultList.
func (a AdvisorsResultList) 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 AdvisorsResultList.
func (a *AdvisorsResultList) UnmarshalJSON(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 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 QueryPerformanceInsightResetDataResult.
func (q QueryPerformanceInsightResetDataResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "message", q.Message)
populate(objectMap, "status", q.Status)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryPerformanceInsightResetDataResult.
func (q *QueryPerformanceInsightResetDataResult) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "message":
err = unpopulate(val, "Message", &q.Message)
delete(rawMsg, key)
case "status":
err = unpopulate(val, "Status", &q.Status)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type QueryStatistic.
func (q QueryStatistic) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", q.ID)
populate(objectMap, "name", q.Name)
populate(objectMap, "properties", q.Properties)
populate(objectMap, "type", q.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatistic.
func (q *QueryStatistic) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &q.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &q.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &q.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &q.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type QueryStatisticProperties.
func (q QueryStatisticProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "aggregationFunction", q.AggregationFunction)
populate(objectMap, "databaseNames", q.DatabaseNames)
populateDateTimeRFC3339(objectMap, "endTime", q.EndTime)
populate(objectMap, "metricDisplayName", q.MetricDisplayName)
populate(objectMap, "metricName", q.MetricName)
populate(objectMap, "metricValue", q.MetricValue)
populate(objectMap, "metricValueUnit", q.MetricValueUnit)
populate(objectMap, "queryExecutionCount", q.QueryExecutionCount)
populate(objectMap, "queryId", q.QueryID)
populateDateTimeRFC3339(objectMap, "startTime", q.StartTime)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatisticProperties.
func (q *QueryStatisticProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "aggregationFunction":
err = unpopulate(val, "AggregationFunction", &q.AggregationFunction)
delete(rawMsg, key)
case "databaseNames":
err = unpopulate(val, "DatabaseNames", &q.DatabaseNames)
delete(rawMsg, key)
case "endTime":
err = unpopulateDateTimeRFC3339(val, "EndTime", &q.EndTime)
delete(rawMsg, key)
case "metricDisplayName":
err = unpopulate(val, "MetricDisplayName", &q.MetricDisplayName)
delete(rawMsg, key)
case "metricName":
err = unpopulate(val, "MetricName", &q.MetricName)
delete(rawMsg, key)
case "metricValue":
err = unpopulate(val, "MetricValue", &q.MetricValue)
delete(rawMsg, key)
case "metricValueUnit":
err = unpopulate(val, "MetricValueUnit", &q.MetricValueUnit)
delete(rawMsg, key)
case "queryExecutionCount":
err = unpopulate(val, "QueryExecutionCount", &q.QueryExecutionCount)
delete(rawMsg, key)
case "queryId":
err = unpopulate(val, "QueryID", &q.QueryID)
delete(rawMsg, key)
case "startTime":
err = unpopulateDateTimeRFC3339(val, "StartTime", &q.StartTime)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type QueryText.
func (q QueryText) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", q.ID)
populate(objectMap, "name", q.Name)
populate(objectMap, "properties", q.Properties)
populate(objectMap, "type", q.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryText.
func (q *QueryText) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &q.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &q.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &q.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &q.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type QueryTextProperties.
func (q QueryTextProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "queryId", q.QueryID)
populate(objectMap, "queryText", q.QueryText)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryTextProperties.
func (q *QueryTextProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "queryId":
err = unpopulate(val, "QueryID", &q.QueryID)
delete(rawMsg, key)
case "queryText":
err = unpopulate(val, "QueryText", &q.QueryText)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type QueryTextsResultList.
func (q QueryTextsResultList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", q.NextLink)
populate(objectMap, "value", q.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type QueryTextsResultList.
func (q *QueryTextsResultList) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &q.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &q.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", q, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type RecommendationAction.
func (r RecommendationAction) 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 RecommendationAction.
func (r *RecommendationAction) UnmarshalJSON(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 RecommendationActionProperties.
func (r RecommendationActionProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "actionId", r.ActionID)
populate(objectMap, "advisorName", r.AdvisorName)
populateDateTimeRFC3339(objectMap, "createdTime", r.CreatedTime)
populate(objectMap, "details", r.Details)
populateDateTimeRFC3339(objectMap, "expirationTime", r.ExpirationTime)
populate(objectMap, "reason", r.Reason)
populate(objectMap, "recommendationType", r.RecommendationType)
populate(objectMap, "sessionId", r.SessionID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationActionProperties.
func (r *RecommendationActionProperties) UnmarshalJSON(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 "actionId":
err = unpopulate(val, "ActionID", &r.ActionID)
delete(rawMsg, key)
case "advisorName":
err = unpopulate(val, "AdvisorName", &r.AdvisorName)
delete(rawMsg, key)
case "createdTime":
err = unpopulateDateTimeRFC3339(val, "CreatedTime", &r.CreatedTime)
delete(rawMsg, key)
case "details":
err = unpopulate(val, "Details", &r.Details)
delete(rawMsg, key)
case "expirationTime":
err = unpopulateDateTimeRFC3339(val, "ExpirationTime", &r.ExpirationTime)
delete(rawMsg, key)
case "reason":
err = unpopulate(val, "Reason", &r.Reason)
delete(rawMsg, key)
case "recommendationType":
err = unpopulate(val, "RecommendationType", &r.RecommendationType)
delete(rawMsg, key)
case "sessionId":
err = unpopulate(val, "SessionID", &r.SessionID)
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 RecommendationActionsResultList.
func (r RecommendationActionsResultList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", r.NextLink)
populate(objectMap, "value", r.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationActionsResultList.
func (r *RecommendationActionsResultList) UnmarshalJSON(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 "nextLink":
err = unpopulate(val, "NextLink", &r.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &r.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", r, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type RecommendedActionSessionsOperationStatus.
func (r RecommendedActionSessionsOperationStatus) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "name", r.Name)
populateDateTimeRFC3339(objectMap, "startTime", r.StartTime)
populate(objectMap, "status", r.Status)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionSessionsOperationStatus.
func (r *RecommendedActionSessionsOperationStatus) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", r, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "name":
err = unpopulate(val, "Name", &r.Name)
delete(rawMsg, key)
case "startTime":
err = unpopulateDateTimeRFC3339(val, "StartTime", &r.StartTime)
delete(rawMsg, key)
case "status":
err = unpopulate(val, "Status", &r.Status)
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 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 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, "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 "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 ServerForCreate.
func (s ServerForCreate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
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 "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 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)
populateDateTimeRFC3339(objectMap, "earliestRestoreDate", s.EarliestRestoreDate)
populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName)
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 "earliestRestoreDate":
err = unpopulateDateTimeRFC3339(val, "EarliestRestoreDate", &s.EarliestRestoreDate)
delete(rawMsg, key)
case "fullyQualifiedDomainName":
err = unpopulate(val, "FullyQualifiedDomainName", &s.FullyQualifiedDomainName)
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, "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 "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, "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 "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, "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 "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, "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 "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, "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 "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, "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 "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 TopQueryStatisticsInput.
func (t TopQueryStatisticsInput) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "properties", t.Properties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueryStatisticsInput.
func (t *TopQueryStatisticsInput) UnmarshalJSON(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 "properties":
err = unpopulate(val, "Properties", &t.Properties)
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 TopQueryStatisticsInputProperties.
func (t TopQueryStatisticsInputProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "aggregationFunction", t.AggregationFunction)
populate(objectMap, "aggregationWindow", t.AggregationWindow)
populate(objectMap, "numberOfTopQueries", t.NumberOfTopQueries)
populateDateTimeRFC3339(objectMap, "observationEndTime", t.ObservationEndTime)
populateDateTimeRFC3339(objectMap, "observationStartTime", t.ObservationStartTime)
populate(objectMap, "observedMetric", t.ObservedMetric)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueryStatisticsInputProperties.
func (t *TopQueryStatisticsInputProperties) UnmarshalJSON(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 "aggregationFunction":
err = unpopulate(val, "AggregationFunction", &t.AggregationFunction)
delete(rawMsg, key)
case "aggregationWindow":
err = unpopulate(val, "AggregationWindow", &t.AggregationWindow)
delete(rawMsg, key)
case "numberOfTopQueries":
err = unpopulate(val, "NumberOfTopQueries", &t.NumberOfTopQueries)
delete(rawMsg, key)
case "observationEndTime":
err = unpopulateDateTimeRFC3339(val, "ObservationEndTime", &t.ObservationEndTime)
delete(rawMsg, key)
case "observationStartTime":
err = unpopulateDateTimeRFC3339(val, "ObservationStartTime", &t.ObservationStartTime)
delete(rawMsg, key)
case "observedMetric":
err = unpopulate(val, "ObservedMetric", &t.ObservedMetric)
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 TopQueryStatisticsResultList.
func (t TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", t.NextLink)
populate(objectMap, "value", t.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueryStatisticsResultList.
func (t *TopQueryStatisticsResultList) UnmarshalJSON(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 "nextLink":
err = unpopulate(val, "NextLink", &t.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &t.Value)
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
}
// MarshalJSON implements the json.Marshaller interface for type WaitStatistic.
func (w WaitStatistic) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", w.ID)
populate(objectMap, "name", w.Name)
populate(objectMap, "properties", w.Properties)
populate(objectMap, "type", w.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatistic.
func (w *WaitStatistic) UnmarshalJSON(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 "id":
err = unpopulate(val, "ID", &w.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &w.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &w.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &w.Type)
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 WaitStatisticProperties.
func (w WaitStatisticProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "count", w.Count)
populate(objectMap, "databaseName", w.DatabaseName)
populateDateTimeRFC3339(objectMap, "endTime", w.EndTime)
populate(objectMap, "eventName", w.EventName)
populate(objectMap, "eventTypeName", w.EventTypeName)
populate(objectMap, "queryId", w.QueryID)
populateDateTimeRFC3339(objectMap, "startTime", w.StartTime)
populate(objectMap, "totalTimeInMs", w.TotalTimeInMs)
populate(objectMap, "userId", w.UserID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticProperties.
func (w *WaitStatisticProperties) UnmarshalJSON(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 "count":
err = unpopulate(val, "Count", &w.Count)
delete(rawMsg, key)
case "databaseName":
err = unpopulate(val, "DatabaseName", &w.DatabaseName)
delete(rawMsg, key)
case "endTime":
err = unpopulateDateTimeRFC3339(val, "EndTime", &w.EndTime)
delete(rawMsg, key)
case "eventName":
err = unpopulate(val, "EventName", &w.EventName)
delete(rawMsg, key)
case "eventTypeName":
err = unpopulate(val, "EventTypeName", &w.EventTypeName)
delete(rawMsg, key)
case "queryId":
err = unpopulate(val, "QueryID", &w.QueryID)
delete(rawMsg, key)
case "startTime":
err = unpopulateDateTimeRFC3339(val, "StartTime", &w.StartTime)
delete(rawMsg, key)
case "totalTimeInMs":
err = unpopulate(val, "TotalTimeInMs", &w.TotalTimeInMs)
delete(rawMsg, key)
case "userId":
err = unpopulate(val, "UserID", &w.UserID)
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 WaitStatisticsInput.
func (w WaitStatisticsInput) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "properties", w.Properties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticsInput.
func (w *WaitStatisticsInput) UnmarshalJSON(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 "properties":
err = unpopulate(val, "Properties", &w.Properties)
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 WaitStatisticsInputProperties.
func (w WaitStatisticsInputProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "aggregationWindow", w.AggregationWindow)
populateDateTimeRFC3339(objectMap, "observationEndTime", w.ObservationEndTime)
populateDateTimeRFC3339(objectMap, "observationStartTime", w.ObservationStartTime)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticsInputProperties.
func (w *WaitStatisticsInputProperties) UnmarshalJSON(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 "aggregationWindow":
err = unpopulate(val, "AggregationWindow", &w.AggregationWindow)
delete(rawMsg, key)
case "observationEndTime":
err = unpopulateDateTimeRFC3339(val, "ObservationEndTime", &w.ObservationEndTime)
delete(rawMsg, key)
case "observationStartTime":
err = unpopulateDateTimeRFC3339(val, "ObservationStartTime", &w.ObservationStartTime)
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 WaitStatisticsResultList.
func (w WaitStatisticsResultList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", w.NextLink)
populate(objectMap, "value", w.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type WaitStatisticsResultList.
func (w *WaitStatisticsResultList) UnmarshalJSON(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 "nextLink":
err = unpopulate(val, "NextLink", &w.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &w.Value)
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 {
return nil
}
if err := json.Unmarshal(data, v); err != nil {
return fmt.Errorf("struct field %s: %v", fn, err)
}
return nil
}