-
Notifications
You must be signed in to change notification settings - Fork 38
/
model_a2areplicationintentdetails.go
143 lines (123 loc) · 6.88 KB
/
model_a2areplicationintentdetails.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package replicationprotectionintents
import (
"encoding/json"
"fmt"
)
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
var _ ReplicationProtectionIntentProviderSpecificSettings = A2AReplicationIntentDetails{}
type A2AReplicationIntentDetails struct {
AgentAutoUpdateStatus *AgentAutoUpdateStatus `json:"agentAutoUpdateStatus,omitempty"`
AutoProtectionOfDataDisk *AutoProtectionOfDataDisk `json:"autoProtectionOfDataDisk,omitempty"`
AutomationAccountArmId *string `json:"automationAccountArmId,omitempty"`
AutomationAccountAuthenticationType *AutomationAccountAuthenticationType `json:"automationAccountAuthenticationType,omitempty"`
DiskEncryptionInfo *DiskEncryptionInfo `json:"diskEncryptionInfo,omitempty"`
FabricObjectId *string `json:"fabricObjectId,omitempty"`
MultiVMGroupId *string `json:"multiVmGroupId,omitempty"`
MultiVMGroupName *string `json:"multiVmGroupName,omitempty"`
PrimaryLocation *string `json:"primaryLocation,omitempty"`
PrimaryStagingStorageAccount StorageAccountCustomDetails `json:"primaryStagingStorageAccount"`
ProtectionProfile ProtectionProfileCustomDetails `json:"protectionProfile"`
RecoveryAvailabilitySet RecoveryAvailabilitySetCustomDetails `json:"recoveryAvailabilitySet"`
RecoveryAvailabilityType string `json:"recoveryAvailabilityType"`
RecoveryAvailabilityZone *string `json:"recoveryAvailabilityZone,omitempty"`
RecoveryBootDiagStorageAccount StorageAccountCustomDetails `json:"recoveryBootDiagStorageAccount"`
RecoveryLocation *string `json:"recoveryLocation,omitempty"`
RecoveryProximityPlacementGroup RecoveryProximityPlacementGroupCustomDetails `json:"recoveryProximityPlacementGroup"`
RecoveryResourceGroupId *string `json:"recoveryResourceGroupId,omitempty"`
RecoverySubscriptionId *string `json:"recoverySubscriptionId,omitempty"`
RecoveryVirtualNetwork RecoveryVirtualNetworkCustomDetails `json:"recoveryVirtualNetwork"`
VMDisks *[]A2AProtectionIntentDiskInputDetails `json:"vmDisks,omitempty"`
VMManagedDisks *[]A2AProtectionIntentManagedDiskInputDetails `json:"vmManagedDisks,omitempty"`
// Fields inherited from ReplicationProtectionIntentProviderSpecificSettings
}
var _ json.Marshaler = A2AReplicationIntentDetails{}
func (s A2AReplicationIntentDetails) MarshalJSON() ([]byte, error) {
type wrapper A2AReplicationIntentDetails
wrapped := wrapper(s)
encoded, err := json.Marshal(wrapped)
if err != nil {
return nil, fmt.Errorf("marshaling A2AReplicationIntentDetails: %+v", err)
}
var decoded map[string]interface{}
if err := json.Unmarshal(encoded, &decoded); err != nil {
return nil, fmt.Errorf("unmarshaling A2AReplicationIntentDetails: %+v", err)
}
decoded["instanceType"] = "A2A"
encoded, err = json.Marshal(decoded)
if err != nil {
return nil, fmt.Errorf("re-marshaling A2AReplicationIntentDetails: %+v", err)
}
return encoded, nil
}
var _ json.Unmarshaler = &A2AReplicationIntentDetails{}
func (s *A2AReplicationIntentDetails) UnmarshalJSON(bytes []byte) error {
type alias A2AReplicationIntentDetails
var decoded alias
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling into A2AReplicationIntentDetails: %+v", err)
}
s.AgentAutoUpdateStatus = decoded.AgentAutoUpdateStatus
s.AutoProtectionOfDataDisk = decoded.AutoProtectionOfDataDisk
s.AutomationAccountArmId = decoded.AutomationAccountArmId
s.AutomationAccountAuthenticationType = decoded.AutomationAccountAuthenticationType
s.DiskEncryptionInfo = decoded.DiskEncryptionInfo
s.FabricObjectId = decoded.FabricObjectId
s.MultiVMGroupId = decoded.MultiVMGroupId
s.MultiVMGroupName = decoded.MultiVMGroupName
s.PrimaryLocation = decoded.PrimaryLocation
s.RecoveryAvailabilityType = decoded.RecoveryAvailabilityType
s.RecoveryAvailabilityZone = decoded.RecoveryAvailabilityZone
s.RecoveryLocation = decoded.RecoveryLocation
s.RecoveryResourceGroupId = decoded.RecoveryResourceGroupId
s.RecoverySubscriptionId = decoded.RecoverySubscriptionId
s.VMDisks = decoded.VMDisks
s.VMManagedDisks = decoded.VMManagedDisks
var temp map[string]json.RawMessage
if err := json.Unmarshal(bytes, &temp); err != nil {
return fmt.Errorf("unmarshaling A2AReplicationIntentDetails into map[string]json.RawMessage: %+v", err)
}
if v, ok := temp["primaryStagingStorageAccount"]; ok {
impl, err := unmarshalStorageAccountCustomDetailsImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'PrimaryStagingStorageAccount' for 'A2AReplicationIntentDetails': %+v", err)
}
s.PrimaryStagingStorageAccount = impl
}
if v, ok := temp["protectionProfile"]; ok {
impl, err := unmarshalProtectionProfileCustomDetailsImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'ProtectionProfile' for 'A2AReplicationIntentDetails': %+v", err)
}
s.ProtectionProfile = impl
}
if v, ok := temp["recoveryAvailabilitySet"]; ok {
impl, err := unmarshalRecoveryAvailabilitySetCustomDetailsImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'RecoveryAvailabilitySet' for 'A2AReplicationIntentDetails': %+v", err)
}
s.RecoveryAvailabilitySet = impl
}
if v, ok := temp["recoveryBootDiagStorageAccount"]; ok {
impl, err := unmarshalStorageAccountCustomDetailsImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'RecoveryBootDiagStorageAccount' for 'A2AReplicationIntentDetails': %+v", err)
}
s.RecoveryBootDiagStorageAccount = impl
}
if v, ok := temp["recoveryProximityPlacementGroup"]; ok {
impl, err := unmarshalRecoveryProximityPlacementGroupCustomDetailsImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'RecoveryProximityPlacementGroup' for 'A2AReplicationIntentDetails': %+v", err)
}
s.RecoveryProximityPlacementGroup = impl
}
if v, ok := temp["recoveryVirtualNetwork"]; ok {
impl, err := unmarshalRecoveryVirtualNetworkCustomDetailsImplementation(v)
if err != nil {
return fmt.Errorf("unmarshaling field 'RecoveryVirtualNetwork' for 'A2AReplicationIntentDetails': %+v", err)
}
s.RecoveryVirtualNetwork = impl
}
return nil
}