1801 строка
58 KiB
Go
1801 строка
58 KiB
Go
//go:build go1.18
|
|
// +build go1.18
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT.
|
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
|
|
package armelasticsan
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
|
"reflect"
|
|
)
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type AutoScaleProperties.
|
|
func (a AutoScaleProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "scaleUpProperties", a.ScaleUpProperties)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type AutoScaleProperties.
|
|
func (a *AutoScaleProperties) UnmarshalJSON(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 "scaleUpProperties":
|
|
err = unpopulate(val, "ScaleUpProperties", &a.ScaleUpProperties)
|
|
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 ElasticSan.
|
|
func (e ElasticSan) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", e.ID)
|
|
populate(objectMap, "location", e.Location)
|
|
populate(objectMap, "name", e.Name)
|
|
populate(objectMap, "properties", e.Properties)
|
|
populate(objectMap, "systemData", e.SystemData)
|
|
populate(objectMap, "tags", e.Tags)
|
|
populate(objectMap, "type", e.Type)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticSan.
|
|
func (e *ElasticSan) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", e, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &e.ID)
|
|
delete(rawMsg, key)
|
|
case "location":
|
|
err = unpopulate(val, "Location", &e.Location)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &e.Name)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &e.Properties)
|
|
delete(rawMsg, key)
|
|
case "systemData":
|
|
err = unpopulate(val, "SystemData", &e.SystemData)
|
|
delete(rawMsg, key)
|
|
case "tags":
|
|
err = unpopulate(val, "Tags", &e.Tags)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &e.Type)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", e, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type EncryptionIdentity.
|
|
func (e EncryptionIdentity) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "userAssignedIdentity", e.EncryptionUserAssignedIdentity)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionIdentity.
|
|
func (e *EncryptionIdentity) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", e, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "userAssignedIdentity":
|
|
err = unpopulate(val, "EncryptionUserAssignedIdentity", &e.EncryptionUserAssignedIdentity)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", e, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type EncryptionProperties.
|
|
func (e EncryptionProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "identity", e.EncryptionIdentity)
|
|
populate(objectMap, "keyVaultProperties", e.KeyVaultProperties)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperties.
|
|
func (e *EncryptionProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", e, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "identity":
|
|
err = unpopulate(val, "EncryptionIdentity", &e.EncryptionIdentity)
|
|
delete(rawMsg, key)
|
|
case "keyVaultProperties":
|
|
err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", e, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type Identity.
|
|
func (i Identity) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "principalId", i.PrincipalID)
|
|
populate(objectMap, "tenantId", i.TenantID)
|
|
populate(objectMap, "type", i.Type)
|
|
populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type Identity.
|
|
func (i *Identity) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", i, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "principalId":
|
|
err = unpopulate(val, "PrincipalID", &i.PrincipalID)
|
|
delete(rawMsg, key)
|
|
case "tenantId":
|
|
err = unpopulate(val, "TenantID", &i.TenantID)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &i.Type)
|
|
delete(rawMsg, key)
|
|
case "userAssignedIdentities":
|
|
err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities)
|
|
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 IscsiTargetInfo.
|
|
func (i IscsiTargetInfo) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "provisioningState", i.ProvisioningState)
|
|
populate(objectMap, "status", i.Status)
|
|
populate(objectMap, "targetIqn", i.TargetIqn)
|
|
populate(objectMap, "targetPortalHostname", i.TargetPortalHostname)
|
|
populate(objectMap, "targetPortalPort", i.TargetPortalPort)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type IscsiTargetInfo.
|
|
func (i *IscsiTargetInfo) UnmarshalJSON(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 "provisioningState":
|
|
err = unpopulate(val, "ProvisioningState", &i.ProvisioningState)
|
|
delete(rawMsg, key)
|
|
case "status":
|
|
err = unpopulate(val, "Status", &i.Status)
|
|
delete(rawMsg, key)
|
|
case "targetIqn":
|
|
err = unpopulate(val, "TargetIqn", &i.TargetIqn)
|
|
delete(rawMsg, key)
|
|
case "targetPortalHostname":
|
|
err = unpopulate(val, "TargetPortalHostname", &i.TargetPortalHostname)
|
|
delete(rawMsg, key)
|
|
case "targetPortalPort":
|
|
err = unpopulate(val, "TargetPortalPort", &i.TargetPortalPort)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", i, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties.
|
|
func (k KeyVaultProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populateDateTimeRFC3339(objectMap, "currentVersionedKeyExpirationTimestamp", k.CurrentVersionedKeyExpirationTimestamp)
|
|
populate(objectMap, "currentVersionedKeyIdentifier", k.CurrentVersionedKeyIdentifier)
|
|
populate(objectMap, "keyName", k.KeyName)
|
|
populate(objectMap, "keyVaultUri", k.KeyVaultURI)
|
|
populate(objectMap, "keyVersion", k.KeyVersion)
|
|
populateDateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties.
|
|
func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", k, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "currentVersionedKeyExpirationTimestamp":
|
|
err = unpopulateDateTimeRFC3339(val, "CurrentVersionedKeyExpirationTimestamp", &k.CurrentVersionedKeyExpirationTimestamp)
|
|
delete(rawMsg, key)
|
|
case "currentVersionedKeyIdentifier":
|
|
err = unpopulate(val, "CurrentVersionedKeyIdentifier", &k.CurrentVersionedKeyIdentifier)
|
|
delete(rawMsg, key)
|
|
case "keyName":
|
|
err = unpopulate(val, "KeyName", &k.KeyName)
|
|
delete(rawMsg, key)
|
|
case "keyVaultUri":
|
|
err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI)
|
|
delete(rawMsg, key)
|
|
case "keyVersion":
|
|
err = unpopulate(val, "KeyVersion", &k.KeyVersion)
|
|
delete(rawMsg, key)
|
|
case "lastKeyRotationTimestamp":
|
|
err = unpopulateDateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", k, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type List.
|
|
func (l List) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "nextLink", l.NextLink)
|
|
populate(objectMap, "value", l.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type List.
|
|
func (l *List) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", l, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "nextLink":
|
|
err = unpopulate(val, "NextLink", &l.NextLink)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &l.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", l, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type ManagedByInfo.
|
|
func (m ManagedByInfo) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "resourceId", m.ResourceID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedByInfo.
|
|
func (m *ManagedByInfo) UnmarshalJSON(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 "resourceId":
|
|
err = unpopulate(val, "ResourceID", &m.ResourceID)
|
|
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 NetworkRuleSet.
|
|
func (n NetworkRuleSet) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "virtualNetworkRules", n.VirtualNetworkRules)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet.
|
|
func (n *NetworkRuleSet) UnmarshalJSON(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 "virtualNetworkRules":
|
|
err = unpopulate(val, "VirtualNetworkRules", &n.VirtualNetworkRules)
|
|
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, "actionType", o.ActionType)
|
|
populate(objectMap, "display", o.Display)
|
|
populate(objectMap, "isDataAction", o.IsDataAction)
|
|
populate(objectMap, "name", o.Name)
|
|
populate(objectMap, "origin", o.Origin)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type 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 "actionType":
|
|
err = unpopulate(val, "ActionType", &o.ActionType)
|
|
delete(rawMsg, key)
|
|
case "display":
|
|
err = unpopulate(val, "Display", &o.Display)
|
|
delete(rawMsg, key)
|
|
case "isDataAction":
|
|
err = unpopulate(val, "IsDataAction", &o.IsDataAction)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &o.Name)
|
|
delete(rawMsg, key)
|
|
case "origin":
|
|
err = unpopulate(val, "Origin", &o.Origin)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", o, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type OperationDisplay.
|
|
func (o OperationDisplay) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "description", o.Description)
|
|
populate(objectMap, "operation", o.Operation)
|
|
populate(objectMap, "provider", o.Provider)
|
|
populate(objectMap, "resource", o.Resource)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.
|
|
func (o *OperationDisplay) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", o, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "description":
|
|
err = unpopulate(val, "Description", &o.Description)
|
|
delete(rawMsg, key)
|
|
case "operation":
|
|
err = unpopulate(val, "Operation", &o.Operation)
|
|
delete(rawMsg, key)
|
|
case "provider":
|
|
err = unpopulate(val, "Provider", &o.Provider)
|
|
delete(rawMsg, key)
|
|
case "resource":
|
|
err = unpopulate(val, "Resource", &o.Resource)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", o, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type OperationListResult.
|
|
func (o OperationListResult) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "nextLink", o.NextLink)
|
|
populate(objectMap, "value", o.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.
|
|
func (o *OperationListResult) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", o, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "nextLink":
|
|
err = unpopulate(val, "NextLink", &o.NextLink)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &o.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", o, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint.
|
|
func (p PrivateEndpoint) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", p.ID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint.
|
|
func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &p.ID)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection.
|
|
func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", p.ID)
|
|
populate(objectMap, "name", p.Name)
|
|
populate(objectMap, "properties", p.Properties)
|
|
populate(objectMap, "systemData", p.SystemData)
|
|
populate(objectMap, "type", p.Type)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection.
|
|
func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &p.ID)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &p.Name)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &p.Properties)
|
|
delete(rawMsg, key)
|
|
case "systemData":
|
|
err = unpopulate(val, "SystemData", &p.SystemData)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &p.Type)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult.
|
|
func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "nextLink", p.NextLink)
|
|
populate(objectMap, "value", p.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult.
|
|
func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "nextLink":
|
|
err = unpopulate(val, "NextLink", &p.NextLink)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &p.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties.
|
|
func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "groupIds", p.GroupIDs)
|
|
populate(objectMap, "privateEndpoint", p.PrivateEndpoint)
|
|
populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState)
|
|
populate(objectMap, "provisioningState", p.ProvisioningState)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties.
|
|
func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "groupIds":
|
|
err = unpopulate(val, "GroupIDs", &p.GroupIDs)
|
|
delete(rawMsg, key)
|
|
case "privateEndpoint":
|
|
err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint)
|
|
delete(rawMsg, key)
|
|
case "privateLinkServiceConnectionState":
|
|
err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState)
|
|
delete(rawMsg, key)
|
|
case "provisioningState":
|
|
err = unpopulate(val, "ProvisioningState", &p.ProvisioningState)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource.
|
|
func (p PrivateLinkResource) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", p.ID)
|
|
populate(objectMap, "name", p.Name)
|
|
populate(objectMap, "properties", p.Properties)
|
|
populate(objectMap, "systemData", p.SystemData)
|
|
populate(objectMap, "type", p.Type)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource.
|
|
func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &p.ID)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &p.Name)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &p.Properties)
|
|
delete(rawMsg, key)
|
|
case "systemData":
|
|
err = unpopulate(val, "SystemData", &p.SystemData)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &p.Type)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult.
|
|
func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "nextLink", p.NextLink)
|
|
populate(objectMap, "value", p.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult.
|
|
func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "nextLink":
|
|
err = unpopulate(val, "NextLink", &p.NextLink)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &p.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties.
|
|
func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "groupId", p.GroupID)
|
|
populate(objectMap, "requiredMembers", p.RequiredMembers)
|
|
populate(objectMap, "requiredZoneNames", p.RequiredZoneNames)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties.
|
|
func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "groupId":
|
|
err = unpopulate(val, "GroupID", &p.GroupID)
|
|
delete(rawMsg, key)
|
|
case "requiredMembers":
|
|
err = unpopulate(val, "RequiredMembers", &p.RequiredMembers)
|
|
delete(rawMsg, key)
|
|
case "requiredZoneNames":
|
|
err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState.
|
|
func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "actionsRequired", p.ActionsRequired)
|
|
populate(objectMap, "description", p.Description)
|
|
populate(objectMap, "status", p.Status)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState.
|
|
func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "actionsRequired":
|
|
err = unpopulate(val, "ActionsRequired", &p.ActionsRequired)
|
|
delete(rawMsg, key)
|
|
case "description":
|
|
err = unpopulate(val, "Description", &p.Description)
|
|
delete(rawMsg, key)
|
|
case "status":
|
|
err = unpopulate(val, "Status", &p.Status)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", p, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type Properties.
|
|
func (p Properties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "autoScaleProperties", p.AutoScaleProperties)
|
|
populate(objectMap, "availabilityZones", p.AvailabilityZones)
|
|
populate(objectMap, "baseSizeTiB", p.BaseSizeTiB)
|
|
populate(objectMap, "extendedCapacitySizeTiB", p.ExtendedCapacitySizeTiB)
|
|
populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections)
|
|
populate(objectMap, "provisioningState", p.ProvisioningState)
|
|
populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess)
|
|
populate(objectMap, "sku", p.SKU)
|
|
populate(objectMap, "totalIops", p.TotalIops)
|
|
populate(objectMap, "totalMBps", p.TotalMBps)
|
|
populate(objectMap, "totalSizeTiB", p.TotalSizeTiB)
|
|
populate(objectMap, "totalVolumeSizeGiB", p.TotalVolumeSizeGiB)
|
|
populate(objectMap, "volumeGroupCount", p.VolumeGroupCount)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type Properties.
|
|
func (p *Properties) UnmarshalJSON(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 "autoScaleProperties":
|
|
err = unpopulate(val, "AutoScaleProperties", &p.AutoScaleProperties)
|
|
delete(rawMsg, key)
|
|
case "availabilityZones":
|
|
err = unpopulate(val, "AvailabilityZones", &p.AvailabilityZones)
|
|
delete(rawMsg, key)
|
|
case "baseSizeTiB":
|
|
err = unpopulate(val, "BaseSizeTiB", &p.BaseSizeTiB)
|
|
delete(rawMsg, key)
|
|
case "extendedCapacitySizeTiB":
|
|
err = unpopulate(val, "ExtendedCapacitySizeTiB", &p.ExtendedCapacitySizeTiB)
|
|
delete(rawMsg, key)
|
|
case "privateEndpointConnections":
|
|
err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections)
|
|
delete(rawMsg, key)
|
|
case "provisioningState":
|
|
err = unpopulate(val, "ProvisioningState", &p.ProvisioningState)
|
|
delete(rawMsg, key)
|
|
case "publicNetworkAccess":
|
|
err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess)
|
|
delete(rawMsg, key)
|
|
case "sku":
|
|
err = unpopulate(val, "SKU", &p.SKU)
|
|
delete(rawMsg, key)
|
|
case "totalIops":
|
|
err = unpopulate(val, "TotalIops", &p.TotalIops)
|
|
delete(rawMsg, key)
|
|
case "totalMBps":
|
|
err = unpopulate(val, "TotalMBps", &p.TotalMBps)
|
|
delete(rawMsg, key)
|
|
case "totalSizeTiB":
|
|
err = unpopulate(val, "TotalSizeTiB", &p.TotalSizeTiB)
|
|
delete(rawMsg, key)
|
|
case "totalVolumeSizeGiB":
|
|
err = unpopulate(val, "TotalVolumeSizeGiB", &p.TotalVolumeSizeGiB)
|
|
delete(rawMsg, key)
|
|
case "volumeGroupCount":
|
|
err = unpopulate(val, "VolumeGroupCount", &p.VolumeGroupCount)
|
|
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 SKU.
|
|
func (s SKU) 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 SKU.
|
|
func (s *SKU) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "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 SKUCapability.
|
|
func (s SKUCapability) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "name", s.Name)
|
|
populate(objectMap, "value", s.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability.
|
|
func (s *SKUCapability) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "name":
|
|
err = unpopulate(val, "Name", &s.Name)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &s.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type SKUInformation.
|
|
func (s SKUInformation) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "capabilities", s.Capabilities)
|
|
populate(objectMap, "locationInfo", s.LocationInfo)
|
|
populate(objectMap, "locations", s.Locations)
|
|
populate(objectMap, "name", s.Name)
|
|
populate(objectMap, "resourceType", s.ResourceType)
|
|
populate(objectMap, "tier", s.Tier)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type SKUInformation.
|
|
func (s *SKUInformation) UnmarshalJSON(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 "capabilities":
|
|
err = unpopulate(val, "Capabilities", &s.Capabilities)
|
|
delete(rawMsg, key)
|
|
case "locationInfo":
|
|
err = unpopulate(val, "LocationInfo", &s.LocationInfo)
|
|
delete(rawMsg, key)
|
|
case "locations":
|
|
err = unpopulate(val, "Locations", &s.Locations)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &s.Name)
|
|
delete(rawMsg, key)
|
|
case "resourceType":
|
|
err = unpopulate(val, "ResourceType", &s.ResourceType)
|
|
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, "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 "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 ScaleUpProperties.
|
|
func (s ScaleUpProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "autoScalePolicyEnforcement", s.AutoScalePolicyEnforcement)
|
|
populate(objectMap, "capacityUnitScaleUpLimitTiB", s.CapacityUnitScaleUpLimitTiB)
|
|
populate(objectMap, "increaseCapacityUnitByTiB", s.IncreaseCapacityUnitByTiB)
|
|
populate(objectMap, "unusedSizeTiB", s.UnusedSizeTiB)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleUpProperties.
|
|
func (s *ScaleUpProperties) UnmarshalJSON(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 "autoScalePolicyEnforcement":
|
|
err = unpopulate(val, "AutoScalePolicyEnforcement", &s.AutoScalePolicyEnforcement)
|
|
delete(rawMsg, key)
|
|
case "capacityUnitScaleUpLimitTiB":
|
|
err = unpopulate(val, "CapacityUnitScaleUpLimitTiB", &s.CapacityUnitScaleUpLimitTiB)
|
|
delete(rawMsg, key)
|
|
case "increaseCapacityUnitByTiB":
|
|
err = unpopulate(val, "IncreaseCapacityUnitByTiB", &s.IncreaseCapacityUnitByTiB)
|
|
delete(rawMsg, key)
|
|
case "unusedSizeTiB":
|
|
err = unpopulate(val, "UnusedSizeTiB", &s.UnusedSizeTiB)
|
|
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 Snapshot.
|
|
func (s Snapshot) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", s.ID)
|
|
populate(objectMap, "name", s.Name)
|
|
populate(objectMap, "properties", s.Properties)
|
|
populate(objectMap, "systemData", s.SystemData)
|
|
populate(objectMap, "type", s.Type)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type Snapshot.
|
|
func (s *Snapshot) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &s.ID)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &s.Name)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &s.Properties)
|
|
delete(rawMsg, key)
|
|
case "systemData":
|
|
err = unpopulate(val, "SystemData", &s.SystemData)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &s.Type)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type SnapshotCreationData.
|
|
func (s SnapshotCreationData) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "sourceId", s.SourceID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotCreationData.
|
|
func (s *SnapshotCreationData) UnmarshalJSON(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 "sourceId":
|
|
err = unpopulate(val, "SourceID", &s.SourceID)
|
|
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 SnapshotList.
|
|
func (s SnapshotList) 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 SnapshotList.
|
|
func (s *SnapshotList) UnmarshalJSON(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 SnapshotProperties.
|
|
func (s SnapshotProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "creationData", s.CreationData)
|
|
populate(objectMap, "provisioningState", s.ProvisioningState)
|
|
populate(objectMap, "sourceVolumeSizeGiB", s.SourceVolumeSizeGiB)
|
|
populate(objectMap, "volumeName", s.VolumeName)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotProperties.
|
|
func (s *SnapshotProperties) UnmarshalJSON(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 "creationData":
|
|
err = unpopulate(val, "CreationData", &s.CreationData)
|
|
delete(rawMsg, key)
|
|
case "provisioningState":
|
|
err = unpopulate(val, "ProvisioningState", &s.ProvisioningState)
|
|
delete(rawMsg, key)
|
|
case "sourceVolumeSizeGiB":
|
|
err = unpopulate(val, "SourceVolumeSizeGiB", &s.SourceVolumeSizeGiB)
|
|
delete(rawMsg, key)
|
|
case "volumeName":
|
|
err = unpopulate(val, "VolumeName", &s.VolumeName)
|
|
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 SourceCreationData.
|
|
func (s SourceCreationData) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "createSource", s.CreateSource)
|
|
populate(objectMap, "sourceId", s.SourceID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type SourceCreationData.
|
|
func (s *SourceCreationData) UnmarshalJSON(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 "createSource":
|
|
err = unpopulate(val, "CreateSource", &s.CreateSource)
|
|
delete(rawMsg, key)
|
|
case "sourceId":
|
|
err = unpopulate(val, "SourceID", &s.SourceID)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type SystemData.
|
|
func (s SystemData) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt)
|
|
populate(objectMap, "createdBy", s.CreatedBy)
|
|
populate(objectMap, "createdByType", s.CreatedByType)
|
|
populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt)
|
|
populate(objectMap, "lastModifiedBy", s.LastModifiedBy)
|
|
populate(objectMap, "lastModifiedByType", s.LastModifiedByType)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
|
|
func (s *SystemData) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "createdAt":
|
|
err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt)
|
|
delete(rawMsg, key)
|
|
case "createdBy":
|
|
err = unpopulate(val, "CreatedBy", &s.CreatedBy)
|
|
delete(rawMsg, key)
|
|
case "createdByType":
|
|
err = unpopulate(val, "CreatedByType", &s.CreatedByType)
|
|
delete(rawMsg, key)
|
|
case "lastModifiedAt":
|
|
err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt)
|
|
delete(rawMsg, key)
|
|
case "lastModifiedBy":
|
|
err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy)
|
|
delete(rawMsg, key)
|
|
case "lastModifiedByType":
|
|
err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type Update.
|
|
func (u Update) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "properties", u.Properties)
|
|
populate(objectMap, "tags", u.Tags)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type Update.
|
|
func (u *Update) UnmarshalJSON(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)
|
|
case "tags":
|
|
err = unpopulate(val, "Tags", &u.Tags)
|
|
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 UpdateProperties.
|
|
func (u UpdateProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "autoScaleProperties", u.AutoScaleProperties)
|
|
populate(objectMap, "baseSizeTiB", u.BaseSizeTiB)
|
|
populate(objectMap, "extendedCapacitySizeTiB", u.ExtendedCapacitySizeTiB)
|
|
populate(objectMap, "publicNetworkAccess", u.PublicNetworkAccess)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties.
|
|
func (u *UpdateProperties) UnmarshalJSON(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 "autoScaleProperties":
|
|
err = unpopulate(val, "AutoScaleProperties", &u.AutoScaleProperties)
|
|
delete(rawMsg, key)
|
|
case "baseSizeTiB":
|
|
err = unpopulate(val, "BaseSizeTiB", &u.BaseSizeTiB)
|
|
delete(rawMsg, key)
|
|
case "extendedCapacitySizeTiB":
|
|
err = unpopulate(val, "ExtendedCapacitySizeTiB", &u.ExtendedCapacitySizeTiB)
|
|
delete(rawMsg, key)
|
|
case "publicNetworkAccess":
|
|
err = unpopulate(val, "PublicNetworkAccess", &u.PublicNetworkAccess)
|
|
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 UserAssignedIdentity.
|
|
func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "clientId", u.ClientID)
|
|
populate(objectMap, "principalId", u.PrincipalID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity.
|
|
func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", u, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "clientId":
|
|
err = unpopulate(val, "ClientID", &u.ClientID)
|
|
delete(rawMsg, key)
|
|
case "principalId":
|
|
err = unpopulate(val, "PrincipalID", &u.PrincipalID)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", u, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRule.
|
|
func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "action", v.Action)
|
|
populate(objectMap, "id", v.VirtualNetworkResourceID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRule.
|
|
func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "action":
|
|
err = unpopulate(val, "Action", &v.Action)
|
|
delete(rawMsg, key)
|
|
case "id":
|
|
err = unpopulate(val, "VirtualNetworkResourceID", &v.VirtualNetworkResourceID)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type Volume.
|
|
func (v Volume) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", v.ID)
|
|
populate(objectMap, "name", v.Name)
|
|
populate(objectMap, "properties", v.Properties)
|
|
populate(objectMap, "systemData", v.SystemData)
|
|
populate(objectMap, "type", v.Type)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type Volume.
|
|
func (v *Volume) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &v.ID)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &v.Name)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &v.Properties)
|
|
delete(rawMsg, key)
|
|
case "systemData":
|
|
err = unpopulate(val, "SystemData", &v.SystemData)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &v.Type)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeGroup.
|
|
func (v VolumeGroup) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "id", v.ID)
|
|
populate(objectMap, "identity", v.Identity)
|
|
populate(objectMap, "name", v.Name)
|
|
populate(objectMap, "properties", v.Properties)
|
|
populate(objectMap, "systemData", v.SystemData)
|
|
populate(objectMap, "type", v.Type)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeGroup.
|
|
func (v *VolumeGroup) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "id":
|
|
err = unpopulate(val, "ID", &v.ID)
|
|
delete(rawMsg, key)
|
|
case "identity":
|
|
err = unpopulate(val, "Identity", &v.Identity)
|
|
delete(rawMsg, key)
|
|
case "name":
|
|
err = unpopulate(val, "Name", &v.Name)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &v.Properties)
|
|
delete(rawMsg, key)
|
|
case "systemData":
|
|
err = unpopulate(val, "SystemData", &v.SystemData)
|
|
delete(rawMsg, key)
|
|
case "type":
|
|
err = unpopulate(val, "Type", &v.Type)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeGroupList.
|
|
func (v VolumeGroupList) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "nextLink", v.NextLink)
|
|
populate(objectMap, "value", v.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeGroupList.
|
|
func (v *VolumeGroupList) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "nextLink":
|
|
err = unpopulate(val, "NextLink", &v.NextLink)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &v.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeGroupProperties.
|
|
func (v VolumeGroupProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "encryption", v.Encryption)
|
|
populate(objectMap, "encryptionProperties", v.EncryptionProperties)
|
|
populate(objectMap, "enforceDataIntegrityCheckForIscsi", v.EnforceDataIntegrityCheckForIscsi)
|
|
populate(objectMap, "networkAcls", v.NetworkACLs)
|
|
populate(objectMap, "privateEndpointConnections", v.PrivateEndpointConnections)
|
|
populate(objectMap, "protocolType", v.ProtocolType)
|
|
populate(objectMap, "provisioningState", v.ProvisioningState)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeGroupProperties.
|
|
func (v *VolumeGroupProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "encryption":
|
|
err = unpopulate(val, "Encryption", &v.Encryption)
|
|
delete(rawMsg, key)
|
|
case "encryptionProperties":
|
|
err = unpopulate(val, "EncryptionProperties", &v.EncryptionProperties)
|
|
delete(rawMsg, key)
|
|
case "enforceDataIntegrityCheckForIscsi":
|
|
err = unpopulate(val, "EnforceDataIntegrityCheckForIscsi", &v.EnforceDataIntegrityCheckForIscsi)
|
|
delete(rawMsg, key)
|
|
case "networkAcls":
|
|
err = unpopulate(val, "NetworkACLs", &v.NetworkACLs)
|
|
delete(rawMsg, key)
|
|
case "privateEndpointConnections":
|
|
err = unpopulate(val, "PrivateEndpointConnections", &v.PrivateEndpointConnections)
|
|
delete(rawMsg, key)
|
|
case "protocolType":
|
|
err = unpopulate(val, "ProtocolType", &v.ProtocolType)
|
|
delete(rawMsg, key)
|
|
case "provisioningState":
|
|
err = unpopulate(val, "ProvisioningState", &v.ProvisioningState)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeGroupUpdate.
|
|
func (v VolumeGroupUpdate) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "identity", v.Identity)
|
|
populate(objectMap, "properties", v.Properties)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeGroupUpdate.
|
|
func (v *VolumeGroupUpdate) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "identity":
|
|
err = unpopulate(val, "Identity", &v.Identity)
|
|
delete(rawMsg, key)
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &v.Properties)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeGroupUpdateProperties.
|
|
func (v VolumeGroupUpdateProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "encryption", v.Encryption)
|
|
populate(objectMap, "encryptionProperties", v.EncryptionProperties)
|
|
populate(objectMap, "enforceDataIntegrityCheckForIscsi", v.EnforceDataIntegrityCheckForIscsi)
|
|
populate(objectMap, "networkAcls", v.NetworkACLs)
|
|
populate(objectMap, "protocolType", v.ProtocolType)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeGroupUpdateProperties.
|
|
func (v *VolumeGroupUpdateProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "encryption":
|
|
err = unpopulate(val, "Encryption", &v.Encryption)
|
|
delete(rawMsg, key)
|
|
case "encryptionProperties":
|
|
err = unpopulate(val, "EncryptionProperties", &v.EncryptionProperties)
|
|
delete(rawMsg, key)
|
|
case "enforceDataIntegrityCheckForIscsi":
|
|
err = unpopulate(val, "EnforceDataIntegrityCheckForIscsi", &v.EnforceDataIntegrityCheckForIscsi)
|
|
delete(rawMsg, key)
|
|
case "networkAcls":
|
|
err = unpopulate(val, "NetworkACLs", &v.NetworkACLs)
|
|
delete(rawMsg, key)
|
|
case "protocolType":
|
|
err = unpopulate(val, "ProtocolType", &v.ProtocolType)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeList.
|
|
func (v VolumeList) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "nextLink", v.NextLink)
|
|
populate(objectMap, "value", v.Value)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeList.
|
|
func (v *VolumeList) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "nextLink":
|
|
err = unpopulate(val, "NextLink", &v.NextLink)
|
|
delete(rawMsg, key)
|
|
case "value":
|
|
err = unpopulate(val, "Value", &v.Value)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeProperties.
|
|
func (v VolumeProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "creationData", v.CreationData)
|
|
populate(objectMap, "managedBy", v.ManagedBy)
|
|
populate(objectMap, "provisioningState", v.ProvisioningState)
|
|
populate(objectMap, "sizeGiB", v.SizeGiB)
|
|
populate(objectMap, "storageTarget", v.StorageTarget)
|
|
populate(objectMap, "volumeId", v.VolumeID)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeProperties.
|
|
func (v *VolumeProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "creationData":
|
|
err = unpopulate(val, "CreationData", &v.CreationData)
|
|
delete(rawMsg, key)
|
|
case "managedBy":
|
|
err = unpopulate(val, "ManagedBy", &v.ManagedBy)
|
|
delete(rawMsg, key)
|
|
case "provisioningState":
|
|
err = unpopulate(val, "ProvisioningState", &v.ProvisioningState)
|
|
delete(rawMsg, key)
|
|
case "sizeGiB":
|
|
err = unpopulate(val, "SizeGiB", &v.SizeGiB)
|
|
delete(rawMsg, key)
|
|
case "storageTarget":
|
|
err = unpopulate(val, "StorageTarget", &v.StorageTarget)
|
|
delete(rawMsg, key)
|
|
case "volumeId":
|
|
err = unpopulate(val, "VolumeID", &v.VolumeID)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeUpdate.
|
|
func (v VolumeUpdate) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "properties", v.Properties)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeUpdate.
|
|
func (v *VolumeUpdate) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "properties":
|
|
err = unpopulate(val, "Properties", &v.Properties)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaller interface for type VolumeUpdateProperties.
|
|
func (v VolumeUpdateProperties) MarshalJSON() ([]byte, error) {
|
|
objectMap := make(map[string]any)
|
|
populate(objectMap, "managedBy", v.ManagedBy)
|
|
populate(objectMap, "sizeGiB", v.SizeGiB)
|
|
return json.Marshal(objectMap)
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeUpdateProperties.
|
|
func (v *VolumeUpdateProperties) UnmarshalJSON(data []byte) error {
|
|
var rawMsg map[string]json.RawMessage
|
|
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
for key, val := range rawMsg {
|
|
var err error
|
|
switch key {
|
|
case "managedBy":
|
|
err = unpopulate(val, "ManagedBy", &v.ManagedBy)
|
|
delete(rawMsg, key)
|
|
case "sizeGiB":
|
|
err = unpopulate(val, "SizeGiB", &v.SizeGiB)
|
|
delete(rawMsg, key)
|
|
}
|
|
if err != nil {
|
|
return fmt.Errorf("unmarshalling type %T: %v", v, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func populate(m map[string]any, k string, v any) {
|
|
if v == nil {
|
|
return
|
|
} else if azcore.IsNullValue(v) {
|
|
m[k] = nil
|
|
} else if !reflect.ValueOf(v).IsNil() {
|
|
m[k] = v
|
|
}
|
|
}
|
|
|
|
func unpopulate(data json.RawMessage, fn string, v any) error {
|
|
if data == nil || string(data) == "null" {
|
|
return nil
|
|
}
|
|
if err := json.Unmarshal(data, v); err != nil {
|
|
return fmt.Errorf("struct field %s: %v", fn, err)
|
|
}
|
|
return nil
|
|
}
|