profile/p20200901/resourcemanager/databoxedge/armdataboxedge/models_serde.go (3,366 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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// DO NOT EDIT.
package armdataboxedge
import (
"encoding/json"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
)
// MarshalJSON implements the json.Marshaller interface for type ARMBaseModel.
func (a ARMBaseModel) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", a.ID)
populate(objectMap, "name", a.Name)
populate(objectMap, "type", a.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ARMBaseModel.
func (a *ARMBaseModel) UnmarshalJSON(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 "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 Address.
func (a Address) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "addressLine1", a.AddressLine1)
populate(objectMap, "addressLine2", a.AddressLine2)
populate(objectMap, "addressLine3", a.AddressLine3)
populate(objectMap, "city", a.City)
populate(objectMap, "country", a.Country)
populate(objectMap, "postalCode", a.PostalCode)
populate(objectMap, "state", a.State)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Address.
func (a *Address) UnmarshalJSON(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 "addressLine1":
err = unpopulate(val, "AddressLine1", &a.AddressLine1)
delete(rawMsg, key)
case "addressLine2":
err = unpopulate(val, "AddressLine2", &a.AddressLine2)
delete(rawMsg, key)
case "addressLine3":
err = unpopulate(val, "AddressLine3", &a.AddressLine3)
delete(rawMsg, key)
case "city":
err = unpopulate(val, "City", &a.City)
delete(rawMsg, key)
case "country":
err = unpopulate(val, "Country", &a.Country)
delete(rawMsg, key)
case "postalCode":
err = unpopulate(val, "PostalCode", &a.PostalCode)
delete(rawMsg, key)
case "state":
err = unpopulate(val, "State", &a.State)
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 Alert.
func (a Alert) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", a.ID)
populate(objectMap, "name", a.Name)
populate(objectMap, "properties", a.Properties)
populate(objectMap, "type", a.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Alert.
func (a *Alert) UnmarshalJSON(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 AlertErrorDetails.
func (a AlertErrorDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "errorCode", a.ErrorCode)
populate(objectMap, "errorMessage", a.ErrorMessage)
populate(objectMap, "occurrences", a.Occurrences)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type AlertErrorDetails.
func (a *AlertErrorDetails) UnmarshalJSON(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 "errorCode":
err = unpopulate(val, "ErrorCode", &a.ErrorCode)
delete(rawMsg, key)
case "errorMessage":
err = unpopulate(val, "ErrorMessage", &a.ErrorMessage)
delete(rawMsg, key)
case "occurrences":
err = unpopulate(val, "Occurrences", &a.Occurrences)
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 AlertList.
func (a AlertList) 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 AlertList.
func (a *AlertList) UnmarshalJSON(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 AlertProperties.
func (a AlertProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "alertType", a.AlertType)
populateTimeRFC3339(objectMap, "appearedAtDateTime", a.AppearedAtDateTime)
populate(objectMap, "detailedInformation", a.DetailedInformation)
populate(objectMap, "errorDetails", a.ErrorDetails)
populate(objectMap, "recommendation", a.Recommendation)
populate(objectMap, "severity", a.Severity)
populate(objectMap, "title", a.Title)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties.
func (a *AlertProperties) UnmarshalJSON(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 "alertType":
err = unpopulate(val, "AlertType", &a.AlertType)
delete(rawMsg, key)
case "appearedAtDateTime":
err = unpopulateTimeRFC3339(val, "AppearedAtDateTime", &a.AppearedAtDateTime)
delete(rawMsg, key)
case "detailedInformation":
err = unpopulate(val, "DetailedInformation", &a.DetailedInformation)
delete(rawMsg, key)
case "errorDetails":
err = unpopulate(val, "ErrorDetails", &a.ErrorDetails)
delete(rawMsg, key)
case "recommendation":
err = unpopulate(val, "Recommendation", &a.Recommendation)
delete(rawMsg, key)
case "severity":
err = unpopulate(val, "Severity", &a.Severity)
delete(rawMsg, key)
case "title":
err = unpopulate(val, "Title", &a.Title)
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 AsymmetricEncryptedSecret.
func (a AsymmetricEncryptedSecret) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "encryptionAlgorithm", a.EncryptionAlgorithm)
populate(objectMap, "encryptionCertThumbprint", a.EncryptionCertThumbprint)
populate(objectMap, "value", a.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type AsymmetricEncryptedSecret.
func (a *AsymmetricEncryptedSecret) UnmarshalJSON(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 "encryptionAlgorithm":
err = unpopulate(val, "EncryptionAlgorithm", &a.EncryptionAlgorithm)
delete(rawMsg, key)
case "encryptionCertThumbprint":
err = unpopulate(val, "EncryptionCertThumbprint", &a.EncryptionCertThumbprint)
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 Authentication.
func (a Authentication) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "symmetricKey", a.SymmetricKey)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Authentication.
func (a *Authentication) UnmarshalJSON(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 "symmetricKey":
err = unpopulate(val, "SymmetricKey", &a.SymmetricKey)
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 AzureContainerInfo.
func (a AzureContainerInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "containerName", a.ContainerName)
populate(objectMap, "dataFormat", a.DataFormat)
populate(objectMap, "storageAccountCredentialId", a.StorageAccountCredentialID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type AzureContainerInfo.
func (a *AzureContainerInfo) UnmarshalJSON(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 "containerName":
err = unpopulate(val, "ContainerName", &a.ContainerName)
delete(rawMsg, key)
case "dataFormat":
err = unpopulate(val, "DataFormat", &a.DataFormat)
delete(rawMsg, key)
case "storageAccountCredentialId":
err = unpopulate(val, "StorageAccountCredentialID", &a.StorageAccountCredentialID)
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 BandwidthSchedule.
func (b BandwidthSchedule) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", b.ID)
populate(objectMap, "name", b.Name)
populate(objectMap, "properties", b.Properties)
populate(objectMap, "type", b.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type BandwidthSchedule.
func (b *BandwidthSchedule) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &b.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &b.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &b.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &b.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type BandwidthScheduleProperties.
func (b BandwidthScheduleProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "days", b.Days)
populate(objectMap, "rateInMbps", b.RateInMbps)
populate(objectMap, "start", b.Start)
populate(objectMap, "stop", b.Stop)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type BandwidthScheduleProperties.
func (b *BandwidthScheduleProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "days":
err = unpopulate(val, "Days", &b.Days)
delete(rawMsg, key)
case "rateInMbps":
err = unpopulate(val, "RateInMbps", &b.RateInMbps)
delete(rawMsg, key)
case "start":
err = unpopulate(val, "Start", &b.Start)
delete(rawMsg, key)
case "stop":
err = unpopulate(val, "Stop", &b.Stop)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type BandwidthSchedulesList.
func (b BandwidthSchedulesList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", b.NextLink)
populate(objectMap, "value", b.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type BandwidthSchedulesList.
func (b *BandwidthSchedulesList) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &b.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &b.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ClientAccessRight.
func (c ClientAccessRight) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "accessPermission", c.AccessPermission)
populate(objectMap, "client", c.Client)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ClientAccessRight.
func (c *ClientAccessRight) UnmarshalJSON(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 "accessPermission":
err = unpopulate(val, "AccessPermission", &c.AccessPermission)
delete(rawMsg, key)
case "client":
err = unpopulate(val, "Client", &c.Client)
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 ContactDetails.
func (c ContactDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "companyName", c.CompanyName)
populate(objectMap, "contactPerson", c.ContactPerson)
populate(objectMap, "emailList", c.EmailList)
populate(objectMap, "phone", c.Phone)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ContactDetails.
func (c *ContactDetails) UnmarshalJSON(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 "companyName":
err = unpopulate(val, "CompanyName", &c.CompanyName)
delete(rawMsg, key)
case "contactPerson":
err = unpopulate(val, "ContactPerson", &c.ContactPerson)
delete(rawMsg, key)
case "emailList":
err = unpopulate(val, "EmailList", &c.EmailList)
delete(rawMsg, key)
case "phone":
err = unpopulate(val, "Phone", &c.Phone)
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 Container.
func (c Container) 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 Container.
func (c *Container) UnmarshalJSON(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 ContainerList.
func (c ContainerList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", c.NextLink)
populate(objectMap, "value", c.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerList.
func (c *ContainerList) UnmarshalJSON(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 "nextLink":
err = unpopulate(val, "NextLink", &c.NextLink)
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 ContainerProperties.
func (c ContainerProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "containerStatus", c.ContainerStatus)
populateTimeRFC3339(objectMap, "createdDateTime", c.CreatedDateTime)
populate(objectMap, "dataFormat", c.DataFormat)
populate(objectMap, "refreshDetails", c.RefreshDetails)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerProperties.
func (c *ContainerProperties) UnmarshalJSON(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 "containerStatus":
err = unpopulate(val, "ContainerStatus", &c.ContainerStatus)
delete(rawMsg, key)
case "createdDateTime":
err = unpopulateTimeRFC3339(val, "CreatedDateTime", &c.CreatedDateTime)
delete(rawMsg, key)
case "dataFormat":
err = unpopulate(val, "DataFormat", &c.DataFormat)
delete(rawMsg, key)
case "refreshDetails":
err = unpopulate(val, "RefreshDetails", &c.RefreshDetails)
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 Device.
func (d Device) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "etag", d.Etag)
populate(objectMap, "id", d.ID)
populate(objectMap, "location", d.Location)
populate(objectMap, "name", d.Name)
populate(objectMap, "properties", d.Properties)
populate(objectMap, "sku", d.SKU)
populate(objectMap, "tags", d.Tags)
populate(objectMap, "type", d.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Device.
func (d *Device) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "etag":
err = unpopulate(val, "Etag", &d.Etag)
delete(rawMsg, key)
case "id":
err = unpopulate(val, "ID", &d.ID)
delete(rawMsg, key)
case "location":
err = unpopulate(val, "Location", &d.Location)
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 "sku":
err = unpopulate(val, "SKU", &d.SKU)
delete(rawMsg, key)
case "tags":
err = unpopulate(val, "Tags", &d.Tags)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &d.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeviceExtendedInfo.
func (d DeviceExtendedInfo) 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 DeviceExtendedInfo.
func (d *DeviceExtendedInfo) UnmarshalJSON(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 DeviceExtendedInfoProperties.
func (d DeviceExtendedInfoProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "encryptionKey", d.EncryptionKey)
populate(objectMap, "encryptionKeyThumbprint", d.EncryptionKeyThumbprint)
populate(objectMap, "resourceKey", d.ResourceKey)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceExtendedInfoProperties.
func (d *DeviceExtendedInfoProperties) UnmarshalJSON(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 "encryptionKey":
err = unpopulate(val, "EncryptionKey", &d.EncryptionKey)
delete(rawMsg, key)
case "encryptionKeyThumbprint":
err = unpopulate(val, "EncryptionKeyThumbprint", &d.EncryptionKeyThumbprint)
delete(rawMsg, key)
case "resourceKey":
err = unpopulate(val, "ResourceKey", &d.ResourceKey)
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 DeviceList.
func (d DeviceList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", d.NextLink)
populate(objectMap, "value", d.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceList.
func (d *DeviceList) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &d.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &d.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DevicePatch.
func (d DevicePatch) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "tags", d.Tags)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DevicePatch.
func (d *DevicePatch) UnmarshalJSON(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 "tags":
err = unpopulate(val, "Tags", &d.Tags)
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 DeviceProperties.
func (d DeviceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "configuredRoleTypes", d.ConfiguredRoleTypes)
populate(objectMap, "culture", d.Culture)
populate(objectMap, "dataBoxEdgeDeviceStatus", d.DataBoxEdgeDeviceStatus)
populate(objectMap, "description", d.Description)
populate(objectMap, "deviceHcsVersion", d.DeviceHcsVersion)
populate(objectMap, "deviceLocalCapacity", d.DeviceLocalCapacity)
populate(objectMap, "deviceModel", d.DeviceModel)
populate(objectMap, "deviceSoftwareVersion", d.DeviceSoftwareVersion)
populate(objectMap, "deviceType", d.DeviceType)
populate(objectMap, "friendlyName", d.FriendlyName)
populate(objectMap, "modelDescription", d.ModelDescription)
populate(objectMap, "nodeCount", d.NodeCount)
populate(objectMap, "serialNumber", d.SerialNumber)
populate(objectMap, "timeZone", d.TimeZone)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceProperties.
func (d *DeviceProperties) UnmarshalJSON(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 "configuredRoleTypes":
err = unpopulate(val, "ConfiguredRoleTypes", &d.ConfiguredRoleTypes)
delete(rawMsg, key)
case "culture":
err = unpopulate(val, "Culture", &d.Culture)
delete(rawMsg, key)
case "dataBoxEdgeDeviceStatus":
err = unpopulate(val, "DataBoxEdgeDeviceStatus", &d.DataBoxEdgeDeviceStatus)
delete(rawMsg, key)
case "description":
err = unpopulate(val, "Description", &d.Description)
delete(rawMsg, key)
case "deviceHcsVersion":
err = unpopulate(val, "DeviceHcsVersion", &d.DeviceHcsVersion)
delete(rawMsg, key)
case "deviceLocalCapacity":
err = unpopulate(val, "DeviceLocalCapacity", &d.DeviceLocalCapacity)
delete(rawMsg, key)
case "deviceModel":
err = unpopulate(val, "DeviceModel", &d.DeviceModel)
delete(rawMsg, key)
case "deviceSoftwareVersion":
err = unpopulate(val, "DeviceSoftwareVersion", &d.DeviceSoftwareVersion)
delete(rawMsg, key)
case "deviceType":
err = unpopulate(val, "DeviceType", &d.DeviceType)
delete(rawMsg, key)
case "friendlyName":
err = unpopulate(val, "FriendlyName", &d.FriendlyName)
delete(rawMsg, key)
case "modelDescription":
err = unpopulate(val, "ModelDescription", &d.ModelDescription)
delete(rawMsg, key)
case "nodeCount":
err = unpopulate(val, "NodeCount", &d.NodeCount)
delete(rawMsg, key)
case "serialNumber":
err = unpopulate(val, "SerialNumber", &d.SerialNumber)
delete(rawMsg, key)
case "timeZone":
err = unpopulate(val, "TimeZone", &d.TimeZone)
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 FileEventTrigger.
func (f FileEventTrigger) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", f.ID)
objectMap["kind"] = TriggerEventTypeFileEvent
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 FileEventTrigger.
func (f *FileEventTrigger) UnmarshalJSON(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 "kind":
err = unpopulate(val, "Kind", &f.Kind)
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 FileSourceInfo.
func (f FileSourceInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "shareId", f.ShareID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type FileSourceInfo.
func (f *FileSourceInfo) UnmarshalJSON(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 "shareId":
err = unpopulate(val, "ShareID", &f.ShareID)
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 FileTriggerProperties.
func (f FileTriggerProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "customContextTag", f.CustomContextTag)
populate(objectMap, "sinkInfo", f.SinkInfo)
populate(objectMap, "sourceInfo", f.SourceInfo)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type FileTriggerProperties.
func (f *FileTriggerProperties) UnmarshalJSON(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 "customContextTag":
err = unpopulate(val, "CustomContextTag", &f.CustomContextTag)
delete(rawMsg, key)
case "sinkInfo":
err = unpopulate(val, "SinkInfo", &f.SinkInfo)
delete(rawMsg, key)
case "sourceInfo":
err = unpopulate(val, "SourceInfo", &f.SourceInfo)
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 IPv4Config.
func (i IPv4Config) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "gateway", i.Gateway)
populate(objectMap, "ipAddress", i.IPAddress)
populate(objectMap, "subnet", i.Subnet)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type IPv4Config.
func (i *IPv4Config) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "gateway":
err = unpopulate(val, "Gateway", &i.Gateway)
delete(rawMsg, key)
case "ipAddress":
err = unpopulate(val, "IPAddress", &i.IPAddress)
delete(rawMsg, key)
case "subnet":
err = unpopulate(val, "Subnet", &i.Subnet)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type IPv6Config.
func (i IPv6Config) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "gateway", i.Gateway)
populate(objectMap, "ipAddress", i.IPAddress)
populate(objectMap, "prefixLength", i.PrefixLength)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type IPv6Config.
func (i *IPv6Config) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "gateway":
err = unpopulate(val, "Gateway", &i.Gateway)
delete(rawMsg, key)
case "ipAddress":
err = unpopulate(val, "IPAddress", &i.IPAddress)
delete(rawMsg, key)
case "prefixLength":
err = unpopulate(val, "PrefixLength", &i.PrefixLength)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type IoTDeviceInfo.
func (i IoTDeviceInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "authentication", i.Authentication)
populate(objectMap, "deviceId", i.DeviceID)
populate(objectMap, "ioTHostHub", i.IoTHostHub)
populate(objectMap, "ioTHostHubId", i.IoTHostHubID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDeviceInfo.
func (i *IoTDeviceInfo) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "authentication":
err = unpopulate(val, "Authentication", &i.Authentication)
delete(rawMsg, key)
case "deviceId":
err = unpopulate(val, "DeviceID", &i.DeviceID)
delete(rawMsg, key)
case "ioTHostHub":
err = unpopulate(val, "IoTHostHub", &i.IoTHostHub)
delete(rawMsg, key)
case "ioTHostHubId":
err = unpopulate(val, "IoTHostHubID", &i.IoTHostHubID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type IoTRole.
func (i IoTRole) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", i.ID)
objectMap["kind"] = RoleTypesIOT
populate(objectMap, "name", i.Name)
populate(objectMap, "properties", i.Properties)
populate(objectMap, "type", i.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type IoTRole.
func (i *IoTRole) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &i.ID)
delete(rawMsg, key)
case "kind":
err = unpopulate(val, "Kind", &i.Kind)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &i.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &i.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &i.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type IoTRoleProperties.
func (i IoTRoleProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "hostPlatform", i.HostPlatform)
populate(objectMap, "ioTDeviceDetails", i.IoTDeviceDetails)
populate(objectMap, "ioTEdgeDeviceDetails", i.IoTEdgeDeviceDetails)
populate(objectMap, "roleStatus", i.RoleStatus)
populate(objectMap, "shareMappings", i.ShareMappings)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type IoTRoleProperties.
func (i *IoTRoleProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "hostPlatform":
err = unpopulate(val, "HostPlatform", &i.HostPlatform)
delete(rawMsg, key)
case "ioTDeviceDetails":
err = unpopulate(val, "IoTDeviceDetails", &i.IoTDeviceDetails)
delete(rawMsg, key)
case "ioTEdgeDeviceDetails":
err = unpopulate(val, "IoTEdgeDeviceDetails", &i.IoTEdgeDeviceDetails)
delete(rawMsg, key)
case "roleStatus":
err = unpopulate(val, "RoleStatus", &i.RoleStatus)
delete(rawMsg, key)
case "shareMappings":
err = unpopulate(val, "ShareMappings", &i.ShareMappings)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type Job.
func (j Job) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populateTimeRFC3339(objectMap, "endTime", j.EndTime)
populate(objectMap, "error", j.Error)
populate(objectMap, "id", j.ID)
populate(objectMap, "name", j.Name)
populate(objectMap, "percentComplete", j.PercentComplete)
populate(objectMap, "properties", j.Properties)
populateTimeRFC3339(objectMap, "startTime", j.StartTime)
populate(objectMap, "status", j.Status)
populate(objectMap, "type", j.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Job.
func (j *Job) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "endTime":
err = unpopulateTimeRFC3339(val, "EndTime", &j.EndTime)
delete(rawMsg, key)
case "error":
err = unpopulate(val, "Error", &j.Error)
delete(rawMsg, key)
case "id":
err = unpopulate(val, "ID", &j.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &j.Name)
delete(rawMsg, key)
case "percentComplete":
err = unpopulate(val, "PercentComplete", &j.PercentComplete)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &j.Properties)
delete(rawMsg, key)
case "startTime":
err = unpopulateTimeRFC3339(val, "StartTime", &j.StartTime)
delete(rawMsg, key)
case "status":
err = unpopulate(val, "Status", &j.Status)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &j.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type JobErrorDetails.
func (j JobErrorDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "code", j.Code)
populate(objectMap, "errorDetails", j.ErrorDetails)
populate(objectMap, "message", j.Message)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type JobErrorDetails.
func (j *JobErrorDetails) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "code":
err = unpopulate(val, "Code", &j.Code)
delete(rawMsg, key)
case "errorDetails":
err = unpopulate(val, "ErrorDetails", &j.ErrorDetails)
delete(rawMsg, key)
case "message":
err = unpopulate(val, "Message", &j.Message)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type JobErrorItem.
func (j JobErrorItem) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "code", j.Code)
populate(objectMap, "message", j.Message)
populate(objectMap, "recommendations", j.Recommendations)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type JobErrorItem.
func (j *JobErrorItem) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "code":
err = unpopulate(val, "Code", &j.Code)
delete(rawMsg, key)
case "message":
err = unpopulate(val, "Message", &j.Message)
delete(rawMsg, key)
case "recommendations":
err = unpopulate(val, "Recommendations", &j.Recommendations)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type JobProperties.
func (j JobProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "currentStage", j.CurrentStage)
populate(objectMap, "downloadProgress", j.DownloadProgress)
populate(objectMap, "errorManifestFile", j.ErrorManifestFile)
populate(objectMap, "folder", j.Folder)
populate(objectMap, "installProgress", j.InstallProgress)
populate(objectMap, "jobType", j.JobType)
populate(objectMap, "refreshedEntityId", j.RefreshedEntityID)
populate(objectMap, "totalRefreshErrors", j.TotalRefreshErrors)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties.
func (j *JobProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "currentStage":
err = unpopulate(val, "CurrentStage", &j.CurrentStage)
delete(rawMsg, key)
case "downloadProgress":
err = unpopulate(val, "DownloadProgress", &j.DownloadProgress)
delete(rawMsg, key)
case "errorManifestFile":
err = unpopulate(val, "ErrorManifestFile", &j.ErrorManifestFile)
delete(rawMsg, key)
case "folder":
err = unpopulate(val, "Folder", &j.Folder)
delete(rawMsg, key)
case "installProgress":
err = unpopulate(val, "InstallProgress", &j.InstallProgress)
delete(rawMsg, key)
case "jobType":
err = unpopulate(val, "JobType", &j.JobType)
delete(rawMsg, key)
case "refreshedEntityId":
err = unpopulate(val, "RefreshedEntityID", &j.RefreshedEntityID)
delete(rawMsg, key)
case "totalRefreshErrors":
err = unpopulate(val, "TotalRefreshErrors", &j.TotalRefreshErrors)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", j, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MetricDimensionV1.
func (m MetricDimensionV1) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "displayName", m.DisplayName)
populate(objectMap, "name", m.Name)
populate(objectMap, "toBeExportedForShoebox", m.ToBeExportedForShoebox)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDimensionV1.
func (m *MetricDimensionV1) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "displayName":
err = unpopulate(val, "DisplayName", &m.DisplayName)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &m.Name)
delete(rawMsg, key)
case "toBeExportedForShoebox":
err = unpopulate(val, "ToBeExportedForShoebox", &m.ToBeExportedForShoebox)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MetricSpecificationV1.
func (m MetricSpecificationV1) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "aggregationType", m.AggregationType)
populate(objectMap, "category", m.Category)
populate(objectMap, "dimensions", m.Dimensions)
populate(objectMap, "displayDescription", m.DisplayDescription)
populate(objectMap, "displayName", m.DisplayName)
populate(objectMap, "fillGapWithZero", m.FillGapWithZero)
populate(objectMap, "name", m.Name)
populate(objectMap, "resourceIdDimensionNameOverride", m.ResourceIDDimensionNameOverride)
populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes)
populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes)
populate(objectMap, "unit", m.Unit)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSpecificationV1.
func (m *MetricSpecificationV1) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "aggregationType":
err = unpopulate(val, "AggregationType", &m.AggregationType)
delete(rawMsg, key)
case "category":
err = unpopulate(val, "Category", &m.Category)
delete(rawMsg, key)
case "dimensions":
err = unpopulate(val, "Dimensions", &m.Dimensions)
delete(rawMsg, key)
case "displayDescription":
err = unpopulate(val, "DisplayDescription", &m.DisplayDescription)
delete(rawMsg, key)
case "displayName":
err = unpopulate(val, "DisplayName", &m.DisplayName)
delete(rawMsg, key)
case "fillGapWithZero":
err = unpopulate(val, "FillGapWithZero", &m.FillGapWithZero)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &m.Name)
delete(rawMsg, key)
case "resourceIdDimensionNameOverride":
err = unpopulate(val, "ResourceIDDimensionNameOverride", &m.ResourceIDDimensionNameOverride)
delete(rawMsg, key)
case "supportedAggregationTypes":
err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes)
delete(rawMsg, key)
case "supportedTimeGrainTypes":
err = unpopulate(val, "SupportedTimeGrainTypes", &m.SupportedTimeGrainTypes)
delete(rawMsg, key)
case "unit":
err = unpopulate(val, "Unit", &m.Unit)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MountPointMap.
func (m MountPointMap) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "mountPoint", m.MountPoint)
populate(objectMap, "roleId", m.RoleID)
populate(objectMap, "roleType", m.RoleType)
populate(objectMap, "shareId", m.ShareID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MountPointMap.
func (m *MountPointMap) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "mountPoint":
err = unpopulate(val, "MountPoint", &m.MountPoint)
delete(rawMsg, key)
case "roleId":
err = unpopulate(val, "RoleID", &m.RoleID)
delete(rawMsg, key)
case "roleType":
err = unpopulate(val, "RoleType", &m.RoleType)
delete(rawMsg, key)
case "shareId":
err = unpopulate(val, "ShareID", &m.ShareID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type NetworkAdapter.
func (n NetworkAdapter) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "adapterId", n.AdapterID)
populate(objectMap, "adapterPosition", n.AdapterPosition)
populate(objectMap, "dnsServers", n.DNSServers)
populate(objectMap, "dhcpStatus", n.DhcpStatus)
populate(objectMap, "ipv4Configuration", n.IPv4Configuration)
populate(objectMap, "ipv6Configuration", n.IPv6Configuration)
populate(objectMap, "ipv6LinkLocalAddress", n.IPv6LinkLocalAddress)
populate(objectMap, "index", n.Index)
populate(objectMap, "label", n.Label)
populate(objectMap, "linkSpeed", n.LinkSpeed)
populate(objectMap, "macAddress", n.MacAddress)
populate(objectMap, "networkAdapterName", n.NetworkAdapterName)
populate(objectMap, "nodeId", n.NodeID)
populate(objectMap, "rdmaStatus", n.RdmaStatus)
populate(objectMap, "status", n.Status)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkAdapter.
func (n *NetworkAdapter) UnmarshalJSON(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 "adapterId":
err = unpopulate(val, "AdapterID", &n.AdapterID)
delete(rawMsg, key)
case "adapterPosition":
err = unpopulate(val, "AdapterPosition", &n.AdapterPosition)
delete(rawMsg, key)
case "dnsServers":
err = unpopulate(val, "DNSServers", &n.DNSServers)
delete(rawMsg, key)
case "dhcpStatus":
err = unpopulate(val, "DhcpStatus", &n.DhcpStatus)
delete(rawMsg, key)
case "ipv4Configuration":
err = unpopulate(val, "IPv4Configuration", &n.IPv4Configuration)
delete(rawMsg, key)
case "ipv6Configuration":
err = unpopulate(val, "IPv6Configuration", &n.IPv6Configuration)
delete(rawMsg, key)
case "ipv6LinkLocalAddress":
err = unpopulate(val, "IPv6LinkLocalAddress", &n.IPv6LinkLocalAddress)
delete(rawMsg, key)
case "index":
err = unpopulate(val, "Index", &n.Index)
delete(rawMsg, key)
case "label":
err = unpopulate(val, "Label", &n.Label)
delete(rawMsg, key)
case "linkSpeed":
err = unpopulate(val, "LinkSpeed", &n.LinkSpeed)
delete(rawMsg, key)
case "macAddress":
err = unpopulate(val, "MacAddress", &n.MacAddress)
delete(rawMsg, key)
case "networkAdapterName":
err = unpopulate(val, "NetworkAdapterName", &n.NetworkAdapterName)
delete(rawMsg, key)
case "nodeId":
err = unpopulate(val, "NodeID", &n.NodeID)
delete(rawMsg, key)
case "rdmaStatus":
err = unpopulate(val, "RdmaStatus", &n.RdmaStatus)
delete(rawMsg, key)
case "status":
err = unpopulate(val, "Status", &n.Status)
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 NetworkAdapterPosition.
func (n NetworkAdapterPosition) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "networkGroup", n.NetworkGroup)
populate(objectMap, "port", n.Port)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkAdapterPosition.
func (n *NetworkAdapterPosition) UnmarshalJSON(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 "networkGroup":
err = unpopulate(val, "NetworkGroup", &n.NetworkGroup)
delete(rawMsg, key)
case "port":
err = unpopulate(val, "Port", &n.Port)
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 NetworkSettings.
func (n NetworkSettings) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", n.ID)
populate(objectMap, "name", n.Name)
populate(objectMap, "properties", n.Properties)
populate(objectMap, "type", n.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSettings.
func (n *NetworkSettings) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &n.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &n.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &n.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &n.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type NetworkSettingsProperties.
func (n NetworkSettingsProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "networkAdapters", n.NetworkAdapters)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSettingsProperties.
func (n *NetworkSettingsProperties) UnmarshalJSON(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 "networkAdapters":
err = unpopulate(val, "NetworkAdapters", &n.NetworkAdapters)
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 Node.
func (n Node) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", n.ID)
populate(objectMap, "name", n.Name)
populate(objectMap, "properties", n.Properties)
populate(objectMap, "type", n.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Node.
func (n *Node) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &n.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &n.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &n.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &n.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type NodeList.
func (n NodeList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "value", n.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NodeList.
func (n *NodeList) UnmarshalJSON(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 "value":
err = unpopulate(val, "Value", &n.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", n, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type NodeProperties.
func (n NodeProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nodeChassisSerialNumber", n.NodeChassisSerialNumber)
populate(objectMap, "nodeDisplayName", n.NodeDisplayName)
populate(objectMap, "nodeFriendlySoftwareVersion", n.NodeFriendlySoftwareVersion)
populate(objectMap, "nodeHcsVersion", n.NodeHcsVersion)
populate(objectMap, "nodeInstanceId", n.NodeInstanceID)
populate(objectMap, "nodeSerialNumber", n.NodeSerialNumber)
populate(objectMap, "nodeStatus", n.NodeStatus)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type NodeProperties.
func (n *NodeProperties) UnmarshalJSON(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 "nodeChassisSerialNumber":
err = unpopulate(val, "NodeChassisSerialNumber", &n.NodeChassisSerialNumber)
delete(rawMsg, key)
case "nodeDisplayName":
err = unpopulate(val, "NodeDisplayName", &n.NodeDisplayName)
delete(rawMsg, key)
case "nodeFriendlySoftwareVersion":
err = unpopulate(val, "NodeFriendlySoftwareVersion", &n.NodeFriendlySoftwareVersion)
delete(rawMsg, key)
case "nodeHcsVersion":
err = unpopulate(val, "NodeHcsVersion", &n.NodeHcsVersion)
delete(rawMsg, key)
case "nodeInstanceId":
err = unpopulate(val, "NodeInstanceID", &n.NodeInstanceID)
delete(rawMsg, key)
case "nodeSerialNumber":
err = unpopulate(val, "NodeSerialNumber", &n.NodeSerialNumber)
delete(rawMsg, key)
case "nodeStatus":
err = unpopulate(val, "NodeStatus", &n.NodeStatus)
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 OperationProperties.
func (o OperationProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "serviceSpecification", o.ServiceSpecification)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties.
func (o *OperationProperties) UnmarshalJSON(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 "serviceSpecification":
err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification)
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 OperationsList.
func (o OperationsList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", o.NextLink)
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList.
func (o *OperationsList) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &o.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &o.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type Order.
func (o Order) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", o.ID)
populate(objectMap, "name", o.Name)
populate(objectMap, "properties", o.Properties)
populate(objectMap, "type", o.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Order.
func (o *Order) UnmarshalJSON(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 "id":
err = unpopulate(val, "ID", &o.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &o.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &o.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &o.Type)
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 OrderList.
func (o OrderList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", o.NextLink)
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OrderList.
func (o *OrderList) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &o.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &o.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OrderProperties.
func (o OrderProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "contactInformation", o.ContactInformation)
populate(objectMap, "currentStatus", o.CurrentStatus)
populate(objectMap, "deliveryTrackingInfo", o.DeliveryTrackingInfo)
populate(objectMap, "orderHistory", o.OrderHistory)
populate(objectMap, "returnTrackingInfo", o.ReturnTrackingInfo)
populate(objectMap, "serialNumber", o.SerialNumber)
populate(objectMap, "shippingAddress", o.ShippingAddress)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OrderProperties.
func (o *OrderProperties) UnmarshalJSON(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 "contactInformation":
err = unpopulate(val, "ContactInformation", &o.ContactInformation)
delete(rawMsg, key)
case "currentStatus":
err = unpopulate(val, "CurrentStatus", &o.CurrentStatus)
delete(rawMsg, key)
case "deliveryTrackingInfo":
err = unpopulate(val, "DeliveryTrackingInfo", &o.DeliveryTrackingInfo)
delete(rawMsg, key)
case "orderHistory":
err = unpopulate(val, "OrderHistory", &o.OrderHistory)
delete(rawMsg, key)
case "returnTrackingInfo":
err = unpopulate(val, "ReturnTrackingInfo", &o.ReturnTrackingInfo)
delete(rawMsg, key)
case "serialNumber":
err = unpopulate(val, "SerialNumber", &o.SerialNumber)
delete(rawMsg, key)
case "shippingAddress":
err = unpopulate(val, "ShippingAddress", &o.ShippingAddress)
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 OrderStatus.
func (o OrderStatus) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "additionalOrderDetails", o.AdditionalOrderDetails)
populate(objectMap, "comments", o.Comments)
populate(objectMap, "status", o.Status)
populateTimeRFC3339(objectMap, "updateDateTime", o.UpdateDateTime)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OrderStatus.
func (o *OrderStatus) UnmarshalJSON(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 "additionalOrderDetails":
err = unpopulate(val, "AdditionalOrderDetails", &o.AdditionalOrderDetails)
delete(rawMsg, key)
case "comments":
err = unpopulate(val, "Comments", &o.Comments)
delete(rawMsg, key)
case "status":
err = unpopulate(val, "Status", &o.Status)
delete(rawMsg, key)
case "updateDateTime":
err = unpopulateTimeRFC3339(val, "UpdateDateTime", &o.UpdateDateTime)
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 PeriodicTimerEventTrigger.
func (p PeriodicTimerEventTrigger) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", p.ID)
objectMap["kind"] = TriggerEventTypePeriodicTimerEvent
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 PeriodicTimerEventTrigger.
func (p *PeriodicTimerEventTrigger) UnmarshalJSON(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 "kind":
err = unpopulate(val, "Kind", &p.Kind)
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 PeriodicTimerProperties.
func (p PeriodicTimerProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "customContextTag", p.CustomContextTag)
populate(objectMap, "sinkInfo", p.SinkInfo)
populate(objectMap, "sourceInfo", p.SourceInfo)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicTimerProperties.
func (p *PeriodicTimerProperties) UnmarshalJSON(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 "customContextTag":
err = unpopulate(val, "CustomContextTag", &p.CustomContextTag)
delete(rawMsg, key)
case "sinkInfo":
err = unpopulate(val, "SinkInfo", &p.SinkInfo)
delete(rawMsg, key)
case "sourceInfo":
err = unpopulate(val, "SourceInfo", &p.SourceInfo)
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 PeriodicTimerSourceInfo.
func (p PeriodicTimerSourceInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "schedule", p.Schedule)
populateTimeRFC3339(objectMap, "startTime", p.StartTime)
populate(objectMap, "topic", p.Topic)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicTimerSourceInfo.
func (p *PeriodicTimerSourceInfo) UnmarshalJSON(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 "schedule":
err = unpopulate(val, "Schedule", &p.Schedule)
delete(rawMsg, key)
case "startTime":
err = unpopulateTimeRFC3339(val, "StartTime", &p.StartTime)
delete(rawMsg, key)
case "topic":
err = unpopulate(val, "Topic", &p.Topic)
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 RawCertificateData.
func (r RawCertificateData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "authenticationType", r.AuthenticationType)
populate(objectMap, "certificate", r.Certificate)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type RawCertificateData.
func (r *RawCertificateData) UnmarshalJSON(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 "authenticationType":
err = unpopulate(val, "AuthenticationType", &r.AuthenticationType)
delete(rawMsg, key)
case "certificate":
err = unpopulate(val, "Certificate", &r.Certificate)
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 RefreshDetails.
func (r RefreshDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "errorManifestFile", r.ErrorManifestFile)
populate(objectMap, "inProgressRefreshJobId", r.InProgressRefreshJobID)
populateTimeRFC3339(objectMap, "lastCompletedRefreshJobTimeInUTC", r.LastCompletedRefreshJobTimeInUTC)
populate(objectMap, "lastJob", r.LastJob)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type RefreshDetails.
func (r *RefreshDetails) UnmarshalJSON(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 "errorManifestFile":
err = unpopulate(val, "ErrorManifestFile", &r.ErrorManifestFile)
delete(rawMsg, key)
case "inProgressRefreshJobId":
err = unpopulate(val, "InProgressRefreshJobID", &r.InProgressRefreshJobID)
delete(rawMsg, key)
case "lastCompletedRefreshJobTimeInUTC":
err = unpopulateTimeRFC3339(val, "LastCompletedRefreshJobTimeInUTC", &r.LastCompletedRefreshJobTimeInUTC)
delete(rawMsg, key)
case "lastJob":
err = unpopulate(val, "LastJob", &r.LastJob)
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 ResourceTypeSKU.
func (r ResourceTypeSKU) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "apiVersions", r.APIVersions)
populate(objectMap, "costs", r.Costs)
populate(objectMap, "family", r.Family)
populate(objectMap, "kind", r.Kind)
populate(objectMap, "locationInfo", r.LocationInfo)
populate(objectMap, "locations", r.Locations)
populate(objectMap, "name", r.Name)
populate(objectMap, "resourceType", r.ResourceType)
populate(objectMap, "restrictions", r.Restrictions)
populate(objectMap, "tier", r.Tier)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceTypeSKU.
func (r *ResourceTypeSKU) UnmarshalJSON(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 "apiVersions":
err = unpopulate(val, "APIVersions", &r.APIVersions)
delete(rawMsg, key)
case "costs":
err = unpopulate(val, "Costs", &r.Costs)
delete(rawMsg, key)
case "family":
err = unpopulate(val, "Family", &r.Family)
delete(rawMsg, key)
case "kind":
err = unpopulate(val, "Kind", &r.Kind)
delete(rawMsg, key)
case "locationInfo":
err = unpopulate(val, "LocationInfo", &r.LocationInfo)
delete(rawMsg, key)
case "locations":
err = unpopulate(val, "Locations", &r.Locations)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &r.Name)
delete(rawMsg, key)
case "resourceType":
err = unpopulate(val, "ResourceType", &r.ResourceType)
delete(rawMsg, key)
case "restrictions":
err = unpopulate(val, "Restrictions", &r.Restrictions)
delete(rawMsg, key)
case "tier":
err = unpopulate(val, "Tier", &r.Tier)
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 Role.
func (r Role) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", r.ID)
objectMap["kind"] = r.Kind
populate(objectMap, "name", r.Name)
populate(objectMap, "type", r.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Role.
func (r *Role) UnmarshalJSON(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 "kind":
err = unpopulate(val, "Kind", &r.Kind)
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 RoleList.
func (r RoleList) 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 RoleList.
func (r *RoleList) UnmarshalJSON(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":
r.Value, err = unmarshalRoleClassificationArray(val)
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 RoleSinkInfo.
func (r RoleSinkInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "roleId", r.RoleID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type RoleSinkInfo.
func (r *RoleSinkInfo) UnmarshalJSON(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 "roleId":
err = unpopulate(val, "RoleID", &r.RoleID)
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 SKUCost.
func (s SKUCost) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "extendedUnit", s.ExtendedUnit)
populate(objectMap, "meterId", s.MeterID)
populate(objectMap, "quantity", s.Quantity)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCost.
func (s *SKUCost) UnmarshalJSON(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 "extendedUnit":
err = unpopulate(val, "ExtendedUnit", &s.ExtendedUnit)
delete(rawMsg, key)
case "meterId":
err = unpopulate(val, "MeterID", &s.MeterID)
delete(rawMsg, key)
case "quantity":
err = unpopulate(val, "Quantity", &s.Quantity)
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 SKUInfo.
func (s SKUInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "name", s.Name)
populate(objectMap, "tier", s.Tier)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SKUInfo.
func (s *SKUInfo) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", s, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "name":
err = unpopulate(val, "Name", &s.Name)
delete(rawMsg, key)
case "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 SKUInformationList.
func (s SKUInformationList) 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 SKUInformationList.
func (s *SKUInformationList) UnmarshalJSON(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 SKULocationInfo.
func (s SKULocationInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "location", s.Location)
populate(objectMap, "sites", s.Sites)
populate(objectMap, "zones", s.Zones)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SKULocationInfo.
func (s *SKULocationInfo) UnmarshalJSON(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 "sites":
err = unpopulate(val, "Sites", &s.Sites)
delete(rawMsg, key)
case "zones":
err = unpopulate(val, "Zones", &s.Zones)
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 SKURestriction.
func (s SKURestriction) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "reasonCode", s.ReasonCode)
populate(objectMap, "restrictionInfo", s.RestrictionInfo)
populate(objectMap, "type", s.Type)
populate(objectMap, "values", s.Values)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SKURestriction.
func (s *SKURestriction) UnmarshalJSON(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 "reasonCode":
err = unpopulate(val, "ReasonCode", &s.ReasonCode)
delete(rawMsg, key)
case "restrictionInfo":
err = unpopulate(val, "RestrictionInfo", &s.RestrictionInfo)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &s.Type)
delete(rawMsg, key)
case "values":
err = unpopulate(val, "Values", &s.Values)
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 SKURestrictionInfo.
func (s SKURestrictionInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "locations", s.Locations)
populate(objectMap, "zones", s.Zones)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SKURestrictionInfo.
func (s *SKURestrictionInfo) UnmarshalJSON(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 "locations":
err = unpopulate(val, "Locations", &s.Locations)
delete(rawMsg, key)
case "zones":
err = unpopulate(val, "Zones", &s.Zones)
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 SecuritySettings.
func (s SecuritySettings) 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 SecuritySettings.
func (s *SecuritySettings) UnmarshalJSON(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 SecuritySettingsProperties.
func (s SecuritySettingsProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "deviceAdminPassword", s.DeviceAdminPassword)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySettingsProperties.
func (s *SecuritySettingsProperties) UnmarshalJSON(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 "deviceAdminPassword":
err = unpopulate(val, "DeviceAdminPassword", &s.DeviceAdminPassword)
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 ServiceSpecification.
func (s ServiceSpecification) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "metricSpecifications", s.MetricSpecifications)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceSpecification.
func (s *ServiceSpecification) UnmarshalJSON(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 "metricSpecifications":
err = unpopulate(val, "MetricSpecifications", &s.MetricSpecifications)
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 Share.
func (s Share) 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 Share.
func (s *Share) UnmarshalJSON(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 ShareAccessRight.
func (s ShareAccessRight) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "accessType", s.AccessType)
populate(objectMap, "shareId", s.ShareID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ShareAccessRight.
func (s *ShareAccessRight) UnmarshalJSON(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 "accessType":
err = unpopulate(val, "AccessType", &s.AccessType)
delete(rawMsg, key)
case "shareId":
err = unpopulate(val, "ShareID", &s.ShareID)
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 ShareList.
func (s ShareList) 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 ShareList.
func (s *ShareList) UnmarshalJSON(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 ShareProperties.
func (s ShareProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "accessProtocol", s.AccessProtocol)
populate(objectMap, "azureContainerInfo", s.AzureContainerInfo)
populate(objectMap, "clientAccessRights", s.ClientAccessRights)
populate(objectMap, "dataPolicy", s.DataPolicy)
populate(objectMap, "description", s.Description)
populate(objectMap, "monitoringStatus", s.MonitoringStatus)
populate(objectMap, "refreshDetails", s.RefreshDetails)
populate(objectMap, "shareMappings", s.ShareMappings)
populate(objectMap, "shareStatus", s.ShareStatus)
populate(objectMap, "userAccessRights", s.UserAccessRights)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ShareProperties.
func (s *ShareProperties) UnmarshalJSON(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 "accessProtocol":
err = unpopulate(val, "AccessProtocol", &s.AccessProtocol)
delete(rawMsg, key)
case "azureContainerInfo":
err = unpopulate(val, "AzureContainerInfo", &s.AzureContainerInfo)
delete(rawMsg, key)
case "clientAccessRights":
err = unpopulate(val, "ClientAccessRights", &s.ClientAccessRights)
delete(rawMsg, key)
case "dataPolicy":
err = unpopulate(val, "DataPolicy", &s.DataPolicy)
delete(rawMsg, key)
case "description":
err = unpopulate(val, "Description", &s.Description)
delete(rawMsg, key)
case "monitoringStatus":
err = unpopulate(val, "MonitoringStatus", &s.MonitoringStatus)
delete(rawMsg, key)
case "refreshDetails":
err = unpopulate(val, "RefreshDetails", &s.RefreshDetails)
delete(rawMsg, key)
case "shareMappings":
err = unpopulate(val, "ShareMappings", &s.ShareMappings)
delete(rawMsg, key)
case "shareStatus":
err = unpopulate(val, "ShareStatus", &s.ShareStatus)
delete(rawMsg, key)
case "userAccessRights":
err = unpopulate(val, "UserAccessRights", &s.UserAccessRights)
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 StorageAccount.
func (s StorageAccount) 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 StorageAccount.
func (s *StorageAccount) UnmarshalJSON(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 StorageAccountCredential.
func (s StorageAccountCredential) 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 StorageAccountCredential.
func (s *StorageAccountCredential) UnmarshalJSON(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 StorageAccountCredentialList.
func (s StorageAccountCredentialList) 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 StorageAccountCredentialList.
func (s *StorageAccountCredentialList) UnmarshalJSON(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 StorageAccountCredentialProperties.
func (s StorageAccountCredentialProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "accountKey", s.AccountKey)
populate(objectMap, "accountType", s.AccountType)
populate(objectMap, "alias", s.Alias)
populate(objectMap, "blobDomainName", s.BlobDomainName)
populate(objectMap, "connectionString", s.ConnectionString)
populate(objectMap, "sslStatus", s.SSLStatus)
populate(objectMap, "storageAccountId", s.StorageAccountID)
populate(objectMap, "userName", s.UserName)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountCredentialProperties.
func (s *StorageAccountCredentialProperties) UnmarshalJSON(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 "accountKey":
err = unpopulate(val, "AccountKey", &s.AccountKey)
delete(rawMsg, key)
case "accountType":
err = unpopulate(val, "AccountType", &s.AccountType)
delete(rawMsg, key)
case "alias":
err = unpopulate(val, "Alias", &s.Alias)
delete(rawMsg, key)
case "blobDomainName":
err = unpopulate(val, "BlobDomainName", &s.BlobDomainName)
delete(rawMsg, key)
case "connectionString":
err = unpopulate(val, "ConnectionString", &s.ConnectionString)
delete(rawMsg, key)
case "sslStatus":
err = unpopulate(val, "SSLStatus", &s.SSLStatus)
delete(rawMsg, key)
case "storageAccountId":
err = unpopulate(val, "StorageAccountID", &s.StorageAccountID)
delete(rawMsg, key)
case "userName":
err = unpopulate(val, "UserName", &s.UserName)
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 StorageAccountList.
func (s StorageAccountList) 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 StorageAccountList.
func (s *StorageAccountList) UnmarshalJSON(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 StorageAccountProperties.
func (s StorageAccountProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "blobEndpoint", s.BlobEndpoint)
populate(objectMap, "containerCount", s.ContainerCount)
populate(objectMap, "dataPolicy", s.DataPolicy)
populate(objectMap, "description", s.Description)
populate(objectMap, "storageAccountCredentialId", s.StorageAccountCredentialID)
populate(objectMap, "storageAccountStatus", s.StorageAccountStatus)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountProperties.
func (s *StorageAccountProperties) UnmarshalJSON(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 "blobEndpoint":
err = unpopulate(val, "BlobEndpoint", &s.BlobEndpoint)
delete(rawMsg, key)
case "containerCount":
err = unpopulate(val, "ContainerCount", &s.ContainerCount)
delete(rawMsg, key)
case "dataPolicy":
err = unpopulate(val, "DataPolicy", &s.DataPolicy)
delete(rawMsg, key)
case "description":
err = unpopulate(val, "Description", &s.Description)
delete(rawMsg, key)
case "storageAccountCredentialId":
err = unpopulate(val, "StorageAccountCredentialID", &s.StorageAccountCredentialID)
delete(rawMsg, key)
case "storageAccountStatus":
err = unpopulate(val, "StorageAccountStatus", &s.StorageAccountStatus)
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 SymmetricKey.
func (s SymmetricKey) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "connectionString", s.ConnectionString)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SymmetricKey.
func (s *SymmetricKey) UnmarshalJSON(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 "connectionString":
err = unpopulate(val, "ConnectionString", &s.ConnectionString)
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 TrackingInfo.
func (t TrackingInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "carrierName", t.CarrierName)
populate(objectMap, "serialNumber", t.SerialNumber)
populate(objectMap, "trackingId", t.TrackingID)
populate(objectMap, "trackingUrl", t.TrackingURL)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type TrackingInfo.
func (t *TrackingInfo) UnmarshalJSON(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 "carrierName":
err = unpopulate(val, "CarrierName", &t.CarrierName)
delete(rawMsg, key)
case "serialNumber":
err = unpopulate(val, "SerialNumber", &t.SerialNumber)
delete(rawMsg, key)
case "trackingId":
err = unpopulate(val, "TrackingID", &t.TrackingID)
delete(rawMsg, key)
case "trackingUrl":
err = unpopulate(val, "TrackingURL", &t.TrackingURL)
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 Trigger.
func (t Trigger) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", t.ID)
objectMap["kind"] = t.Kind
populate(objectMap, "name", t.Name)
populate(objectMap, "type", t.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Trigger.
func (t *Trigger) UnmarshalJSON(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 "kind":
err = unpopulate(val, "Kind", &t.Kind)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &t.Name)
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 TriggerList.
func (t TriggerList) 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 TriggerList.
func (t *TriggerList) UnmarshalJSON(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":
t.Value, err = unmarshalTriggerClassificationArray(val)
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 UpdateDownloadProgress.
func (u UpdateDownloadProgress) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "downloadPhase", u.DownloadPhase)
populate(objectMap, "numberOfUpdatesDownloaded", u.NumberOfUpdatesDownloaded)
populate(objectMap, "numberOfUpdatesToDownload", u.NumberOfUpdatesToDownload)
populate(objectMap, "percentComplete", u.PercentComplete)
populate(objectMap, "totalBytesDownloaded", u.TotalBytesDownloaded)
populate(objectMap, "totalBytesToDownload", u.TotalBytesToDownload)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateDownloadProgress.
func (u *UpdateDownloadProgress) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "downloadPhase":
err = unpopulate(val, "DownloadPhase", &u.DownloadPhase)
delete(rawMsg, key)
case "numberOfUpdatesDownloaded":
err = unpopulate(val, "NumberOfUpdatesDownloaded", &u.NumberOfUpdatesDownloaded)
delete(rawMsg, key)
case "numberOfUpdatesToDownload":
err = unpopulate(val, "NumberOfUpdatesToDownload", &u.NumberOfUpdatesToDownload)
delete(rawMsg, key)
case "percentComplete":
err = unpopulate(val, "PercentComplete", &u.PercentComplete)
delete(rawMsg, key)
case "totalBytesDownloaded":
err = unpopulate(val, "TotalBytesDownloaded", &u.TotalBytesDownloaded)
delete(rawMsg, key)
case "totalBytesToDownload":
err = unpopulate(val, "TotalBytesToDownload", &u.TotalBytesToDownload)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UpdateInstallProgress.
func (u UpdateInstallProgress) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "numberOfUpdatesInstalled", u.NumberOfUpdatesInstalled)
populate(objectMap, "numberOfUpdatesToInstall", u.NumberOfUpdatesToInstall)
populate(objectMap, "percentComplete", u.PercentComplete)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateInstallProgress.
func (u *UpdateInstallProgress) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "numberOfUpdatesInstalled":
err = unpopulate(val, "NumberOfUpdatesInstalled", &u.NumberOfUpdatesInstalled)
delete(rawMsg, key)
case "numberOfUpdatesToInstall":
err = unpopulate(val, "NumberOfUpdatesToInstall", &u.NumberOfUpdatesToInstall)
delete(rawMsg, key)
case "percentComplete":
err = unpopulate(val, "PercentComplete", &u.PercentComplete)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UpdateSummary.
func (u UpdateSummary) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", u.ID)
populate(objectMap, "name", u.Name)
populate(objectMap, "properties", u.Properties)
populate(objectMap, "type", u.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummary.
func (u *UpdateSummary) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &u.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &u.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &u.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &u.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UpdateSummaryProperties.
func (u UpdateSummaryProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populateTimeRFC3339(objectMap, "deviceLastScannedDateTime", u.DeviceLastScannedDateTime)
populate(objectMap, "deviceVersionNumber", u.DeviceVersionNumber)
populate(objectMap, "friendlyDeviceVersionName", u.FriendlyDeviceVersionName)
populate(objectMap, "inProgressDownloadJobId", u.InProgressDownloadJobID)
populateTimeRFC3339(objectMap, "inProgressDownloadJobStartedDateTime", u.InProgressDownloadJobStartedDateTime)
populate(objectMap, "inProgressInstallJobId", u.InProgressInstallJobID)
populateTimeRFC3339(objectMap, "inProgressInstallJobStartedDateTime", u.InProgressInstallJobStartedDateTime)
populateTimeRFC3339(objectMap, "lastCompletedDownloadJobDateTime", u.LastCompletedDownloadJobDateTime)
populateTimeRFC3339(objectMap, "lastCompletedInstallJobDateTime", u.LastCompletedInstallJobDateTime)
populateTimeRFC3339(objectMap, "lastCompletedScanJobDateTime", u.LastCompletedScanJobDateTime)
populate(objectMap, "ongoingUpdateOperation", u.OngoingUpdateOperation)
populate(objectMap, "rebootBehavior", u.RebootBehavior)
populate(objectMap, "totalNumberOfUpdatesAvailable", u.TotalNumberOfUpdatesAvailable)
populate(objectMap, "totalNumberOfUpdatesPendingDownload", u.TotalNumberOfUpdatesPendingDownload)
populate(objectMap, "totalNumberOfUpdatesPendingInstall", u.TotalNumberOfUpdatesPendingInstall)
populate(objectMap, "totalUpdateSizeInBytes", u.TotalUpdateSizeInBytes)
populate(objectMap, "updateTitles", u.UpdateTitles)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummaryProperties.
func (u *UpdateSummaryProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "deviceLastScannedDateTime":
err = unpopulateTimeRFC3339(val, "DeviceLastScannedDateTime", &u.DeviceLastScannedDateTime)
delete(rawMsg, key)
case "deviceVersionNumber":
err = unpopulate(val, "DeviceVersionNumber", &u.DeviceVersionNumber)
delete(rawMsg, key)
case "friendlyDeviceVersionName":
err = unpopulate(val, "FriendlyDeviceVersionName", &u.FriendlyDeviceVersionName)
delete(rawMsg, key)
case "inProgressDownloadJobId":
err = unpopulate(val, "InProgressDownloadJobID", &u.InProgressDownloadJobID)
delete(rawMsg, key)
case "inProgressDownloadJobStartedDateTime":
err = unpopulateTimeRFC3339(val, "InProgressDownloadJobStartedDateTime", &u.InProgressDownloadJobStartedDateTime)
delete(rawMsg, key)
case "inProgressInstallJobId":
err = unpopulate(val, "InProgressInstallJobID", &u.InProgressInstallJobID)
delete(rawMsg, key)
case "inProgressInstallJobStartedDateTime":
err = unpopulateTimeRFC3339(val, "InProgressInstallJobStartedDateTime", &u.InProgressInstallJobStartedDateTime)
delete(rawMsg, key)
case "lastCompletedDownloadJobDateTime":
err = unpopulateTimeRFC3339(val, "LastCompletedDownloadJobDateTime", &u.LastCompletedDownloadJobDateTime)
delete(rawMsg, key)
case "lastCompletedInstallJobDateTime":
err = unpopulateTimeRFC3339(val, "LastCompletedInstallJobDateTime", &u.LastCompletedInstallJobDateTime)
delete(rawMsg, key)
case "lastCompletedScanJobDateTime":
err = unpopulateTimeRFC3339(val, "LastCompletedScanJobDateTime", &u.LastCompletedScanJobDateTime)
delete(rawMsg, key)
case "ongoingUpdateOperation":
err = unpopulate(val, "OngoingUpdateOperation", &u.OngoingUpdateOperation)
delete(rawMsg, key)
case "rebootBehavior":
err = unpopulate(val, "RebootBehavior", &u.RebootBehavior)
delete(rawMsg, key)
case "totalNumberOfUpdatesAvailable":
err = unpopulate(val, "TotalNumberOfUpdatesAvailable", &u.TotalNumberOfUpdatesAvailable)
delete(rawMsg, key)
case "totalNumberOfUpdatesPendingDownload":
err = unpopulate(val, "TotalNumberOfUpdatesPendingDownload", &u.TotalNumberOfUpdatesPendingDownload)
delete(rawMsg, key)
case "totalNumberOfUpdatesPendingInstall":
err = unpopulate(val, "TotalNumberOfUpdatesPendingInstall", &u.TotalNumberOfUpdatesPendingInstall)
delete(rawMsg, key)
case "totalUpdateSizeInBytes":
err = unpopulate(val, "TotalUpdateSizeInBytes", &u.TotalUpdateSizeInBytes)
delete(rawMsg, key)
case "updateTitles":
err = unpopulate(val, "UpdateTitles", &u.UpdateTitles)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UploadCertificateRequest.
func (u UploadCertificateRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "properties", u.Properties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UploadCertificateRequest.
func (u *UploadCertificateRequest) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "properties":
err = unpopulate(val, "Properties", &u.Properties)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UploadCertificateResponse.
func (u UploadCertificateResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "aadAudience", u.AADAudience)
populate(objectMap, "aadAuthority", u.AADAuthority)
populate(objectMap, "aadTenantId", u.AADTenantID)
populate(objectMap, "authType", u.AuthType)
populate(objectMap, "azureManagementEndpointAudience", u.AzureManagementEndpointAudience)
populate(objectMap, "resourceId", u.ResourceID)
populate(objectMap, "servicePrincipalClientId", u.ServicePrincipalClientID)
populate(objectMap, "servicePrincipalObjectId", u.ServicePrincipalObjectID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UploadCertificateResponse.
func (u *UploadCertificateResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "aadAudience":
err = unpopulate(val, "AADAudience", &u.AADAudience)
delete(rawMsg, key)
case "aadAuthority":
err = unpopulate(val, "AADAuthority", &u.AADAuthority)
delete(rawMsg, key)
case "aadTenantId":
err = unpopulate(val, "AADTenantID", &u.AADTenantID)
delete(rawMsg, key)
case "authType":
err = unpopulate(val, "AuthType", &u.AuthType)
delete(rawMsg, key)
case "azureManagementEndpointAudience":
err = unpopulate(val, "AzureManagementEndpointAudience", &u.AzureManagementEndpointAudience)
delete(rawMsg, key)
case "resourceId":
err = unpopulate(val, "ResourceID", &u.ResourceID)
delete(rawMsg, key)
case "servicePrincipalClientId":
err = unpopulate(val, "ServicePrincipalClientID", &u.ServicePrincipalClientID)
delete(rawMsg, key)
case "servicePrincipalObjectId":
err = unpopulate(val, "ServicePrincipalObjectID", &u.ServicePrincipalObjectID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type User.
func (u User) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", u.ID)
populate(objectMap, "name", u.Name)
populate(objectMap, "properties", u.Properties)
populate(objectMap, "type", u.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type User.
func (u *User) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &u.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &u.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &u.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &u.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UserAccessRight.
func (u UserAccessRight) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "accessType", u.AccessType)
populate(objectMap, "userId", u.UserID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UserAccessRight.
func (u *UserAccessRight) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "accessType":
err = unpopulate(val, "AccessType", &u.AccessType)
delete(rawMsg, key)
case "userId":
err = unpopulate(val, "UserID", &u.UserID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UserList.
func (u UserList) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", u.NextLink)
populate(objectMap, "value", u.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UserList.
func (u *UserList) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &u.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &u.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UserProperties.
func (u UserProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "encryptedPassword", u.EncryptedPassword)
populate(objectMap, "shareAccessRights", u.ShareAccessRights)
populate(objectMap, "userType", u.UserType)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UserProperties.
func (u *UserProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "encryptedPassword":
err = unpopulate(val, "EncryptedPassword", &u.EncryptedPassword)
delete(rawMsg, key)
case "shareAccessRights":
err = unpopulate(val, "ShareAccessRights", &u.ShareAccessRights)
delete(rawMsg, key)
case "userType":
err = unpopulate(val, "UserType", &u.UserType)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, 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 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
}