1package backup 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/date" 25 "github.com/Azure/go-autorest/autorest/to" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// The package's fully qualified name. 31const fqdn = "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2016-06-01/backup" 32 33// AzureBackupServerEngine the backup engine type when Azure Backup Server is used to manage the backups. 34type AzureBackupServerEngine struct { 35 // FriendlyName - The friendly name of the backup engine. 36 FriendlyName *string `json:"friendlyName,omitempty"` 37 // BackupManagementType - The type of backup management associated with the backup engine. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 38 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 39 // RegistrationStatus - The status of the backup engine registration with the Recovery Services vault. 40 RegistrationStatus *string `json:"registrationStatus,omitempty"` 41 // HealthStatus - The backup status of the backup engine. 42 HealthStatus *string `json:"healthStatus,omitempty"` 43 // CanReRegister - The flag indicating whether the backup engine be registered again, once the engine has been initially registered. 44 CanReRegister *bool `json:"canReRegister,omitempty"` 45 // BackupEngineID - The ID of the backup engine. 46 BackupEngineID *string `json:"backupEngineId,omitempty"` 47 // BackupEngineType - Possible values include: 'BackupEngineTypeBackupEngineBase', 'BackupEngineTypeAzureBackupServerEngine', 'BackupEngineTypeDpmBackupEngine' 48 BackupEngineType EngineType `json:"backupEngineType,omitempty"` 49} 50 51// MarshalJSON is the custom marshaler for AzureBackupServerEngine. 52func (abse AzureBackupServerEngine) MarshalJSON() ([]byte, error) { 53 abse.BackupEngineType = BackupEngineTypeAzureBackupServerEngine 54 objectMap := make(map[string]interface{}) 55 if abse.FriendlyName != nil { 56 objectMap["friendlyName"] = abse.FriendlyName 57 } 58 if abse.BackupManagementType != "" { 59 objectMap["backupManagementType"] = abse.BackupManagementType 60 } 61 if abse.RegistrationStatus != nil { 62 objectMap["registrationStatus"] = abse.RegistrationStatus 63 } 64 if abse.HealthStatus != nil { 65 objectMap["healthStatus"] = abse.HealthStatus 66 } 67 if abse.CanReRegister != nil { 68 objectMap["canReRegister"] = abse.CanReRegister 69 } 70 if abse.BackupEngineID != nil { 71 objectMap["backupEngineId"] = abse.BackupEngineID 72 } 73 if abse.BackupEngineType != "" { 74 objectMap["backupEngineType"] = abse.BackupEngineType 75 } 76 return json.Marshal(objectMap) 77} 78 79// AsAzureBackupServerEngine is the BasicEngineBase implementation for AzureBackupServerEngine. 80func (abse AzureBackupServerEngine) AsAzureBackupServerEngine() (*AzureBackupServerEngine, bool) { 81 return &abse, true 82} 83 84// AsDpmBackupEngine is the BasicEngineBase implementation for AzureBackupServerEngine. 85func (abse AzureBackupServerEngine) AsDpmBackupEngine() (*DpmBackupEngine, bool) { 86 return nil, false 87} 88 89// AsEngineBase is the BasicEngineBase implementation for AzureBackupServerEngine. 90func (abse AzureBackupServerEngine) AsEngineBase() (*EngineBase, bool) { 91 return nil, false 92} 93 94// AsBasicEngineBase is the BasicEngineBase implementation for AzureBackupServerEngine. 95func (abse AzureBackupServerEngine) AsBasicEngineBase() (BasicEngineBase, bool) { 96 return &abse, true 97} 98 99// AzureIaaSClassicComputeVMContainer iaaS VM workload-specific backup item representing a classic-deployed 100// virtual machine. 101type AzureIaaSClassicComputeVMContainer struct { 102 // VirtualMachineID - The fully qualified Resource Manager URL of the virtual machine represented by this Azure IaaS VM container. 103 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 104 // VirtualMachineVersion - Specifies whether the container represents a classic or a Resource Manager-deployed virtual machine. 105 VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` 106 // ResourceGroup - The resource group name associated with the Recovery Services vault. 107 ResourceGroup *string `json:"resourceGroup,omitempty"` 108 // FriendlyName - Friendly name of the container. 109 FriendlyName *string `json:"friendlyName,omitempty"` 110 // BackupManagementType - The backup management type for the container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 111 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 112 // RegistrationStatus - The container's registration status with the Recovery Services vault. 113 RegistrationStatus *string `json:"registrationStatus,omitempty"` 114 // HealthStatus - The status of the container's health. 115 HealthStatus *string `json:"healthStatus,omitempty"` 116 // ContainerType - READ-ONLY; The type assigned to the container. The values to use for each of these properties are:<br/> 1. Compute Azure VM is Microsoft.Compute/virtualMachines<br/> 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines<br/> 3. Windows machines (like Azure Backup Server and DPM) is Windows<br/> 4. Azure SQL instance is AzureSqlContainer. 117 ContainerType *string `json:"containerType,omitempty"` 118 // ProtectableObjectType - Possible values include: 'ProtectableObjectTypeProtectionContainer', 'ProtectableObjectTypeAzureSQLContainer', 'ProtectableObjectTypeIaaSVMContainer', 'ProtectableObjectTypeMABWindowsContainer', 'ProtectableObjectTypeMicrosoftComputevirtualMachines', 'ProtectableObjectTypeMicrosoftClassicComputevirtualMachines' 119 ProtectableObjectType ProtectableObjectType `json:"protectableObjectType,omitempty"` 120} 121 122// MarshalJSON is the custom marshaler for AzureIaaSClassicComputeVMContainer. 123func (aisccvc AzureIaaSClassicComputeVMContainer) MarshalJSON() ([]byte, error) { 124 aisccvc.ProtectableObjectType = ProtectableObjectTypeMicrosoftClassicComputevirtualMachines 125 objectMap := make(map[string]interface{}) 126 if aisccvc.VirtualMachineID != nil { 127 objectMap["virtualMachineId"] = aisccvc.VirtualMachineID 128 } 129 if aisccvc.VirtualMachineVersion != nil { 130 objectMap["virtualMachineVersion"] = aisccvc.VirtualMachineVersion 131 } 132 if aisccvc.ResourceGroup != nil { 133 objectMap["resourceGroup"] = aisccvc.ResourceGroup 134 } 135 if aisccvc.FriendlyName != nil { 136 objectMap["friendlyName"] = aisccvc.FriendlyName 137 } 138 if aisccvc.BackupManagementType != "" { 139 objectMap["backupManagementType"] = aisccvc.BackupManagementType 140 } 141 if aisccvc.RegistrationStatus != nil { 142 objectMap["registrationStatus"] = aisccvc.RegistrationStatus 143 } 144 if aisccvc.HealthStatus != nil { 145 objectMap["healthStatus"] = aisccvc.HealthStatus 146 } 147 if aisccvc.ProtectableObjectType != "" { 148 objectMap["protectableObjectType"] = aisccvc.ProtectableObjectType 149 } 150 return json.Marshal(objectMap) 151} 152 153// AsAzureSQLContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 154func (aisccvc AzureIaaSClassicComputeVMContainer) AsAzureSQLContainer() (*AzureSQLContainer, bool) { 155 return nil, false 156} 157 158// AsIaaSVMContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 159func (aisccvc AzureIaaSClassicComputeVMContainer) AsIaaSVMContainer() (*IaaSVMContainer, bool) { 160 return nil, false 161} 162 163// AsBasicIaaSVMContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 164func (aisccvc AzureIaaSClassicComputeVMContainer) AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) { 165 return &aisccvc, true 166} 167 168// AsMabContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 169func (aisccvc AzureIaaSClassicComputeVMContainer) AsMabContainer() (*MabContainer, bool) { 170 return nil, false 171} 172 173// AsAzureIaaSComputeVMContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 174func (aisccvc AzureIaaSClassicComputeVMContainer) AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) { 175 return nil, false 176} 177 178// AsAzureIaaSClassicComputeVMContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 179func (aisccvc AzureIaaSClassicComputeVMContainer) AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) { 180 return &aisccvc, true 181} 182 183// AsProtectionContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 184func (aisccvc AzureIaaSClassicComputeVMContainer) AsProtectionContainer() (*ProtectionContainer, bool) { 185 return nil, false 186} 187 188// AsBasicProtectionContainer is the BasicProtectionContainer implementation for AzureIaaSClassicComputeVMContainer. 189func (aisccvc AzureIaaSClassicComputeVMContainer) AsBasicProtectionContainer() (BasicProtectionContainer, bool) { 190 return &aisccvc, true 191} 192 193// AzureIaaSClassicComputeVMProtectableItem iaaS VM workload-specific backup item representing a classic 194// VM. 195type AzureIaaSClassicComputeVMProtectableItem struct { 196 // VirtualMachineID - The fully qualified Resource Manager ID of the virtual machine. 197 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 198 // BackupManagementType - The backup management type. 199 BackupManagementType *string `json:"backupManagementType,omitempty"` 200 // FriendlyName - The friendly name of the backup item. 201 FriendlyName *string `json:"friendlyName,omitempty"` 202 // ProtectionState - The state of the back up item. Possible values include: 'ProtectionStatusInvalid', 'ProtectionStatusNotProtected', 'ProtectionStatusProtecting', 'ProtectionStatusProtected' 203 ProtectionState ProtectionStatus `json:"protectionState,omitempty"` 204 // ProtectableItemType - Possible values include: 'ProtectableItemTypeWorkloadProtectableItem', 'ProtectableItemTypeIaaSVMProtectableItem', 'ProtectableItemTypeMicrosoftComputevirtualMachines', 'ProtectableItemTypeMicrosoftClassicComputevirtualMachines' 205 ProtectableItemType ProtectableItemType `json:"protectableItemType,omitempty"` 206} 207 208// MarshalJSON is the custom marshaler for AzureIaaSClassicComputeVMProtectableItem. 209func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) MarshalJSON() ([]byte, error) { 210 aisccvpi.ProtectableItemType = ProtectableItemTypeMicrosoftClassicComputevirtualMachines 211 objectMap := make(map[string]interface{}) 212 if aisccvpi.VirtualMachineID != nil { 213 objectMap["virtualMachineId"] = aisccvpi.VirtualMachineID 214 } 215 if aisccvpi.BackupManagementType != nil { 216 objectMap["backupManagementType"] = aisccvpi.BackupManagementType 217 } 218 if aisccvpi.FriendlyName != nil { 219 objectMap["friendlyName"] = aisccvpi.FriendlyName 220 } 221 if aisccvpi.ProtectionState != "" { 222 objectMap["protectionState"] = aisccvpi.ProtectionState 223 } 224 if aisccvpi.ProtectableItemType != "" { 225 objectMap["protectableItemType"] = aisccvpi.ProtectableItemType 226 } 227 return json.Marshal(objectMap) 228} 229 230// AsIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSClassicComputeVMProtectableItem. 231func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) AsIaaSVMProtectableItem() (*IaaSVMProtectableItem, bool) { 232 return nil, false 233} 234 235// AsBasicIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSClassicComputeVMProtectableItem. 236func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) AsBasicIaaSVMProtectableItem() (BasicIaaSVMProtectableItem, bool) { 237 return &aisccvpi, true 238} 239 240// AsAzureIaaSComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSClassicComputeVMProtectableItem. 241func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) AsAzureIaaSComputeVMProtectableItem() (*AzureIaaSComputeVMProtectableItem, bool) { 242 return nil, false 243} 244 245// AsAzureIaaSClassicComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSClassicComputeVMProtectableItem. 246func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) AsAzureIaaSClassicComputeVMProtectableItem() (*AzureIaaSClassicComputeVMProtectableItem, bool) { 247 return &aisccvpi, true 248} 249 250// AsWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSClassicComputeVMProtectableItem. 251func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) AsWorkloadProtectableItem() (*WorkloadProtectableItem, bool) { 252 return nil, false 253} 254 255// AsBasicWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSClassicComputeVMProtectableItem. 256func (aisccvpi AzureIaaSClassicComputeVMProtectableItem) AsBasicWorkloadProtectableItem() (BasicWorkloadProtectableItem, bool) { 257 return &aisccvpi, true 258} 259 260// AzureIaaSClassicComputeVMProtectedItem iaaS VM workload-specific backup item representing the classic 261// VM. 262type AzureIaaSClassicComputeVMProtectedItem struct { 263 // FriendlyName - The friendly name of the VM represented by this backup item. 264 FriendlyName *string `json:"friendlyName,omitempty"` 265 // VirtualMachineID - The fully qualified Resource Manager ID of the virtual machine represented by this item. 266 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 267 // ProtectionStatus - The backup status of this backup item. 268 ProtectionStatus *string `json:"protectionStatus,omitempty"` 269 // ProtectionState - The backup state of this backup item. Possible values include: 'ProtectionStateInvalid', 'ProtectionStateIRPending', 'ProtectionStateProtected', 'ProtectionStateProtectionError', 'ProtectionStateProtectionStopped', 'ProtectionStateProtectionPaused' 270 ProtectionState ProtectionState `json:"protectionState,omitempty"` 271 // LastBackupStatus - The last backup operation status. The possible values are: Healthy or Unhealthy. 272 LastBackupStatus *string `json:"lastBackupStatus,omitempty"` 273 // LastBackupTime - The timestamp of the last backup operation for this backup item. 274 LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` 275 // ExtendedInfo - Additional information for this backup item. 276 ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` 277 // BackupManagementType - The backup management type associated with the backup item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 278 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 279 // WorkloadType - The workload type for this item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 280 WorkloadType DataSourceType `json:"workloadType,omitempty"` 281 // SourceResourceID - The ID of the resource to be backed up. 282 SourceResourceID *string `json:"sourceResourceId,omitempty"` 283 // PolicyID - The ID of the backup policy associated with this backup item. 284 PolicyID *string `json:"policyId,omitempty"` 285 // LastRecoveryPoint - The timestamp when the most recent backup copy was created for this backup item. 286 LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` 287 // ProtectedItemType - Possible values include: 'ProtectedItemTypeProtectedItem', 'ProtectedItemTypeAzureIaaSVMProtectedItem', 'ProtectedItemTypeMabFileFolderProtectedItem', 'ProtectedItemTypeMicrosoftSqlserversdatabases', 'ProtectedItemTypeMicrosoftComputevirtualMachines', 'ProtectedItemTypeMicrosoftClassicComputevirtualMachines' 288 ProtectedItemType ProtectedItemType `json:"protectedItemType,omitempty"` 289} 290 291// MarshalJSON is the custom marshaler for AzureIaaSClassicComputeVMProtectedItem. 292func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) MarshalJSON() ([]byte, error) { 293 aisccvpi.ProtectedItemType = ProtectedItemTypeMicrosoftClassicComputevirtualMachines 294 objectMap := make(map[string]interface{}) 295 if aisccvpi.FriendlyName != nil { 296 objectMap["friendlyName"] = aisccvpi.FriendlyName 297 } 298 if aisccvpi.VirtualMachineID != nil { 299 objectMap["virtualMachineId"] = aisccvpi.VirtualMachineID 300 } 301 if aisccvpi.ProtectionStatus != nil { 302 objectMap["protectionStatus"] = aisccvpi.ProtectionStatus 303 } 304 if aisccvpi.ProtectionState != "" { 305 objectMap["protectionState"] = aisccvpi.ProtectionState 306 } 307 if aisccvpi.LastBackupStatus != nil { 308 objectMap["lastBackupStatus"] = aisccvpi.LastBackupStatus 309 } 310 if aisccvpi.LastBackupTime != nil { 311 objectMap["lastBackupTime"] = aisccvpi.LastBackupTime 312 } 313 if aisccvpi.ExtendedInfo != nil { 314 objectMap["extendedInfo"] = aisccvpi.ExtendedInfo 315 } 316 if aisccvpi.BackupManagementType != "" { 317 objectMap["backupManagementType"] = aisccvpi.BackupManagementType 318 } 319 if aisccvpi.WorkloadType != "" { 320 objectMap["workloadType"] = aisccvpi.WorkloadType 321 } 322 if aisccvpi.SourceResourceID != nil { 323 objectMap["sourceResourceId"] = aisccvpi.SourceResourceID 324 } 325 if aisccvpi.PolicyID != nil { 326 objectMap["policyId"] = aisccvpi.PolicyID 327 } 328 if aisccvpi.LastRecoveryPoint != nil { 329 objectMap["lastRecoveryPoint"] = aisccvpi.LastRecoveryPoint 330 } 331 if aisccvpi.ProtectedItemType != "" { 332 objectMap["protectedItemType"] = aisccvpi.ProtectedItemType 333 } 334 return json.Marshal(objectMap) 335} 336 337// AsAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 338func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) { 339 return nil, false 340} 341 342// AsBasicAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 343func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) { 344 return &aisccvpi, true 345} 346 347// AsMabFileFolderProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 348func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) { 349 return nil, false 350} 351 352// AsAzureSQLProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 353func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) { 354 return nil, false 355} 356 357// AsAzureIaaSComputeVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 358func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) { 359 return nil, false 360} 361 362// AsAzureIaaSClassicComputeVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 363func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) { 364 return &aisccvpi, true 365} 366 367// AsProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 368func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsProtectedItem() (*ProtectedItem, bool) { 369 return nil, false 370} 371 372// AsBasicProtectedItem is the BasicProtectedItem implementation for AzureIaaSClassicComputeVMProtectedItem. 373func (aisccvpi AzureIaaSClassicComputeVMProtectedItem) AsBasicProtectedItem() (BasicProtectedItem, bool) { 374 return &aisccvpi, true 375} 376 377// AzureIaaSComputeVMContainer iaaS VM workload-specific backup item representing a Resource 378// Manager-deployed virtual machine. 379type AzureIaaSComputeVMContainer struct { 380 // VirtualMachineID - The fully qualified Resource Manager URL of the virtual machine represented by this Azure IaaS VM container. 381 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 382 // VirtualMachineVersion - Specifies whether the container represents a classic or a Resource Manager-deployed virtual machine. 383 VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` 384 // ResourceGroup - The resource group name associated with the Recovery Services vault. 385 ResourceGroup *string `json:"resourceGroup,omitempty"` 386 // FriendlyName - Friendly name of the container. 387 FriendlyName *string `json:"friendlyName,omitempty"` 388 // BackupManagementType - The backup management type for the container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 389 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 390 // RegistrationStatus - The container's registration status with the Recovery Services vault. 391 RegistrationStatus *string `json:"registrationStatus,omitempty"` 392 // HealthStatus - The status of the container's health. 393 HealthStatus *string `json:"healthStatus,omitempty"` 394 // ContainerType - READ-ONLY; The type assigned to the container. The values to use for each of these properties are:<br/> 1. Compute Azure VM is Microsoft.Compute/virtualMachines<br/> 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines<br/> 3. Windows machines (like Azure Backup Server and DPM) is Windows<br/> 4. Azure SQL instance is AzureSqlContainer. 395 ContainerType *string `json:"containerType,omitempty"` 396 // ProtectableObjectType - Possible values include: 'ProtectableObjectTypeProtectionContainer', 'ProtectableObjectTypeAzureSQLContainer', 'ProtectableObjectTypeIaaSVMContainer', 'ProtectableObjectTypeMABWindowsContainer', 'ProtectableObjectTypeMicrosoftComputevirtualMachines', 'ProtectableObjectTypeMicrosoftClassicComputevirtualMachines' 397 ProtectableObjectType ProtectableObjectType `json:"protectableObjectType,omitempty"` 398} 399 400// MarshalJSON is the custom marshaler for AzureIaaSComputeVMContainer. 401func (aiscvc AzureIaaSComputeVMContainer) MarshalJSON() ([]byte, error) { 402 aiscvc.ProtectableObjectType = ProtectableObjectTypeMicrosoftComputevirtualMachines 403 objectMap := make(map[string]interface{}) 404 if aiscvc.VirtualMachineID != nil { 405 objectMap["virtualMachineId"] = aiscvc.VirtualMachineID 406 } 407 if aiscvc.VirtualMachineVersion != nil { 408 objectMap["virtualMachineVersion"] = aiscvc.VirtualMachineVersion 409 } 410 if aiscvc.ResourceGroup != nil { 411 objectMap["resourceGroup"] = aiscvc.ResourceGroup 412 } 413 if aiscvc.FriendlyName != nil { 414 objectMap["friendlyName"] = aiscvc.FriendlyName 415 } 416 if aiscvc.BackupManagementType != "" { 417 objectMap["backupManagementType"] = aiscvc.BackupManagementType 418 } 419 if aiscvc.RegistrationStatus != nil { 420 objectMap["registrationStatus"] = aiscvc.RegistrationStatus 421 } 422 if aiscvc.HealthStatus != nil { 423 objectMap["healthStatus"] = aiscvc.HealthStatus 424 } 425 if aiscvc.ProtectableObjectType != "" { 426 objectMap["protectableObjectType"] = aiscvc.ProtectableObjectType 427 } 428 return json.Marshal(objectMap) 429} 430 431// AsAzureSQLContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 432func (aiscvc AzureIaaSComputeVMContainer) AsAzureSQLContainer() (*AzureSQLContainer, bool) { 433 return nil, false 434} 435 436// AsIaaSVMContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 437func (aiscvc AzureIaaSComputeVMContainer) AsIaaSVMContainer() (*IaaSVMContainer, bool) { 438 return nil, false 439} 440 441// AsBasicIaaSVMContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 442func (aiscvc AzureIaaSComputeVMContainer) AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) { 443 return &aiscvc, true 444} 445 446// AsMabContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 447func (aiscvc AzureIaaSComputeVMContainer) AsMabContainer() (*MabContainer, bool) { 448 return nil, false 449} 450 451// AsAzureIaaSComputeVMContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 452func (aiscvc AzureIaaSComputeVMContainer) AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) { 453 return &aiscvc, true 454} 455 456// AsAzureIaaSClassicComputeVMContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 457func (aiscvc AzureIaaSComputeVMContainer) AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) { 458 return nil, false 459} 460 461// AsProtectionContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 462func (aiscvc AzureIaaSComputeVMContainer) AsProtectionContainer() (*ProtectionContainer, bool) { 463 return nil, false 464} 465 466// AsBasicProtectionContainer is the BasicProtectionContainer implementation for AzureIaaSComputeVMContainer. 467func (aiscvc AzureIaaSComputeVMContainer) AsBasicProtectionContainer() (BasicProtectionContainer, bool) { 468 return &aiscvc, true 469} 470 471// AzureIaaSComputeVMProtectableItem iaaS VM workload-specific backup item representing a Resource Manager 472// VM. 473type AzureIaaSComputeVMProtectableItem struct { 474 // VirtualMachineID - The fully qualified Resource Manager ID of the virtual machine. 475 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 476 // BackupManagementType - The backup management type. 477 BackupManagementType *string `json:"backupManagementType,omitempty"` 478 // FriendlyName - The friendly name of the backup item. 479 FriendlyName *string `json:"friendlyName,omitempty"` 480 // ProtectionState - The state of the back up item. Possible values include: 'ProtectionStatusInvalid', 'ProtectionStatusNotProtected', 'ProtectionStatusProtecting', 'ProtectionStatusProtected' 481 ProtectionState ProtectionStatus `json:"protectionState,omitempty"` 482 // ProtectableItemType - Possible values include: 'ProtectableItemTypeWorkloadProtectableItem', 'ProtectableItemTypeIaaSVMProtectableItem', 'ProtectableItemTypeMicrosoftComputevirtualMachines', 'ProtectableItemTypeMicrosoftClassicComputevirtualMachines' 483 ProtectableItemType ProtectableItemType `json:"protectableItemType,omitempty"` 484} 485 486// MarshalJSON is the custom marshaler for AzureIaaSComputeVMProtectableItem. 487func (aiscvpi AzureIaaSComputeVMProtectableItem) MarshalJSON() ([]byte, error) { 488 aiscvpi.ProtectableItemType = ProtectableItemTypeMicrosoftComputevirtualMachines 489 objectMap := make(map[string]interface{}) 490 if aiscvpi.VirtualMachineID != nil { 491 objectMap["virtualMachineId"] = aiscvpi.VirtualMachineID 492 } 493 if aiscvpi.BackupManagementType != nil { 494 objectMap["backupManagementType"] = aiscvpi.BackupManagementType 495 } 496 if aiscvpi.FriendlyName != nil { 497 objectMap["friendlyName"] = aiscvpi.FriendlyName 498 } 499 if aiscvpi.ProtectionState != "" { 500 objectMap["protectionState"] = aiscvpi.ProtectionState 501 } 502 if aiscvpi.ProtectableItemType != "" { 503 objectMap["protectableItemType"] = aiscvpi.ProtectableItemType 504 } 505 return json.Marshal(objectMap) 506} 507 508// AsIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSComputeVMProtectableItem. 509func (aiscvpi AzureIaaSComputeVMProtectableItem) AsIaaSVMProtectableItem() (*IaaSVMProtectableItem, bool) { 510 return nil, false 511} 512 513// AsBasicIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSComputeVMProtectableItem. 514func (aiscvpi AzureIaaSComputeVMProtectableItem) AsBasicIaaSVMProtectableItem() (BasicIaaSVMProtectableItem, bool) { 515 return &aiscvpi, true 516} 517 518// AsAzureIaaSComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSComputeVMProtectableItem. 519func (aiscvpi AzureIaaSComputeVMProtectableItem) AsAzureIaaSComputeVMProtectableItem() (*AzureIaaSComputeVMProtectableItem, bool) { 520 return &aiscvpi, true 521} 522 523// AsAzureIaaSClassicComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSComputeVMProtectableItem. 524func (aiscvpi AzureIaaSComputeVMProtectableItem) AsAzureIaaSClassicComputeVMProtectableItem() (*AzureIaaSClassicComputeVMProtectableItem, bool) { 525 return nil, false 526} 527 528// AsWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSComputeVMProtectableItem. 529func (aiscvpi AzureIaaSComputeVMProtectableItem) AsWorkloadProtectableItem() (*WorkloadProtectableItem, bool) { 530 return nil, false 531} 532 533// AsBasicWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for AzureIaaSComputeVMProtectableItem. 534func (aiscvpi AzureIaaSComputeVMProtectableItem) AsBasicWorkloadProtectableItem() (BasicWorkloadProtectableItem, bool) { 535 return &aiscvpi, true 536} 537 538// AzureIaaSComputeVMProtectedItem iaaS VM workload-specific backup item representing the Resource Manager 539// VM. 540type AzureIaaSComputeVMProtectedItem struct { 541 // FriendlyName - The friendly name of the VM represented by this backup item. 542 FriendlyName *string `json:"friendlyName,omitempty"` 543 // VirtualMachineID - The fully qualified Resource Manager ID of the virtual machine represented by this item. 544 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 545 // ProtectionStatus - The backup status of this backup item. 546 ProtectionStatus *string `json:"protectionStatus,omitempty"` 547 // ProtectionState - The backup state of this backup item. Possible values include: 'ProtectionStateInvalid', 'ProtectionStateIRPending', 'ProtectionStateProtected', 'ProtectionStateProtectionError', 'ProtectionStateProtectionStopped', 'ProtectionStateProtectionPaused' 548 ProtectionState ProtectionState `json:"protectionState,omitempty"` 549 // LastBackupStatus - The last backup operation status. The possible values are: Healthy or Unhealthy. 550 LastBackupStatus *string `json:"lastBackupStatus,omitempty"` 551 // LastBackupTime - The timestamp of the last backup operation for this backup item. 552 LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` 553 // ExtendedInfo - Additional information for this backup item. 554 ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` 555 // BackupManagementType - The backup management type associated with the backup item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 556 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 557 // WorkloadType - The workload type for this item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 558 WorkloadType DataSourceType `json:"workloadType,omitempty"` 559 // SourceResourceID - The ID of the resource to be backed up. 560 SourceResourceID *string `json:"sourceResourceId,omitempty"` 561 // PolicyID - The ID of the backup policy associated with this backup item. 562 PolicyID *string `json:"policyId,omitempty"` 563 // LastRecoveryPoint - The timestamp when the most recent backup copy was created for this backup item. 564 LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` 565 // ProtectedItemType - Possible values include: 'ProtectedItemTypeProtectedItem', 'ProtectedItemTypeAzureIaaSVMProtectedItem', 'ProtectedItemTypeMabFileFolderProtectedItem', 'ProtectedItemTypeMicrosoftSqlserversdatabases', 'ProtectedItemTypeMicrosoftComputevirtualMachines', 'ProtectedItemTypeMicrosoftClassicComputevirtualMachines' 566 ProtectedItemType ProtectedItemType `json:"protectedItemType,omitempty"` 567} 568 569// MarshalJSON is the custom marshaler for AzureIaaSComputeVMProtectedItem. 570func (aiscvpi AzureIaaSComputeVMProtectedItem) MarshalJSON() ([]byte, error) { 571 aiscvpi.ProtectedItemType = ProtectedItemTypeMicrosoftComputevirtualMachines 572 objectMap := make(map[string]interface{}) 573 if aiscvpi.FriendlyName != nil { 574 objectMap["friendlyName"] = aiscvpi.FriendlyName 575 } 576 if aiscvpi.VirtualMachineID != nil { 577 objectMap["virtualMachineId"] = aiscvpi.VirtualMachineID 578 } 579 if aiscvpi.ProtectionStatus != nil { 580 objectMap["protectionStatus"] = aiscvpi.ProtectionStatus 581 } 582 if aiscvpi.ProtectionState != "" { 583 objectMap["protectionState"] = aiscvpi.ProtectionState 584 } 585 if aiscvpi.LastBackupStatus != nil { 586 objectMap["lastBackupStatus"] = aiscvpi.LastBackupStatus 587 } 588 if aiscvpi.LastBackupTime != nil { 589 objectMap["lastBackupTime"] = aiscvpi.LastBackupTime 590 } 591 if aiscvpi.ExtendedInfo != nil { 592 objectMap["extendedInfo"] = aiscvpi.ExtendedInfo 593 } 594 if aiscvpi.BackupManagementType != "" { 595 objectMap["backupManagementType"] = aiscvpi.BackupManagementType 596 } 597 if aiscvpi.WorkloadType != "" { 598 objectMap["workloadType"] = aiscvpi.WorkloadType 599 } 600 if aiscvpi.SourceResourceID != nil { 601 objectMap["sourceResourceId"] = aiscvpi.SourceResourceID 602 } 603 if aiscvpi.PolicyID != nil { 604 objectMap["policyId"] = aiscvpi.PolicyID 605 } 606 if aiscvpi.LastRecoveryPoint != nil { 607 objectMap["lastRecoveryPoint"] = aiscvpi.LastRecoveryPoint 608 } 609 if aiscvpi.ProtectedItemType != "" { 610 objectMap["protectedItemType"] = aiscvpi.ProtectedItemType 611 } 612 return json.Marshal(objectMap) 613} 614 615// AsAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 616func (aiscvpi AzureIaaSComputeVMProtectedItem) AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) { 617 return nil, false 618} 619 620// AsBasicAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 621func (aiscvpi AzureIaaSComputeVMProtectedItem) AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) { 622 return &aiscvpi, true 623} 624 625// AsMabFileFolderProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 626func (aiscvpi AzureIaaSComputeVMProtectedItem) AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) { 627 return nil, false 628} 629 630// AsAzureSQLProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 631func (aiscvpi AzureIaaSComputeVMProtectedItem) AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) { 632 return nil, false 633} 634 635// AsAzureIaaSComputeVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 636func (aiscvpi AzureIaaSComputeVMProtectedItem) AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) { 637 return &aiscvpi, true 638} 639 640// AsAzureIaaSClassicComputeVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 641func (aiscvpi AzureIaaSComputeVMProtectedItem) AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) { 642 return nil, false 643} 644 645// AsProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 646func (aiscvpi AzureIaaSComputeVMProtectedItem) AsProtectedItem() (*ProtectedItem, bool) { 647 return nil, false 648} 649 650// AsBasicProtectedItem is the BasicProtectedItem implementation for AzureIaaSComputeVMProtectedItem. 651func (aiscvpi AzureIaaSComputeVMProtectedItem) AsBasicProtectedItem() (BasicProtectedItem, bool) { 652 return &aiscvpi, true 653} 654 655// AzureIaaSVMErrorInfo azure IaaS VM workload-specific error information. 656type AzureIaaSVMErrorInfo struct { 657 // ErrorCode - Error code. 658 ErrorCode *int32 `json:"errorCode,omitempty"` 659 // ErrorTitle - Title: typically, the entity associated the error. 660 ErrorTitle *string `json:"errorTitle,omitempty"` 661 // ErrorString - Localized error string. 662 ErrorString *string `json:"errorString,omitempty"` 663 // Recommendations - List of localized recommendations for the error string. 664 Recommendations *[]string `json:"recommendations,omitempty"` 665} 666 667// AzureIaaSVMJob the Azure IaaS VM workload-specific job object. 668type AzureIaaSVMJob struct { 669 // Duration - The time that elapsed during the execution of this job. 670 Duration *string `json:"duration,omitempty"` 671 // ActionsInfo - Gets or sets the state, or actions, applicable on this job. Examples of the actions are: Cancel or Retry. 672 ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` 673 // ErrorDetails - Error details about this job. 674 ErrorDetails *[]AzureIaaSVMErrorInfo `json:"errorDetails,omitempty"` 675 // VirtualMachineVersion - Specifies whether the backup item is a Classic VM or a Resource Manager VM. 676 VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` 677 // ExtendedInfo - Additional information for this job. 678 ExtendedInfo *AzureIaaSVMJobExtendedInfo `json:"extendedInfo,omitempty"` 679 // EntityFriendlyName - The friendly name of the entity on which the current job is executing. 680 EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` 681 // BackupManagementType - The backup management type for the current job. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 682 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 683 // Operation - The operation name. 684 Operation *string `json:"operation,omitempty"` 685 // Status - The job status. 686 Status *string `json:"status,omitempty"` 687 // StartTime - The start time. 688 StartTime *date.Time `json:"startTime,omitempty"` 689 // EndTime - The end time. 690 EndTime *date.Time `json:"endTime,omitempty"` 691 // ActivityID - ActivityId of job. 692 ActivityID *string `json:"activityId,omitempty"` 693 // JobType - Possible values include: 'JobTypeJob', 'JobTypeAzureIaaSVMJob', 'JobTypeDpmJob', 'JobTypeMabJob' 694 JobType JobType `json:"jobType,omitempty"` 695} 696 697// MarshalJSON is the custom marshaler for AzureIaaSVMJob. 698func (aisj AzureIaaSVMJob) MarshalJSON() ([]byte, error) { 699 aisj.JobType = JobTypeAzureIaaSVMJob 700 objectMap := make(map[string]interface{}) 701 if aisj.Duration != nil { 702 objectMap["duration"] = aisj.Duration 703 } 704 if aisj.ActionsInfo != nil { 705 objectMap["actionsInfo"] = aisj.ActionsInfo 706 } 707 if aisj.ErrorDetails != nil { 708 objectMap["errorDetails"] = aisj.ErrorDetails 709 } 710 if aisj.VirtualMachineVersion != nil { 711 objectMap["virtualMachineVersion"] = aisj.VirtualMachineVersion 712 } 713 if aisj.ExtendedInfo != nil { 714 objectMap["extendedInfo"] = aisj.ExtendedInfo 715 } 716 if aisj.EntityFriendlyName != nil { 717 objectMap["entityFriendlyName"] = aisj.EntityFriendlyName 718 } 719 if aisj.BackupManagementType != "" { 720 objectMap["backupManagementType"] = aisj.BackupManagementType 721 } 722 if aisj.Operation != nil { 723 objectMap["operation"] = aisj.Operation 724 } 725 if aisj.Status != nil { 726 objectMap["status"] = aisj.Status 727 } 728 if aisj.StartTime != nil { 729 objectMap["startTime"] = aisj.StartTime 730 } 731 if aisj.EndTime != nil { 732 objectMap["endTime"] = aisj.EndTime 733 } 734 if aisj.ActivityID != nil { 735 objectMap["activityId"] = aisj.ActivityID 736 } 737 if aisj.JobType != "" { 738 objectMap["jobType"] = aisj.JobType 739 } 740 return json.Marshal(objectMap) 741} 742 743// AsAzureIaaSVMJob is the BasicJob implementation for AzureIaaSVMJob. 744func (aisj AzureIaaSVMJob) AsAzureIaaSVMJob() (*AzureIaaSVMJob, bool) { 745 return &aisj, true 746} 747 748// AsDpmJob is the BasicJob implementation for AzureIaaSVMJob. 749func (aisj AzureIaaSVMJob) AsDpmJob() (*DpmJob, bool) { 750 return nil, false 751} 752 753// AsMabJob is the BasicJob implementation for AzureIaaSVMJob. 754func (aisj AzureIaaSVMJob) AsMabJob() (*MabJob, bool) { 755 return nil, false 756} 757 758// AsJob is the BasicJob implementation for AzureIaaSVMJob. 759func (aisj AzureIaaSVMJob) AsJob() (*Job, bool) { 760 return nil, false 761} 762 763// AsBasicJob is the BasicJob implementation for AzureIaaSVMJob. 764func (aisj AzureIaaSVMJob) AsBasicJob() (BasicJob, bool) { 765 return &aisj, true 766} 767 768// AzureIaaSVMJobExtendedInfo additional information for the Azure IaaS VM workload-specific job. 769type AzureIaaSVMJobExtendedInfo struct { 770 // TasksList - List of tasks associated with this job. 771 TasksList *[]AzureIaaSVMJobTaskDetails `json:"tasksList,omitempty"` 772 // PropertyBag - Job properties. 773 PropertyBag map[string]*string `json:"propertyBag"` 774 // ProgressPercentage - Indicates progress of the job. Null if it has not started or completed. 775 ProgressPercentage *float64 `json:"progressPercentage,omitempty"` 776 // DynamicErrorMessage - Non-localized error message for job execution. 777 DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` 778} 779 780// MarshalJSON is the custom marshaler for AzureIaaSVMJobExtendedInfo. 781func (aisjei AzureIaaSVMJobExtendedInfo) MarshalJSON() ([]byte, error) { 782 objectMap := make(map[string]interface{}) 783 if aisjei.TasksList != nil { 784 objectMap["tasksList"] = aisjei.TasksList 785 } 786 if aisjei.PropertyBag != nil { 787 objectMap["propertyBag"] = aisjei.PropertyBag 788 } 789 if aisjei.ProgressPercentage != nil { 790 objectMap["progressPercentage"] = aisjei.ProgressPercentage 791 } 792 if aisjei.DynamicErrorMessage != nil { 793 objectMap["dynamicErrorMessage"] = aisjei.DynamicErrorMessage 794 } 795 return json.Marshal(objectMap) 796} 797 798// AzureIaaSVMJobTaskDetails azure IaaS VM workload-specific job task details. 799type AzureIaaSVMJobTaskDetails struct { 800 // TaskID - The task display name. 801 TaskID *string `json:"taskId,omitempty"` 802 // StartTime - The start time. 803 StartTime *date.Time `json:"startTime,omitempty"` 804 // EndTime - The end time. 805 EndTime *date.Time `json:"endTime,omitempty"` 806 // InstanceID - The instance ID. 807 InstanceID *string `json:"instanceId,omitempty"` 808 // Duration - The time elapsed for the task. 809 Duration *string `json:"duration,omitempty"` 810 // Status - The status. 811 Status *string `json:"status,omitempty"` 812 // ProgressPercentage - The progress of the task, as a percentage. 813 ProgressPercentage *float64 `json:"progressPercentage,omitempty"` 814} 815 816// BasicAzureIaaSVMProtectedItem this Azure VM workload-specific (also known as IaaS VM workload-specific) backup item 817// has been backed up. 818type BasicAzureIaaSVMProtectedItem interface { 819 AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) 820 AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) 821 AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) 822} 823 824// AzureIaaSVMProtectedItem this Azure VM workload-specific (also known as IaaS VM workload-specific) backup 825// item has been backed up. 826type AzureIaaSVMProtectedItem struct { 827 // FriendlyName - The friendly name of the VM represented by this backup item. 828 FriendlyName *string `json:"friendlyName,omitempty"` 829 // VirtualMachineID - The fully qualified Resource Manager ID of the virtual machine represented by this item. 830 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 831 // ProtectionStatus - The backup status of this backup item. 832 ProtectionStatus *string `json:"protectionStatus,omitempty"` 833 // ProtectionState - The backup state of this backup item. Possible values include: 'ProtectionStateInvalid', 'ProtectionStateIRPending', 'ProtectionStateProtected', 'ProtectionStateProtectionError', 'ProtectionStateProtectionStopped', 'ProtectionStateProtectionPaused' 834 ProtectionState ProtectionState `json:"protectionState,omitempty"` 835 // LastBackupStatus - The last backup operation status. The possible values are: Healthy or Unhealthy. 836 LastBackupStatus *string `json:"lastBackupStatus,omitempty"` 837 // LastBackupTime - The timestamp of the last backup operation for this backup item. 838 LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` 839 // ExtendedInfo - Additional information for this backup item. 840 ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` 841 // BackupManagementType - The backup management type associated with the backup item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 842 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 843 // WorkloadType - The workload type for this item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 844 WorkloadType DataSourceType `json:"workloadType,omitempty"` 845 // SourceResourceID - The ID of the resource to be backed up. 846 SourceResourceID *string `json:"sourceResourceId,omitempty"` 847 // PolicyID - The ID of the backup policy associated with this backup item. 848 PolicyID *string `json:"policyId,omitempty"` 849 // LastRecoveryPoint - The timestamp when the most recent backup copy was created for this backup item. 850 LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` 851 // ProtectedItemType - Possible values include: 'ProtectedItemTypeProtectedItem', 'ProtectedItemTypeAzureIaaSVMProtectedItem', 'ProtectedItemTypeMabFileFolderProtectedItem', 'ProtectedItemTypeMicrosoftSqlserversdatabases', 'ProtectedItemTypeMicrosoftComputevirtualMachines', 'ProtectedItemTypeMicrosoftClassicComputevirtualMachines' 852 ProtectedItemType ProtectedItemType `json:"protectedItemType,omitempty"` 853} 854 855func unmarshalBasicAzureIaaSVMProtectedItem(body []byte) (BasicAzureIaaSVMProtectedItem, error) { 856 var m map[string]interface{} 857 err := json.Unmarshal(body, &m) 858 if err != nil { 859 return nil, err 860 } 861 862 switch m["protectedItemType"] { 863 case string(ProtectedItemTypeMicrosoftComputevirtualMachines): 864 var aiscvpi AzureIaaSComputeVMProtectedItem 865 err := json.Unmarshal(body, &aiscvpi) 866 return aiscvpi, err 867 case string(ProtectedItemTypeMicrosoftClassicComputevirtualMachines): 868 var aisccvpi AzureIaaSClassicComputeVMProtectedItem 869 err := json.Unmarshal(body, &aisccvpi) 870 return aisccvpi, err 871 default: 872 var aispi AzureIaaSVMProtectedItem 873 err := json.Unmarshal(body, &aispi) 874 return aispi, err 875 } 876} 877func unmarshalBasicAzureIaaSVMProtectedItemArray(body []byte) ([]BasicAzureIaaSVMProtectedItem, error) { 878 var rawMessages []*json.RawMessage 879 err := json.Unmarshal(body, &rawMessages) 880 if err != nil { 881 return nil, err 882 } 883 884 aispiArray := make([]BasicAzureIaaSVMProtectedItem, len(rawMessages)) 885 886 for index, rawMessage := range rawMessages { 887 aispi, err := unmarshalBasicAzureIaaSVMProtectedItem(*rawMessage) 888 if err != nil { 889 return nil, err 890 } 891 aispiArray[index] = aispi 892 } 893 return aispiArray, nil 894} 895 896// MarshalJSON is the custom marshaler for AzureIaaSVMProtectedItem. 897func (aispi AzureIaaSVMProtectedItem) MarshalJSON() ([]byte, error) { 898 aispi.ProtectedItemType = ProtectedItemTypeAzureIaaSVMProtectedItem 899 objectMap := make(map[string]interface{}) 900 if aispi.FriendlyName != nil { 901 objectMap["friendlyName"] = aispi.FriendlyName 902 } 903 if aispi.VirtualMachineID != nil { 904 objectMap["virtualMachineId"] = aispi.VirtualMachineID 905 } 906 if aispi.ProtectionStatus != nil { 907 objectMap["protectionStatus"] = aispi.ProtectionStatus 908 } 909 if aispi.ProtectionState != "" { 910 objectMap["protectionState"] = aispi.ProtectionState 911 } 912 if aispi.LastBackupStatus != nil { 913 objectMap["lastBackupStatus"] = aispi.LastBackupStatus 914 } 915 if aispi.LastBackupTime != nil { 916 objectMap["lastBackupTime"] = aispi.LastBackupTime 917 } 918 if aispi.ExtendedInfo != nil { 919 objectMap["extendedInfo"] = aispi.ExtendedInfo 920 } 921 if aispi.BackupManagementType != "" { 922 objectMap["backupManagementType"] = aispi.BackupManagementType 923 } 924 if aispi.WorkloadType != "" { 925 objectMap["workloadType"] = aispi.WorkloadType 926 } 927 if aispi.SourceResourceID != nil { 928 objectMap["sourceResourceId"] = aispi.SourceResourceID 929 } 930 if aispi.PolicyID != nil { 931 objectMap["policyId"] = aispi.PolicyID 932 } 933 if aispi.LastRecoveryPoint != nil { 934 objectMap["lastRecoveryPoint"] = aispi.LastRecoveryPoint 935 } 936 if aispi.ProtectedItemType != "" { 937 objectMap["protectedItemType"] = aispi.ProtectedItemType 938 } 939 return json.Marshal(objectMap) 940} 941 942// AsAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 943func (aispi AzureIaaSVMProtectedItem) AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) { 944 return &aispi, true 945} 946 947// AsBasicAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 948func (aispi AzureIaaSVMProtectedItem) AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) { 949 return &aispi, true 950} 951 952// AsMabFileFolderProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 953func (aispi AzureIaaSVMProtectedItem) AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) { 954 return nil, false 955} 956 957// AsAzureSQLProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 958func (aispi AzureIaaSVMProtectedItem) AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) { 959 return nil, false 960} 961 962// AsAzureIaaSComputeVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 963func (aispi AzureIaaSVMProtectedItem) AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) { 964 return nil, false 965} 966 967// AsAzureIaaSClassicComputeVMProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 968func (aispi AzureIaaSVMProtectedItem) AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) { 969 return nil, false 970} 971 972// AsProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 973func (aispi AzureIaaSVMProtectedItem) AsProtectedItem() (*ProtectedItem, bool) { 974 return nil, false 975} 976 977// AsBasicProtectedItem is the BasicProtectedItem implementation for AzureIaaSVMProtectedItem. 978func (aispi AzureIaaSVMProtectedItem) AsBasicProtectedItem() (BasicProtectedItem, bool) { 979 return &aispi, true 980} 981 982// AzureIaaSVMProtectedItemExtendedInfo additional information for the Azure VM (also known as IaaS 983// VM)-specific backup item. 984type AzureIaaSVMProtectedItemExtendedInfo struct { 985 // OldestRecoveryPoint - The oldest backup copy available for this backup item. 986 OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` 987 // RecoveryPointCount - The number of backup copies available for this backup item. 988 RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` 989 // PolicyInconsistent - Specifies if the backup policy associated with the backup item is inconsistent. 990 PolicyInconsistent *bool `json:"policyInconsistent,omitempty"` 991} 992 993// AzureIaaSVMProtectionPolicy azure VM (also known as IaaS VM) workload-specific backup policy. 994type AzureIaaSVMProtectionPolicy struct { 995 // SchedulePolicy - The backup schedule specified as part of backup policy. 996 SchedulePolicy BasicSchedulePolicy `json:"schedulePolicy,omitempty"` 997 // RetentionPolicy - The retention policy with the details on backup copy retention ranges. 998 RetentionPolicy BasicRetentionPolicy `json:"retentionPolicy,omitempty"` 999 // ProtectedItemsCount - The number of items associated with this policy. 1000 ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` 1001 // BackupManagementType - Possible values include: 'BackupManagementTypeProtectionPolicy', 'BackupManagementTypeAzureIaasVM', 'BackupManagementTypeMAB', 'BackupManagementTypeAzureSQL' 1002 BackupManagementType ManagementTypeBasicProtectionPolicy `json:"backupManagementType,omitempty"` 1003} 1004 1005// MarshalJSON is the custom marshaler for AzureIaaSVMProtectionPolicy. 1006func (aispp AzureIaaSVMProtectionPolicy) MarshalJSON() ([]byte, error) { 1007 aispp.BackupManagementType = BackupManagementTypeAzureIaasVM 1008 objectMap := make(map[string]interface{}) 1009 objectMap["schedulePolicy"] = aispp.SchedulePolicy 1010 objectMap["retentionPolicy"] = aispp.RetentionPolicy 1011 if aispp.ProtectedItemsCount != nil { 1012 objectMap["protectedItemsCount"] = aispp.ProtectedItemsCount 1013 } 1014 if aispp.BackupManagementType != "" { 1015 objectMap["backupManagementType"] = aispp.BackupManagementType 1016 } 1017 return json.Marshal(objectMap) 1018} 1019 1020// AsAzureIaaSVMProtectionPolicy is the BasicProtectionPolicy implementation for AzureIaaSVMProtectionPolicy. 1021func (aispp AzureIaaSVMProtectionPolicy) AsAzureIaaSVMProtectionPolicy() (*AzureIaaSVMProtectionPolicy, bool) { 1022 return &aispp, true 1023} 1024 1025// AsMabProtectionPolicy is the BasicProtectionPolicy implementation for AzureIaaSVMProtectionPolicy. 1026func (aispp AzureIaaSVMProtectionPolicy) AsMabProtectionPolicy() (*MabProtectionPolicy, bool) { 1027 return nil, false 1028} 1029 1030// AsAzureSQLProtectionPolicy is the BasicProtectionPolicy implementation for AzureIaaSVMProtectionPolicy. 1031func (aispp AzureIaaSVMProtectionPolicy) AsAzureSQLProtectionPolicy() (*AzureSQLProtectionPolicy, bool) { 1032 return nil, false 1033} 1034 1035// AsProtectionPolicy is the BasicProtectionPolicy implementation for AzureIaaSVMProtectionPolicy. 1036func (aispp AzureIaaSVMProtectionPolicy) AsProtectionPolicy() (*ProtectionPolicy, bool) { 1037 return nil, false 1038} 1039 1040// AsBasicProtectionPolicy is the BasicProtectionPolicy implementation for AzureIaaSVMProtectionPolicy. 1041func (aispp AzureIaaSVMProtectionPolicy) AsBasicProtectionPolicy() (BasicProtectionPolicy, bool) { 1042 return &aispp, true 1043} 1044 1045// UnmarshalJSON is the custom unmarshaler for AzureIaaSVMProtectionPolicy struct. 1046func (aispp *AzureIaaSVMProtectionPolicy) UnmarshalJSON(body []byte) error { 1047 var m map[string]*json.RawMessage 1048 err := json.Unmarshal(body, &m) 1049 if err != nil { 1050 return err 1051 } 1052 for k, v := range m { 1053 switch k { 1054 case "schedulePolicy": 1055 if v != nil { 1056 schedulePolicy, err := unmarshalBasicSchedulePolicy(*v) 1057 if err != nil { 1058 return err 1059 } 1060 aispp.SchedulePolicy = schedulePolicy 1061 } 1062 case "retentionPolicy": 1063 if v != nil { 1064 retentionPolicy, err := unmarshalBasicRetentionPolicy(*v) 1065 if err != nil { 1066 return err 1067 } 1068 aispp.RetentionPolicy = retentionPolicy 1069 } 1070 case "protectedItemsCount": 1071 if v != nil { 1072 var protectedItemsCount int32 1073 err = json.Unmarshal(*v, &protectedItemsCount) 1074 if err != nil { 1075 return err 1076 } 1077 aispp.ProtectedItemsCount = &protectedItemsCount 1078 } 1079 case "backupManagementType": 1080 if v != nil { 1081 var backupManagementType ManagementTypeBasicProtectionPolicy 1082 err = json.Unmarshal(*v, &backupManagementType) 1083 if err != nil { 1084 return err 1085 } 1086 aispp.BackupManagementType = backupManagementType 1087 } 1088 } 1089 } 1090 1091 return nil 1092} 1093 1094// AzureSQLContainer azure SQL workload-specific container. 1095type AzureSQLContainer struct { 1096 // FriendlyName - Friendly name of the container. 1097 FriendlyName *string `json:"friendlyName,omitempty"` 1098 // BackupManagementType - The backup management type for the container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1099 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1100 // RegistrationStatus - The container's registration status with the Recovery Services vault. 1101 RegistrationStatus *string `json:"registrationStatus,omitempty"` 1102 // HealthStatus - The status of the container's health. 1103 HealthStatus *string `json:"healthStatus,omitempty"` 1104 // ContainerType - READ-ONLY; The type assigned to the container. The values to use for each of these properties are:<br/> 1. Compute Azure VM is Microsoft.Compute/virtualMachines<br/> 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines<br/> 3. Windows machines (like Azure Backup Server and DPM) is Windows<br/> 4. Azure SQL instance is AzureSqlContainer. 1105 ContainerType *string `json:"containerType,omitempty"` 1106 // ProtectableObjectType - Possible values include: 'ProtectableObjectTypeProtectionContainer', 'ProtectableObjectTypeAzureSQLContainer', 'ProtectableObjectTypeIaaSVMContainer', 'ProtectableObjectTypeMABWindowsContainer', 'ProtectableObjectTypeMicrosoftComputevirtualMachines', 'ProtectableObjectTypeMicrosoftClassicComputevirtualMachines' 1107 ProtectableObjectType ProtectableObjectType `json:"protectableObjectType,omitempty"` 1108} 1109 1110// MarshalJSON is the custom marshaler for AzureSQLContainer. 1111func (asc AzureSQLContainer) MarshalJSON() ([]byte, error) { 1112 asc.ProtectableObjectType = ProtectableObjectTypeAzureSQLContainer 1113 objectMap := make(map[string]interface{}) 1114 if asc.FriendlyName != nil { 1115 objectMap["friendlyName"] = asc.FriendlyName 1116 } 1117 if asc.BackupManagementType != "" { 1118 objectMap["backupManagementType"] = asc.BackupManagementType 1119 } 1120 if asc.RegistrationStatus != nil { 1121 objectMap["registrationStatus"] = asc.RegistrationStatus 1122 } 1123 if asc.HealthStatus != nil { 1124 objectMap["healthStatus"] = asc.HealthStatus 1125 } 1126 if asc.ProtectableObjectType != "" { 1127 objectMap["protectableObjectType"] = asc.ProtectableObjectType 1128 } 1129 return json.Marshal(objectMap) 1130} 1131 1132// AsAzureSQLContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1133func (asc AzureSQLContainer) AsAzureSQLContainer() (*AzureSQLContainer, bool) { 1134 return &asc, true 1135} 1136 1137// AsIaaSVMContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1138func (asc AzureSQLContainer) AsIaaSVMContainer() (*IaaSVMContainer, bool) { 1139 return nil, false 1140} 1141 1142// AsBasicIaaSVMContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1143func (asc AzureSQLContainer) AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) { 1144 return nil, false 1145} 1146 1147// AsMabContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1148func (asc AzureSQLContainer) AsMabContainer() (*MabContainer, bool) { 1149 return nil, false 1150} 1151 1152// AsAzureIaaSComputeVMContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1153func (asc AzureSQLContainer) AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) { 1154 return nil, false 1155} 1156 1157// AsAzureIaaSClassicComputeVMContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1158func (asc AzureSQLContainer) AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) { 1159 return nil, false 1160} 1161 1162// AsProtectionContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1163func (asc AzureSQLContainer) AsProtectionContainer() (*ProtectionContainer, bool) { 1164 return nil, false 1165} 1166 1167// AsBasicProtectionContainer is the BasicProtectionContainer implementation for AzureSQLContainer. 1168func (asc AzureSQLContainer) AsBasicProtectionContainer() (BasicProtectionContainer, bool) { 1169 return &asc, true 1170} 1171 1172// AzureSQLProtectedItem this is an Azure SQL workload-specific backup item. 1173type AzureSQLProtectedItem struct { 1174 // ProtectedItemDataID - The internal ID of a backup item. The internal ID is used by the Azure SQL Backup engine to contact Recovery Services. 1175 ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` 1176 // ProtectionState - The backup state of the backup item. Possible values include: 'ProtectedItemStateInvalid', 'ProtectedItemStateIRPending', 'ProtectedItemStateProtected', 'ProtectedItemStateProtectionError', 'ProtectedItemStateProtectionStopped', 'ProtectedItemStateProtectionPaused' 1177 ProtectionState ProtectedItemState `json:"protectionState,omitempty"` 1178 // ExtendedInfo - Additional information for this backup item. 1179 ExtendedInfo *AzureSQLProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` 1180 // BackupManagementType - The backup management type associated with the backup item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1181 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1182 // WorkloadType - The workload type for this item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 1183 WorkloadType DataSourceType `json:"workloadType,omitempty"` 1184 // SourceResourceID - The ID of the resource to be backed up. 1185 SourceResourceID *string `json:"sourceResourceId,omitempty"` 1186 // PolicyID - The ID of the backup policy associated with this backup item. 1187 PolicyID *string `json:"policyId,omitempty"` 1188 // LastRecoveryPoint - The timestamp when the most recent backup copy was created for this backup item. 1189 LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` 1190 // ProtectedItemType - Possible values include: 'ProtectedItemTypeProtectedItem', 'ProtectedItemTypeAzureIaaSVMProtectedItem', 'ProtectedItemTypeMabFileFolderProtectedItem', 'ProtectedItemTypeMicrosoftSqlserversdatabases', 'ProtectedItemTypeMicrosoftComputevirtualMachines', 'ProtectedItemTypeMicrosoftClassicComputevirtualMachines' 1191 ProtectedItemType ProtectedItemType `json:"protectedItemType,omitempty"` 1192} 1193 1194// MarshalJSON is the custom marshaler for AzureSQLProtectedItem. 1195func (aspi AzureSQLProtectedItem) MarshalJSON() ([]byte, error) { 1196 aspi.ProtectedItemType = ProtectedItemTypeMicrosoftSqlserversdatabases 1197 objectMap := make(map[string]interface{}) 1198 if aspi.ProtectedItemDataID != nil { 1199 objectMap["protectedItemDataId"] = aspi.ProtectedItemDataID 1200 } 1201 if aspi.ProtectionState != "" { 1202 objectMap["protectionState"] = aspi.ProtectionState 1203 } 1204 if aspi.ExtendedInfo != nil { 1205 objectMap["extendedInfo"] = aspi.ExtendedInfo 1206 } 1207 if aspi.BackupManagementType != "" { 1208 objectMap["backupManagementType"] = aspi.BackupManagementType 1209 } 1210 if aspi.WorkloadType != "" { 1211 objectMap["workloadType"] = aspi.WorkloadType 1212 } 1213 if aspi.SourceResourceID != nil { 1214 objectMap["sourceResourceId"] = aspi.SourceResourceID 1215 } 1216 if aspi.PolicyID != nil { 1217 objectMap["policyId"] = aspi.PolicyID 1218 } 1219 if aspi.LastRecoveryPoint != nil { 1220 objectMap["lastRecoveryPoint"] = aspi.LastRecoveryPoint 1221 } 1222 if aspi.ProtectedItemType != "" { 1223 objectMap["protectedItemType"] = aspi.ProtectedItemType 1224 } 1225 return json.Marshal(objectMap) 1226} 1227 1228// AsAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1229func (aspi AzureSQLProtectedItem) AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) { 1230 return nil, false 1231} 1232 1233// AsBasicAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1234func (aspi AzureSQLProtectedItem) AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) { 1235 return nil, false 1236} 1237 1238// AsMabFileFolderProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1239func (aspi AzureSQLProtectedItem) AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) { 1240 return nil, false 1241} 1242 1243// AsAzureSQLProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1244func (aspi AzureSQLProtectedItem) AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) { 1245 return &aspi, true 1246} 1247 1248// AsAzureIaaSComputeVMProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1249func (aspi AzureSQLProtectedItem) AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) { 1250 return nil, false 1251} 1252 1253// AsAzureIaaSClassicComputeVMProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1254func (aspi AzureSQLProtectedItem) AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) { 1255 return nil, false 1256} 1257 1258// AsProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1259func (aspi AzureSQLProtectedItem) AsProtectedItem() (*ProtectedItem, bool) { 1260 return nil, false 1261} 1262 1263// AsBasicProtectedItem is the BasicProtectedItem implementation for AzureSQLProtectedItem. 1264func (aspi AzureSQLProtectedItem) AsBasicProtectedItem() (BasicProtectedItem, bool) { 1265 return &aspi, true 1266} 1267 1268// AzureSQLProtectedItemExtendedInfo additional information for the Azure SQL specific backup item. 1269type AzureSQLProtectedItemExtendedInfo struct { 1270 // OldestRecoveryPoint - The oldest backup copy available for this item in the service. 1271 OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` 1272 // RecoveryPointCount - The number of available backup copies for this backup item. 1273 RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` 1274 // PolicyState - The state of the backup policy associated with this backup item. 1275 PolicyState *string `json:"policyState,omitempty"` 1276} 1277 1278// AzureSQLProtectionPolicy the Azure SQL workload-specific backup policy. 1279type AzureSQLProtectionPolicy struct { 1280 // RetentionPolicy - The retention policy details. 1281 RetentionPolicy BasicRetentionPolicy `json:"retentionPolicy,omitempty"` 1282 // ProtectedItemsCount - The number of items associated with this policy. 1283 ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` 1284 // BackupManagementType - Possible values include: 'BackupManagementTypeProtectionPolicy', 'BackupManagementTypeAzureIaasVM', 'BackupManagementTypeMAB', 'BackupManagementTypeAzureSQL' 1285 BackupManagementType ManagementTypeBasicProtectionPolicy `json:"backupManagementType,omitempty"` 1286} 1287 1288// MarshalJSON is the custom marshaler for AzureSQLProtectionPolicy. 1289func (aspp AzureSQLProtectionPolicy) MarshalJSON() ([]byte, error) { 1290 aspp.BackupManagementType = BackupManagementTypeAzureSQL 1291 objectMap := make(map[string]interface{}) 1292 objectMap["retentionPolicy"] = aspp.RetentionPolicy 1293 if aspp.ProtectedItemsCount != nil { 1294 objectMap["protectedItemsCount"] = aspp.ProtectedItemsCount 1295 } 1296 if aspp.BackupManagementType != "" { 1297 objectMap["backupManagementType"] = aspp.BackupManagementType 1298 } 1299 return json.Marshal(objectMap) 1300} 1301 1302// AsAzureIaaSVMProtectionPolicy is the BasicProtectionPolicy implementation for AzureSQLProtectionPolicy. 1303func (aspp AzureSQLProtectionPolicy) AsAzureIaaSVMProtectionPolicy() (*AzureIaaSVMProtectionPolicy, bool) { 1304 return nil, false 1305} 1306 1307// AsMabProtectionPolicy is the BasicProtectionPolicy implementation for AzureSQLProtectionPolicy. 1308func (aspp AzureSQLProtectionPolicy) AsMabProtectionPolicy() (*MabProtectionPolicy, bool) { 1309 return nil, false 1310} 1311 1312// AsAzureSQLProtectionPolicy is the BasicProtectionPolicy implementation for AzureSQLProtectionPolicy. 1313func (aspp AzureSQLProtectionPolicy) AsAzureSQLProtectionPolicy() (*AzureSQLProtectionPolicy, bool) { 1314 return &aspp, true 1315} 1316 1317// AsProtectionPolicy is the BasicProtectionPolicy implementation for AzureSQLProtectionPolicy. 1318func (aspp AzureSQLProtectionPolicy) AsProtectionPolicy() (*ProtectionPolicy, bool) { 1319 return nil, false 1320} 1321 1322// AsBasicProtectionPolicy is the BasicProtectionPolicy implementation for AzureSQLProtectionPolicy. 1323func (aspp AzureSQLProtectionPolicy) AsBasicProtectionPolicy() (BasicProtectionPolicy, bool) { 1324 return &aspp, true 1325} 1326 1327// UnmarshalJSON is the custom unmarshaler for AzureSQLProtectionPolicy struct. 1328func (aspp *AzureSQLProtectionPolicy) UnmarshalJSON(body []byte) error { 1329 var m map[string]*json.RawMessage 1330 err := json.Unmarshal(body, &m) 1331 if err != nil { 1332 return err 1333 } 1334 for k, v := range m { 1335 switch k { 1336 case "retentionPolicy": 1337 if v != nil { 1338 retentionPolicy, err := unmarshalBasicRetentionPolicy(*v) 1339 if err != nil { 1340 return err 1341 } 1342 aspp.RetentionPolicy = retentionPolicy 1343 } 1344 case "protectedItemsCount": 1345 if v != nil { 1346 var protectedItemsCount int32 1347 err = json.Unmarshal(*v, &protectedItemsCount) 1348 if err != nil { 1349 return err 1350 } 1351 aspp.ProtectedItemsCount = &protectedItemsCount 1352 } 1353 case "backupManagementType": 1354 if v != nil { 1355 var backupManagementType ManagementTypeBasicProtectionPolicy 1356 err = json.Unmarshal(*v, &backupManagementType) 1357 if err != nil { 1358 return err 1359 } 1360 aspp.BackupManagementType = backupManagementType 1361 } 1362 } 1363 } 1364 1365 return nil 1366} 1367 1368// BEKDetails BEK is Bitlocker Encryption Key. 1369type BEKDetails struct { 1370 // SecretURL - Secret refers to Bitlocker Encryption Key (BEK). The Secret can be unlocked by the key (or KEK). 1371 SecretURL *string `json:"secretUrl,omitempty"` 1372 // SecretVaultID - ID of the Key Vault where this Secret is stored. 1373 SecretVaultID *string `json:"secretVaultId,omitempty"` 1374 // SecretData - Bitlocker Encryption Key (BEK) data. 1375 SecretData *string `json:"secretData,omitempty"` 1376} 1377 1378// BMSBackupEngineQueryObject the query parameters used to GET the list of backup engines. 1379type BMSBackupEngineQueryObject struct { 1380 // BackupManagementType - The backup management type associated with the backup engine. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1381 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1382} 1383 1384// BMSContainerQueryObject the query filters that can be used with the list containers API. 1385type BMSContainerQueryObject struct { 1386 // BackupManagementType - The backup management type for this container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1387 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1388 // Status - The status of the container's registration with the Recovery Services vault. 1389 Status *string `json:"status,omitempty"` 1390 // FriendlyName - The friendly name of the container. 1391 FriendlyName *string `json:"friendlyName,omitempty"` 1392} 1393 1394// BMSPOQueryObject filters the list of backup items. 1395type BMSPOQueryObject struct { 1396 // BackupManagementType - The backup management type. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1397 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1398 // Status - The backup status query parameter. 1399 Status *string `json:"status,omitempty"` 1400 // FriendlyName - The friendly name for the item. 1401 FriendlyName *string `json:"friendlyName,omitempty"` 1402} 1403 1404// BMSRPQueryObject filters the list of backup copies based on the property. 1405type BMSRPQueryObject struct { 1406 // StartDate - Use backup copies created after this time. 1407 StartDate *date.Time `json:"startDate,omitempty"` 1408 // EndDate - Use backup copies created before this time. 1409 EndDate *date.Time `json:"endDate,omitempty"` 1410} 1411 1412// ClientScriptForConnect client script details for the file or folder restore. 1413type ClientScriptForConnect struct { 1414 // ScriptContent - File content of the client script for file or folder restore. 1415 ScriptContent *string `json:"scriptContent,omitempty"` 1416 // ScriptExtension - File extension of the client script for the file or folder restore. Some examples of the extension are: .ps1 and .sh. 1417 ScriptExtension *string `json:"scriptExtension,omitempty"` 1418 // OsType - The operating system platform ("Windows" or "Linux") for which this file or folder restore client script works. 1419 OsType *string `json:"osType,omitempty"` 1420} 1421 1422// DailyRetentionFormat daily retention format. 1423type DailyRetentionFormat struct { 1424 // DaysOfTheMonth - List of days of the month. 1425 DaysOfTheMonth *[]Day `json:"daysOfTheMonth,omitempty"` 1426} 1427 1428// DailyRetentionSchedule daily retention schedule. 1429type DailyRetentionSchedule struct { 1430 // RetentionTimes - The retention times of retention policy. 1431 RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` 1432 // RetentionDuration - The retention duration of retention policy. 1433 RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` 1434} 1435 1436// Day day of the week. 1437type Day struct { 1438 Date *int32 `json:"date,omitempty"` 1439 IsLast *bool `json:"isLast,omitempty"` 1440} 1441 1442// DpmBackupEngine the backup engine type when Data Protection Manager (DPM) is used to manage backups. 1443type DpmBackupEngine struct { 1444 // FriendlyName - The friendly name of the backup engine. 1445 FriendlyName *string `json:"friendlyName,omitempty"` 1446 // BackupManagementType - The type of backup management associated with the backup engine. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1447 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1448 // RegistrationStatus - The status of the backup engine registration with the Recovery Services vault. 1449 RegistrationStatus *string `json:"registrationStatus,omitempty"` 1450 // HealthStatus - The backup status of the backup engine. 1451 HealthStatus *string `json:"healthStatus,omitempty"` 1452 // CanReRegister - The flag indicating whether the backup engine be registered again, once the engine has been initially registered. 1453 CanReRegister *bool `json:"canReRegister,omitempty"` 1454 // BackupEngineID - The ID of the backup engine. 1455 BackupEngineID *string `json:"backupEngineId,omitempty"` 1456 // BackupEngineType - Possible values include: 'BackupEngineTypeBackupEngineBase', 'BackupEngineTypeAzureBackupServerEngine', 'BackupEngineTypeDpmBackupEngine' 1457 BackupEngineType EngineType `json:"backupEngineType,omitempty"` 1458} 1459 1460// MarshalJSON is the custom marshaler for DpmBackupEngine. 1461func (dbe DpmBackupEngine) MarshalJSON() ([]byte, error) { 1462 dbe.BackupEngineType = BackupEngineTypeDpmBackupEngine 1463 objectMap := make(map[string]interface{}) 1464 if dbe.FriendlyName != nil { 1465 objectMap["friendlyName"] = dbe.FriendlyName 1466 } 1467 if dbe.BackupManagementType != "" { 1468 objectMap["backupManagementType"] = dbe.BackupManagementType 1469 } 1470 if dbe.RegistrationStatus != nil { 1471 objectMap["registrationStatus"] = dbe.RegistrationStatus 1472 } 1473 if dbe.HealthStatus != nil { 1474 objectMap["healthStatus"] = dbe.HealthStatus 1475 } 1476 if dbe.CanReRegister != nil { 1477 objectMap["canReRegister"] = dbe.CanReRegister 1478 } 1479 if dbe.BackupEngineID != nil { 1480 objectMap["backupEngineId"] = dbe.BackupEngineID 1481 } 1482 if dbe.BackupEngineType != "" { 1483 objectMap["backupEngineType"] = dbe.BackupEngineType 1484 } 1485 return json.Marshal(objectMap) 1486} 1487 1488// AsAzureBackupServerEngine is the BasicEngineBase implementation for DpmBackupEngine. 1489func (dbe DpmBackupEngine) AsAzureBackupServerEngine() (*AzureBackupServerEngine, bool) { 1490 return nil, false 1491} 1492 1493// AsDpmBackupEngine is the BasicEngineBase implementation for DpmBackupEngine. 1494func (dbe DpmBackupEngine) AsDpmBackupEngine() (*DpmBackupEngine, bool) { 1495 return &dbe, true 1496} 1497 1498// AsEngineBase is the BasicEngineBase implementation for DpmBackupEngine. 1499func (dbe DpmBackupEngine) AsEngineBase() (*EngineBase, bool) { 1500 return nil, false 1501} 1502 1503// AsBasicEngineBase is the BasicEngineBase implementation for DpmBackupEngine. 1504func (dbe DpmBackupEngine) AsBasicEngineBase() (BasicEngineBase, bool) { 1505 return &dbe, true 1506} 1507 1508// DpmErrorInfo DPM workload-specific error information. 1509type DpmErrorInfo struct { 1510 // ErrorString - Localized error string. 1511 ErrorString *string `json:"errorString,omitempty"` 1512 // Recommendations - The list of localized recommendations for the error string. 1513 Recommendations *[]string `json:"recommendations,omitempty"` 1514} 1515 1516// DpmJob the DPM workload-specific job object. 1517type DpmJob struct { 1518 // Duration - The time elapsed for the job. 1519 Duration *string `json:"duration,omitempty"` 1520 // DpmServerName - DPM server name managing the backup item or backup job. 1521 DpmServerName *string `json:"dpmServerName,omitempty"` 1522 // ContainerName - The name of the cluster or server protecting the current backup item, if any. 1523 ContainerName *string `json:"containerName,omitempty"` 1524 // ContainerType - The type of container. 1525 ContainerType *string `json:"containerType,omitempty"` 1526 // WorkloadType - The type of backup item. 1527 WorkloadType *string `json:"workloadType,omitempty"` 1528 // ActionsInfo - The state or actions applicable on this job, such as Cancel or Retry. 1529 ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` 1530 // ErrorDetails - The errors. 1531 ErrorDetails *[]DpmErrorInfo `json:"errorDetails,omitempty"` 1532 // ExtendedInfo - Additional information for this job. 1533 ExtendedInfo *DpmJobExtendedInfo `json:"extendedInfo,omitempty"` 1534 // EntityFriendlyName - The friendly name of the entity on which the current job is executing. 1535 EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` 1536 // BackupManagementType - The backup management type for the current job. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1537 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1538 // Operation - The operation name. 1539 Operation *string `json:"operation,omitempty"` 1540 // Status - The job status. 1541 Status *string `json:"status,omitempty"` 1542 // StartTime - The start time. 1543 StartTime *date.Time `json:"startTime,omitempty"` 1544 // EndTime - The end time. 1545 EndTime *date.Time `json:"endTime,omitempty"` 1546 // ActivityID - ActivityId of job. 1547 ActivityID *string `json:"activityId,omitempty"` 1548 // JobType - Possible values include: 'JobTypeJob', 'JobTypeAzureIaaSVMJob', 'JobTypeDpmJob', 'JobTypeMabJob' 1549 JobType JobType `json:"jobType,omitempty"` 1550} 1551 1552// MarshalJSON is the custom marshaler for DpmJob. 1553func (dj DpmJob) MarshalJSON() ([]byte, error) { 1554 dj.JobType = JobTypeDpmJob 1555 objectMap := make(map[string]interface{}) 1556 if dj.Duration != nil { 1557 objectMap["duration"] = dj.Duration 1558 } 1559 if dj.DpmServerName != nil { 1560 objectMap["dpmServerName"] = dj.DpmServerName 1561 } 1562 if dj.ContainerName != nil { 1563 objectMap["containerName"] = dj.ContainerName 1564 } 1565 if dj.ContainerType != nil { 1566 objectMap["containerType"] = dj.ContainerType 1567 } 1568 if dj.WorkloadType != nil { 1569 objectMap["workloadType"] = dj.WorkloadType 1570 } 1571 if dj.ActionsInfo != nil { 1572 objectMap["actionsInfo"] = dj.ActionsInfo 1573 } 1574 if dj.ErrorDetails != nil { 1575 objectMap["errorDetails"] = dj.ErrorDetails 1576 } 1577 if dj.ExtendedInfo != nil { 1578 objectMap["extendedInfo"] = dj.ExtendedInfo 1579 } 1580 if dj.EntityFriendlyName != nil { 1581 objectMap["entityFriendlyName"] = dj.EntityFriendlyName 1582 } 1583 if dj.BackupManagementType != "" { 1584 objectMap["backupManagementType"] = dj.BackupManagementType 1585 } 1586 if dj.Operation != nil { 1587 objectMap["operation"] = dj.Operation 1588 } 1589 if dj.Status != nil { 1590 objectMap["status"] = dj.Status 1591 } 1592 if dj.StartTime != nil { 1593 objectMap["startTime"] = dj.StartTime 1594 } 1595 if dj.EndTime != nil { 1596 objectMap["endTime"] = dj.EndTime 1597 } 1598 if dj.ActivityID != nil { 1599 objectMap["activityId"] = dj.ActivityID 1600 } 1601 if dj.JobType != "" { 1602 objectMap["jobType"] = dj.JobType 1603 } 1604 return json.Marshal(objectMap) 1605} 1606 1607// AsAzureIaaSVMJob is the BasicJob implementation for DpmJob. 1608func (dj DpmJob) AsAzureIaaSVMJob() (*AzureIaaSVMJob, bool) { 1609 return nil, false 1610} 1611 1612// AsDpmJob is the BasicJob implementation for DpmJob. 1613func (dj DpmJob) AsDpmJob() (*DpmJob, bool) { 1614 return &dj, true 1615} 1616 1617// AsMabJob is the BasicJob implementation for DpmJob. 1618func (dj DpmJob) AsMabJob() (*MabJob, bool) { 1619 return nil, false 1620} 1621 1622// AsJob is the BasicJob implementation for DpmJob. 1623func (dj DpmJob) AsJob() (*Job, bool) { 1624 return nil, false 1625} 1626 1627// AsBasicJob is the BasicJob implementation for DpmJob. 1628func (dj DpmJob) AsBasicJob() (BasicJob, bool) { 1629 return &dj, true 1630} 1631 1632// DpmJobExtendedInfo additional information on the DPM workload-specific job. 1633type DpmJobExtendedInfo struct { 1634 // TasksList - List of tasks associated with this job. 1635 TasksList *[]DpmJobTaskDetails `json:"tasksList,omitempty"` 1636 // PropertyBag - The job properties. 1637 PropertyBag map[string]*string `json:"propertyBag"` 1638 // DynamicErrorMessage - Non-localized error message on job execution. 1639 DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` 1640} 1641 1642// MarshalJSON is the custom marshaler for DpmJobExtendedInfo. 1643func (djei DpmJobExtendedInfo) MarshalJSON() ([]byte, error) { 1644 objectMap := make(map[string]interface{}) 1645 if djei.TasksList != nil { 1646 objectMap["tasksList"] = djei.TasksList 1647 } 1648 if djei.PropertyBag != nil { 1649 objectMap["propertyBag"] = djei.PropertyBag 1650 } 1651 if djei.DynamicErrorMessage != nil { 1652 objectMap["dynamicErrorMessage"] = djei.DynamicErrorMessage 1653 } 1654 return json.Marshal(objectMap) 1655} 1656 1657// DpmJobTaskDetails DPM workload-specific job task details. 1658type DpmJobTaskDetails struct { 1659 // TaskID - The task display name. 1660 TaskID *string `json:"taskId,omitempty"` 1661 // StartTime - The start time. 1662 StartTime *date.Time `json:"startTime,omitempty"` 1663 // EndTime - The end time. 1664 EndTime *date.Time `json:"endTime,omitempty"` 1665 // Duration - The time elapsed for task. 1666 Duration *string `json:"duration,omitempty"` 1667 // Status - The status. 1668 Status *string `json:"status,omitempty"` 1669} 1670 1671// EncryptionDetails details needed if the VM was encrypted at the time of backup. 1672type EncryptionDetails struct { 1673 // EncryptionEnabled - Identifies whether the backup copy represents an encrypted VM at the time of backup. 1674 EncryptionEnabled *bool `json:"encryptionEnabled,omitempty"` 1675 // KekURL - URL of the Key Encryption Key (KEK). 1676 KekURL *string `json:"kekUrl,omitempty"` 1677 // SecretKeyURL - URL of the Bitlocker Encryption Key (BEK). 1678 SecretKeyURL *string `json:"secretKeyUrl,omitempty"` 1679 // KekVaultID - The ID of Key Vault where the Key Encryption Key (KEK) is stored. 1680 KekVaultID *string `json:"kekVaultId,omitempty"` 1681 // SecretKeyVaultID - The ID of Key Vault where the Bitlocker Encryption Key (BEK), or Secret, is stored. 1682 SecretKeyVaultID *string `json:"secretKeyVaultId,omitempty"` 1683} 1684 1685// BasicEngineBase the base backup engine class. All workload-specific backup engines derive from this class. 1686type BasicEngineBase interface { 1687 AsAzureBackupServerEngine() (*AzureBackupServerEngine, bool) 1688 AsDpmBackupEngine() (*DpmBackupEngine, bool) 1689 AsEngineBase() (*EngineBase, bool) 1690} 1691 1692// EngineBase the base backup engine class. All workload-specific backup engines derive from this class. 1693type EngineBase struct { 1694 // FriendlyName - The friendly name of the backup engine. 1695 FriendlyName *string `json:"friendlyName,omitempty"` 1696 // BackupManagementType - The type of backup management associated with the backup engine. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 1697 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 1698 // RegistrationStatus - The status of the backup engine registration with the Recovery Services vault. 1699 RegistrationStatus *string `json:"registrationStatus,omitempty"` 1700 // HealthStatus - The backup status of the backup engine. 1701 HealthStatus *string `json:"healthStatus,omitempty"` 1702 // CanReRegister - The flag indicating whether the backup engine be registered again, once the engine has been initially registered. 1703 CanReRegister *bool `json:"canReRegister,omitempty"` 1704 // BackupEngineID - The ID of the backup engine. 1705 BackupEngineID *string `json:"backupEngineId,omitempty"` 1706 // BackupEngineType - Possible values include: 'BackupEngineTypeBackupEngineBase', 'BackupEngineTypeAzureBackupServerEngine', 'BackupEngineTypeDpmBackupEngine' 1707 BackupEngineType EngineType `json:"backupEngineType,omitempty"` 1708} 1709 1710func unmarshalBasicEngineBase(body []byte) (BasicEngineBase, error) { 1711 var m map[string]interface{} 1712 err := json.Unmarshal(body, &m) 1713 if err != nil { 1714 return nil, err 1715 } 1716 1717 switch m["backupEngineType"] { 1718 case string(BackupEngineTypeAzureBackupServerEngine): 1719 var abse AzureBackupServerEngine 1720 err := json.Unmarshal(body, &abse) 1721 return abse, err 1722 case string(BackupEngineTypeDpmBackupEngine): 1723 var dbe DpmBackupEngine 1724 err := json.Unmarshal(body, &dbe) 1725 return dbe, err 1726 default: 1727 var eb EngineBase 1728 err := json.Unmarshal(body, &eb) 1729 return eb, err 1730 } 1731} 1732func unmarshalBasicEngineBaseArray(body []byte) ([]BasicEngineBase, error) { 1733 var rawMessages []*json.RawMessage 1734 err := json.Unmarshal(body, &rawMessages) 1735 if err != nil { 1736 return nil, err 1737 } 1738 1739 ebArray := make([]BasicEngineBase, len(rawMessages)) 1740 1741 for index, rawMessage := range rawMessages { 1742 eb, err := unmarshalBasicEngineBase(*rawMessage) 1743 if err != nil { 1744 return nil, err 1745 } 1746 ebArray[index] = eb 1747 } 1748 return ebArray, nil 1749} 1750 1751// MarshalJSON is the custom marshaler for EngineBase. 1752func (eb EngineBase) MarshalJSON() ([]byte, error) { 1753 eb.BackupEngineType = BackupEngineTypeBackupEngineBase 1754 objectMap := make(map[string]interface{}) 1755 if eb.FriendlyName != nil { 1756 objectMap["friendlyName"] = eb.FriendlyName 1757 } 1758 if eb.BackupManagementType != "" { 1759 objectMap["backupManagementType"] = eb.BackupManagementType 1760 } 1761 if eb.RegistrationStatus != nil { 1762 objectMap["registrationStatus"] = eb.RegistrationStatus 1763 } 1764 if eb.HealthStatus != nil { 1765 objectMap["healthStatus"] = eb.HealthStatus 1766 } 1767 if eb.CanReRegister != nil { 1768 objectMap["canReRegister"] = eb.CanReRegister 1769 } 1770 if eb.BackupEngineID != nil { 1771 objectMap["backupEngineId"] = eb.BackupEngineID 1772 } 1773 if eb.BackupEngineType != "" { 1774 objectMap["backupEngineType"] = eb.BackupEngineType 1775 } 1776 return json.Marshal(objectMap) 1777} 1778 1779// AsAzureBackupServerEngine is the BasicEngineBase implementation for EngineBase. 1780func (eb EngineBase) AsAzureBackupServerEngine() (*AzureBackupServerEngine, bool) { 1781 return nil, false 1782} 1783 1784// AsDpmBackupEngine is the BasicEngineBase implementation for EngineBase. 1785func (eb EngineBase) AsDpmBackupEngine() (*DpmBackupEngine, bool) { 1786 return nil, false 1787} 1788 1789// AsEngineBase is the BasicEngineBase implementation for EngineBase. 1790func (eb EngineBase) AsEngineBase() (*EngineBase, bool) { 1791 return &eb, true 1792} 1793 1794// AsBasicEngineBase is the BasicEngineBase implementation for EngineBase. 1795func (eb EngineBase) AsBasicEngineBase() (BasicEngineBase, bool) { 1796 return &eb, true 1797} 1798 1799// EngineBaseResource the base backup engine class. All workload-specific backup engines derive from this 1800// class. 1801type EngineBaseResource struct { 1802 Properties BasicEngineBase `json:"properties,omitempty"` 1803 // ID - Resource ID represents the complete path to the resource. 1804 ID *string `json:"id,omitempty"` 1805 // Name - Resource name associated with the resource. 1806 Name *string `json:"name,omitempty"` 1807 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 1808 Type *string `json:"type,omitempty"` 1809 // Location - Resource location. 1810 Location *string `json:"location,omitempty"` 1811 // Tags - Resource tags. 1812 Tags map[string]*string `json:"tags"` 1813 // ETag - Optional ETag. 1814 ETag *string `json:"eTag,omitempty"` 1815} 1816 1817// MarshalJSON is the custom marshaler for EngineBaseResource. 1818func (ebr EngineBaseResource) MarshalJSON() ([]byte, error) { 1819 objectMap := make(map[string]interface{}) 1820 objectMap["properties"] = ebr.Properties 1821 if ebr.ID != nil { 1822 objectMap["id"] = ebr.ID 1823 } 1824 if ebr.Name != nil { 1825 objectMap["name"] = ebr.Name 1826 } 1827 if ebr.Type != nil { 1828 objectMap["type"] = ebr.Type 1829 } 1830 if ebr.Location != nil { 1831 objectMap["location"] = ebr.Location 1832 } 1833 if ebr.Tags != nil { 1834 objectMap["tags"] = ebr.Tags 1835 } 1836 if ebr.ETag != nil { 1837 objectMap["eTag"] = ebr.ETag 1838 } 1839 return json.Marshal(objectMap) 1840} 1841 1842// UnmarshalJSON is the custom unmarshaler for EngineBaseResource struct. 1843func (ebr *EngineBaseResource) UnmarshalJSON(body []byte) error { 1844 var m map[string]*json.RawMessage 1845 err := json.Unmarshal(body, &m) 1846 if err != nil { 1847 return err 1848 } 1849 for k, v := range m { 1850 switch k { 1851 case "properties": 1852 if v != nil { 1853 properties, err := unmarshalBasicEngineBase(*v) 1854 if err != nil { 1855 return err 1856 } 1857 ebr.Properties = properties 1858 } 1859 case "id": 1860 if v != nil { 1861 var ID string 1862 err = json.Unmarshal(*v, &ID) 1863 if err != nil { 1864 return err 1865 } 1866 ebr.ID = &ID 1867 } 1868 case "name": 1869 if v != nil { 1870 var name string 1871 err = json.Unmarshal(*v, &name) 1872 if err != nil { 1873 return err 1874 } 1875 ebr.Name = &name 1876 } 1877 case "type": 1878 if v != nil { 1879 var typeVar string 1880 err = json.Unmarshal(*v, &typeVar) 1881 if err != nil { 1882 return err 1883 } 1884 ebr.Type = &typeVar 1885 } 1886 case "location": 1887 if v != nil { 1888 var location string 1889 err = json.Unmarshal(*v, &location) 1890 if err != nil { 1891 return err 1892 } 1893 ebr.Location = &location 1894 } 1895 case "tags": 1896 if v != nil { 1897 var tags map[string]*string 1898 err = json.Unmarshal(*v, &tags) 1899 if err != nil { 1900 return err 1901 } 1902 ebr.Tags = tags 1903 } 1904 case "eTag": 1905 if v != nil { 1906 var eTag string 1907 err = json.Unmarshal(*v, &eTag) 1908 if err != nil { 1909 return err 1910 } 1911 ebr.ETag = &eTag 1912 } 1913 } 1914 } 1915 1916 return nil 1917} 1918 1919// EngineBaseResourceList list of BackupEngineBase resources 1920type EngineBaseResourceList struct { 1921 autorest.Response `json:"-"` 1922 // Value - List of resources. 1923 Value *[]EngineBaseResource `json:"value,omitempty"` 1924 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 1925 NextLink *string `json:"nextLink,omitempty"` 1926} 1927 1928// EngineBaseResourceListIterator provides access to a complete listing of EngineBaseResource values. 1929type EngineBaseResourceListIterator struct { 1930 i int 1931 page EngineBaseResourceListPage 1932} 1933 1934// NextWithContext advances to the next value. If there was an error making 1935// the request the iterator does not advance and the error is returned. 1936func (iter *EngineBaseResourceListIterator) NextWithContext(ctx context.Context) (err error) { 1937 if tracing.IsEnabled() { 1938 ctx = tracing.StartSpan(ctx, fqdn+"/EngineBaseResourceListIterator.NextWithContext") 1939 defer func() { 1940 sc := -1 1941 if iter.Response().Response.Response != nil { 1942 sc = iter.Response().Response.Response.StatusCode 1943 } 1944 tracing.EndSpan(ctx, sc, err) 1945 }() 1946 } 1947 iter.i++ 1948 if iter.i < len(iter.page.Values()) { 1949 return nil 1950 } 1951 err = iter.page.NextWithContext(ctx) 1952 if err != nil { 1953 iter.i-- 1954 return err 1955 } 1956 iter.i = 0 1957 return nil 1958} 1959 1960// Next advances to the next value. If there was an error making 1961// the request the iterator does not advance and the error is returned. 1962// Deprecated: Use NextWithContext() instead. 1963func (iter *EngineBaseResourceListIterator) Next() error { 1964 return iter.NextWithContext(context.Background()) 1965} 1966 1967// NotDone returns true if the enumeration should be started or is not yet complete. 1968func (iter EngineBaseResourceListIterator) NotDone() bool { 1969 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1970} 1971 1972// Response returns the raw server response from the last page request. 1973func (iter EngineBaseResourceListIterator) Response() EngineBaseResourceList { 1974 return iter.page.Response() 1975} 1976 1977// Value returns the current value or a zero-initialized value if the 1978// iterator has advanced beyond the end of the collection. 1979func (iter EngineBaseResourceListIterator) Value() EngineBaseResource { 1980 if !iter.page.NotDone() { 1981 return EngineBaseResource{} 1982 } 1983 return iter.page.Values()[iter.i] 1984} 1985 1986// Creates a new instance of the EngineBaseResourceListIterator type. 1987func NewEngineBaseResourceListIterator(page EngineBaseResourceListPage) EngineBaseResourceListIterator { 1988 return EngineBaseResourceListIterator{page: page} 1989} 1990 1991// IsEmpty returns true if the ListResult contains no values. 1992func (ebrl EngineBaseResourceList) IsEmpty() bool { 1993 return ebrl.Value == nil || len(*ebrl.Value) == 0 1994} 1995 1996// hasNextLink returns true if the NextLink is not empty. 1997func (ebrl EngineBaseResourceList) hasNextLink() bool { 1998 return ebrl.NextLink != nil && len(*ebrl.NextLink) != 0 1999} 2000 2001// engineBaseResourceListPreparer prepares a request to retrieve the next set of results. 2002// It returns nil if no more results exist. 2003func (ebrl EngineBaseResourceList) engineBaseResourceListPreparer(ctx context.Context) (*http.Request, error) { 2004 if !ebrl.hasNextLink() { 2005 return nil, nil 2006 } 2007 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2008 autorest.AsJSON(), 2009 autorest.AsGet(), 2010 autorest.WithBaseURL(to.String(ebrl.NextLink))) 2011} 2012 2013// EngineBaseResourceListPage contains a page of EngineBaseResource values. 2014type EngineBaseResourceListPage struct { 2015 fn func(context.Context, EngineBaseResourceList) (EngineBaseResourceList, error) 2016 ebrl EngineBaseResourceList 2017} 2018 2019// NextWithContext advances to the next page of values. If there was an error making 2020// the request the page does not advance and the error is returned. 2021func (page *EngineBaseResourceListPage) NextWithContext(ctx context.Context) (err error) { 2022 if tracing.IsEnabled() { 2023 ctx = tracing.StartSpan(ctx, fqdn+"/EngineBaseResourceListPage.NextWithContext") 2024 defer func() { 2025 sc := -1 2026 if page.Response().Response.Response != nil { 2027 sc = page.Response().Response.Response.StatusCode 2028 } 2029 tracing.EndSpan(ctx, sc, err) 2030 }() 2031 } 2032 for { 2033 next, err := page.fn(ctx, page.ebrl) 2034 if err != nil { 2035 return err 2036 } 2037 page.ebrl = next 2038 if !next.hasNextLink() || !next.IsEmpty() { 2039 break 2040 } 2041 } 2042 return nil 2043} 2044 2045// Next advances to the next page of values. If there was an error making 2046// the request the page does not advance and the error is returned. 2047// Deprecated: Use NextWithContext() instead. 2048func (page *EngineBaseResourceListPage) Next() error { 2049 return page.NextWithContext(context.Background()) 2050} 2051 2052// NotDone returns true if the page enumeration should be started or is not yet complete. 2053func (page EngineBaseResourceListPage) NotDone() bool { 2054 return !page.ebrl.IsEmpty() 2055} 2056 2057// Response returns the raw server response from the last page request. 2058func (page EngineBaseResourceListPage) Response() EngineBaseResourceList { 2059 return page.ebrl 2060} 2061 2062// Values returns the slice of values for the current page or nil if there are no values. 2063func (page EngineBaseResourceListPage) Values() []EngineBaseResource { 2064 if page.ebrl.IsEmpty() { 2065 return nil 2066 } 2067 return *page.ebrl.Value 2068} 2069 2070// Creates a new instance of the EngineBaseResourceListPage type. 2071func NewEngineBaseResourceListPage(cur EngineBaseResourceList, getNextPage func(context.Context, EngineBaseResourceList) (EngineBaseResourceList, error)) EngineBaseResourceListPage { 2072 return EngineBaseResourceListPage{ 2073 fn: getNextPage, 2074 ebrl: cur, 2075 } 2076} 2077 2078// ExportJobsOperationResultInfo this class is used to send blob details after exporting jobs. 2079type ExportJobsOperationResultInfo struct { 2080 // BlobURL - The URL of the blob. The serialized string, which is the list of jobs, is exported to this URL. 2081 BlobURL *string `json:"blobUrl,omitempty"` 2082 // BlobSasKey - The Shared Access Signatures (SAS) key used to access the blob. The key expires after 15 minutes. 2083 BlobSasKey *string `json:"blobSasKey,omitempty"` 2084 // ObjectType - Possible values include: 'ObjectTypeOperationResultInfoBase', 'ObjectTypeOperationResultInfo', 'ObjectTypeExportJobsOperationResultInfo' 2085 ObjectType ObjectTypeBasicOperationResultInfoBase `json:"objectType,omitempty"` 2086} 2087 2088// MarshalJSON is the custom marshaler for ExportJobsOperationResultInfo. 2089func (ejori ExportJobsOperationResultInfo) MarshalJSON() ([]byte, error) { 2090 ejori.ObjectType = ObjectTypeExportJobsOperationResultInfo 2091 objectMap := make(map[string]interface{}) 2092 if ejori.BlobURL != nil { 2093 objectMap["blobUrl"] = ejori.BlobURL 2094 } 2095 if ejori.BlobSasKey != nil { 2096 objectMap["blobSasKey"] = ejori.BlobSasKey 2097 } 2098 if ejori.ObjectType != "" { 2099 objectMap["objectType"] = ejori.ObjectType 2100 } 2101 return json.Marshal(objectMap) 2102} 2103 2104// AsOperationResultInfo is the BasicOperationResultInfoBase implementation for ExportJobsOperationResultInfo. 2105func (ejori ExportJobsOperationResultInfo) AsOperationResultInfo() (*OperationResultInfo, bool) { 2106 return nil, false 2107} 2108 2109// AsExportJobsOperationResultInfo is the BasicOperationResultInfoBase implementation for ExportJobsOperationResultInfo. 2110func (ejori ExportJobsOperationResultInfo) AsExportJobsOperationResultInfo() (*ExportJobsOperationResultInfo, bool) { 2111 return &ejori, true 2112} 2113 2114// AsOperationResultInfoBase is the BasicOperationResultInfoBase implementation for ExportJobsOperationResultInfo. 2115func (ejori ExportJobsOperationResultInfo) AsOperationResultInfoBase() (*OperationResultInfoBase, bool) { 2116 return nil, false 2117} 2118 2119// AsBasicOperationResultInfoBase is the BasicOperationResultInfoBase implementation for ExportJobsOperationResultInfo. 2120func (ejori ExportJobsOperationResultInfo) AsBasicOperationResultInfoBase() (BasicOperationResultInfoBase, bool) { 2121 return &ejori, true 2122} 2123 2124// GenericRecoveryPoint generic backup copy. 2125type GenericRecoveryPoint struct { 2126 // FriendlyName - Friendly name of the backup copy. 2127 FriendlyName *string `json:"friendlyName,omitempty"` 2128 // RecoveryPointType - Type of the backup copy. 2129 RecoveryPointType *string `json:"recoveryPointType,omitempty"` 2130 // RecoveryPointTime - The time when this backup copy was created. 2131 RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` 2132 // RecoveryPointAdditionalInfo - Additional information associated with this backup copy. 2133 RecoveryPointAdditionalInfo *string `json:"recoveryPointAdditionalInfo,omitempty"` 2134 // ObjectType - Possible values include: 'ObjectTypeRecoveryPoint', 'ObjectTypeIaasVMRecoveryPoint', 'ObjectTypeGenericRecoveryPoint' 2135 ObjectType ObjectTypeBasicRecoveryPoint `json:"objectType,omitempty"` 2136} 2137 2138// MarshalJSON is the custom marshaler for GenericRecoveryPoint. 2139func (grp GenericRecoveryPoint) MarshalJSON() ([]byte, error) { 2140 grp.ObjectType = ObjectTypeGenericRecoveryPoint 2141 objectMap := make(map[string]interface{}) 2142 if grp.FriendlyName != nil { 2143 objectMap["friendlyName"] = grp.FriendlyName 2144 } 2145 if grp.RecoveryPointType != nil { 2146 objectMap["recoveryPointType"] = grp.RecoveryPointType 2147 } 2148 if grp.RecoveryPointTime != nil { 2149 objectMap["recoveryPointTime"] = grp.RecoveryPointTime 2150 } 2151 if grp.RecoveryPointAdditionalInfo != nil { 2152 objectMap["recoveryPointAdditionalInfo"] = grp.RecoveryPointAdditionalInfo 2153 } 2154 if grp.ObjectType != "" { 2155 objectMap["objectType"] = grp.ObjectType 2156 } 2157 return json.Marshal(objectMap) 2158} 2159 2160// AsIaasVMRecoveryPoint is the BasicRecoveryPoint implementation for GenericRecoveryPoint. 2161func (grp GenericRecoveryPoint) AsIaasVMRecoveryPoint() (*IaasVMRecoveryPoint, bool) { 2162 return nil, false 2163} 2164 2165// AsGenericRecoveryPoint is the BasicRecoveryPoint implementation for GenericRecoveryPoint. 2166func (grp GenericRecoveryPoint) AsGenericRecoveryPoint() (*GenericRecoveryPoint, bool) { 2167 return &grp, true 2168} 2169 2170// AsRecoveryPoint is the BasicRecoveryPoint implementation for GenericRecoveryPoint. 2171func (grp GenericRecoveryPoint) AsRecoveryPoint() (*RecoveryPoint, bool) { 2172 return nil, false 2173} 2174 2175// AsBasicRecoveryPoint is the BasicRecoveryPoint implementation for GenericRecoveryPoint. 2176func (grp GenericRecoveryPoint) AsBasicRecoveryPoint() (BasicRecoveryPoint, bool) { 2177 return &grp, true 2178} 2179 2180// GetProtectedItemQueryObject this object filters the list of backup items. 2181type GetProtectedItemQueryObject struct { 2182 // Expand - Specifies if the additional information should be provided for this item. 2183 Expand *string `json:"expand,omitempty"` 2184} 2185 2186// IaasVMBackupRequest this is an Azure VM (also known as IaaS VM) workload-specific backup request. 2187type IaasVMBackupRequest struct { 2188 // RecoveryPointExpiryTimeInUTC - The backup copy will expire after the time specified. The time is in UTC format. 2189 RecoveryPointExpiryTimeInUTC *date.Time `json:"recoveryPointExpiryTimeInUTC,omitempty"` 2190 // ObjectType - Possible values include: 'ObjectTypeBackupRequest', 'ObjectTypeIaasVMBackupRequest' 2191 ObjectType ObjectTypeBasicRequest `json:"objectType,omitempty"` 2192} 2193 2194// MarshalJSON is the custom marshaler for IaasVMBackupRequest. 2195func (ivbr IaasVMBackupRequest) MarshalJSON() ([]byte, error) { 2196 ivbr.ObjectType = ObjectTypeIaasVMBackupRequest 2197 objectMap := make(map[string]interface{}) 2198 if ivbr.RecoveryPointExpiryTimeInUTC != nil { 2199 objectMap["recoveryPointExpiryTimeInUTC"] = ivbr.RecoveryPointExpiryTimeInUTC 2200 } 2201 if ivbr.ObjectType != "" { 2202 objectMap["objectType"] = ivbr.ObjectType 2203 } 2204 return json.Marshal(objectMap) 2205} 2206 2207// AsIaasVMBackupRequest is the BasicRequest implementation for IaasVMBackupRequest. 2208func (ivbr IaasVMBackupRequest) AsIaasVMBackupRequest() (*IaasVMBackupRequest, bool) { 2209 return &ivbr, true 2210} 2211 2212// AsRequest is the BasicRequest implementation for IaasVMBackupRequest. 2213func (ivbr IaasVMBackupRequest) AsRequest() (*Request, bool) { 2214 return nil, false 2215} 2216 2217// AsBasicRequest is the BasicRequest implementation for IaasVMBackupRequest. 2218func (ivbr IaasVMBackupRequest) AsBasicRequest() (BasicRequest, bool) { 2219 return &ivbr, true 2220} 2221 2222// BasicIaaSVMContainer iaaS VM workload-specific container. 2223type BasicIaaSVMContainer interface { 2224 AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) 2225 AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) 2226 AsIaaSVMContainer() (*IaaSVMContainer, bool) 2227} 2228 2229// IaaSVMContainer iaaS VM workload-specific container. 2230type IaaSVMContainer struct { 2231 // VirtualMachineID - The fully qualified Resource Manager URL of the virtual machine represented by this Azure IaaS VM container. 2232 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 2233 // VirtualMachineVersion - Specifies whether the container represents a classic or a Resource Manager-deployed virtual machine. 2234 VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` 2235 // ResourceGroup - The resource group name associated with the Recovery Services vault. 2236 ResourceGroup *string `json:"resourceGroup,omitempty"` 2237 // FriendlyName - Friendly name of the container. 2238 FriendlyName *string `json:"friendlyName,omitempty"` 2239 // BackupManagementType - The backup management type for the container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 2240 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 2241 // RegistrationStatus - The container's registration status with the Recovery Services vault. 2242 RegistrationStatus *string `json:"registrationStatus,omitempty"` 2243 // HealthStatus - The status of the container's health. 2244 HealthStatus *string `json:"healthStatus,omitempty"` 2245 // ContainerType - READ-ONLY; The type assigned to the container. The values to use for each of these properties are:<br/> 1. Compute Azure VM is Microsoft.Compute/virtualMachines<br/> 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines<br/> 3. Windows machines (like Azure Backup Server and DPM) is Windows<br/> 4. Azure SQL instance is AzureSqlContainer. 2246 ContainerType *string `json:"containerType,omitempty"` 2247 // ProtectableObjectType - Possible values include: 'ProtectableObjectTypeProtectionContainer', 'ProtectableObjectTypeAzureSQLContainer', 'ProtectableObjectTypeIaaSVMContainer', 'ProtectableObjectTypeMABWindowsContainer', 'ProtectableObjectTypeMicrosoftComputevirtualMachines', 'ProtectableObjectTypeMicrosoftClassicComputevirtualMachines' 2248 ProtectableObjectType ProtectableObjectType `json:"protectableObjectType,omitempty"` 2249} 2250 2251func unmarshalBasicIaaSVMContainer(body []byte) (BasicIaaSVMContainer, error) { 2252 var m map[string]interface{} 2253 err := json.Unmarshal(body, &m) 2254 if err != nil { 2255 return nil, err 2256 } 2257 2258 switch m["protectableObjectType"] { 2259 case string(ProtectableObjectTypeMicrosoftComputevirtualMachines): 2260 var aiscvc AzureIaaSComputeVMContainer 2261 err := json.Unmarshal(body, &aiscvc) 2262 return aiscvc, err 2263 case string(ProtectableObjectTypeMicrosoftClassicComputevirtualMachines): 2264 var aisccvc AzureIaaSClassicComputeVMContainer 2265 err := json.Unmarshal(body, &aisccvc) 2266 return aisccvc, err 2267 default: 2268 var isc IaaSVMContainer 2269 err := json.Unmarshal(body, &isc) 2270 return isc, err 2271 } 2272} 2273func unmarshalBasicIaaSVMContainerArray(body []byte) ([]BasicIaaSVMContainer, error) { 2274 var rawMessages []*json.RawMessage 2275 err := json.Unmarshal(body, &rawMessages) 2276 if err != nil { 2277 return nil, err 2278 } 2279 2280 iscArray := make([]BasicIaaSVMContainer, len(rawMessages)) 2281 2282 for index, rawMessage := range rawMessages { 2283 isc, err := unmarshalBasicIaaSVMContainer(*rawMessage) 2284 if err != nil { 2285 return nil, err 2286 } 2287 iscArray[index] = isc 2288 } 2289 return iscArray, nil 2290} 2291 2292// MarshalJSON is the custom marshaler for IaaSVMContainer. 2293func (isc IaaSVMContainer) MarshalJSON() ([]byte, error) { 2294 isc.ProtectableObjectType = ProtectableObjectTypeIaaSVMContainer 2295 objectMap := make(map[string]interface{}) 2296 if isc.VirtualMachineID != nil { 2297 objectMap["virtualMachineId"] = isc.VirtualMachineID 2298 } 2299 if isc.VirtualMachineVersion != nil { 2300 objectMap["virtualMachineVersion"] = isc.VirtualMachineVersion 2301 } 2302 if isc.ResourceGroup != nil { 2303 objectMap["resourceGroup"] = isc.ResourceGroup 2304 } 2305 if isc.FriendlyName != nil { 2306 objectMap["friendlyName"] = isc.FriendlyName 2307 } 2308 if isc.BackupManagementType != "" { 2309 objectMap["backupManagementType"] = isc.BackupManagementType 2310 } 2311 if isc.RegistrationStatus != nil { 2312 objectMap["registrationStatus"] = isc.RegistrationStatus 2313 } 2314 if isc.HealthStatus != nil { 2315 objectMap["healthStatus"] = isc.HealthStatus 2316 } 2317 if isc.ProtectableObjectType != "" { 2318 objectMap["protectableObjectType"] = isc.ProtectableObjectType 2319 } 2320 return json.Marshal(objectMap) 2321} 2322 2323// AsAzureSQLContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2324func (isc IaaSVMContainer) AsAzureSQLContainer() (*AzureSQLContainer, bool) { 2325 return nil, false 2326} 2327 2328// AsIaaSVMContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2329func (isc IaaSVMContainer) AsIaaSVMContainer() (*IaaSVMContainer, bool) { 2330 return &isc, true 2331} 2332 2333// AsBasicIaaSVMContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2334func (isc IaaSVMContainer) AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) { 2335 return &isc, true 2336} 2337 2338// AsMabContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2339func (isc IaaSVMContainer) AsMabContainer() (*MabContainer, bool) { 2340 return nil, false 2341} 2342 2343// AsAzureIaaSComputeVMContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2344func (isc IaaSVMContainer) AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) { 2345 return nil, false 2346} 2347 2348// AsAzureIaaSClassicComputeVMContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2349func (isc IaaSVMContainer) AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) { 2350 return nil, false 2351} 2352 2353// AsProtectionContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2354func (isc IaaSVMContainer) AsProtectionContainer() (*ProtectionContainer, bool) { 2355 return nil, false 2356} 2357 2358// AsBasicProtectionContainer is the BasicProtectionContainer implementation for IaaSVMContainer. 2359func (isc IaaSVMContainer) AsBasicProtectionContainer() (BasicProtectionContainer, bool) { 2360 return &isc, true 2361} 2362 2363// IaasVMILRRegistrationRequest restore files or folders from a backup copy, or recovery point, of an IaaS 2364// (or Azure) VM. 2365type IaasVMILRRegistrationRequest struct { 2366 // RecoveryPointID - The ID of the IaaS VM recovery point used to restore the files or folders. 2367 RecoveryPointID *string `json:"recoveryPointId,omitempty"` 2368 // VirtualMachineID - The fully qualified Resource Manager ID of the VM used to restore the files or folders. 2369 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 2370 // InitiatorName - The iSCSI initiator name. 2371 InitiatorName *string `json:"initiatorName,omitempty"` 2372 // RenewExistingRegistration - Whether to renew the existing registration with the iSCSI server. 2373 RenewExistingRegistration *bool `json:"renewExistingRegistration,omitempty"` 2374 // ObjectType - Possible values include: 'ObjectTypeILRRequest', 'ObjectTypeIaasVMILRRegistrationRequest' 2375 ObjectType ObjectTypeBasicILRRequest `json:"objectType,omitempty"` 2376} 2377 2378// MarshalJSON is the custom marshaler for IaasVMILRRegistrationRequest. 2379func (ivrr IaasVMILRRegistrationRequest) MarshalJSON() ([]byte, error) { 2380 ivrr.ObjectType = ObjectTypeIaasVMILRRegistrationRequest 2381 objectMap := make(map[string]interface{}) 2382 if ivrr.RecoveryPointID != nil { 2383 objectMap["recoveryPointId"] = ivrr.RecoveryPointID 2384 } 2385 if ivrr.VirtualMachineID != nil { 2386 objectMap["virtualMachineId"] = ivrr.VirtualMachineID 2387 } 2388 if ivrr.InitiatorName != nil { 2389 objectMap["initiatorName"] = ivrr.InitiatorName 2390 } 2391 if ivrr.RenewExistingRegistration != nil { 2392 objectMap["renewExistingRegistration"] = ivrr.RenewExistingRegistration 2393 } 2394 if ivrr.ObjectType != "" { 2395 objectMap["objectType"] = ivrr.ObjectType 2396 } 2397 return json.Marshal(objectMap) 2398} 2399 2400// AsIaasVMILRRegistrationRequest is the BasicILRRequest implementation for IaasVMILRRegistrationRequest. 2401func (ivrr IaasVMILRRegistrationRequest) AsIaasVMILRRegistrationRequest() (*IaasVMILRRegistrationRequest, bool) { 2402 return &ivrr, true 2403} 2404 2405// AsILRRequest is the BasicILRRequest implementation for IaasVMILRRegistrationRequest. 2406func (ivrr IaasVMILRRegistrationRequest) AsILRRequest() (*ILRRequest, bool) { 2407 return nil, false 2408} 2409 2410// AsBasicILRRequest is the BasicILRRequest implementation for IaasVMILRRegistrationRequest. 2411func (ivrr IaasVMILRRegistrationRequest) AsBasicILRRequest() (BasicILRRequest, bool) { 2412 return &ivrr, true 2413} 2414 2415// BasicIaaSVMProtectableItem this Azure VM workload-specific (also known as IaaS VM workload-specific) backup item can 2416// be backed up. 2417type BasicIaaSVMProtectableItem interface { 2418 AsAzureIaaSComputeVMProtectableItem() (*AzureIaaSComputeVMProtectableItem, bool) 2419 AsAzureIaaSClassicComputeVMProtectableItem() (*AzureIaaSClassicComputeVMProtectableItem, bool) 2420 AsIaaSVMProtectableItem() (*IaaSVMProtectableItem, bool) 2421} 2422 2423// IaaSVMProtectableItem this Azure VM workload-specific (also known as IaaS VM workload-specific) backup item 2424// can be backed up. 2425type IaaSVMProtectableItem struct { 2426 // VirtualMachineID - The fully qualified Resource Manager ID of the virtual machine. 2427 VirtualMachineID *string `json:"virtualMachineId,omitempty"` 2428 // BackupManagementType - The backup management type. 2429 BackupManagementType *string `json:"backupManagementType,omitempty"` 2430 // FriendlyName - The friendly name of the backup item. 2431 FriendlyName *string `json:"friendlyName,omitempty"` 2432 // ProtectionState - The state of the back up item. Possible values include: 'ProtectionStatusInvalid', 'ProtectionStatusNotProtected', 'ProtectionStatusProtecting', 'ProtectionStatusProtected' 2433 ProtectionState ProtectionStatus `json:"protectionState,omitempty"` 2434 // ProtectableItemType - Possible values include: 'ProtectableItemTypeWorkloadProtectableItem', 'ProtectableItemTypeIaaSVMProtectableItem', 'ProtectableItemTypeMicrosoftComputevirtualMachines', 'ProtectableItemTypeMicrosoftClassicComputevirtualMachines' 2435 ProtectableItemType ProtectableItemType `json:"protectableItemType,omitempty"` 2436} 2437 2438func unmarshalBasicIaaSVMProtectableItem(body []byte) (BasicIaaSVMProtectableItem, error) { 2439 var m map[string]interface{} 2440 err := json.Unmarshal(body, &m) 2441 if err != nil { 2442 return nil, err 2443 } 2444 2445 switch m["protectableItemType"] { 2446 case string(ProtectableItemTypeMicrosoftComputevirtualMachines): 2447 var aiscvpi AzureIaaSComputeVMProtectableItem 2448 err := json.Unmarshal(body, &aiscvpi) 2449 return aiscvpi, err 2450 case string(ProtectableItemTypeMicrosoftClassicComputevirtualMachines): 2451 var aisccvpi AzureIaaSClassicComputeVMProtectableItem 2452 err := json.Unmarshal(body, &aisccvpi) 2453 return aisccvpi, err 2454 default: 2455 var ispi IaaSVMProtectableItem 2456 err := json.Unmarshal(body, &ispi) 2457 return ispi, err 2458 } 2459} 2460func unmarshalBasicIaaSVMProtectableItemArray(body []byte) ([]BasicIaaSVMProtectableItem, error) { 2461 var rawMessages []*json.RawMessage 2462 err := json.Unmarshal(body, &rawMessages) 2463 if err != nil { 2464 return nil, err 2465 } 2466 2467 ispiArray := make([]BasicIaaSVMProtectableItem, len(rawMessages)) 2468 2469 for index, rawMessage := range rawMessages { 2470 ispi, err := unmarshalBasicIaaSVMProtectableItem(*rawMessage) 2471 if err != nil { 2472 return nil, err 2473 } 2474 ispiArray[index] = ispi 2475 } 2476 return ispiArray, nil 2477} 2478 2479// MarshalJSON is the custom marshaler for IaaSVMProtectableItem. 2480func (ispi IaaSVMProtectableItem) MarshalJSON() ([]byte, error) { 2481 ispi.ProtectableItemType = ProtectableItemTypeIaaSVMProtectableItem 2482 objectMap := make(map[string]interface{}) 2483 if ispi.VirtualMachineID != nil { 2484 objectMap["virtualMachineId"] = ispi.VirtualMachineID 2485 } 2486 if ispi.BackupManagementType != nil { 2487 objectMap["backupManagementType"] = ispi.BackupManagementType 2488 } 2489 if ispi.FriendlyName != nil { 2490 objectMap["friendlyName"] = ispi.FriendlyName 2491 } 2492 if ispi.ProtectionState != "" { 2493 objectMap["protectionState"] = ispi.ProtectionState 2494 } 2495 if ispi.ProtectableItemType != "" { 2496 objectMap["protectableItemType"] = ispi.ProtectableItemType 2497 } 2498 return json.Marshal(objectMap) 2499} 2500 2501// AsIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for IaaSVMProtectableItem. 2502func (ispi IaaSVMProtectableItem) AsIaaSVMProtectableItem() (*IaaSVMProtectableItem, bool) { 2503 return &ispi, true 2504} 2505 2506// AsBasicIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for IaaSVMProtectableItem. 2507func (ispi IaaSVMProtectableItem) AsBasicIaaSVMProtectableItem() (BasicIaaSVMProtectableItem, bool) { 2508 return &ispi, true 2509} 2510 2511// AsAzureIaaSComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for IaaSVMProtectableItem. 2512func (ispi IaaSVMProtectableItem) AsAzureIaaSComputeVMProtectableItem() (*AzureIaaSComputeVMProtectableItem, bool) { 2513 return nil, false 2514} 2515 2516// AsAzureIaaSClassicComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for IaaSVMProtectableItem. 2517func (ispi IaaSVMProtectableItem) AsAzureIaaSClassicComputeVMProtectableItem() (*AzureIaaSClassicComputeVMProtectableItem, bool) { 2518 return nil, false 2519} 2520 2521// AsWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for IaaSVMProtectableItem. 2522func (ispi IaaSVMProtectableItem) AsWorkloadProtectableItem() (*WorkloadProtectableItem, bool) { 2523 return nil, false 2524} 2525 2526// AsBasicWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for IaaSVMProtectableItem. 2527func (ispi IaaSVMProtectableItem) AsBasicWorkloadProtectableItem() (BasicWorkloadProtectableItem, bool) { 2528 return &ispi, true 2529} 2530 2531// IaasVMRecoveryPoint azure VM (also known as IaaS VM) workload-specific backup copy. 2532type IaasVMRecoveryPoint struct { 2533 // RecoveryPointType - Type of the backup copy. 2534 RecoveryPointType *string `json:"recoveryPointType,omitempty"` 2535 // RecoveryPointTime - The date and time when the backup copy was created. 2536 RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` 2537 // RecoveryPointAdditionalInfo - Additional information associated with this backup copy. 2538 RecoveryPointAdditionalInfo *string `json:"recoveryPointAdditionalInfo,omitempty"` 2539 // SourceVMStorageType - The storage type for the VM whose backup copy was created. 2540 SourceVMStorageType *string `json:"sourceVMStorageType,omitempty"` 2541 // IsSourceVMEncrypted - Identifies whether the VM was encrypted when the backup copy is created. 2542 IsSourceVMEncrypted *bool `json:"isSourceVMEncrypted,omitempty"` 2543 // KeyAndSecret - Required details for recovering an encrypted VM. Applicable only when IsSourceVMEncrypted is true. 2544 KeyAndSecret *KeyAndSecretDetails `json:"keyAndSecret,omitempty"` 2545 // IsInstantILRSessionActive - Answer to the question - Is the session to recover items from this backup copy still active. 2546 IsInstantILRSessionActive *bool `json:"isInstantILRSessionActive,omitempty"` 2547 // ObjectType - Possible values include: 'ObjectTypeRecoveryPoint', 'ObjectTypeIaasVMRecoveryPoint', 'ObjectTypeGenericRecoveryPoint' 2548 ObjectType ObjectTypeBasicRecoveryPoint `json:"objectType,omitempty"` 2549} 2550 2551// MarshalJSON is the custom marshaler for IaasVMRecoveryPoint. 2552func (ivrp IaasVMRecoveryPoint) MarshalJSON() ([]byte, error) { 2553 ivrp.ObjectType = ObjectTypeIaasVMRecoveryPoint 2554 objectMap := make(map[string]interface{}) 2555 if ivrp.RecoveryPointType != nil { 2556 objectMap["recoveryPointType"] = ivrp.RecoveryPointType 2557 } 2558 if ivrp.RecoveryPointTime != nil { 2559 objectMap["recoveryPointTime"] = ivrp.RecoveryPointTime 2560 } 2561 if ivrp.RecoveryPointAdditionalInfo != nil { 2562 objectMap["recoveryPointAdditionalInfo"] = ivrp.RecoveryPointAdditionalInfo 2563 } 2564 if ivrp.SourceVMStorageType != nil { 2565 objectMap["sourceVMStorageType"] = ivrp.SourceVMStorageType 2566 } 2567 if ivrp.IsSourceVMEncrypted != nil { 2568 objectMap["isSourceVMEncrypted"] = ivrp.IsSourceVMEncrypted 2569 } 2570 if ivrp.KeyAndSecret != nil { 2571 objectMap["keyAndSecret"] = ivrp.KeyAndSecret 2572 } 2573 if ivrp.IsInstantILRSessionActive != nil { 2574 objectMap["isInstantILRSessionActive"] = ivrp.IsInstantILRSessionActive 2575 } 2576 if ivrp.ObjectType != "" { 2577 objectMap["objectType"] = ivrp.ObjectType 2578 } 2579 return json.Marshal(objectMap) 2580} 2581 2582// AsIaasVMRecoveryPoint is the BasicRecoveryPoint implementation for IaasVMRecoveryPoint. 2583func (ivrp IaasVMRecoveryPoint) AsIaasVMRecoveryPoint() (*IaasVMRecoveryPoint, bool) { 2584 return &ivrp, true 2585} 2586 2587// AsGenericRecoveryPoint is the BasicRecoveryPoint implementation for IaasVMRecoveryPoint. 2588func (ivrp IaasVMRecoveryPoint) AsGenericRecoveryPoint() (*GenericRecoveryPoint, bool) { 2589 return nil, false 2590} 2591 2592// AsRecoveryPoint is the BasicRecoveryPoint implementation for IaasVMRecoveryPoint. 2593func (ivrp IaasVMRecoveryPoint) AsRecoveryPoint() (*RecoveryPoint, bool) { 2594 return nil, false 2595} 2596 2597// AsBasicRecoveryPoint is the BasicRecoveryPoint implementation for IaasVMRecoveryPoint. 2598func (ivrp IaasVMRecoveryPoint) AsBasicRecoveryPoint() (BasicRecoveryPoint, bool) { 2599 return &ivrp, true 2600} 2601 2602// IaasVMRestoreRequest iaaS VM workload-specific restore. 2603type IaasVMRestoreRequest struct { 2604 // RecoveryPointID - The ID of the backup copy to be recovered. 2605 RecoveryPointID *string `json:"recoveryPointId,omitempty"` 2606 // RecoveryType - The type of this recovery. Possible values include: 'RecoveryTypeInvalid', 'RecoveryTypeOriginalLocation', 'RecoveryTypeAlternateLocation', 'RecoveryTypeRestoreDisks' 2607 RecoveryType RecoveryType `json:"recoveryType,omitempty"` 2608 // SourceResourceID - The fully qualified Resource Manager ID of the VM being recovered. 2609 SourceResourceID *string `json:"sourceResourceId,omitempty"` 2610 // TargetVirtualMachineID - The complete Resource Manager ID of the VM that will be created. 2611 // For example: /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm} 2612 TargetVirtualMachineID *string `json:"targetVirtualMachineId,omitempty"` 2613 // TargetResourceGroupID - The Resource Manager ID of the resource group you're creating for this VM and other artifacts. 2614 // For example: /subscriptions/{subId}/resourcegroups/{rg} 2615 TargetResourceGroupID *string `json:"targetResourceGroupId,omitempty"` 2616 // StorageAccountID - The fully qualified Resource Manager ID of the storage account where the VM will be restored. 2617 StorageAccountID *string `json:"storageAccountId,omitempty"` 2618 // VirtualNetworkID - This is the virtual network ID of the vnet that is attached to the virtual machine. 2619 // Your join action permissions are validated during the linked access. 2620 VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` 2621 // SubnetID - Subnet ID is the identifier for the VM to be restored. For Classic VMs the subnet ID would be {VnetID}/Subnet/{SubnetName}, and for the Resource Manager VMs, the subnet ID would be the Resource Manager resource ID used to represent the subnet. 2622 SubnetID *string `json:"subnetId,omitempty"` 2623 // TargetDomainNameID - The fully qualified Resource Manager ID of the domain name to be associated with the VM being restored. Use the Resource Manager ID to identify the domain, only for Classic-deployed virtual machines. 2624 TargetDomainNameID *string `json:"targetDomainNameId,omitempty"` 2625 // Region - The region where the virtual machine is restored. 2626 Region *string `json:"region,omitempty"` 2627 // AffinityGroup - The affinity group associated with the VM to be restored. Affinity groups are used only for Classic-deployed virtual machines. 2628 AffinityGroup *string `json:"affinityGroup,omitempty"` 2629 // CreateNewCloudService - Asks the question if a new cloud service should be created while restoring the VM. If the answer is false, the VM is restored to the same cloud service. 2630 CreateNewCloudService *bool `json:"createNewCloudService,omitempty"` 2631 // EncryptionDetails - If the VM was encrypted at the time of backup, these details are needed. 2632 EncryptionDetails *EncryptionDetails `json:"encryptionDetails,omitempty"` 2633 // ObjectType - Possible values include: 'ObjectTypeRestoreRequest', 'ObjectTypeIaasVMRestoreRequest' 2634 ObjectType ObjectTypeBasicRestoreRequest `json:"objectType,omitempty"` 2635} 2636 2637// MarshalJSON is the custom marshaler for IaasVMRestoreRequest. 2638func (ivrr IaasVMRestoreRequest) MarshalJSON() ([]byte, error) { 2639 ivrr.ObjectType = ObjectTypeIaasVMRestoreRequest 2640 objectMap := make(map[string]interface{}) 2641 if ivrr.RecoveryPointID != nil { 2642 objectMap["recoveryPointId"] = ivrr.RecoveryPointID 2643 } 2644 if ivrr.RecoveryType != "" { 2645 objectMap["recoveryType"] = ivrr.RecoveryType 2646 } 2647 if ivrr.SourceResourceID != nil { 2648 objectMap["sourceResourceId"] = ivrr.SourceResourceID 2649 } 2650 if ivrr.TargetVirtualMachineID != nil { 2651 objectMap["targetVirtualMachineId"] = ivrr.TargetVirtualMachineID 2652 } 2653 if ivrr.TargetResourceGroupID != nil { 2654 objectMap["targetResourceGroupId"] = ivrr.TargetResourceGroupID 2655 } 2656 if ivrr.StorageAccountID != nil { 2657 objectMap["storageAccountId"] = ivrr.StorageAccountID 2658 } 2659 if ivrr.VirtualNetworkID != nil { 2660 objectMap["virtualNetworkId"] = ivrr.VirtualNetworkID 2661 } 2662 if ivrr.SubnetID != nil { 2663 objectMap["subnetId"] = ivrr.SubnetID 2664 } 2665 if ivrr.TargetDomainNameID != nil { 2666 objectMap["targetDomainNameId"] = ivrr.TargetDomainNameID 2667 } 2668 if ivrr.Region != nil { 2669 objectMap["region"] = ivrr.Region 2670 } 2671 if ivrr.AffinityGroup != nil { 2672 objectMap["affinityGroup"] = ivrr.AffinityGroup 2673 } 2674 if ivrr.CreateNewCloudService != nil { 2675 objectMap["createNewCloudService"] = ivrr.CreateNewCloudService 2676 } 2677 if ivrr.EncryptionDetails != nil { 2678 objectMap["encryptionDetails"] = ivrr.EncryptionDetails 2679 } 2680 if ivrr.ObjectType != "" { 2681 objectMap["objectType"] = ivrr.ObjectType 2682 } 2683 return json.Marshal(objectMap) 2684} 2685 2686// AsIaasVMRestoreRequest is the BasicRestoreRequest implementation for IaasVMRestoreRequest. 2687func (ivrr IaasVMRestoreRequest) AsIaasVMRestoreRequest() (*IaasVMRestoreRequest, bool) { 2688 return &ivrr, true 2689} 2690 2691// AsRestoreRequest is the BasicRestoreRequest implementation for IaasVMRestoreRequest. 2692func (ivrr IaasVMRestoreRequest) AsRestoreRequest() (*RestoreRequest, bool) { 2693 return nil, false 2694} 2695 2696// AsBasicRestoreRequest is the BasicRestoreRequest implementation for IaasVMRestoreRequest. 2697func (ivrr IaasVMRestoreRequest) AsBasicRestoreRequest() (BasicRestoreRequest, bool) { 2698 return &ivrr, true 2699} 2700 2701// BasicILRRequest parameters to restore file or folders API. 2702type BasicILRRequest interface { 2703 AsIaasVMILRRegistrationRequest() (*IaasVMILRRegistrationRequest, bool) 2704 AsILRRequest() (*ILRRequest, bool) 2705} 2706 2707// ILRRequest parameters to restore file or folders API. 2708type ILRRequest struct { 2709 // ObjectType - Possible values include: 'ObjectTypeILRRequest', 'ObjectTypeIaasVMILRRegistrationRequest' 2710 ObjectType ObjectTypeBasicILRRequest `json:"objectType,omitempty"` 2711} 2712 2713func unmarshalBasicILRRequest(body []byte) (BasicILRRequest, error) { 2714 var m map[string]interface{} 2715 err := json.Unmarshal(body, &m) 2716 if err != nil { 2717 return nil, err 2718 } 2719 2720 switch m["objectType"] { 2721 case string(ObjectTypeIaasVMILRRegistrationRequest): 2722 var ivrr IaasVMILRRegistrationRequest 2723 err := json.Unmarshal(body, &ivrr) 2724 return ivrr, err 2725 default: 2726 var ir ILRRequest 2727 err := json.Unmarshal(body, &ir) 2728 return ir, err 2729 } 2730} 2731func unmarshalBasicILRRequestArray(body []byte) ([]BasicILRRequest, error) { 2732 var rawMessages []*json.RawMessage 2733 err := json.Unmarshal(body, &rawMessages) 2734 if err != nil { 2735 return nil, err 2736 } 2737 2738 irArray := make([]BasicILRRequest, len(rawMessages)) 2739 2740 for index, rawMessage := range rawMessages { 2741 ir, err := unmarshalBasicILRRequest(*rawMessage) 2742 if err != nil { 2743 return nil, err 2744 } 2745 irArray[index] = ir 2746 } 2747 return irArray, nil 2748} 2749 2750// MarshalJSON is the custom marshaler for ILRRequest. 2751func (ir ILRRequest) MarshalJSON() ([]byte, error) { 2752 ir.ObjectType = ObjectTypeILRRequest 2753 objectMap := make(map[string]interface{}) 2754 if ir.ObjectType != "" { 2755 objectMap["objectType"] = ir.ObjectType 2756 } 2757 return json.Marshal(objectMap) 2758} 2759 2760// AsIaasVMILRRegistrationRequest is the BasicILRRequest implementation for ILRRequest. 2761func (ir ILRRequest) AsIaasVMILRRegistrationRequest() (*IaasVMILRRegistrationRequest, bool) { 2762 return nil, false 2763} 2764 2765// AsILRRequest is the BasicILRRequest implementation for ILRRequest. 2766func (ir ILRRequest) AsILRRequest() (*ILRRequest, bool) { 2767 return &ir, true 2768} 2769 2770// AsBasicILRRequest is the BasicILRRequest implementation for ILRRequest. 2771func (ir ILRRequest) AsBasicILRRequest() (BasicILRRequest, bool) { 2772 return &ir, true 2773} 2774 2775// ILRRequestResource the parameters to restore files or folders. 2776type ILRRequestResource struct { 2777 Properties BasicILRRequest `json:"properties,omitempty"` 2778 // ID - Resource ID represents the complete path to the resource. 2779 ID *string `json:"id,omitempty"` 2780 // Name - Resource name associated with the resource. 2781 Name *string `json:"name,omitempty"` 2782 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 2783 Type *string `json:"type,omitempty"` 2784 // Location - Resource location. 2785 Location *string `json:"location,omitempty"` 2786 // Tags - Resource tags. 2787 Tags map[string]*string `json:"tags"` 2788 // ETag - Optional ETag. 2789 ETag *string `json:"eTag,omitempty"` 2790} 2791 2792// MarshalJSON is the custom marshaler for ILRRequestResource. 2793func (irr ILRRequestResource) MarshalJSON() ([]byte, error) { 2794 objectMap := make(map[string]interface{}) 2795 objectMap["properties"] = irr.Properties 2796 if irr.ID != nil { 2797 objectMap["id"] = irr.ID 2798 } 2799 if irr.Name != nil { 2800 objectMap["name"] = irr.Name 2801 } 2802 if irr.Type != nil { 2803 objectMap["type"] = irr.Type 2804 } 2805 if irr.Location != nil { 2806 objectMap["location"] = irr.Location 2807 } 2808 if irr.Tags != nil { 2809 objectMap["tags"] = irr.Tags 2810 } 2811 if irr.ETag != nil { 2812 objectMap["eTag"] = irr.ETag 2813 } 2814 return json.Marshal(objectMap) 2815} 2816 2817// UnmarshalJSON is the custom unmarshaler for ILRRequestResource struct. 2818func (irr *ILRRequestResource) UnmarshalJSON(body []byte) error { 2819 var m map[string]*json.RawMessage 2820 err := json.Unmarshal(body, &m) 2821 if err != nil { 2822 return err 2823 } 2824 for k, v := range m { 2825 switch k { 2826 case "properties": 2827 if v != nil { 2828 properties, err := unmarshalBasicILRRequest(*v) 2829 if err != nil { 2830 return err 2831 } 2832 irr.Properties = properties 2833 } 2834 case "id": 2835 if v != nil { 2836 var ID string 2837 err = json.Unmarshal(*v, &ID) 2838 if err != nil { 2839 return err 2840 } 2841 irr.ID = &ID 2842 } 2843 case "name": 2844 if v != nil { 2845 var name string 2846 err = json.Unmarshal(*v, &name) 2847 if err != nil { 2848 return err 2849 } 2850 irr.Name = &name 2851 } 2852 case "type": 2853 if v != nil { 2854 var typeVar string 2855 err = json.Unmarshal(*v, &typeVar) 2856 if err != nil { 2857 return err 2858 } 2859 irr.Type = &typeVar 2860 } 2861 case "location": 2862 if v != nil { 2863 var location string 2864 err = json.Unmarshal(*v, &location) 2865 if err != nil { 2866 return err 2867 } 2868 irr.Location = &location 2869 } 2870 case "tags": 2871 if v != nil { 2872 var tags map[string]*string 2873 err = json.Unmarshal(*v, &tags) 2874 if err != nil { 2875 return err 2876 } 2877 irr.Tags = tags 2878 } 2879 case "eTag": 2880 if v != nil { 2881 var eTag string 2882 err = json.Unmarshal(*v, &eTag) 2883 if err != nil { 2884 return err 2885 } 2886 irr.ETag = &eTag 2887 } 2888 } 2889 } 2890 2891 return nil 2892} 2893 2894// InstantItemRecoveryTarget target details for the file or folder restore. 2895type InstantItemRecoveryTarget struct { 2896 // ClientScripts - List of client scripts. 2897 ClientScripts *[]ClientScriptForConnect `json:"clientScripts,omitempty"` 2898} 2899 2900// BasicJob defines workload-agnostic properties for a job. 2901type BasicJob interface { 2902 AsAzureIaaSVMJob() (*AzureIaaSVMJob, bool) 2903 AsDpmJob() (*DpmJob, bool) 2904 AsMabJob() (*MabJob, bool) 2905 AsJob() (*Job, bool) 2906} 2907 2908// Job defines workload-agnostic properties for a job. 2909type Job struct { 2910 // EntityFriendlyName - The friendly name of the entity on which the current job is executing. 2911 EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` 2912 // BackupManagementType - The backup management type for the current job. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 2913 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 2914 // Operation - The operation name. 2915 Operation *string `json:"operation,omitempty"` 2916 // Status - The job status. 2917 Status *string `json:"status,omitempty"` 2918 // StartTime - The start time. 2919 StartTime *date.Time `json:"startTime,omitempty"` 2920 // EndTime - The end time. 2921 EndTime *date.Time `json:"endTime,omitempty"` 2922 // ActivityID - ActivityId of job. 2923 ActivityID *string `json:"activityId,omitempty"` 2924 // JobType - Possible values include: 'JobTypeJob', 'JobTypeAzureIaaSVMJob', 'JobTypeDpmJob', 'JobTypeMabJob' 2925 JobType JobType `json:"jobType,omitempty"` 2926} 2927 2928func unmarshalBasicJob(body []byte) (BasicJob, error) { 2929 var m map[string]interface{} 2930 err := json.Unmarshal(body, &m) 2931 if err != nil { 2932 return nil, err 2933 } 2934 2935 switch m["jobType"] { 2936 case string(JobTypeAzureIaaSVMJob): 2937 var aisj AzureIaaSVMJob 2938 err := json.Unmarshal(body, &aisj) 2939 return aisj, err 2940 case string(JobTypeDpmJob): 2941 var dj DpmJob 2942 err := json.Unmarshal(body, &dj) 2943 return dj, err 2944 case string(JobTypeMabJob): 2945 var mj MabJob 2946 err := json.Unmarshal(body, &mj) 2947 return mj, err 2948 default: 2949 var j Job 2950 err := json.Unmarshal(body, &j) 2951 return j, err 2952 } 2953} 2954func unmarshalBasicJobArray(body []byte) ([]BasicJob, error) { 2955 var rawMessages []*json.RawMessage 2956 err := json.Unmarshal(body, &rawMessages) 2957 if err != nil { 2958 return nil, err 2959 } 2960 2961 jArray := make([]BasicJob, len(rawMessages)) 2962 2963 for index, rawMessage := range rawMessages { 2964 j, err := unmarshalBasicJob(*rawMessage) 2965 if err != nil { 2966 return nil, err 2967 } 2968 jArray[index] = j 2969 } 2970 return jArray, nil 2971} 2972 2973// MarshalJSON is the custom marshaler for Job. 2974func (j Job) MarshalJSON() ([]byte, error) { 2975 j.JobType = JobTypeJob 2976 objectMap := make(map[string]interface{}) 2977 if j.EntityFriendlyName != nil { 2978 objectMap["entityFriendlyName"] = j.EntityFriendlyName 2979 } 2980 if j.BackupManagementType != "" { 2981 objectMap["backupManagementType"] = j.BackupManagementType 2982 } 2983 if j.Operation != nil { 2984 objectMap["operation"] = j.Operation 2985 } 2986 if j.Status != nil { 2987 objectMap["status"] = j.Status 2988 } 2989 if j.StartTime != nil { 2990 objectMap["startTime"] = j.StartTime 2991 } 2992 if j.EndTime != nil { 2993 objectMap["endTime"] = j.EndTime 2994 } 2995 if j.ActivityID != nil { 2996 objectMap["activityId"] = j.ActivityID 2997 } 2998 if j.JobType != "" { 2999 objectMap["jobType"] = j.JobType 3000 } 3001 return json.Marshal(objectMap) 3002} 3003 3004// AsAzureIaaSVMJob is the BasicJob implementation for Job. 3005func (j Job) AsAzureIaaSVMJob() (*AzureIaaSVMJob, bool) { 3006 return nil, false 3007} 3008 3009// AsDpmJob is the BasicJob implementation for Job. 3010func (j Job) AsDpmJob() (*DpmJob, bool) { 3011 return nil, false 3012} 3013 3014// AsMabJob is the BasicJob implementation for Job. 3015func (j Job) AsMabJob() (*MabJob, bool) { 3016 return nil, false 3017} 3018 3019// AsJob is the BasicJob implementation for Job. 3020func (j Job) AsJob() (*Job, bool) { 3021 return &j, true 3022} 3023 3024// AsBasicJob is the BasicJob implementation for Job. 3025func (j Job) AsBasicJob() (BasicJob, bool) { 3026 return &j, true 3027} 3028 3029// JobQueryObject the filters to list the jobs. 3030type JobQueryObject struct { 3031 // Status - Status of the job. Possible values include: 'JobStatusInvalid', 'JobStatusInProgress', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCompletedWithWarnings', 'JobStatusCancelled', 'JobStatusCancelling' 3032 Status JobStatus `json:"status,omitempty"` 3033 // BackupManagementType - Type of backup management for the job. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 3034 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 3035 // Operation - The type of operation. Possible values include: 'JobOperationTypeInvalid', 'JobOperationTypeConfigureBackup', 'JobOperationTypeBackup', 'JobOperationTypeRestore', 'JobOperationTypeDisableBackup', 'JobOperationTypeDeleteBackupData' 3036 Operation JobOperationType `json:"operation,omitempty"` 3037 // JobID - The ID of the job. Each jobID is unique. 3038 JobID *string `json:"jobId,omitempty"` 3039 // StartTime - The time when the job starts. The value is in UTC. 3040 StartTime *date.Time `json:"startTime,omitempty"` 3041 // EndTime - The time when the job ends. The value is in UTC. 3042 EndTime *date.Time `json:"endTime,omitempty"` 3043} 3044 3045// JobResource defines the workload-agnostic properties for a job. 3046type JobResource struct { 3047 autorest.Response `json:"-"` 3048 Properties BasicJob `json:"properties,omitempty"` 3049 // ID - Resource ID represents the complete path to the resource. 3050 ID *string `json:"id,omitempty"` 3051 // Name - Resource name associated with the resource. 3052 Name *string `json:"name,omitempty"` 3053 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 3054 Type *string `json:"type,omitempty"` 3055 // Location - Resource location. 3056 Location *string `json:"location,omitempty"` 3057 // Tags - Resource tags. 3058 Tags map[string]*string `json:"tags"` 3059 // ETag - Optional ETag. 3060 ETag *string `json:"eTag,omitempty"` 3061} 3062 3063// MarshalJSON is the custom marshaler for JobResource. 3064func (jr JobResource) MarshalJSON() ([]byte, error) { 3065 objectMap := make(map[string]interface{}) 3066 objectMap["properties"] = jr.Properties 3067 if jr.ID != nil { 3068 objectMap["id"] = jr.ID 3069 } 3070 if jr.Name != nil { 3071 objectMap["name"] = jr.Name 3072 } 3073 if jr.Type != nil { 3074 objectMap["type"] = jr.Type 3075 } 3076 if jr.Location != nil { 3077 objectMap["location"] = jr.Location 3078 } 3079 if jr.Tags != nil { 3080 objectMap["tags"] = jr.Tags 3081 } 3082 if jr.ETag != nil { 3083 objectMap["eTag"] = jr.ETag 3084 } 3085 return json.Marshal(objectMap) 3086} 3087 3088// UnmarshalJSON is the custom unmarshaler for JobResource struct. 3089func (jr *JobResource) UnmarshalJSON(body []byte) error { 3090 var m map[string]*json.RawMessage 3091 err := json.Unmarshal(body, &m) 3092 if err != nil { 3093 return err 3094 } 3095 for k, v := range m { 3096 switch k { 3097 case "properties": 3098 if v != nil { 3099 properties, err := unmarshalBasicJob(*v) 3100 if err != nil { 3101 return err 3102 } 3103 jr.Properties = properties 3104 } 3105 case "id": 3106 if v != nil { 3107 var ID string 3108 err = json.Unmarshal(*v, &ID) 3109 if err != nil { 3110 return err 3111 } 3112 jr.ID = &ID 3113 } 3114 case "name": 3115 if v != nil { 3116 var name string 3117 err = json.Unmarshal(*v, &name) 3118 if err != nil { 3119 return err 3120 } 3121 jr.Name = &name 3122 } 3123 case "type": 3124 if v != nil { 3125 var typeVar string 3126 err = json.Unmarshal(*v, &typeVar) 3127 if err != nil { 3128 return err 3129 } 3130 jr.Type = &typeVar 3131 } 3132 case "location": 3133 if v != nil { 3134 var location string 3135 err = json.Unmarshal(*v, &location) 3136 if err != nil { 3137 return err 3138 } 3139 jr.Location = &location 3140 } 3141 case "tags": 3142 if v != nil { 3143 var tags map[string]*string 3144 err = json.Unmarshal(*v, &tags) 3145 if err != nil { 3146 return err 3147 } 3148 jr.Tags = tags 3149 } 3150 case "eTag": 3151 if v != nil { 3152 var eTag string 3153 err = json.Unmarshal(*v, &eTag) 3154 if err != nil { 3155 return err 3156 } 3157 jr.ETag = &eTag 3158 } 3159 } 3160 } 3161 3162 return nil 3163} 3164 3165// JobResourceList list of Job resources. 3166type JobResourceList struct { 3167 autorest.Response `json:"-"` 3168 // Value - List of resources. 3169 Value *[]JobResource `json:"value,omitempty"` 3170 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 3171 NextLink *string `json:"nextLink,omitempty"` 3172} 3173 3174// JobResourceListIterator provides access to a complete listing of JobResource values. 3175type JobResourceListIterator struct { 3176 i int 3177 page JobResourceListPage 3178} 3179 3180// NextWithContext advances to the next value. If there was an error making 3181// the request the iterator does not advance and the error is returned. 3182func (iter *JobResourceListIterator) NextWithContext(ctx context.Context) (err error) { 3183 if tracing.IsEnabled() { 3184 ctx = tracing.StartSpan(ctx, fqdn+"/JobResourceListIterator.NextWithContext") 3185 defer func() { 3186 sc := -1 3187 if iter.Response().Response.Response != nil { 3188 sc = iter.Response().Response.Response.StatusCode 3189 } 3190 tracing.EndSpan(ctx, sc, err) 3191 }() 3192 } 3193 iter.i++ 3194 if iter.i < len(iter.page.Values()) { 3195 return nil 3196 } 3197 err = iter.page.NextWithContext(ctx) 3198 if err != nil { 3199 iter.i-- 3200 return err 3201 } 3202 iter.i = 0 3203 return nil 3204} 3205 3206// Next advances to the next value. If there was an error making 3207// the request the iterator does not advance and the error is returned. 3208// Deprecated: Use NextWithContext() instead. 3209func (iter *JobResourceListIterator) Next() error { 3210 return iter.NextWithContext(context.Background()) 3211} 3212 3213// NotDone returns true if the enumeration should be started or is not yet complete. 3214func (iter JobResourceListIterator) NotDone() bool { 3215 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3216} 3217 3218// Response returns the raw server response from the last page request. 3219func (iter JobResourceListIterator) Response() JobResourceList { 3220 return iter.page.Response() 3221} 3222 3223// Value returns the current value or a zero-initialized value if the 3224// iterator has advanced beyond the end of the collection. 3225func (iter JobResourceListIterator) Value() JobResource { 3226 if !iter.page.NotDone() { 3227 return JobResource{} 3228 } 3229 return iter.page.Values()[iter.i] 3230} 3231 3232// Creates a new instance of the JobResourceListIterator type. 3233func NewJobResourceListIterator(page JobResourceListPage) JobResourceListIterator { 3234 return JobResourceListIterator{page: page} 3235} 3236 3237// IsEmpty returns true if the ListResult contains no values. 3238func (jrl JobResourceList) IsEmpty() bool { 3239 return jrl.Value == nil || len(*jrl.Value) == 0 3240} 3241 3242// hasNextLink returns true if the NextLink is not empty. 3243func (jrl JobResourceList) hasNextLink() bool { 3244 return jrl.NextLink != nil && len(*jrl.NextLink) != 0 3245} 3246 3247// jobResourceListPreparer prepares a request to retrieve the next set of results. 3248// It returns nil if no more results exist. 3249func (jrl JobResourceList) jobResourceListPreparer(ctx context.Context) (*http.Request, error) { 3250 if !jrl.hasNextLink() { 3251 return nil, nil 3252 } 3253 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3254 autorest.AsJSON(), 3255 autorest.AsGet(), 3256 autorest.WithBaseURL(to.String(jrl.NextLink))) 3257} 3258 3259// JobResourceListPage contains a page of JobResource values. 3260type JobResourceListPage struct { 3261 fn func(context.Context, JobResourceList) (JobResourceList, error) 3262 jrl JobResourceList 3263} 3264 3265// NextWithContext advances to the next page of values. If there was an error making 3266// the request the page does not advance and the error is returned. 3267func (page *JobResourceListPage) NextWithContext(ctx context.Context) (err error) { 3268 if tracing.IsEnabled() { 3269 ctx = tracing.StartSpan(ctx, fqdn+"/JobResourceListPage.NextWithContext") 3270 defer func() { 3271 sc := -1 3272 if page.Response().Response.Response != nil { 3273 sc = page.Response().Response.Response.StatusCode 3274 } 3275 tracing.EndSpan(ctx, sc, err) 3276 }() 3277 } 3278 for { 3279 next, err := page.fn(ctx, page.jrl) 3280 if err != nil { 3281 return err 3282 } 3283 page.jrl = next 3284 if !next.hasNextLink() || !next.IsEmpty() { 3285 break 3286 } 3287 } 3288 return nil 3289} 3290 3291// Next advances to the next page of values. If there was an error making 3292// the request the page does not advance and the error is returned. 3293// Deprecated: Use NextWithContext() instead. 3294func (page *JobResourceListPage) Next() error { 3295 return page.NextWithContext(context.Background()) 3296} 3297 3298// NotDone returns true if the page enumeration should be started or is not yet complete. 3299func (page JobResourceListPage) NotDone() bool { 3300 return !page.jrl.IsEmpty() 3301} 3302 3303// Response returns the raw server response from the last page request. 3304func (page JobResourceListPage) Response() JobResourceList { 3305 return page.jrl 3306} 3307 3308// Values returns the slice of values for the current page or nil if there are no values. 3309func (page JobResourceListPage) Values() []JobResource { 3310 if page.jrl.IsEmpty() { 3311 return nil 3312 } 3313 return *page.jrl.Value 3314} 3315 3316// Creates a new instance of the JobResourceListPage type. 3317func NewJobResourceListPage(cur JobResourceList, getNextPage func(context.Context, JobResourceList) (JobResourceList, error)) JobResourceListPage { 3318 return JobResourceListPage{ 3319 fn: getNextPage, 3320 jrl: cur, 3321 } 3322} 3323 3324// KEKDetails the Key Encryption Key (KEK) is the encryption key for the Bitlocker Encryption Key (BEK). 3325type KEKDetails struct { 3326 // KeyURL - Key refers to the Key Encryption Key (KEK). The KEK is the Key to unlock the Secret. 3327 KeyURL *string `json:"keyUrl,omitempty"` 3328 // KeyVaultID - Key Vault ID identifies where the KEK is stored. 3329 KeyVaultID *string `json:"keyVaultId,omitempty"` 3330 // KeyBackupData - Key Backup Data refers to Key Encryption Key (KEK) data. 3331 KeyBackupData *string `json:"keyBackupData,omitempty"` 3332} 3333 3334// KeyAndSecretDetails BEK stands for Bitlocker Encryption Key. 3335// KEK stands for Key Encryption Key. KEK is the encryption key used to protect the Secret for the BEK 3336// If the VM is encrypted, then the service stores the following details : 3337// 1. Secret(BEK) - Url + Backup Data + vaultID. 3338// 2. Key(KEK) - Url + Backup Data + vaultID. 3339// It is possible for the BEK and KEK to have different vaultIDs. 3340type KeyAndSecretDetails struct { 3341 // KekDetails - The Key Encryption Key (KEK) is the encryption key for the Bitlocker Encryption Key (BEK). 3342 KekDetails *KEKDetails `json:"kekDetails,omitempty"` 3343 // BekDetails - BEK is Bitlocker Encryption Key. 3344 BekDetails *BEKDetails `json:"bekDetails,omitempty"` 3345} 3346 3347// LongTermRetentionPolicy long-term retention policy. 3348type LongTermRetentionPolicy struct { 3349 // DailySchedule - Daily retention schedule of the backup policy. 3350 DailySchedule *DailyRetentionSchedule `json:"dailySchedule,omitempty"` 3351 // WeeklySchedule - Weekly retention schedule of the backup policy. 3352 WeeklySchedule *WeeklyRetentionSchedule `json:"weeklySchedule,omitempty"` 3353 // MonthlySchedule - Monthly retention schedule of the backup policy. 3354 MonthlySchedule *MonthlyRetentionSchedule `json:"monthlySchedule,omitempty"` 3355 // YearlySchedule - Yearly retention schedule of the backup policy. 3356 YearlySchedule *YearlyRetentionSchedule `json:"yearlySchedule,omitempty"` 3357 // RetentionPolicyType - Possible values include: 'RetentionPolicyTypeRetentionPolicy', 'RetentionPolicyTypeSimpleRetentionPolicy', 'RetentionPolicyTypeLongTermRetentionPolicy' 3358 RetentionPolicyType RetentionPolicyType `json:"retentionPolicyType,omitempty"` 3359} 3360 3361// MarshalJSON is the custom marshaler for LongTermRetentionPolicy. 3362func (ltrp LongTermRetentionPolicy) MarshalJSON() ([]byte, error) { 3363 ltrp.RetentionPolicyType = RetentionPolicyTypeLongTermRetentionPolicy 3364 objectMap := make(map[string]interface{}) 3365 if ltrp.DailySchedule != nil { 3366 objectMap["dailySchedule"] = ltrp.DailySchedule 3367 } 3368 if ltrp.WeeklySchedule != nil { 3369 objectMap["weeklySchedule"] = ltrp.WeeklySchedule 3370 } 3371 if ltrp.MonthlySchedule != nil { 3372 objectMap["monthlySchedule"] = ltrp.MonthlySchedule 3373 } 3374 if ltrp.YearlySchedule != nil { 3375 objectMap["yearlySchedule"] = ltrp.YearlySchedule 3376 } 3377 if ltrp.RetentionPolicyType != "" { 3378 objectMap["retentionPolicyType"] = ltrp.RetentionPolicyType 3379 } 3380 return json.Marshal(objectMap) 3381} 3382 3383// AsSimpleRetentionPolicy is the BasicRetentionPolicy implementation for LongTermRetentionPolicy. 3384func (ltrp LongTermRetentionPolicy) AsSimpleRetentionPolicy() (*SimpleRetentionPolicy, bool) { 3385 return nil, false 3386} 3387 3388// AsLongTermRetentionPolicy is the BasicRetentionPolicy implementation for LongTermRetentionPolicy. 3389func (ltrp LongTermRetentionPolicy) AsLongTermRetentionPolicy() (*LongTermRetentionPolicy, bool) { 3390 return <rp, true 3391} 3392 3393// AsRetentionPolicy is the BasicRetentionPolicy implementation for LongTermRetentionPolicy. 3394func (ltrp LongTermRetentionPolicy) AsRetentionPolicy() (*RetentionPolicy, bool) { 3395 return nil, false 3396} 3397 3398// AsBasicRetentionPolicy is the BasicRetentionPolicy implementation for LongTermRetentionPolicy. 3399func (ltrp LongTermRetentionPolicy) AsBasicRetentionPolicy() (BasicRetentionPolicy, bool) { 3400 return <rp, true 3401} 3402 3403// LongTermSchedulePolicy long-term policy schedule. 3404type LongTermSchedulePolicy struct { 3405 // SchedulePolicyType - Possible values include: 'SchedulePolicyTypeSchedulePolicy', 'SchedulePolicyTypeLongTermSchedulePolicy', 'SchedulePolicyTypeSimpleSchedulePolicy' 3406 SchedulePolicyType SchedulePolicyType `json:"schedulePolicyType,omitempty"` 3407} 3408 3409// MarshalJSON is the custom marshaler for LongTermSchedulePolicy. 3410func (ltsp LongTermSchedulePolicy) MarshalJSON() ([]byte, error) { 3411 ltsp.SchedulePolicyType = SchedulePolicyTypeLongTermSchedulePolicy 3412 objectMap := make(map[string]interface{}) 3413 if ltsp.SchedulePolicyType != "" { 3414 objectMap["schedulePolicyType"] = ltsp.SchedulePolicyType 3415 } 3416 return json.Marshal(objectMap) 3417} 3418 3419// AsLongTermSchedulePolicy is the BasicSchedulePolicy implementation for LongTermSchedulePolicy. 3420func (ltsp LongTermSchedulePolicy) AsLongTermSchedulePolicy() (*LongTermSchedulePolicy, bool) { 3421 return <sp, true 3422} 3423 3424// AsSimpleSchedulePolicy is the BasicSchedulePolicy implementation for LongTermSchedulePolicy. 3425func (ltsp LongTermSchedulePolicy) AsSimpleSchedulePolicy() (*SimpleSchedulePolicy, bool) { 3426 return nil, false 3427} 3428 3429// AsSchedulePolicy is the BasicSchedulePolicy implementation for LongTermSchedulePolicy. 3430func (ltsp LongTermSchedulePolicy) AsSchedulePolicy() (*SchedulePolicy, bool) { 3431 return nil, false 3432} 3433 3434// AsBasicSchedulePolicy is the BasicSchedulePolicy implementation for LongTermSchedulePolicy. 3435func (ltsp LongTermSchedulePolicy) AsBasicSchedulePolicy() (BasicSchedulePolicy, bool) { 3436 return <sp, true 3437} 3438 3439// MabContainer the container associated with items backed up using Azure Backup Server. 3440type MabContainer struct { 3441 // CanReRegister - The container can be registered one more time. 3442 CanReRegister *bool `json:"canReRegister,omitempty"` 3443 // ContainerID - The ID for the container. 3444 ContainerID *int64 `json:"containerId,omitempty"` 3445 // ProtectedItemCount - The number of backup items in the container. 3446 ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` 3447 // AgentVersion - The version of the agent used with this container. 3448 AgentVersion *string `json:"agentVersion,omitempty"` 3449 // ExtendedInfo - Additional information for the container. 3450 ExtendedInfo *MabContainerExtendedInfo `json:"extendedInfo,omitempty"` 3451 // FriendlyName - Friendly name of the container. 3452 FriendlyName *string `json:"friendlyName,omitempty"` 3453 // BackupManagementType - The backup management type for the container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 3454 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 3455 // RegistrationStatus - The container's registration status with the Recovery Services vault. 3456 RegistrationStatus *string `json:"registrationStatus,omitempty"` 3457 // HealthStatus - The status of the container's health. 3458 HealthStatus *string `json:"healthStatus,omitempty"` 3459 // ContainerType - READ-ONLY; The type assigned to the container. The values to use for each of these properties are:<br/> 1. Compute Azure VM is Microsoft.Compute/virtualMachines<br/> 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines<br/> 3. Windows machines (like Azure Backup Server and DPM) is Windows<br/> 4. Azure SQL instance is AzureSqlContainer. 3460 ContainerType *string `json:"containerType,omitempty"` 3461 // ProtectableObjectType - Possible values include: 'ProtectableObjectTypeProtectionContainer', 'ProtectableObjectTypeAzureSQLContainer', 'ProtectableObjectTypeIaaSVMContainer', 'ProtectableObjectTypeMABWindowsContainer', 'ProtectableObjectTypeMicrosoftComputevirtualMachines', 'ProtectableObjectTypeMicrosoftClassicComputevirtualMachines' 3462 ProtectableObjectType ProtectableObjectType `json:"protectableObjectType,omitempty"` 3463} 3464 3465// MarshalJSON is the custom marshaler for MabContainer. 3466func (mc MabContainer) MarshalJSON() ([]byte, error) { 3467 mc.ProtectableObjectType = ProtectableObjectTypeMABWindowsContainer 3468 objectMap := make(map[string]interface{}) 3469 if mc.CanReRegister != nil { 3470 objectMap["canReRegister"] = mc.CanReRegister 3471 } 3472 if mc.ContainerID != nil { 3473 objectMap["containerId"] = mc.ContainerID 3474 } 3475 if mc.ProtectedItemCount != nil { 3476 objectMap["protectedItemCount"] = mc.ProtectedItemCount 3477 } 3478 if mc.AgentVersion != nil { 3479 objectMap["agentVersion"] = mc.AgentVersion 3480 } 3481 if mc.ExtendedInfo != nil { 3482 objectMap["extendedInfo"] = mc.ExtendedInfo 3483 } 3484 if mc.FriendlyName != nil { 3485 objectMap["friendlyName"] = mc.FriendlyName 3486 } 3487 if mc.BackupManagementType != "" { 3488 objectMap["backupManagementType"] = mc.BackupManagementType 3489 } 3490 if mc.RegistrationStatus != nil { 3491 objectMap["registrationStatus"] = mc.RegistrationStatus 3492 } 3493 if mc.HealthStatus != nil { 3494 objectMap["healthStatus"] = mc.HealthStatus 3495 } 3496 if mc.ProtectableObjectType != "" { 3497 objectMap["protectableObjectType"] = mc.ProtectableObjectType 3498 } 3499 return json.Marshal(objectMap) 3500} 3501 3502// AsAzureSQLContainer is the BasicProtectionContainer implementation for MabContainer. 3503func (mc MabContainer) AsAzureSQLContainer() (*AzureSQLContainer, bool) { 3504 return nil, false 3505} 3506 3507// AsIaaSVMContainer is the BasicProtectionContainer implementation for MabContainer. 3508func (mc MabContainer) AsIaaSVMContainer() (*IaaSVMContainer, bool) { 3509 return nil, false 3510} 3511 3512// AsBasicIaaSVMContainer is the BasicProtectionContainer implementation for MabContainer. 3513func (mc MabContainer) AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) { 3514 return nil, false 3515} 3516 3517// AsMabContainer is the BasicProtectionContainer implementation for MabContainer. 3518func (mc MabContainer) AsMabContainer() (*MabContainer, bool) { 3519 return &mc, true 3520} 3521 3522// AsAzureIaaSComputeVMContainer is the BasicProtectionContainer implementation for MabContainer. 3523func (mc MabContainer) AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) { 3524 return nil, false 3525} 3526 3527// AsAzureIaaSClassicComputeVMContainer is the BasicProtectionContainer implementation for MabContainer. 3528func (mc MabContainer) AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) { 3529 return nil, false 3530} 3531 3532// AsProtectionContainer is the BasicProtectionContainer implementation for MabContainer. 3533func (mc MabContainer) AsProtectionContainer() (*ProtectionContainer, bool) { 3534 return nil, false 3535} 3536 3537// AsBasicProtectionContainer is the BasicProtectionContainer implementation for MabContainer. 3538func (mc MabContainer) AsBasicProtectionContainer() (BasicProtectionContainer, bool) { 3539 return &mc, true 3540} 3541 3542// MabContainerExtendedInfo additional information for the container. 3543type MabContainerExtendedInfo struct { 3544 // LastRefreshedAt - The time stamp when this container was refreshed. 3545 LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` 3546 // BackupItemType - The type of backup items associated with this container. Possible values include: 'ItemTypeInvalid', 'ItemTypeVM', 'ItemTypeFileFolder', 'ItemTypeAzureSQLDb', 'ItemTypeSQLDB', 'ItemTypeExchange', 'ItemTypeSharepoint', 'ItemTypeDPMUnknown' 3547 BackupItemType ItemType `json:"backupItemType,omitempty"` 3548 // BackupItems - The list of backup items associated with this container. 3549 BackupItems *[]string `json:"backupItems,omitempty"` 3550 // PolicyName - The backup policy associated with this container. 3551 PolicyName *string `json:"policyName,omitempty"` 3552 // LastBackupStatus - The latest backup status of this container. 3553 LastBackupStatus *string `json:"lastBackupStatus,omitempty"` 3554} 3555 3556// MabErrorInfo azure Backup Server workload-specific error information. 3557type MabErrorInfo struct { 3558 // ErrorString - Localized error string. 3559 ErrorString *string `json:"errorString,omitempty"` 3560 // Recommendations - List of localized recommendations. 3561 Recommendations *[]string `json:"recommendations,omitempty"` 3562} 3563 3564// MabFileFolderProtectedItem this is a file or folder workload-specific backup item. 3565type MabFileFolderProtectedItem struct { 3566 // FriendlyName - The friendly name of this backup item. 3567 FriendlyName *string `json:"friendlyName,omitempty"` 3568 // ComputerName - The name of the computer associated with this backup item. 3569 ComputerName *string `json:"computerName,omitempty"` 3570 // LastBackupStatus - The status of last backup operation. 3571 LastBackupStatus *string `json:"lastBackupStatus,omitempty"` 3572 // ProtectionState - The states for this property are: Protected, ProtectionStopped, IRPending, or ProtectionError. 3573 ProtectionState *string `json:"protectionState,omitempty"` 3574 IsScheduledForDeferredDelete *bool `json:"isScheduledForDeferredDelete,omitempty"` 3575 // ExtendedInfo - Additional information for this backup item. 3576 ExtendedInfo *MabFileFolderProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` 3577 // BackupManagementType - The backup management type associated with the backup item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 3578 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 3579 // WorkloadType - The workload type for this item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 3580 WorkloadType DataSourceType `json:"workloadType,omitempty"` 3581 // SourceResourceID - The ID of the resource to be backed up. 3582 SourceResourceID *string `json:"sourceResourceId,omitempty"` 3583 // PolicyID - The ID of the backup policy associated with this backup item. 3584 PolicyID *string `json:"policyId,omitempty"` 3585 // LastRecoveryPoint - The timestamp when the most recent backup copy was created for this backup item. 3586 LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` 3587 // ProtectedItemType - Possible values include: 'ProtectedItemTypeProtectedItem', 'ProtectedItemTypeAzureIaaSVMProtectedItem', 'ProtectedItemTypeMabFileFolderProtectedItem', 'ProtectedItemTypeMicrosoftSqlserversdatabases', 'ProtectedItemTypeMicrosoftComputevirtualMachines', 'ProtectedItemTypeMicrosoftClassicComputevirtualMachines' 3588 ProtectedItemType ProtectedItemType `json:"protectedItemType,omitempty"` 3589} 3590 3591// MarshalJSON is the custom marshaler for MabFileFolderProtectedItem. 3592func (mffpi MabFileFolderProtectedItem) MarshalJSON() ([]byte, error) { 3593 mffpi.ProtectedItemType = ProtectedItemTypeMabFileFolderProtectedItem 3594 objectMap := make(map[string]interface{}) 3595 if mffpi.FriendlyName != nil { 3596 objectMap["friendlyName"] = mffpi.FriendlyName 3597 } 3598 if mffpi.ComputerName != nil { 3599 objectMap["computerName"] = mffpi.ComputerName 3600 } 3601 if mffpi.LastBackupStatus != nil { 3602 objectMap["lastBackupStatus"] = mffpi.LastBackupStatus 3603 } 3604 if mffpi.ProtectionState != nil { 3605 objectMap["protectionState"] = mffpi.ProtectionState 3606 } 3607 if mffpi.IsScheduledForDeferredDelete != nil { 3608 objectMap["isScheduledForDeferredDelete"] = mffpi.IsScheduledForDeferredDelete 3609 } 3610 if mffpi.ExtendedInfo != nil { 3611 objectMap["extendedInfo"] = mffpi.ExtendedInfo 3612 } 3613 if mffpi.BackupManagementType != "" { 3614 objectMap["backupManagementType"] = mffpi.BackupManagementType 3615 } 3616 if mffpi.WorkloadType != "" { 3617 objectMap["workloadType"] = mffpi.WorkloadType 3618 } 3619 if mffpi.SourceResourceID != nil { 3620 objectMap["sourceResourceId"] = mffpi.SourceResourceID 3621 } 3622 if mffpi.PolicyID != nil { 3623 objectMap["policyId"] = mffpi.PolicyID 3624 } 3625 if mffpi.LastRecoveryPoint != nil { 3626 objectMap["lastRecoveryPoint"] = mffpi.LastRecoveryPoint 3627 } 3628 if mffpi.ProtectedItemType != "" { 3629 objectMap["protectedItemType"] = mffpi.ProtectedItemType 3630 } 3631 return json.Marshal(objectMap) 3632} 3633 3634// AsAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3635func (mffpi MabFileFolderProtectedItem) AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) { 3636 return nil, false 3637} 3638 3639// AsBasicAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3640func (mffpi MabFileFolderProtectedItem) AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) { 3641 return nil, false 3642} 3643 3644// AsMabFileFolderProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3645func (mffpi MabFileFolderProtectedItem) AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) { 3646 return &mffpi, true 3647} 3648 3649// AsAzureSQLProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3650func (mffpi MabFileFolderProtectedItem) AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) { 3651 return nil, false 3652} 3653 3654// AsAzureIaaSComputeVMProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3655func (mffpi MabFileFolderProtectedItem) AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) { 3656 return nil, false 3657} 3658 3659// AsAzureIaaSClassicComputeVMProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3660func (mffpi MabFileFolderProtectedItem) AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) { 3661 return nil, false 3662} 3663 3664// AsProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3665func (mffpi MabFileFolderProtectedItem) AsProtectedItem() (*ProtectedItem, bool) { 3666 return nil, false 3667} 3668 3669// AsBasicProtectedItem is the BasicProtectedItem implementation for MabFileFolderProtectedItem. 3670func (mffpi MabFileFolderProtectedItem) AsBasicProtectedItem() (BasicProtectedItem, bool) { 3671 return &mffpi, true 3672} 3673 3674// MabFileFolderProtectedItemExtendedInfo additional information for the backup item. 3675type MabFileFolderProtectedItemExtendedInfo struct { 3676 // LastRefreshedAt - The last day and time the agent synced with the service. 3677 LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` 3678 // OldestRecoveryPoint - The oldest backup copy available. 3679 OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` 3680 // RecoveryPointCount - The number of backup copies associated with the backup item. 3681 RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` 3682} 3683 3684// MabJob the Azure Backup Server workload-specific job. 3685type MabJob struct { 3686 // Duration - The time required for the job to run. 3687 Duration *string `json:"duration,omitempty"` 3688 // ActionsInfo - The state or actions applicable on jobs such as Cancel or Retry. 3689 ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` 3690 // MabServerName - The name of server protecting the data store. 3691 MabServerName *string `json:"mabServerName,omitempty"` 3692 // MabServerType - Server type of the Azure Backup Server container. Possible values include: 'MabServerTypeInvalid', 'MabServerTypeUnknown', 'MabServerTypeIaasVMContainer', 'MabServerTypeIaasVMServiceContainer', 'MabServerTypeDPMContainer', 'MabServerTypeDPMVenusContainer', 'MabServerTypeMABContainer', 'MabServerTypeClusterResource', 'MabServerTypeAzureSQLContainer', 'MabServerTypeWindowsServer', 'MabServerTypeWindows' 3693 MabServerType MabServerType `json:"mabServerType,omitempty"` 3694 // WorkloadType - Workload type of backup item. Possible values include: 'WorkloadTypeInvalid', 'WorkloadTypeVM', 'WorkloadTypeFileFolder', 'WorkloadTypeAzureSQLDb', 'WorkloadTypeSQLDB', 'WorkloadTypeExchange', 'WorkloadTypeSharepoint', 'WorkloadTypeDPMUnknown' 3695 WorkloadType WorkloadType `json:"workloadType,omitempty"` 3696 // ErrorDetails - The errors. 3697 ErrorDetails *[]MabErrorInfo `json:"errorDetails,omitempty"` 3698 // ExtendedInfo - Additional information on the job. 3699 ExtendedInfo *MabJobExtendedInfo `json:"extendedInfo,omitempty"` 3700 // EntityFriendlyName - The friendly name of the entity on which the current job is executing. 3701 EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` 3702 // BackupManagementType - The backup management type for the current job. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 3703 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 3704 // Operation - The operation name. 3705 Operation *string `json:"operation,omitempty"` 3706 // Status - The job status. 3707 Status *string `json:"status,omitempty"` 3708 // StartTime - The start time. 3709 StartTime *date.Time `json:"startTime,omitempty"` 3710 // EndTime - The end time. 3711 EndTime *date.Time `json:"endTime,omitempty"` 3712 // ActivityID - ActivityId of job. 3713 ActivityID *string `json:"activityId,omitempty"` 3714 // JobType - Possible values include: 'JobTypeJob', 'JobTypeAzureIaaSVMJob', 'JobTypeDpmJob', 'JobTypeMabJob' 3715 JobType JobType `json:"jobType,omitempty"` 3716} 3717 3718// MarshalJSON is the custom marshaler for MabJob. 3719func (mj MabJob) MarshalJSON() ([]byte, error) { 3720 mj.JobType = JobTypeMabJob 3721 objectMap := make(map[string]interface{}) 3722 if mj.Duration != nil { 3723 objectMap["duration"] = mj.Duration 3724 } 3725 if mj.ActionsInfo != nil { 3726 objectMap["actionsInfo"] = mj.ActionsInfo 3727 } 3728 if mj.MabServerName != nil { 3729 objectMap["mabServerName"] = mj.MabServerName 3730 } 3731 if mj.MabServerType != "" { 3732 objectMap["mabServerType"] = mj.MabServerType 3733 } 3734 if mj.WorkloadType != "" { 3735 objectMap["workloadType"] = mj.WorkloadType 3736 } 3737 if mj.ErrorDetails != nil { 3738 objectMap["errorDetails"] = mj.ErrorDetails 3739 } 3740 if mj.ExtendedInfo != nil { 3741 objectMap["extendedInfo"] = mj.ExtendedInfo 3742 } 3743 if mj.EntityFriendlyName != nil { 3744 objectMap["entityFriendlyName"] = mj.EntityFriendlyName 3745 } 3746 if mj.BackupManagementType != "" { 3747 objectMap["backupManagementType"] = mj.BackupManagementType 3748 } 3749 if mj.Operation != nil { 3750 objectMap["operation"] = mj.Operation 3751 } 3752 if mj.Status != nil { 3753 objectMap["status"] = mj.Status 3754 } 3755 if mj.StartTime != nil { 3756 objectMap["startTime"] = mj.StartTime 3757 } 3758 if mj.EndTime != nil { 3759 objectMap["endTime"] = mj.EndTime 3760 } 3761 if mj.ActivityID != nil { 3762 objectMap["activityId"] = mj.ActivityID 3763 } 3764 if mj.JobType != "" { 3765 objectMap["jobType"] = mj.JobType 3766 } 3767 return json.Marshal(objectMap) 3768} 3769 3770// AsAzureIaaSVMJob is the BasicJob implementation for MabJob. 3771func (mj MabJob) AsAzureIaaSVMJob() (*AzureIaaSVMJob, bool) { 3772 return nil, false 3773} 3774 3775// AsDpmJob is the BasicJob implementation for MabJob. 3776func (mj MabJob) AsDpmJob() (*DpmJob, bool) { 3777 return nil, false 3778} 3779 3780// AsMabJob is the BasicJob implementation for MabJob. 3781func (mj MabJob) AsMabJob() (*MabJob, bool) { 3782 return &mj, true 3783} 3784 3785// AsJob is the BasicJob implementation for MabJob. 3786func (mj MabJob) AsJob() (*Job, bool) { 3787 return nil, false 3788} 3789 3790// AsBasicJob is the BasicJob implementation for MabJob. 3791func (mj MabJob) AsBasicJob() (BasicJob, bool) { 3792 return &mj, true 3793} 3794 3795// MabJobExtendedInfo additional information for the Azure Backup Server workload-specific job. 3796type MabJobExtendedInfo struct { 3797 // TasksList - List of tasks for this job. 3798 TasksList *[]MabJobTaskDetails `json:"tasksList,omitempty"` 3799 // PropertyBag - The job properties. 3800 PropertyBag map[string]*string `json:"propertyBag"` 3801 // DynamicErrorMessage - Non-localized error message specific to this job. 3802 DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` 3803} 3804 3805// MarshalJSON is the custom marshaler for MabJobExtendedInfo. 3806func (mjei MabJobExtendedInfo) MarshalJSON() ([]byte, error) { 3807 objectMap := make(map[string]interface{}) 3808 if mjei.TasksList != nil { 3809 objectMap["tasksList"] = mjei.TasksList 3810 } 3811 if mjei.PropertyBag != nil { 3812 objectMap["propertyBag"] = mjei.PropertyBag 3813 } 3814 if mjei.DynamicErrorMessage != nil { 3815 objectMap["dynamicErrorMessage"] = mjei.DynamicErrorMessage 3816 } 3817 return json.Marshal(objectMap) 3818} 3819 3820// MabJobTaskDetails azure Backup Server workload-specific job task details. 3821type MabJobTaskDetails struct { 3822 // TaskID - The task display name. 3823 TaskID *string `json:"taskId,omitempty"` 3824 // StartTime - The start time. 3825 StartTime *date.Time `json:"startTime,omitempty"` 3826 // EndTime - The end time. 3827 EndTime *date.Time `json:"endTime,omitempty"` 3828 // Duration - Time elapsed for task. 3829 Duration *string `json:"duration,omitempty"` 3830 // Status - The status. 3831 Status *string `json:"status,omitempty"` 3832} 3833 3834// MabProtectionPolicy the backup policy for the file or folder container. 3835type MabProtectionPolicy struct { 3836 // SchedulePolicy - The schedule specified in the backup policy. 3837 SchedulePolicy BasicSchedulePolicy `json:"schedulePolicy,omitempty"` 3838 // RetentionPolicy - The details specified in the Retention policy. 3839 RetentionPolicy BasicRetentionPolicy `json:"retentionPolicy,omitempty"` 3840 // ProtectedItemsCount - The number of items associated with this policy. 3841 ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` 3842 // BackupManagementType - Possible values include: 'BackupManagementTypeProtectionPolicy', 'BackupManagementTypeAzureIaasVM', 'BackupManagementTypeMAB', 'BackupManagementTypeAzureSQL' 3843 BackupManagementType ManagementTypeBasicProtectionPolicy `json:"backupManagementType,omitempty"` 3844} 3845 3846// MarshalJSON is the custom marshaler for MabProtectionPolicy. 3847func (mpp MabProtectionPolicy) MarshalJSON() ([]byte, error) { 3848 mpp.BackupManagementType = BackupManagementTypeMAB 3849 objectMap := make(map[string]interface{}) 3850 objectMap["schedulePolicy"] = mpp.SchedulePolicy 3851 objectMap["retentionPolicy"] = mpp.RetentionPolicy 3852 if mpp.ProtectedItemsCount != nil { 3853 objectMap["protectedItemsCount"] = mpp.ProtectedItemsCount 3854 } 3855 if mpp.BackupManagementType != "" { 3856 objectMap["backupManagementType"] = mpp.BackupManagementType 3857 } 3858 return json.Marshal(objectMap) 3859} 3860 3861// AsAzureIaaSVMProtectionPolicy is the BasicProtectionPolicy implementation for MabProtectionPolicy. 3862func (mpp MabProtectionPolicy) AsAzureIaaSVMProtectionPolicy() (*AzureIaaSVMProtectionPolicy, bool) { 3863 return nil, false 3864} 3865 3866// AsMabProtectionPolicy is the BasicProtectionPolicy implementation for MabProtectionPolicy. 3867func (mpp MabProtectionPolicy) AsMabProtectionPolicy() (*MabProtectionPolicy, bool) { 3868 return &mpp, true 3869} 3870 3871// AsAzureSQLProtectionPolicy is the BasicProtectionPolicy implementation for MabProtectionPolicy. 3872func (mpp MabProtectionPolicy) AsAzureSQLProtectionPolicy() (*AzureSQLProtectionPolicy, bool) { 3873 return nil, false 3874} 3875 3876// AsProtectionPolicy is the BasicProtectionPolicy implementation for MabProtectionPolicy. 3877func (mpp MabProtectionPolicy) AsProtectionPolicy() (*ProtectionPolicy, bool) { 3878 return nil, false 3879} 3880 3881// AsBasicProtectionPolicy is the BasicProtectionPolicy implementation for MabProtectionPolicy. 3882func (mpp MabProtectionPolicy) AsBasicProtectionPolicy() (BasicProtectionPolicy, bool) { 3883 return &mpp, true 3884} 3885 3886// UnmarshalJSON is the custom unmarshaler for MabProtectionPolicy struct. 3887func (mpp *MabProtectionPolicy) UnmarshalJSON(body []byte) error { 3888 var m map[string]*json.RawMessage 3889 err := json.Unmarshal(body, &m) 3890 if err != nil { 3891 return err 3892 } 3893 for k, v := range m { 3894 switch k { 3895 case "schedulePolicy": 3896 if v != nil { 3897 schedulePolicy, err := unmarshalBasicSchedulePolicy(*v) 3898 if err != nil { 3899 return err 3900 } 3901 mpp.SchedulePolicy = schedulePolicy 3902 } 3903 case "retentionPolicy": 3904 if v != nil { 3905 retentionPolicy, err := unmarshalBasicRetentionPolicy(*v) 3906 if err != nil { 3907 return err 3908 } 3909 mpp.RetentionPolicy = retentionPolicy 3910 } 3911 case "protectedItemsCount": 3912 if v != nil { 3913 var protectedItemsCount int32 3914 err = json.Unmarshal(*v, &protectedItemsCount) 3915 if err != nil { 3916 return err 3917 } 3918 mpp.ProtectedItemsCount = &protectedItemsCount 3919 } 3920 case "backupManagementType": 3921 if v != nil { 3922 var backupManagementType ManagementTypeBasicProtectionPolicy 3923 err = json.Unmarshal(*v, &backupManagementType) 3924 if err != nil { 3925 return err 3926 } 3927 mpp.BackupManagementType = backupManagementType 3928 } 3929 } 3930 } 3931 3932 return nil 3933} 3934 3935// MonthlyRetentionSchedule the monthly retention schedule. 3936type MonthlyRetentionSchedule struct { 3937 // RetentionScheduleFormatType - Retention schedule format type for monthly retention policy. Possible values include: 'RetentionScheduleFormatInvalid', 'RetentionScheduleFormatDaily', 'RetentionScheduleFormatWeekly' 3938 RetentionScheduleFormatType RetentionScheduleFormat `json:"retentionScheduleFormatType,omitempty"` 3939 // RetentionScheduleDaily - Daily retention format for the monthly retention policy. 3940 RetentionScheduleDaily *DailyRetentionFormat `json:"retentionScheduleDaily,omitempty"` 3941 // RetentionScheduleWeekly - Weekly retention format for the monthly retention policy. 3942 RetentionScheduleWeekly *WeeklyRetentionFormat `json:"retentionScheduleWeekly,omitempty"` 3943 // RetentionTimes - Retention times of the retention policy. 3944 RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` 3945 // RetentionDuration - Retention duration of the retention policy. 3946 RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` 3947} 3948 3949// OperationResultInfo information about the result of the operation. 3950type OperationResultInfo struct { 3951 // JobList - List of jobs created by this operation. 3952 JobList *[]string `json:"jobList,omitempty"` 3953 // ObjectType - Possible values include: 'ObjectTypeOperationResultInfoBase', 'ObjectTypeOperationResultInfo', 'ObjectTypeExportJobsOperationResultInfo' 3954 ObjectType ObjectTypeBasicOperationResultInfoBase `json:"objectType,omitempty"` 3955} 3956 3957// MarshalJSON is the custom marshaler for OperationResultInfo. 3958func (ori OperationResultInfo) MarshalJSON() ([]byte, error) { 3959 ori.ObjectType = ObjectTypeOperationResultInfo 3960 objectMap := make(map[string]interface{}) 3961 if ori.JobList != nil { 3962 objectMap["jobList"] = ori.JobList 3963 } 3964 if ori.ObjectType != "" { 3965 objectMap["objectType"] = ori.ObjectType 3966 } 3967 return json.Marshal(objectMap) 3968} 3969 3970// AsOperationResultInfo is the BasicOperationResultInfoBase implementation for OperationResultInfo. 3971func (ori OperationResultInfo) AsOperationResultInfo() (*OperationResultInfo, bool) { 3972 return &ori, true 3973} 3974 3975// AsExportJobsOperationResultInfo is the BasicOperationResultInfoBase implementation for OperationResultInfo. 3976func (ori OperationResultInfo) AsExportJobsOperationResultInfo() (*ExportJobsOperationResultInfo, bool) { 3977 return nil, false 3978} 3979 3980// AsOperationResultInfoBase is the BasicOperationResultInfoBase implementation for OperationResultInfo. 3981func (ori OperationResultInfo) AsOperationResultInfoBase() (*OperationResultInfoBase, bool) { 3982 return nil, false 3983} 3984 3985// AsBasicOperationResultInfoBase is the BasicOperationResultInfoBase implementation for OperationResultInfo. 3986func (ori OperationResultInfo) AsBasicOperationResultInfoBase() (BasicOperationResultInfoBase, bool) { 3987 return &ori, true 3988} 3989 3990// BasicOperationResultInfoBase the base class for operation result information. 3991type BasicOperationResultInfoBase interface { 3992 AsOperationResultInfo() (*OperationResultInfo, bool) 3993 AsExportJobsOperationResultInfo() (*ExportJobsOperationResultInfo, bool) 3994 AsOperationResultInfoBase() (*OperationResultInfoBase, bool) 3995} 3996 3997// OperationResultInfoBase the base class for operation result information. 3998type OperationResultInfoBase struct { 3999 // ObjectType - Possible values include: 'ObjectTypeOperationResultInfoBase', 'ObjectTypeOperationResultInfo', 'ObjectTypeExportJobsOperationResultInfo' 4000 ObjectType ObjectTypeBasicOperationResultInfoBase `json:"objectType,omitempty"` 4001} 4002 4003func unmarshalBasicOperationResultInfoBase(body []byte) (BasicOperationResultInfoBase, error) { 4004 var m map[string]interface{} 4005 err := json.Unmarshal(body, &m) 4006 if err != nil { 4007 return nil, err 4008 } 4009 4010 switch m["objectType"] { 4011 case string(ObjectTypeOperationResultInfo): 4012 var ori OperationResultInfo 4013 err := json.Unmarshal(body, &ori) 4014 return ori, err 4015 case string(ObjectTypeExportJobsOperationResultInfo): 4016 var ejori ExportJobsOperationResultInfo 4017 err := json.Unmarshal(body, &ejori) 4018 return ejori, err 4019 default: 4020 var orib OperationResultInfoBase 4021 err := json.Unmarshal(body, &orib) 4022 return orib, err 4023 } 4024} 4025func unmarshalBasicOperationResultInfoBaseArray(body []byte) ([]BasicOperationResultInfoBase, error) { 4026 var rawMessages []*json.RawMessage 4027 err := json.Unmarshal(body, &rawMessages) 4028 if err != nil { 4029 return nil, err 4030 } 4031 4032 oribArray := make([]BasicOperationResultInfoBase, len(rawMessages)) 4033 4034 for index, rawMessage := range rawMessages { 4035 orib, err := unmarshalBasicOperationResultInfoBase(*rawMessage) 4036 if err != nil { 4037 return nil, err 4038 } 4039 oribArray[index] = orib 4040 } 4041 return oribArray, nil 4042} 4043 4044// MarshalJSON is the custom marshaler for OperationResultInfoBase. 4045func (orib OperationResultInfoBase) MarshalJSON() ([]byte, error) { 4046 orib.ObjectType = ObjectTypeOperationResultInfoBase 4047 objectMap := make(map[string]interface{}) 4048 if orib.ObjectType != "" { 4049 objectMap["objectType"] = orib.ObjectType 4050 } 4051 return json.Marshal(objectMap) 4052} 4053 4054// AsOperationResultInfo is the BasicOperationResultInfoBase implementation for OperationResultInfoBase. 4055func (orib OperationResultInfoBase) AsOperationResultInfo() (*OperationResultInfo, bool) { 4056 return nil, false 4057} 4058 4059// AsExportJobsOperationResultInfo is the BasicOperationResultInfoBase implementation for OperationResultInfoBase. 4060func (orib OperationResultInfoBase) AsExportJobsOperationResultInfo() (*ExportJobsOperationResultInfo, bool) { 4061 return nil, false 4062} 4063 4064// AsOperationResultInfoBase is the BasicOperationResultInfoBase implementation for OperationResultInfoBase. 4065func (orib OperationResultInfoBase) AsOperationResultInfoBase() (*OperationResultInfoBase, bool) { 4066 return &orib, true 4067} 4068 4069// AsBasicOperationResultInfoBase is the BasicOperationResultInfoBase implementation for OperationResultInfoBase. 4070func (orib OperationResultInfoBase) AsBasicOperationResultInfoBase() (BasicOperationResultInfoBase, bool) { 4071 return &orib, true 4072} 4073 4074// OperationResultInfoBaseResource base class for operation result information. 4075type OperationResultInfoBaseResource struct { 4076 autorest.Response `json:"-"` 4077 Properties BasicOperationResultInfoBase `json:"properties,omitempty"` 4078 // StatusCode - The HTTP status code of the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestURITooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HTTPVersionNotSupported' 4079 StatusCode HTTPStatusCode `json:"statusCode,omitempty"` 4080 // Headers - The HTTP headers associated with this operation. 4081 Headers map[string][]string `json:"Headers"` 4082} 4083 4084// MarshalJSON is the custom marshaler for OperationResultInfoBaseResource. 4085func (oribr OperationResultInfoBaseResource) MarshalJSON() ([]byte, error) { 4086 objectMap := make(map[string]interface{}) 4087 objectMap["properties"] = oribr.Properties 4088 if oribr.StatusCode != "" { 4089 objectMap["statusCode"] = oribr.StatusCode 4090 } 4091 if oribr.Headers != nil { 4092 objectMap["Headers"] = oribr.Headers 4093 } 4094 return json.Marshal(objectMap) 4095} 4096 4097// UnmarshalJSON is the custom unmarshaler for OperationResultInfoBaseResource struct. 4098func (oribr *OperationResultInfoBaseResource) UnmarshalJSON(body []byte) error { 4099 var m map[string]*json.RawMessage 4100 err := json.Unmarshal(body, &m) 4101 if err != nil { 4102 return err 4103 } 4104 for k, v := range m { 4105 switch k { 4106 case "properties": 4107 if v != nil { 4108 properties, err := unmarshalBasicOperationResultInfoBase(*v) 4109 if err != nil { 4110 return err 4111 } 4112 oribr.Properties = properties 4113 } 4114 case "statusCode": 4115 if v != nil { 4116 var statusCode HTTPStatusCode 4117 err = json.Unmarshal(*v, &statusCode) 4118 if err != nil { 4119 return err 4120 } 4121 oribr.StatusCode = statusCode 4122 } 4123 case "Headers": 4124 if v != nil { 4125 var headers map[string][]string 4126 err = json.Unmarshal(*v, &headers) 4127 if err != nil { 4128 return err 4129 } 4130 oribr.Headers = headers 4131 } 4132 } 4133 } 4134 4135 return nil 4136} 4137 4138// OperationStatus operation status. 4139type OperationStatus struct { 4140 autorest.Response `json:"-"` 4141 // ID - ID of the operation. 4142 ID *string `json:"id,omitempty"` 4143 // Name - Name of the operation. 4144 Name *string `json:"name,omitempty"` 4145 // Status - Operation status. Possible values include: 'OperationStatusValuesInvalid', 'OperationStatusValuesInProgress', 'OperationStatusValuesSucceeded', 'OperationStatusValuesFailed', 'OperationStatusValuesCanceled' 4146 Status OperationStatusValues `json:"status,omitempty"` 4147 // StartTime - The operation start time. The format of the time is ISO-8601. 4148 StartTime *date.Time `json:"startTime,omitempty"` 4149 // EndTime - The operation end time. The format of the time is ISO-8601. 4150 EndTime *date.Time `json:"endTime,omitempty"` 4151 // Error - Error information related to this operation. 4152 Error *OperationStatusError `json:"error,omitempty"` 4153 // Properties - Additional information associated with this operation. 4154 Properties BasicOperationStatusExtendedInfo `json:"properties,omitempty"` 4155} 4156 4157// UnmarshalJSON is the custom unmarshaler for OperationStatus struct. 4158func (osVar *OperationStatus) UnmarshalJSON(body []byte) error { 4159 var m map[string]*json.RawMessage 4160 err := json.Unmarshal(body, &m) 4161 if err != nil { 4162 return err 4163 } 4164 for k, v := range m { 4165 switch k { 4166 case "id": 4167 if v != nil { 4168 var ID string 4169 err = json.Unmarshal(*v, &ID) 4170 if err != nil { 4171 return err 4172 } 4173 osVar.ID = &ID 4174 } 4175 case "name": 4176 if v != nil { 4177 var name string 4178 err = json.Unmarshal(*v, &name) 4179 if err != nil { 4180 return err 4181 } 4182 osVar.Name = &name 4183 } 4184 case "status": 4185 if v != nil { 4186 var status OperationStatusValues 4187 err = json.Unmarshal(*v, &status) 4188 if err != nil { 4189 return err 4190 } 4191 osVar.Status = status 4192 } 4193 case "startTime": 4194 if v != nil { 4195 var startTime date.Time 4196 err = json.Unmarshal(*v, &startTime) 4197 if err != nil { 4198 return err 4199 } 4200 osVar.StartTime = &startTime 4201 } 4202 case "endTime": 4203 if v != nil { 4204 var endTime date.Time 4205 err = json.Unmarshal(*v, &endTime) 4206 if err != nil { 4207 return err 4208 } 4209 osVar.EndTime = &endTime 4210 } 4211 case "error": 4212 if v != nil { 4213 var errorVar OperationStatusError 4214 err = json.Unmarshal(*v, &errorVar) 4215 if err != nil { 4216 return err 4217 } 4218 osVar.Error = &errorVar 4219 } 4220 case "properties": 4221 if v != nil { 4222 properties, err := unmarshalBasicOperationStatusExtendedInfo(*v) 4223 if err != nil { 4224 return err 4225 } 4226 osVar.Properties = properties 4227 } 4228 } 4229 } 4230 4231 return nil 4232} 4233 4234// OperationStatusError error information associated with the operation status call. 4235type OperationStatusError struct { 4236 // Code - The error code for the failed operation. 4237 Code *string `json:"code,omitempty"` 4238 // Message - The error message for the failed operation. 4239 Message *string `json:"message,omitempty"` 4240} 4241 4242// BasicOperationStatusExtendedInfo the base class for additional information about the operation status. 4243type BasicOperationStatusExtendedInfo interface { 4244 AsOperationStatusJobExtendedInfo() (*OperationStatusJobExtendedInfo, bool) 4245 AsOperationStatusProvisionILRExtendedInfo() (*OperationStatusProvisionILRExtendedInfo, bool) 4246 AsOperationStatusJobsExtendedInfo() (*OperationStatusJobsExtendedInfo, bool) 4247 AsOperationStatusExtendedInfo() (*OperationStatusExtendedInfo, bool) 4248} 4249 4250// OperationStatusExtendedInfo the base class for additional information about the operation status. 4251type OperationStatusExtendedInfo struct { 4252 // ObjectType - Possible values include: 'ObjectTypeOperationStatusExtendedInfo', 'ObjectTypeOperationStatusJobExtendedInfo', 'ObjectTypeOperationStatusProvisionILRExtendedInfo', 'ObjectTypeOperationStatusJobsExtendedInfo' 4253 ObjectType ObjectType `json:"objectType,omitempty"` 4254} 4255 4256func unmarshalBasicOperationStatusExtendedInfo(body []byte) (BasicOperationStatusExtendedInfo, error) { 4257 var m map[string]interface{} 4258 err := json.Unmarshal(body, &m) 4259 if err != nil { 4260 return nil, err 4261 } 4262 4263 switch m["objectType"] { 4264 case string(ObjectTypeOperationStatusJobExtendedInfo): 4265 var osjei OperationStatusJobExtendedInfo 4266 err := json.Unmarshal(body, &osjei) 4267 return osjei, err 4268 case string(ObjectTypeOperationStatusProvisionILRExtendedInfo): 4269 var ospiei OperationStatusProvisionILRExtendedInfo 4270 err := json.Unmarshal(body, &ospiei) 4271 return ospiei, err 4272 case string(ObjectTypeOperationStatusJobsExtendedInfo): 4273 var osjei OperationStatusJobsExtendedInfo 4274 err := json.Unmarshal(body, &osjei) 4275 return osjei, err 4276 default: 4277 var osei OperationStatusExtendedInfo 4278 err := json.Unmarshal(body, &osei) 4279 return osei, err 4280 } 4281} 4282func unmarshalBasicOperationStatusExtendedInfoArray(body []byte) ([]BasicOperationStatusExtendedInfo, error) { 4283 var rawMessages []*json.RawMessage 4284 err := json.Unmarshal(body, &rawMessages) 4285 if err != nil { 4286 return nil, err 4287 } 4288 4289 oseiArray := make([]BasicOperationStatusExtendedInfo, len(rawMessages)) 4290 4291 for index, rawMessage := range rawMessages { 4292 osei, err := unmarshalBasicOperationStatusExtendedInfo(*rawMessage) 4293 if err != nil { 4294 return nil, err 4295 } 4296 oseiArray[index] = osei 4297 } 4298 return oseiArray, nil 4299} 4300 4301// MarshalJSON is the custom marshaler for OperationStatusExtendedInfo. 4302func (osei OperationStatusExtendedInfo) MarshalJSON() ([]byte, error) { 4303 osei.ObjectType = ObjectTypeOperationStatusExtendedInfo 4304 objectMap := make(map[string]interface{}) 4305 if osei.ObjectType != "" { 4306 objectMap["objectType"] = osei.ObjectType 4307 } 4308 return json.Marshal(objectMap) 4309} 4310 4311// AsOperationStatusJobExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusExtendedInfo. 4312func (osei OperationStatusExtendedInfo) AsOperationStatusJobExtendedInfo() (*OperationStatusJobExtendedInfo, bool) { 4313 return nil, false 4314} 4315 4316// AsOperationStatusProvisionILRExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusExtendedInfo. 4317func (osei OperationStatusExtendedInfo) AsOperationStatusProvisionILRExtendedInfo() (*OperationStatusProvisionILRExtendedInfo, bool) { 4318 return nil, false 4319} 4320 4321// AsOperationStatusJobsExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusExtendedInfo. 4322func (osei OperationStatusExtendedInfo) AsOperationStatusJobsExtendedInfo() (*OperationStatusJobsExtendedInfo, bool) { 4323 return nil, false 4324} 4325 4326// AsOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusExtendedInfo. 4327func (osei OperationStatusExtendedInfo) AsOperationStatusExtendedInfo() (*OperationStatusExtendedInfo, bool) { 4328 return &osei, true 4329} 4330 4331// AsBasicOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusExtendedInfo. 4332func (osei OperationStatusExtendedInfo) AsBasicOperationStatusExtendedInfo() (BasicOperationStatusExtendedInfo, bool) { 4333 return &osei, true 4334} 4335 4336// OperationStatusJobExtendedInfo extended information about the operation status job. 4337type OperationStatusJobExtendedInfo struct { 4338 // JobID - ID of the job created for this backup item. 4339 JobID *string `json:"jobId,omitempty"` 4340 // ObjectType - Possible values include: 'ObjectTypeOperationStatusExtendedInfo', 'ObjectTypeOperationStatusJobExtendedInfo', 'ObjectTypeOperationStatusProvisionILRExtendedInfo', 'ObjectTypeOperationStatusJobsExtendedInfo' 4341 ObjectType ObjectType `json:"objectType,omitempty"` 4342} 4343 4344// MarshalJSON is the custom marshaler for OperationStatusJobExtendedInfo. 4345func (osjei OperationStatusJobExtendedInfo) MarshalJSON() ([]byte, error) { 4346 osjei.ObjectType = ObjectTypeOperationStatusJobExtendedInfo 4347 objectMap := make(map[string]interface{}) 4348 if osjei.JobID != nil { 4349 objectMap["jobId"] = osjei.JobID 4350 } 4351 if osjei.ObjectType != "" { 4352 objectMap["objectType"] = osjei.ObjectType 4353 } 4354 return json.Marshal(objectMap) 4355} 4356 4357// AsOperationStatusJobExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobExtendedInfo. 4358func (osjei OperationStatusJobExtendedInfo) AsOperationStatusJobExtendedInfo() (*OperationStatusJobExtendedInfo, bool) { 4359 return &osjei, true 4360} 4361 4362// AsOperationStatusProvisionILRExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobExtendedInfo. 4363func (osjei OperationStatusJobExtendedInfo) AsOperationStatusProvisionILRExtendedInfo() (*OperationStatusProvisionILRExtendedInfo, bool) { 4364 return nil, false 4365} 4366 4367// AsOperationStatusJobsExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobExtendedInfo. 4368func (osjei OperationStatusJobExtendedInfo) AsOperationStatusJobsExtendedInfo() (*OperationStatusJobsExtendedInfo, bool) { 4369 return nil, false 4370} 4371 4372// AsOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobExtendedInfo. 4373func (osjei OperationStatusJobExtendedInfo) AsOperationStatusExtendedInfo() (*OperationStatusExtendedInfo, bool) { 4374 return nil, false 4375} 4376 4377// AsBasicOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobExtendedInfo. 4378func (osjei OperationStatusJobExtendedInfo) AsBasicOperationStatusExtendedInfo() (BasicOperationStatusExtendedInfo, bool) { 4379 return &osjei, true 4380} 4381 4382// OperationStatusJobsExtendedInfo operation status extended info for the job list. 4383type OperationStatusJobsExtendedInfo struct { 4384 // JobIds - IDs of the jobs created for the backup item. 4385 JobIds *[]string `json:"jobIds,omitempty"` 4386 // FailedJobsError - Stores all the failed jobs along with the corresponding error codes. 4387 FailedJobsError map[string]*string `json:"failedJobsError"` 4388 // ObjectType - Possible values include: 'ObjectTypeOperationStatusExtendedInfo', 'ObjectTypeOperationStatusJobExtendedInfo', 'ObjectTypeOperationStatusProvisionILRExtendedInfo', 'ObjectTypeOperationStatusJobsExtendedInfo' 4389 ObjectType ObjectType `json:"objectType,omitempty"` 4390} 4391 4392// MarshalJSON is the custom marshaler for OperationStatusJobsExtendedInfo. 4393func (osjei OperationStatusJobsExtendedInfo) MarshalJSON() ([]byte, error) { 4394 osjei.ObjectType = ObjectTypeOperationStatusJobsExtendedInfo 4395 objectMap := make(map[string]interface{}) 4396 if osjei.JobIds != nil { 4397 objectMap["jobIds"] = osjei.JobIds 4398 } 4399 if osjei.FailedJobsError != nil { 4400 objectMap["failedJobsError"] = osjei.FailedJobsError 4401 } 4402 if osjei.ObjectType != "" { 4403 objectMap["objectType"] = osjei.ObjectType 4404 } 4405 return json.Marshal(objectMap) 4406} 4407 4408// AsOperationStatusJobExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobsExtendedInfo. 4409func (osjei OperationStatusJobsExtendedInfo) AsOperationStatusJobExtendedInfo() (*OperationStatusJobExtendedInfo, bool) { 4410 return nil, false 4411} 4412 4413// AsOperationStatusProvisionILRExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobsExtendedInfo. 4414func (osjei OperationStatusJobsExtendedInfo) AsOperationStatusProvisionILRExtendedInfo() (*OperationStatusProvisionILRExtendedInfo, bool) { 4415 return nil, false 4416} 4417 4418// AsOperationStatusJobsExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobsExtendedInfo. 4419func (osjei OperationStatusJobsExtendedInfo) AsOperationStatusJobsExtendedInfo() (*OperationStatusJobsExtendedInfo, bool) { 4420 return &osjei, true 4421} 4422 4423// AsOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobsExtendedInfo. 4424func (osjei OperationStatusJobsExtendedInfo) AsOperationStatusExtendedInfo() (*OperationStatusExtendedInfo, bool) { 4425 return nil, false 4426} 4427 4428// AsBasicOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusJobsExtendedInfo. 4429func (osjei OperationStatusJobsExtendedInfo) AsBasicOperationStatusExtendedInfo() (BasicOperationStatusExtendedInfo, bool) { 4430 return &osjei, true 4431} 4432 4433// OperationStatusProvisionILRExtendedInfo extended information about the Item Level Recovery (ILR) 4434// provision action, operation status. 4435type OperationStatusProvisionILRExtendedInfo struct { 4436 // RecoveryTarget - Target details for the file or folder restore. 4437 RecoveryTarget *InstantItemRecoveryTarget `json:"recoveryTarget,omitempty"` 4438 // ObjectType - Possible values include: 'ObjectTypeOperationStatusExtendedInfo', 'ObjectTypeOperationStatusJobExtendedInfo', 'ObjectTypeOperationStatusProvisionILRExtendedInfo', 'ObjectTypeOperationStatusJobsExtendedInfo' 4439 ObjectType ObjectType `json:"objectType,omitempty"` 4440} 4441 4442// MarshalJSON is the custom marshaler for OperationStatusProvisionILRExtendedInfo. 4443func (ospiei OperationStatusProvisionILRExtendedInfo) MarshalJSON() ([]byte, error) { 4444 ospiei.ObjectType = ObjectTypeOperationStatusProvisionILRExtendedInfo 4445 objectMap := make(map[string]interface{}) 4446 if ospiei.RecoveryTarget != nil { 4447 objectMap["recoveryTarget"] = ospiei.RecoveryTarget 4448 } 4449 if ospiei.ObjectType != "" { 4450 objectMap["objectType"] = ospiei.ObjectType 4451 } 4452 return json.Marshal(objectMap) 4453} 4454 4455// AsOperationStatusJobExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusProvisionILRExtendedInfo. 4456func (ospiei OperationStatusProvisionILRExtendedInfo) AsOperationStatusJobExtendedInfo() (*OperationStatusJobExtendedInfo, bool) { 4457 return nil, false 4458} 4459 4460// AsOperationStatusProvisionILRExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusProvisionILRExtendedInfo. 4461func (ospiei OperationStatusProvisionILRExtendedInfo) AsOperationStatusProvisionILRExtendedInfo() (*OperationStatusProvisionILRExtendedInfo, bool) { 4462 return &ospiei, true 4463} 4464 4465// AsOperationStatusJobsExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusProvisionILRExtendedInfo. 4466func (ospiei OperationStatusProvisionILRExtendedInfo) AsOperationStatusJobsExtendedInfo() (*OperationStatusJobsExtendedInfo, bool) { 4467 return nil, false 4468} 4469 4470// AsOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusProvisionILRExtendedInfo. 4471func (ospiei OperationStatusProvisionILRExtendedInfo) AsOperationStatusExtendedInfo() (*OperationStatusExtendedInfo, bool) { 4472 return nil, false 4473} 4474 4475// AsBasicOperationStatusExtendedInfo is the BasicOperationStatusExtendedInfo implementation for OperationStatusProvisionILRExtendedInfo. 4476func (ospiei OperationStatusProvisionILRExtendedInfo) AsBasicOperationStatusExtendedInfo() (BasicOperationStatusExtendedInfo, bool) { 4477 return &ospiei, true 4478} 4479 4480// OperationWorkerResponse the base class for operation result responses. 4481type OperationWorkerResponse struct { 4482 // StatusCode - The HTTP status code of the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestURITooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HTTPVersionNotSupported' 4483 StatusCode HTTPStatusCode `json:"statusCode,omitempty"` 4484 // Headers - The HTTP headers associated with this operation. 4485 Headers map[string][]string `json:"Headers"` 4486} 4487 4488// MarshalJSON is the custom marshaler for OperationWorkerResponse. 4489func (owr OperationWorkerResponse) MarshalJSON() ([]byte, error) { 4490 objectMap := make(map[string]interface{}) 4491 if owr.StatusCode != "" { 4492 objectMap["statusCode"] = owr.StatusCode 4493 } 4494 if owr.Headers != nil { 4495 objectMap["Headers"] = owr.Headers 4496 } 4497 return json.Marshal(objectMap) 4498} 4499 4500// BasicProtectedItem the base class for backup items. 4501type BasicProtectedItem interface { 4502 AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) 4503 AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) 4504 AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) 4505 AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) 4506 AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) 4507 AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) 4508 AsProtectedItem() (*ProtectedItem, bool) 4509} 4510 4511// ProtectedItem the base class for backup items. 4512type ProtectedItem struct { 4513 // BackupManagementType - The backup management type associated with the backup item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 4514 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 4515 // WorkloadType - The workload type for this item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 4516 WorkloadType DataSourceType `json:"workloadType,omitempty"` 4517 // SourceResourceID - The ID of the resource to be backed up. 4518 SourceResourceID *string `json:"sourceResourceId,omitempty"` 4519 // PolicyID - The ID of the backup policy associated with this backup item. 4520 PolicyID *string `json:"policyId,omitempty"` 4521 // LastRecoveryPoint - The timestamp when the most recent backup copy was created for this backup item. 4522 LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` 4523 // ProtectedItemType - Possible values include: 'ProtectedItemTypeProtectedItem', 'ProtectedItemTypeAzureIaaSVMProtectedItem', 'ProtectedItemTypeMabFileFolderProtectedItem', 'ProtectedItemTypeMicrosoftSqlserversdatabases', 'ProtectedItemTypeMicrosoftComputevirtualMachines', 'ProtectedItemTypeMicrosoftClassicComputevirtualMachines' 4524 ProtectedItemType ProtectedItemType `json:"protectedItemType,omitempty"` 4525} 4526 4527func unmarshalBasicProtectedItem(body []byte) (BasicProtectedItem, error) { 4528 var m map[string]interface{} 4529 err := json.Unmarshal(body, &m) 4530 if err != nil { 4531 return nil, err 4532 } 4533 4534 switch m["protectedItemType"] { 4535 case string(ProtectedItemTypeAzureIaaSVMProtectedItem): 4536 var aispi AzureIaaSVMProtectedItem 4537 err := json.Unmarshal(body, &aispi) 4538 return aispi, err 4539 case string(ProtectedItemTypeMabFileFolderProtectedItem): 4540 var mffpi MabFileFolderProtectedItem 4541 err := json.Unmarshal(body, &mffpi) 4542 return mffpi, err 4543 case string(ProtectedItemTypeMicrosoftSqlserversdatabases): 4544 var aspi AzureSQLProtectedItem 4545 err := json.Unmarshal(body, &aspi) 4546 return aspi, err 4547 case string(ProtectedItemTypeMicrosoftComputevirtualMachines): 4548 var aiscvpi AzureIaaSComputeVMProtectedItem 4549 err := json.Unmarshal(body, &aiscvpi) 4550 return aiscvpi, err 4551 case string(ProtectedItemTypeMicrosoftClassicComputevirtualMachines): 4552 var aisccvpi AzureIaaSClassicComputeVMProtectedItem 4553 err := json.Unmarshal(body, &aisccvpi) 4554 return aisccvpi, err 4555 default: 4556 var pi ProtectedItem 4557 err := json.Unmarshal(body, &pi) 4558 return pi, err 4559 } 4560} 4561func unmarshalBasicProtectedItemArray(body []byte) ([]BasicProtectedItem, error) { 4562 var rawMessages []*json.RawMessage 4563 err := json.Unmarshal(body, &rawMessages) 4564 if err != nil { 4565 return nil, err 4566 } 4567 4568 piArray := make([]BasicProtectedItem, len(rawMessages)) 4569 4570 for index, rawMessage := range rawMessages { 4571 pi, err := unmarshalBasicProtectedItem(*rawMessage) 4572 if err != nil { 4573 return nil, err 4574 } 4575 piArray[index] = pi 4576 } 4577 return piArray, nil 4578} 4579 4580// MarshalJSON is the custom marshaler for ProtectedItem. 4581func (pi ProtectedItem) MarshalJSON() ([]byte, error) { 4582 pi.ProtectedItemType = ProtectedItemTypeProtectedItem 4583 objectMap := make(map[string]interface{}) 4584 if pi.BackupManagementType != "" { 4585 objectMap["backupManagementType"] = pi.BackupManagementType 4586 } 4587 if pi.WorkloadType != "" { 4588 objectMap["workloadType"] = pi.WorkloadType 4589 } 4590 if pi.SourceResourceID != nil { 4591 objectMap["sourceResourceId"] = pi.SourceResourceID 4592 } 4593 if pi.PolicyID != nil { 4594 objectMap["policyId"] = pi.PolicyID 4595 } 4596 if pi.LastRecoveryPoint != nil { 4597 objectMap["lastRecoveryPoint"] = pi.LastRecoveryPoint 4598 } 4599 if pi.ProtectedItemType != "" { 4600 objectMap["protectedItemType"] = pi.ProtectedItemType 4601 } 4602 return json.Marshal(objectMap) 4603} 4604 4605// AsAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4606func (pi ProtectedItem) AsAzureIaaSVMProtectedItem() (*AzureIaaSVMProtectedItem, bool) { 4607 return nil, false 4608} 4609 4610// AsBasicAzureIaaSVMProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4611func (pi ProtectedItem) AsBasicAzureIaaSVMProtectedItem() (BasicAzureIaaSVMProtectedItem, bool) { 4612 return nil, false 4613} 4614 4615// AsMabFileFolderProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4616func (pi ProtectedItem) AsMabFileFolderProtectedItem() (*MabFileFolderProtectedItem, bool) { 4617 return nil, false 4618} 4619 4620// AsAzureSQLProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4621func (pi ProtectedItem) AsAzureSQLProtectedItem() (*AzureSQLProtectedItem, bool) { 4622 return nil, false 4623} 4624 4625// AsAzureIaaSComputeVMProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4626func (pi ProtectedItem) AsAzureIaaSComputeVMProtectedItem() (*AzureIaaSComputeVMProtectedItem, bool) { 4627 return nil, false 4628} 4629 4630// AsAzureIaaSClassicComputeVMProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4631func (pi ProtectedItem) AsAzureIaaSClassicComputeVMProtectedItem() (*AzureIaaSClassicComputeVMProtectedItem, bool) { 4632 return nil, false 4633} 4634 4635// AsProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4636func (pi ProtectedItem) AsProtectedItem() (*ProtectedItem, bool) { 4637 return &pi, true 4638} 4639 4640// AsBasicProtectedItem is the BasicProtectedItem implementation for ProtectedItem. 4641func (pi ProtectedItem) AsBasicProtectedItem() (BasicProtectedItem, bool) { 4642 return &pi, true 4643} 4644 4645// ProtectedItemQueryObject filters the list of backup items. 4646type ProtectedItemQueryObject struct { 4647 // BackupManagementType - The backup management type associated with an item. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 4648 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 4649 // ItemType - The workload type associated with an item. Possible values include: 'Invalid', 'VM', 'FileFolder', 'AzureSQLDb', 'SQLDB', 'Exchange', 'Sharepoint', 'DPMUnknown' 4650 ItemType DataSourceType `json:"itemType,omitempty"` 4651 // PolicyName - The name of the backup policy associated with the item. 4652 PolicyName *string `json:"policyName,omitempty"` 4653 // ContainerName - The name of the container. 4654 ContainerName *string `json:"containerName,omitempty"` 4655} 4656 4657// ProtectedItemResource the base class for backup items. 4658type ProtectedItemResource struct { 4659 autorest.Response `json:"-"` 4660 Properties BasicProtectedItem `json:"properties,omitempty"` 4661 // ID - Resource ID represents the complete path to the resource. 4662 ID *string `json:"id,omitempty"` 4663 // Name - Resource name associated with the resource. 4664 Name *string `json:"name,omitempty"` 4665 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 4666 Type *string `json:"type,omitempty"` 4667 // Location - Resource location. 4668 Location *string `json:"location,omitempty"` 4669 // Tags - Resource tags. 4670 Tags map[string]*string `json:"tags"` 4671 // ETag - Optional ETag. 4672 ETag *string `json:"eTag,omitempty"` 4673} 4674 4675// MarshalJSON is the custom marshaler for ProtectedItemResource. 4676func (pir ProtectedItemResource) MarshalJSON() ([]byte, error) { 4677 objectMap := make(map[string]interface{}) 4678 objectMap["properties"] = pir.Properties 4679 if pir.ID != nil { 4680 objectMap["id"] = pir.ID 4681 } 4682 if pir.Name != nil { 4683 objectMap["name"] = pir.Name 4684 } 4685 if pir.Type != nil { 4686 objectMap["type"] = pir.Type 4687 } 4688 if pir.Location != nil { 4689 objectMap["location"] = pir.Location 4690 } 4691 if pir.Tags != nil { 4692 objectMap["tags"] = pir.Tags 4693 } 4694 if pir.ETag != nil { 4695 objectMap["eTag"] = pir.ETag 4696 } 4697 return json.Marshal(objectMap) 4698} 4699 4700// UnmarshalJSON is the custom unmarshaler for ProtectedItemResource struct. 4701func (pir *ProtectedItemResource) UnmarshalJSON(body []byte) error { 4702 var m map[string]*json.RawMessage 4703 err := json.Unmarshal(body, &m) 4704 if err != nil { 4705 return err 4706 } 4707 for k, v := range m { 4708 switch k { 4709 case "properties": 4710 if v != nil { 4711 properties, err := unmarshalBasicProtectedItem(*v) 4712 if err != nil { 4713 return err 4714 } 4715 pir.Properties = properties 4716 } 4717 case "id": 4718 if v != nil { 4719 var ID string 4720 err = json.Unmarshal(*v, &ID) 4721 if err != nil { 4722 return err 4723 } 4724 pir.ID = &ID 4725 } 4726 case "name": 4727 if v != nil { 4728 var name string 4729 err = json.Unmarshal(*v, &name) 4730 if err != nil { 4731 return err 4732 } 4733 pir.Name = &name 4734 } 4735 case "type": 4736 if v != nil { 4737 var typeVar string 4738 err = json.Unmarshal(*v, &typeVar) 4739 if err != nil { 4740 return err 4741 } 4742 pir.Type = &typeVar 4743 } 4744 case "location": 4745 if v != nil { 4746 var location string 4747 err = json.Unmarshal(*v, &location) 4748 if err != nil { 4749 return err 4750 } 4751 pir.Location = &location 4752 } 4753 case "tags": 4754 if v != nil { 4755 var tags map[string]*string 4756 err = json.Unmarshal(*v, &tags) 4757 if err != nil { 4758 return err 4759 } 4760 pir.Tags = tags 4761 } 4762 case "eTag": 4763 if v != nil { 4764 var eTag string 4765 err = json.Unmarshal(*v, &eTag) 4766 if err != nil { 4767 return err 4768 } 4769 pir.ETag = &eTag 4770 } 4771 } 4772 } 4773 4774 return nil 4775} 4776 4777// ProtectedItemResourceList the list of ProtectedItem resources. 4778type ProtectedItemResourceList struct { 4779 autorest.Response `json:"-"` 4780 // Value - The list of resources. 4781 Value *[]ProtectedItemResource `json:"value,omitempty"` 4782 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 4783 NextLink *string `json:"nextLink,omitempty"` 4784} 4785 4786// ProtectedItemResourceListIterator provides access to a complete listing of ProtectedItemResource values. 4787type ProtectedItemResourceListIterator struct { 4788 i int 4789 page ProtectedItemResourceListPage 4790} 4791 4792// NextWithContext advances to the next value. If there was an error making 4793// the request the iterator does not advance and the error is returned. 4794func (iter *ProtectedItemResourceListIterator) NextWithContext(ctx context.Context) (err error) { 4795 if tracing.IsEnabled() { 4796 ctx = tracing.StartSpan(ctx, fqdn+"/ProtectedItemResourceListIterator.NextWithContext") 4797 defer func() { 4798 sc := -1 4799 if iter.Response().Response.Response != nil { 4800 sc = iter.Response().Response.Response.StatusCode 4801 } 4802 tracing.EndSpan(ctx, sc, err) 4803 }() 4804 } 4805 iter.i++ 4806 if iter.i < len(iter.page.Values()) { 4807 return nil 4808 } 4809 err = iter.page.NextWithContext(ctx) 4810 if err != nil { 4811 iter.i-- 4812 return err 4813 } 4814 iter.i = 0 4815 return nil 4816} 4817 4818// Next advances to the next value. If there was an error making 4819// the request the iterator does not advance and the error is returned. 4820// Deprecated: Use NextWithContext() instead. 4821func (iter *ProtectedItemResourceListIterator) Next() error { 4822 return iter.NextWithContext(context.Background()) 4823} 4824 4825// NotDone returns true if the enumeration should be started or is not yet complete. 4826func (iter ProtectedItemResourceListIterator) NotDone() bool { 4827 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4828} 4829 4830// Response returns the raw server response from the last page request. 4831func (iter ProtectedItemResourceListIterator) Response() ProtectedItemResourceList { 4832 return iter.page.Response() 4833} 4834 4835// Value returns the current value or a zero-initialized value if the 4836// iterator has advanced beyond the end of the collection. 4837func (iter ProtectedItemResourceListIterator) Value() ProtectedItemResource { 4838 if !iter.page.NotDone() { 4839 return ProtectedItemResource{} 4840 } 4841 return iter.page.Values()[iter.i] 4842} 4843 4844// Creates a new instance of the ProtectedItemResourceListIterator type. 4845func NewProtectedItemResourceListIterator(page ProtectedItemResourceListPage) ProtectedItemResourceListIterator { 4846 return ProtectedItemResourceListIterator{page: page} 4847} 4848 4849// IsEmpty returns true if the ListResult contains no values. 4850func (pirl ProtectedItemResourceList) IsEmpty() bool { 4851 return pirl.Value == nil || len(*pirl.Value) == 0 4852} 4853 4854// hasNextLink returns true if the NextLink is not empty. 4855func (pirl ProtectedItemResourceList) hasNextLink() bool { 4856 return pirl.NextLink != nil && len(*pirl.NextLink) != 0 4857} 4858 4859// protectedItemResourceListPreparer prepares a request to retrieve the next set of results. 4860// It returns nil if no more results exist. 4861func (pirl ProtectedItemResourceList) protectedItemResourceListPreparer(ctx context.Context) (*http.Request, error) { 4862 if !pirl.hasNextLink() { 4863 return nil, nil 4864 } 4865 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4866 autorest.AsJSON(), 4867 autorest.AsGet(), 4868 autorest.WithBaseURL(to.String(pirl.NextLink))) 4869} 4870 4871// ProtectedItemResourceListPage contains a page of ProtectedItemResource values. 4872type ProtectedItemResourceListPage struct { 4873 fn func(context.Context, ProtectedItemResourceList) (ProtectedItemResourceList, error) 4874 pirl ProtectedItemResourceList 4875} 4876 4877// NextWithContext advances to the next page of values. If there was an error making 4878// the request the page does not advance and the error is returned. 4879func (page *ProtectedItemResourceListPage) NextWithContext(ctx context.Context) (err error) { 4880 if tracing.IsEnabled() { 4881 ctx = tracing.StartSpan(ctx, fqdn+"/ProtectedItemResourceListPage.NextWithContext") 4882 defer func() { 4883 sc := -1 4884 if page.Response().Response.Response != nil { 4885 sc = page.Response().Response.Response.StatusCode 4886 } 4887 tracing.EndSpan(ctx, sc, err) 4888 }() 4889 } 4890 for { 4891 next, err := page.fn(ctx, page.pirl) 4892 if err != nil { 4893 return err 4894 } 4895 page.pirl = next 4896 if !next.hasNextLink() || !next.IsEmpty() { 4897 break 4898 } 4899 } 4900 return nil 4901} 4902 4903// Next advances to the next page of values. If there was an error making 4904// the request the page does not advance and the error is returned. 4905// Deprecated: Use NextWithContext() instead. 4906func (page *ProtectedItemResourceListPage) Next() error { 4907 return page.NextWithContext(context.Background()) 4908} 4909 4910// NotDone returns true if the page enumeration should be started or is not yet complete. 4911func (page ProtectedItemResourceListPage) NotDone() bool { 4912 return !page.pirl.IsEmpty() 4913} 4914 4915// Response returns the raw server response from the last page request. 4916func (page ProtectedItemResourceListPage) Response() ProtectedItemResourceList { 4917 return page.pirl 4918} 4919 4920// Values returns the slice of values for the current page or nil if there are no values. 4921func (page ProtectedItemResourceListPage) Values() []ProtectedItemResource { 4922 if page.pirl.IsEmpty() { 4923 return nil 4924 } 4925 return *page.pirl.Value 4926} 4927 4928// Creates a new instance of the ProtectedItemResourceListPage type. 4929func NewProtectedItemResourceListPage(cur ProtectedItemResourceList, getNextPage func(context.Context, ProtectedItemResourceList) (ProtectedItemResourceList, error)) ProtectedItemResourceListPage { 4930 return ProtectedItemResourceListPage{ 4931 fn: getNextPage, 4932 pirl: cur, 4933 } 4934} 4935 4936// BasicProtectionContainer the base class for a container with backup items. Containers with specific workloads are 4937// derived from this class. 4938type BasicProtectionContainer interface { 4939 AsAzureSQLContainer() (*AzureSQLContainer, bool) 4940 AsIaaSVMContainer() (*IaaSVMContainer, bool) 4941 AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) 4942 AsMabContainer() (*MabContainer, bool) 4943 AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) 4944 AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) 4945 AsProtectionContainer() (*ProtectionContainer, bool) 4946} 4947 4948// ProtectionContainer the base class for a container with backup items. Containers with specific workloads are 4949// derived from this class. 4950type ProtectionContainer struct { 4951 // FriendlyName - Friendly name of the container. 4952 FriendlyName *string `json:"friendlyName,omitempty"` 4953 // BackupManagementType - The backup management type for the container. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 4954 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 4955 // RegistrationStatus - The container's registration status with the Recovery Services vault. 4956 RegistrationStatus *string `json:"registrationStatus,omitempty"` 4957 // HealthStatus - The status of the container's health. 4958 HealthStatus *string `json:"healthStatus,omitempty"` 4959 // ContainerType - READ-ONLY; The type assigned to the container. The values to use for each of these properties are:<br/> 1. Compute Azure VM is Microsoft.Compute/virtualMachines<br/> 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines<br/> 3. Windows machines (like Azure Backup Server and DPM) is Windows<br/> 4. Azure SQL instance is AzureSqlContainer. 4960 ContainerType *string `json:"containerType,omitempty"` 4961 // ProtectableObjectType - Possible values include: 'ProtectableObjectTypeProtectionContainer', 'ProtectableObjectTypeAzureSQLContainer', 'ProtectableObjectTypeIaaSVMContainer', 'ProtectableObjectTypeMABWindowsContainer', 'ProtectableObjectTypeMicrosoftComputevirtualMachines', 'ProtectableObjectTypeMicrosoftClassicComputevirtualMachines' 4962 ProtectableObjectType ProtectableObjectType `json:"protectableObjectType,omitempty"` 4963} 4964 4965func unmarshalBasicProtectionContainer(body []byte) (BasicProtectionContainer, error) { 4966 var m map[string]interface{} 4967 err := json.Unmarshal(body, &m) 4968 if err != nil { 4969 return nil, err 4970 } 4971 4972 switch m["protectableObjectType"] { 4973 case string(ProtectableObjectTypeAzureSQLContainer): 4974 var asc AzureSQLContainer 4975 err := json.Unmarshal(body, &asc) 4976 return asc, err 4977 case string(ProtectableObjectTypeIaaSVMContainer): 4978 var isc IaaSVMContainer 4979 err := json.Unmarshal(body, &isc) 4980 return isc, err 4981 case string(ProtectableObjectTypeMABWindowsContainer): 4982 var mc MabContainer 4983 err := json.Unmarshal(body, &mc) 4984 return mc, err 4985 case string(ProtectableObjectTypeMicrosoftComputevirtualMachines): 4986 var aiscvc AzureIaaSComputeVMContainer 4987 err := json.Unmarshal(body, &aiscvc) 4988 return aiscvc, err 4989 case string(ProtectableObjectTypeMicrosoftClassicComputevirtualMachines): 4990 var aisccvc AzureIaaSClassicComputeVMContainer 4991 err := json.Unmarshal(body, &aisccvc) 4992 return aisccvc, err 4993 default: 4994 var pc ProtectionContainer 4995 err := json.Unmarshal(body, &pc) 4996 return pc, err 4997 } 4998} 4999func unmarshalBasicProtectionContainerArray(body []byte) ([]BasicProtectionContainer, error) { 5000 var rawMessages []*json.RawMessage 5001 err := json.Unmarshal(body, &rawMessages) 5002 if err != nil { 5003 return nil, err 5004 } 5005 5006 pcArray := make([]BasicProtectionContainer, len(rawMessages)) 5007 5008 for index, rawMessage := range rawMessages { 5009 pc, err := unmarshalBasicProtectionContainer(*rawMessage) 5010 if err != nil { 5011 return nil, err 5012 } 5013 pcArray[index] = pc 5014 } 5015 return pcArray, nil 5016} 5017 5018// MarshalJSON is the custom marshaler for ProtectionContainer. 5019func (pc ProtectionContainer) MarshalJSON() ([]byte, error) { 5020 pc.ProtectableObjectType = ProtectableObjectTypeProtectionContainer 5021 objectMap := make(map[string]interface{}) 5022 if pc.FriendlyName != nil { 5023 objectMap["friendlyName"] = pc.FriendlyName 5024 } 5025 if pc.BackupManagementType != "" { 5026 objectMap["backupManagementType"] = pc.BackupManagementType 5027 } 5028 if pc.RegistrationStatus != nil { 5029 objectMap["registrationStatus"] = pc.RegistrationStatus 5030 } 5031 if pc.HealthStatus != nil { 5032 objectMap["healthStatus"] = pc.HealthStatus 5033 } 5034 if pc.ProtectableObjectType != "" { 5035 objectMap["protectableObjectType"] = pc.ProtectableObjectType 5036 } 5037 return json.Marshal(objectMap) 5038} 5039 5040// AsAzureSQLContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5041func (pc ProtectionContainer) AsAzureSQLContainer() (*AzureSQLContainer, bool) { 5042 return nil, false 5043} 5044 5045// AsIaaSVMContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5046func (pc ProtectionContainer) AsIaaSVMContainer() (*IaaSVMContainer, bool) { 5047 return nil, false 5048} 5049 5050// AsBasicIaaSVMContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5051func (pc ProtectionContainer) AsBasicIaaSVMContainer() (BasicIaaSVMContainer, bool) { 5052 return nil, false 5053} 5054 5055// AsMabContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5056func (pc ProtectionContainer) AsMabContainer() (*MabContainer, bool) { 5057 return nil, false 5058} 5059 5060// AsAzureIaaSComputeVMContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5061func (pc ProtectionContainer) AsAzureIaaSComputeVMContainer() (*AzureIaaSComputeVMContainer, bool) { 5062 return nil, false 5063} 5064 5065// AsAzureIaaSClassicComputeVMContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5066func (pc ProtectionContainer) AsAzureIaaSClassicComputeVMContainer() (*AzureIaaSClassicComputeVMContainer, bool) { 5067 return nil, false 5068} 5069 5070// AsProtectionContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5071func (pc ProtectionContainer) AsProtectionContainer() (*ProtectionContainer, bool) { 5072 return &pc, true 5073} 5074 5075// AsBasicProtectionContainer is the BasicProtectionContainer implementation for ProtectionContainer. 5076func (pc ProtectionContainer) AsBasicProtectionContainer() (BasicProtectionContainer, bool) { 5077 return &pc, true 5078} 5079 5080// ProtectionContainerResource base class for a container with backup items. Containers with specific 5081// workloads are derived from this class. 5082type ProtectionContainerResource struct { 5083 autorest.Response `json:"-"` 5084 Properties BasicProtectionContainer `json:"properties,omitempty"` 5085 // ID - Resource ID represents the complete path to the resource. 5086 ID *string `json:"id,omitempty"` 5087 // Name - Resource name associated with the resource. 5088 Name *string `json:"name,omitempty"` 5089 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 5090 Type *string `json:"type,omitempty"` 5091 // Location - Resource location. 5092 Location *string `json:"location,omitempty"` 5093 // Tags - Resource tags. 5094 Tags map[string]*string `json:"tags"` 5095 // ETag - Optional ETag. 5096 ETag *string `json:"eTag,omitempty"` 5097} 5098 5099// MarshalJSON is the custom marshaler for ProtectionContainerResource. 5100func (pcr ProtectionContainerResource) MarshalJSON() ([]byte, error) { 5101 objectMap := make(map[string]interface{}) 5102 objectMap["properties"] = pcr.Properties 5103 if pcr.ID != nil { 5104 objectMap["id"] = pcr.ID 5105 } 5106 if pcr.Name != nil { 5107 objectMap["name"] = pcr.Name 5108 } 5109 if pcr.Type != nil { 5110 objectMap["type"] = pcr.Type 5111 } 5112 if pcr.Location != nil { 5113 objectMap["location"] = pcr.Location 5114 } 5115 if pcr.Tags != nil { 5116 objectMap["tags"] = pcr.Tags 5117 } 5118 if pcr.ETag != nil { 5119 objectMap["eTag"] = pcr.ETag 5120 } 5121 return json.Marshal(objectMap) 5122} 5123 5124// UnmarshalJSON is the custom unmarshaler for ProtectionContainerResource struct. 5125func (pcr *ProtectionContainerResource) UnmarshalJSON(body []byte) error { 5126 var m map[string]*json.RawMessage 5127 err := json.Unmarshal(body, &m) 5128 if err != nil { 5129 return err 5130 } 5131 for k, v := range m { 5132 switch k { 5133 case "properties": 5134 if v != nil { 5135 properties, err := unmarshalBasicProtectionContainer(*v) 5136 if err != nil { 5137 return err 5138 } 5139 pcr.Properties = properties 5140 } 5141 case "id": 5142 if v != nil { 5143 var ID string 5144 err = json.Unmarshal(*v, &ID) 5145 if err != nil { 5146 return err 5147 } 5148 pcr.ID = &ID 5149 } 5150 case "name": 5151 if v != nil { 5152 var name string 5153 err = json.Unmarshal(*v, &name) 5154 if err != nil { 5155 return err 5156 } 5157 pcr.Name = &name 5158 } 5159 case "type": 5160 if v != nil { 5161 var typeVar string 5162 err = json.Unmarshal(*v, &typeVar) 5163 if err != nil { 5164 return err 5165 } 5166 pcr.Type = &typeVar 5167 } 5168 case "location": 5169 if v != nil { 5170 var location string 5171 err = json.Unmarshal(*v, &location) 5172 if err != nil { 5173 return err 5174 } 5175 pcr.Location = &location 5176 } 5177 case "tags": 5178 if v != nil { 5179 var tags map[string]*string 5180 err = json.Unmarshal(*v, &tags) 5181 if err != nil { 5182 return err 5183 } 5184 pcr.Tags = tags 5185 } 5186 case "eTag": 5187 if v != nil { 5188 var eTag string 5189 err = json.Unmarshal(*v, &eTag) 5190 if err != nil { 5191 return err 5192 } 5193 pcr.ETag = &eTag 5194 } 5195 } 5196 } 5197 5198 return nil 5199} 5200 5201// ProtectionContainerResourceList the list of ProtectionContainer resources. 5202type ProtectionContainerResourceList struct { 5203 autorest.Response `json:"-"` 5204 // Value - The list of resources. 5205 Value *[]ProtectionContainerResource `json:"value,omitempty"` 5206 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 5207 NextLink *string `json:"nextLink,omitempty"` 5208} 5209 5210// BasicProtectionPolicy the base class for a backup policy. Workload-specific backup policies are derived from this 5211// class. 5212type BasicProtectionPolicy interface { 5213 AsAzureIaaSVMProtectionPolicy() (*AzureIaaSVMProtectionPolicy, bool) 5214 AsMabProtectionPolicy() (*MabProtectionPolicy, bool) 5215 AsAzureSQLProtectionPolicy() (*AzureSQLProtectionPolicy, bool) 5216 AsProtectionPolicy() (*ProtectionPolicy, bool) 5217} 5218 5219// ProtectionPolicy the base class for a backup policy. Workload-specific backup policies are derived from this 5220// class. 5221type ProtectionPolicy struct { 5222 // ProtectedItemsCount - The number of items associated with this policy. 5223 ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` 5224 // BackupManagementType - Possible values include: 'BackupManagementTypeProtectionPolicy', 'BackupManagementTypeAzureIaasVM', 'BackupManagementTypeMAB', 'BackupManagementTypeAzureSQL' 5225 BackupManagementType ManagementTypeBasicProtectionPolicy `json:"backupManagementType,omitempty"` 5226} 5227 5228func unmarshalBasicProtectionPolicy(body []byte) (BasicProtectionPolicy, error) { 5229 var m map[string]interface{} 5230 err := json.Unmarshal(body, &m) 5231 if err != nil { 5232 return nil, err 5233 } 5234 5235 switch m["backupManagementType"] { 5236 case string(BackupManagementTypeAzureIaasVM): 5237 var aispp AzureIaaSVMProtectionPolicy 5238 err := json.Unmarshal(body, &aispp) 5239 return aispp, err 5240 case string(BackupManagementTypeMAB): 5241 var mpp MabProtectionPolicy 5242 err := json.Unmarshal(body, &mpp) 5243 return mpp, err 5244 case string(BackupManagementTypeAzureSQL): 5245 var aspp AzureSQLProtectionPolicy 5246 err := json.Unmarshal(body, &aspp) 5247 return aspp, err 5248 default: 5249 var pp ProtectionPolicy 5250 err := json.Unmarshal(body, &pp) 5251 return pp, err 5252 } 5253} 5254func unmarshalBasicProtectionPolicyArray(body []byte) ([]BasicProtectionPolicy, error) { 5255 var rawMessages []*json.RawMessage 5256 err := json.Unmarshal(body, &rawMessages) 5257 if err != nil { 5258 return nil, err 5259 } 5260 5261 ppArray := make([]BasicProtectionPolicy, len(rawMessages)) 5262 5263 for index, rawMessage := range rawMessages { 5264 pp, err := unmarshalBasicProtectionPolicy(*rawMessage) 5265 if err != nil { 5266 return nil, err 5267 } 5268 ppArray[index] = pp 5269 } 5270 return ppArray, nil 5271} 5272 5273// MarshalJSON is the custom marshaler for ProtectionPolicy. 5274func (pp ProtectionPolicy) MarshalJSON() ([]byte, error) { 5275 pp.BackupManagementType = BackupManagementTypeProtectionPolicy 5276 objectMap := make(map[string]interface{}) 5277 if pp.ProtectedItemsCount != nil { 5278 objectMap["protectedItemsCount"] = pp.ProtectedItemsCount 5279 } 5280 if pp.BackupManagementType != "" { 5281 objectMap["backupManagementType"] = pp.BackupManagementType 5282 } 5283 return json.Marshal(objectMap) 5284} 5285 5286// AsAzureIaaSVMProtectionPolicy is the BasicProtectionPolicy implementation for ProtectionPolicy. 5287func (pp ProtectionPolicy) AsAzureIaaSVMProtectionPolicy() (*AzureIaaSVMProtectionPolicy, bool) { 5288 return nil, false 5289} 5290 5291// AsMabProtectionPolicy is the BasicProtectionPolicy implementation for ProtectionPolicy. 5292func (pp ProtectionPolicy) AsMabProtectionPolicy() (*MabProtectionPolicy, bool) { 5293 return nil, false 5294} 5295 5296// AsAzureSQLProtectionPolicy is the BasicProtectionPolicy implementation for ProtectionPolicy. 5297func (pp ProtectionPolicy) AsAzureSQLProtectionPolicy() (*AzureSQLProtectionPolicy, bool) { 5298 return nil, false 5299} 5300 5301// AsProtectionPolicy is the BasicProtectionPolicy implementation for ProtectionPolicy. 5302func (pp ProtectionPolicy) AsProtectionPolicy() (*ProtectionPolicy, bool) { 5303 return &pp, true 5304} 5305 5306// AsBasicProtectionPolicy is the BasicProtectionPolicy implementation for ProtectionPolicy. 5307func (pp ProtectionPolicy) AsBasicProtectionPolicy() (BasicProtectionPolicy, bool) { 5308 return &pp, true 5309} 5310 5311// ProtectionPolicyQueryObject this object filters the list of backup policies. 5312type ProtectionPolicyQueryObject struct { 5313 // BackupManagementType - The backup management type associated with the backup policy. Possible values include: 'ManagementTypeInvalid', 'ManagementTypeAzureIaasVM', 'ManagementTypeMAB', 'ManagementTypeDPM', 'ManagementTypeAzureBackupServer', 'ManagementTypeAzureSQL' 5314 BackupManagementType ManagementType `json:"backupManagementType,omitempty"` 5315} 5316 5317// ProtectionPolicyResource the base class for backup policy. Workload-specific backup policies are derived 5318// from this class. 5319type ProtectionPolicyResource struct { 5320 autorest.Response `json:"-"` 5321 Properties BasicProtectionPolicy `json:"properties,omitempty"` 5322 // ID - Resource ID represents the complete path to the resource. 5323 ID *string `json:"id,omitempty"` 5324 // Name - Resource name associated with the resource. 5325 Name *string `json:"name,omitempty"` 5326 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 5327 Type *string `json:"type,omitempty"` 5328 // Location - Resource location. 5329 Location *string `json:"location,omitempty"` 5330 // Tags - Resource tags. 5331 Tags map[string]*string `json:"tags"` 5332 // ETag - Optional ETag. 5333 ETag *string `json:"eTag,omitempty"` 5334} 5335 5336// MarshalJSON is the custom marshaler for ProtectionPolicyResource. 5337func (ppr ProtectionPolicyResource) MarshalJSON() ([]byte, error) { 5338 objectMap := make(map[string]interface{}) 5339 objectMap["properties"] = ppr.Properties 5340 if ppr.ID != nil { 5341 objectMap["id"] = ppr.ID 5342 } 5343 if ppr.Name != nil { 5344 objectMap["name"] = ppr.Name 5345 } 5346 if ppr.Type != nil { 5347 objectMap["type"] = ppr.Type 5348 } 5349 if ppr.Location != nil { 5350 objectMap["location"] = ppr.Location 5351 } 5352 if ppr.Tags != nil { 5353 objectMap["tags"] = ppr.Tags 5354 } 5355 if ppr.ETag != nil { 5356 objectMap["eTag"] = ppr.ETag 5357 } 5358 return json.Marshal(objectMap) 5359} 5360 5361// UnmarshalJSON is the custom unmarshaler for ProtectionPolicyResource struct. 5362func (ppr *ProtectionPolicyResource) UnmarshalJSON(body []byte) error { 5363 var m map[string]*json.RawMessage 5364 err := json.Unmarshal(body, &m) 5365 if err != nil { 5366 return err 5367 } 5368 for k, v := range m { 5369 switch k { 5370 case "properties": 5371 if v != nil { 5372 properties, err := unmarshalBasicProtectionPolicy(*v) 5373 if err != nil { 5374 return err 5375 } 5376 ppr.Properties = properties 5377 } 5378 case "id": 5379 if v != nil { 5380 var ID string 5381 err = json.Unmarshal(*v, &ID) 5382 if err != nil { 5383 return err 5384 } 5385 ppr.ID = &ID 5386 } 5387 case "name": 5388 if v != nil { 5389 var name string 5390 err = json.Unmarshal(*v, &name) 5391 if err != nil { 5392 return err 5393 } 5394 ppr.Name = &name 5395 } 5396 case "type": 5397 if v != nil { 5398 var typeVar string 5399 err = json.Unmarshal(*v, &typeVar) 5400 if err != nil { 5401 return err 5402 } 5403 ppr.Type = &typeVar 5404 } 5405 case "location": 5406 if v != nil { 5407 var location string 5408 err = json.Unmarshal(*v, &location) 5409 if err != nil { 5410 return err 5411 } 5412 ppr.Location = &location 5413 } 5414 case "tags": 5415 if v != nil { 5416 var tags map[string]*string 5417 err = json.Unmarshal(*v, &tags) 5418 if err != nil { 5419 return err 5420 } 5421 ppr.Tags = tags 5422 } 5423 case "eTag": 5424 if v != nil { 5425 var eTag string 5426 err = json.Unmarshal(*v, &eTag) 5427 if err != nil { 5428 return err 5429 } 5430 ppr.ETag = &eTag 5431 } 5432 } 5433 } 5434 5435 return nil 5436} 5437 5438// ProtectionPolicyResourceList the list of ProtectionPolicy resources. 5439type ProtectionPolicyResourceList struct { 5440 autorest.Response `json:"-"` 5441 // Value - The list of resources. 5442 Value *[]ProtectionPolicyResource `json:"value,omitempty"` 5443 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 5444 NextLink *string `json:"nextLink,omitempty"` 5445} 5446 5447// BasicRecoveryPoint the base class for backup copies. Workload-specific backup copies are derived from this class. 5448type BasicRecoveryPoint interface { 5449 AsIaasVMRecoveryPoint() (*IaasVMRecoveryPoint, bool) 5450 AsGenericRecoveryPoint() (*GenericRecoveryPoint, bool) 5451 AsRecoveryPoint() (*RecoveryPoint, bool) 5452} 5453 5454// RecoveryPoint the base class for backup copies. Workload-specific backup copies are derived from this class. 5455type RecoveryPoint struct { 5456 // ObjectType - Possible values include: 'ObjectTypeRecoveryPoint', 'ObjectTypeIaasVMRecoveryPoint', 'ObjectTypeGenericRecoveryPoint' 5457 ObjectType ObjectTypeBasicRecoveryPoint `json:"objectType,omitempty"` 5458} 5459 5460func unmarshalBasicRecoveryPoint(body []byte) (BasicRecoveryPoint, error) { 5461 var m map[string]interface{} 5462 err := json.Unmarshal(body, &m) 5463 if err != nil { 5464 return nil, err 5465 } 5466 5467 switch m["objectType"] { 5468 case string(ObjectTypeIaasVMRecoveryPoint): 5469 var ivrp IaasVMRecoveryPoint 5470 err := json.Unmarshal(body, &ivrp) 5471 return ivrp, err 5472 case string(ObjectTypeGenericRecoveryPoint): 5473 var grp GenericRecoveryPoint 5474 err := json.Unmarshal(body, &grp) 5475 return grp, err 5476 default: 5477 var rp RecoveryPoint 5478 err := json.Unmarshal(body, &rp) 5479 return rp, err 5480 } 5481} 5482func unmarshalBasicRecoveryPointArray(body []byte) ([]BasicRecoveryPoint, error) { 5483 var rawMessages []*json.RawMessage 5484 err := json.Unmarshal(body, &rawMessages) 5485 if err != nil { 5486 return nil, err 5487 } 5488 5489 rpArray := make([]BasicRecoveryPoint, len(rawMessages)) 5490 5491 for index, rawMessage := range rawMessages { 5492 rp, err := unmarshalBasicRecoveryPoint(*rawMessage) 5493 if err != nil { 5494 return nil, err 5495 } 5496 rpArray[index] = rp 5497 } 5498 return rpArray, nil 5499} 5500 5501// MarshalJSON is the custom marshaler for RecoveryPoint. 5502func (rp RecoveryPoint) MarshalJSON() ([]byte, error) { 5503 rp.ObjectType = ObjectTypeRecoveryPoint 5504 objectMap := make(map[string]interface{}) 5505 if rp.ObjectType != "" { 5506 objectMap["objectType"] = rp.ObjectType 5507 } 5508 return json.Marshal(objectMap) 5509} 5510 5511// AsIaasVMRecoveryPoint is the BasicRecoveryPoint implementation for RecoveryPoint. 5512func (rp RecoveryPoint) AsIaasVMRecoveryPoint() (*IaasVMRecoveryPoint, bool) { 5513 return nil, false 5514} 5515 5516// AsGenericRecoveryPoint is the BasicRecoveryPoint implementation for RecoveryPoint. 5517func (rp RecoveryPoint) AsGenericRecoveryPoint() (*GenericRecoveryPoint, bool) { 5518 return nil, false 5519} 5520 5521// AsRecoveryPoint is the BasicRecoveryPoint implementation for RecoveryPoint. 5522func (rp RecoveryPoint) AsRecoveryPoint() (*RecoveryPoint, bool) { 5523 return &rp, true 5524} 5525 5526// AsBasicRecoveryPoint is the BasicRecoveryPoint implementation for RecoveryPoint. 5527func (rp RecoveryPoint) AsBasicRecoveryPoint() (BasicRecoveryPoint, bool) { 5528 return &rp, true 5529} 5530 5531// RecoveryPointResource the base class for backup copies. Workload-specific backup copies are derived from 5532// this class. 5533type RecoveryPointResource struct { 5534 autorest.Response `json:"-"` 5535 Properties BasicRecoveryPoint `json:"properties,omitempty"` 5536 // ID - Resource ID represents the complete path to the resource. 5537 ID *string `json:"id,omitempty"` 5538 // Name - Resource name associated with the resource. 5539 Name *string `json:"name,omitempty"` 5540 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 5541 Type *string `json:"type,omitempty"` 5542 // Location - Resource location. 5543 Location *string `json:"location,omitempty"` 5544 // Tags - Resource tags. 5545 Tags map[string]*string `json:"tags"` 5546 // ETag - Optional ETag. 5547 ETag *string `json:"eTag,omitempty"` 5548} 5549 5550// MarshalJSON is the custom marshaler for RecoveryPointResource. 5551func (rpr RecoveryPointResource) MarshalJSON() ([]byte, error) { 5552 objectMap := make(map[string]interface{}) 5553 objectMap["properties"] = rpr.Properties 5554 if rpr.ID != nil { 5555 objectMap["id"] = rpr.ID 5556 } 5557 if rpr.Name != nil { 5558 objectMap["name"] = rpr.Name 5559 } 5560 if rpr.Type != nil { 5561 objectMap["type"] = rpr.Type 5562 } 5563 if rpr.Location != nil { 5564 objectMap["location"] = rpr.Location 5565 } 5566 if rpr.Tags != nil { 5567 objectMap["tags"] = rpr.Tags 5568 } 5569 if rpr.ETag != nil { 5570 objectMap["eTag"] = rpr.ETag 5571 } 5572 return json.Marshal(objectMap) 5573} 5574 5575// UnmarshalJSON is the custom unmarshaler for RecoveryPointResource struct. 5576func (rpr *RecoveryPointResource) UnmarshalJSON(body []byte) error { 5577 var m map[string]*json.RawMessage 5578 err := json.Unmarshal(body, &m) 5579 if err != nil { 5580 return err 5581 } 5582 for k, v := range m { 5583 switch k { 5584 case "properties": 5585 if v != nil { 5586 properties, err := unmarshalBasicRecoveryPoint(*v) 5587 if err != nil { 5588 return err 5589 } 5590 rpr.Properties = properties 5591 } 5592 case "id": 5593 if v != nil { 5594 var ID string 5595 err = json.Unmarshal(*v, &ID) 5596 if err != nil { 5597 return err 5598 } 5599 rpr.ID = &ID 5600 } 5601 case "name": 5602 if v != nil { 5603 var name string 5604 err = json.Unmarshal(*v, &name) 5605 if err != nil { 5606 return err 5607 } 5608 rpr.Name = &name 5609 } 5610 case "type": 5611 if v != nil { 5612 var typeVar string 5613 err = json.Unmarshal(*v, &typeVar) 5614 if err != nil { 5615 return err 5616 } 5617 rpr.Type = &typeVar 5618 } 5619 case "location": 5620 if v != nil { 5621 var location string 5622 err = json.Unmarshal(*v, &location) 5623 if err != nil { 5624 return err 5625 } 5626 rpr.Location = &location 5627 } 5628 case "tags": 5629 if v != nil { 5630 var tags map[string]*string 5631 err = json.Unmarshal(*v, &tags) 5632 if err != nil { 5633 return err 5634 } 5635 rpr.Tags = tags 5636 } 5637 case "eTag": 5638 if v != nil { 5639 var eTag string 5640 err = json.Unmarshal(*v, &eTag) 5641 if err != nil { 5642 return err 5643 } 5644 rpr.ETag = &eTag 5645 } 5646 } 5647 } 5648 5649 return nil 5650} 5651 5652// RecoveryPointResourceList the list of RecoveryPoint resources. 5653type RecoveryPointResourceList struct { 5654 autorest.Response `json:"-"` 5655 // Value - The list of resources. 5656 Value *[]RecoveryPointResource `json:"value,omitempty"` 5657 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 5658 NextLink *string `json:"nextLink,omitempty"` 5659} 5660 5661// BasicRequest the base class for a backup request. Workload-specific backup requests are derived from this class. 5662type BasicRequest interface { 5663 AsIaasVMBackupRequest() (*IaasVMBackupRequest, bool) 5664 AsRequest() (*Request, bool) 5665} 5666 5667// Request the base class for a backup request. Workload-specific backup requests are derived from this class. 5668type Request struct { 5669 // ObjectType - Possible values include: 'ObjectTypeBackupRequest', 'ObjectTypeIaasVMBackupRequest' 5670 ObjectType ObjectTypeBasicRequest `json:"objectType,omitempty"` 5671} 5672 5673func unmarshalBasicRequest(body []byte) (BasicRequest, error) { 5674 var m map[string]interface{} 5675 err := json.Unmarshal(body, &m) 5676 if err != nil { 5677 return nil, err 5678 } 5679 5680 switch m["objectType"] { 5681 case string(ObjectTypeIaasVMBackupRequest): 5682 var ivbr IaasVMBackupRequest 5683 err := json.Unmarshal(body, &ivbr) 5684 return ivbr, err 5685 default: 5686 var r Request 5687 err := json.Unmarshal(body, &r) 5688 return r, err 5689 } 5690} 5691func unmarshalBasicRequestArray(body []byte) ([]BasicRequest, error) { 5692 var rawMessages []*json.RawMessage 5693 err := json.Unmarshal(body, &rawMessages) 5694 if err != nil { 5695 return nil, err 5696 } 5697 5698 rArray := make([]BasicRequest, len(rawMessages)) 5699 5700 for index, rawMessage := range rawMessages { 5701 r, err := unmarshalBasicRequest(*rawMessage) 5702 if err != nil { 5703 return nil, err 5704 } 5705 rArray[index] = r 5706 } 5707 return rArray, nil 5708} 5709 5710// MarshalJSON is the custom marshaler for Request. 5711func (r Request) MarshalJSON() ([]byte, error) { 5712 r.ObjectType = ObjectTypeBackupRequest 5713 objectMap := make(map[string]interface{}) 5714 if r.ObjectType != "" { 5715 objectMap["objectType"] = r.ObjectType 5716 } 5717 return json.Marshal(objectMap) 5718} 5719 5720// AsIaasVMBackupRequest is the BasicRequest implementation for Request. 5721func (r Request) AsIaasVMBackupRequest() (*IaasVMBackupRequest, bool) { 5722 return nil, false 5723} 5724 5725// AsRequest is the BasicRequest implementation for Request. 5726func (r Request) AsRequest() (*Request, bool) { 5727 return &r, true 5728} 5729 5730// AsBasicRequest is the BasicRequest implementation for Request. 5731func (r Request) AsBasicRequest() (BasicRequest, bool) { 5732 return &r, true 5733} 5734 5735// RequestResource base class for the backup request. Workload-specific backup requests are derived from 5736// this class. 5737type RequestResource struct { 5738 Properties BasicRequest `json:"properties,omitempty"` 5739 // ID - Resource ID represents the complete path to the resource. 5740 ID *string `json:"id,omitempty"` 5741 // Name - Resource name associated with the resource. 5742 Name *string `json:"name,omitempty"` 5743 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 5744 Type *string `json:"type,omitempty"` 5745 // Location - Resource location. 5746 Location *string `json:"location,omitempty"` 5747 // Tags - Resource tags. 5748 Tags map[string]*string `json:"tags"` 5749 // ETag - Optional ETag. 5750 ETag *string `json:"eTag,omitempty"` 5751} 5752 5753// MarshalJSON is the custom marshaler for RequestResource. 5754func (rr RequestResource) MarshalJSON() ([]byte, error) { 5755 objectMap := make(map[string]interface{}) 5756 objectMap["properties"] = rr.Properties 5757 if rr.ID != nil { 5758 objectMap["id"] = rr.ID 5759 } 5760 if rr.Name != nil { 5761 objectMap["name"] = rr.Name 5762 } 5763 if rr.Type != nil { 5764 objectMap["type"] = rr.Type 5765 } 5766 if rr.Location != nil { 5767 objectMap["location"] = rr.Location 5768 } 5769 if rr.Tags != nil { 5770 objectMap["tags"] = rr.Tags 5771 } 5772 if rr.ETag != nil { 5773 objectMap["eTag"] = rr.ETag 5774 } 5775 return json.Marshal(objectMap) 5776} 5777 5778// UnmarshalJSON is the custom unmarshaler for RequestResource struct. 5779func (rr *RequestResource) UnmarshalJSON(body []byte) error { 5780 var m map[string]*json.RawMessage 5781 err := json.Unmarshal(body, &m) 5782 if err != nil { 5783 return err 5784 } 5785 for k, v := range m { 5786 switch k { 5787 case "properties": 5788 if v != nil { 5789 properties, err := unmarshalBasicRequest(*v) 5790 if err != nil { 5791 return err 5792 } 5793 rr.Properties = properties 5794 } 5795 case "id": 5796 if v != nil { 5797 var ID string 5798 err = json.Unmarshal(*v, &ID) 5799 if err != nil { 5800 return err 5801 } 5802 rr.ID = &ID 5803 } 5804 case "name": 5805 if v != nil { 5806 var name string 5807 err = json.Unmarshal(*v, &name) 5808 if err != nil { 5809 return err 5810 } 5811 rr.Name = &name 5812 } 5813 case "type": 5814 if v != nil { 5815 var typeVar string 5816 err = json.Unmarshal(*v, &typeVar) 5817 if err != nil { 5818 return err 5819 } 5820 rr.Type = &typeVar 5821 } 5822 case "location": 5823 if v != nil { 5824 var location string 5825 err = json.Unmarshal(*v, &location) 5826 if err != nil { 5827 return err 5828 } 5829 rr.Location = &location 5830 } 5831 case "tags": 5832 if v != nil { 5833 var tags map[string]*string 5834 err = json.Unmarshal(*v, &tags) 5835 if err != nil { 5836 return err 5837 } 5838 rr.Tags = tags 5839 } 5840 case "eTag": 5841 if v != nil { 5842 var eTag string 5843 err = json.Unmarshal(*v, &eTag) 5844 if err != nil { 5845 return err 5846 } 5847 rr.ETag = &eTag 5848 } 5849 } 5850 } 5851 5852 return nil 5853} 5854 5855// Resource base for all resources. 5856type Resource struct { 5857 // ID - Resource ID represents the complete path to the resource. 5858 ID *string `json:"id,omitempty"` 5859 // Name - Resource name associated with the resource. 5860 Name *string `json:"name,omitempty"` 5861 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 5862 Type *string `json:"type,omitempty"` 5863 // Location - Resource location. 5864 Location *string `json:"location,omitempty"` 5865 // Tags - Resource tags. 5866 Tags map[string]*string `json:"tags"` 5867 // ETag - Optional ETag. 5868 ETag *string `json:"eTag,omitempty"` 5869} 5870 5871// MarshalJSON is the custom marshaler for Resource. 5872func (r Resource) MarshalJSON() ([]byte, error) { 5873 objectMap := make(map[string]interface{}) 5874 if r.ID != nil { 5875 objectMap["id"] = r.ID 5876 } 5877 if r.Name != nil { 5878 objectMap["name"] = r.Name 5879 } 5880 if r.Type != nil { 5881 objectMap["type"] = r.Type 5882 } 5883 if r.Location != nil { 5884 objectMap["location"] = r.Location 5885 } 5886 if r.Tags != nil { 5887 objectMap["tags"] = r.Tags 5888 } 5889 if r.ETag != nil { 5890 objectMap["eTag"] = r.ETag 5891 } 5892 return json.Marshal(objectMap) 5893} 5894 5895// ResourceList base for all lists of resources. 5896type ResourceList struct { 5897 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 5898 NextLink *string `json:"nextLink,omitempty"` 5899} 5900 5901// BasicRestoreRequest the base class for restore requests. Workload-specific restore requests are derived from this 5902// class. 5903type BasicRestoreRequest interface { 5904 AsIaasVMRestoreRequest() (*IaasVMRestoreRequest, bool) 5905 AsRestoreRequest() (*RestoreRequest, bool) 5906} 5907 5908// RestoreRequest the base class for restore requests. Workload-specific restore requests are derived from this 5909// class. 5910type RestoreRequest struct { 5911 // ObjectType - Possible values include: 'ObjectTypeRestoreRequest', 'ObjectTypeIaasVMRestoreRequest' 5912 ObjectType ObjectTypeBasicRestoreRequest `json:"objectType,omitempty"` 5913} 5914 5915func unmarshalBasicRestoreRequest(body []byte) (BasicRestoreRequest, error) { 5916 var m map[string]interface{} 5917 err := json.Unmarshal(body, &m) 5918 if err != nil { 5919 return nil, err 5920 } 5921 5922 switch m["objectType"] { 5923 case string(ObjectTypeIaasVMRestoreRequest): 5924 var ivrr IaasVMRestoreRequest 5925 err := json.Unmarshal(body, &ivrr) 5926 return ivrr, err 5927 default: 5928 var rr RestoreRequest 5929 err := json.Unmarshal(body, &rr) 5930 return rr, err 5931 } 5932} 5933func unmarshalBasicRestoreRequestArray(body []byte) ([]BasicRestoreRequest, error) { 5934 var rawMessages []*json.RawMessage 5935 err := json.Unmarshal(body, &rawMessages) 5936 if err != nil { 5937 return nil, err 5938 } 5939 5940 rrArray := make([]BasicRestoreRequest, len(rawMessages)) 5941 5942 for index, rawMessage := range rawMessages { 5943 rr, err := unmarshalBasicRestoreRequest(*rawMessage) 5944 if err != nil { 5945 return nil, err 5946 } 5947 rrArray[index] = rr 5948 } 5949 return rrArray, nil 5950} 5951 5952// MarshalJSON is the custom marshaler for RestoreRequest. 5953func (rr RestoreRequest) MarshalJSON() ([]byte, error) { 5954 rr.ObjectType = ObjectTypeRestoreRequest 5955 objectMap := make(map[string]interface{}) 5956 if rr.ObjectType != "" { 5957 objectMap["objectType"] = rr.ObjectType 5958 } 5959 return json.Marshal(objectMap) 5960} 5961 5962// AsIaasVMRestoreRequest is the BasicRestoreRequest implementation for RestoreRequest. 5963func (rr RestoreRequest) AsIaasVMRestoreRequest() (*IaasVMRestoreRequest, bool) { 5964 return nil, false 5965} 5966 5967// AsRestoreRequest is the BasicRestoreRequest implementation for RestoreRequest. 5968func (rr RestoreRequest) AsRestoreRequest() (*RestoreRequest, bool) { 5969 return &rr, true 5970} 5971 5972// AsBasicRestoreRequest is the BasicRestoreRequest implementation for RestoreRequest. 5973func (rr RestoreRequest) AsBasicRestoreRequest() (BasicRestoreRequest, bool) { 5974 return &rr, true 5975} 5976 5977// RestoreRequestResource the base class for a restore request. Workload-specific restore requests are 5978// derived from this class. 5979type RestoreRequestResource struct { 5980 Properties BasicRestoreRequest `json:"properties,omitempty"` 5981 // ID - Resource ID represents the complete path to the resource. 5982 ID *string `json:"id,omitempty"` 5983 // Name - Resource name associated with the resource. 5984 Name *string `json:"name,omitempty"` 5985 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 5986 Type *string `json:"type,omitempty"` 5987 // Location - Resource location. 5988 Location *string `json:"location,omitempty"` 5989 // Tags - Resource tags. 5990 Tags map[string]*string `json:"tags"` 5991 // ETag - Optional ETag. 5992 ETag *string `json:"eTag,omitempty"` 5993} 5994 5995// MarshalJSON is the custom marshaler for RestoreRequestResource. 5996func (rrr RestoreRequestResource) MarshalJSON() ([]byte, error) { 5997 objectMap := make(map[string]interface{}) 5998 objectMap["properties"] = rrr.Properties 5999 if rrr.ID != nil { 6000 objectMap["id"] = rrr.ID 6001 } 6002 if rrr.Name != nil { 6003 objectMap["name"] = rrr.Name 6004 } 6005 if rrr.Type != nil { 6006 objectMap["type"] = rrr.Type 6007 } 6008 if rrr.Location != nil { 6009 objectMap["location"] = rrr.Location 6010 } 6011 if rrr.Tags != nil { 6012 objectMap["tags"] = rrr.Tags 6013 } 6014 if rrr.ETag != nil { 6015 objectMap["eTag"] = rrr.ETag 6016 } 6017 return json.Marshal(objectMap) 6018} 6019 6020// UnmarshalJSON is the custom unmarshaler for RestoreRequestResource struct. 6021func (rrr *RestoreRequestResource) UnmarshalJSON(body []byte) error { 6022 var m map[string]*json.RawMessage 6023 err := json.Unmarshal(body, &m) 6024 if err != nil { 6025 return err 6026 } 6027 for k, v := range m { 6028 switch k { 6029 case "properties": 6030 if v != nil { 6031 properties, err := unmarshalBasicRestoreRequest(*v) 6032 if err != nil { 6033 return err 6034 } 6035 rrr.Properties = properties 6036 } 6037 case "id": 6038 if v != nil { 6039 var ID string 6040 err = json.Unmarshal(*v, &ID) 6041 if err != nil { 6042 return err 6043 } 6044 rrr.ID = &ID 6045 } 6046 case "name": 6047 if v != nil { 6048 var name string 6049 err = json.Unmarshal(*v, &name) 6050 if err != nil { 6051 return err 6052 } 6053 rrr.Name = &name 6054 } 6055 case "type": 6056 if v != nil { 6057 var typeVar string 6058 err = json.Unmarshal(*v, &typeVar) 6059 if err != nil { 6060 return err 6061 } 6062 rrr.Type = &typeVar 6063 } 6064 case "location": 6065 if v != nil { 6066 var location string 6067 err = json.Unmarshal(*v, &location) 6068 if err != nil { 6069 return err 6070 } 6071 rrr.Location = &location 6072 } 6073 case "tags": 6074 if v != nil { 6075 var tags map[string]*string 6076 err = json.Unmarshal(*v, &tags) 6077 if err != nil { 6078 return err 6079 } 6080 rrr.Tags = tags 6081 } 6082 case "eTag": 6083 if v != nil { 6084 var eTag string 6085 err = json.Unmarshal(*v, &eTag) 6086 if err != nil { 6087 return err 6088 } 6089 rrr.ETag = &eTag 6090 } 6091 } 6092 } 6093 6094 return nil 6095} 6096 6097// RetentionDuration retention duration. 6098type RetentionDuration struct { 6099 // Count - Count of the duration types. Retention duration is determined by the combining the Count times and durationType. 6100 // For example, if Count = 3 and durationType = Weeks, then the retention duration is three weeks. 6101 Count *int32 `json:"count,omitempty"` 6102 // DurationType - The retention duration type of the retention policy. Possible values include: 'RetentionDurationTypeInvalid', 'RetentionDurationTypeDays', 'RetentionDurationTypeWeeks', 'RetentionDurationTypeMonths', 'RetentionDurationTypeYears' 6103 DurationType RetentionDurationType `json:"durationType,omitempty"` 6104} 6105 6106// BasicRetentionPolicy the base class for retention policy. 6107type BasicRetentionPolicy interface { 6108 AsSimpleRetentionPolicy() (*SimpleRetentionPolicy, bool) 6109 AsLongTermRetentionPolicy() (*LongTermRetentionPolicy, bool) 6110 AsRetentionPolicy() (*RetentionPolicy, bool) 6111} 6112 6113// RetentionPolicy the base class for retention policy. 6114type RetentionPolicy struct { 6115 // RetentionPolicyType - Possible values include: 'RetentionPolicyTypeRetentionPolicy', 'RetentionPolicyTypeSimpleRetentionPolicy', 'RetentionPolicyTypeLongTermRetentionPolicy' 6116 RetentionPolicyType RetentionPolicyType `json:"retentionPolicyType,omitempty"` 6117} 6118 6119func unmarshalBasicRetentionPolicy(body []byte) (BasicRetentionPolicy, error) { 6120 var m map[string]interface{} 6121 err := json.Unmarshal(body, &m) 6122 if err != nil { 6123 return nil, err 6124 } 6125 6126 switch m["retentionPolicyType"] { 6127 case string(RetentionPolicyTypeSimpleRetentionPolicy): 6128 var srp SimpleRetentionPolicy 6129 err := json.Unmarshal(body, &srp) 6130 return srp, err 6131 case string(RetentionPolicyTypeLongTermRetentionPolicy): 6132 var ltrp LongTermRetentionPolicy 6133 err := json.Unmarshal(body, <rp) 6134 return ltrp, err 6135 default: 6136 var rp RetentionPolicy 6137 err := json.Unmarshal(body, &rp) 6138 return rp, err 6139 } 6140} 6141func unmarshalBasicRetentionPolicyArray(body []byte) ([]BasicRetentionPolicy, error) { 6142 var rawMessages []*json.RawMessage 6143 err := json.Unmarshal(body, &rawMessages) 6144 if err != nil { 6145 return nil, err 6146 } 6147 6148 rpArray := make([]BasicRetentionPolicy, len(rawMessages)) 6149 6150 for index, rawMessage := range rawMessages { 6151 rp, err := unmarshalBasicRetentionPolicy(*rawMessage) 6152 if err != nil { 6153 return nil, err 6154 } 6155 rpArray[index] = rp 6156 } 6157 return rpArray, nil 6158} 6159 6160// MarshalJSON is the custom marshaler for RetentionPolicy. 6161func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { 6162 rp.RetentionPolicyType = RetentionPolicyTypeRetentionPolicy 6163 objectMap := make(map[string]interface{}) 6164 if rp.RetentionPolicyType != "" { 6165 objectMap["retentionPolicyType"] = rp.RetentionPolicyType 6166 } 6167 return json.Marshal(objectMap) 6168} 6169 6170// AsSimpleRetentionPolicy is the BasicRetentionPolicy implementation for RetentionPolicy. 6171func (rp RetentionPolicy) AsSimpleRetentionPolicy() (*SimpleRetentionPolicy, bool) { 6172 return nil, false 6173} 6174 6175// AsLongTermRetentionPolicy is the BasicRetentionPolicy implementation for RetentionPolicy. 6176func (rp RetentionPolicy) AsLongTermRetentionPolicy() (*LongTermRetentionPolicy, bool) { 6177 return nil, false 6178} 6179 6180// AsRetentionPolicy is the BasicRetentionPolicy implementation for RetentionPolicy. 6181func (rp RetentionPolicy) AsRetentionPolicy() (*RetentionPolicy, bool) { 6182 return &rp, true 6183} 6184 6185// AsBasicRetentionPolicy is the BasicRetentionPolicy implementation for RetentionPolicy. 6186func (rp RetentionPolicy) AsBasicRetentionPolicy() (BasicRetentionPolicy, bool) { 6187 return &rp, true 6188} 6189 6190// BasicSchedulePolicy the base class for backup schedules. 6191type BasicSchedulePolicy interface { 6192 AsLongTermSchedulePolicy() (*LongTermSchedulePolicy, bool) 6193 AsSimpleSchedulePolicy() (*SimpleSchedulePolicy, bool) 6194 AsSchedulePolicy() (*SchedulePolicy, bool) 6195} 6196 6197// SchedulePolicy the base class for backup schedules. 6198type SchedulePolicy struct { 6199 // SchedulePolicyType - Possible values include: 'SchedulePolicyTypeSchedulePolicy', 'SchedulePolicyTypeLongTermSchedulePolicy', 'SchedulePolicyTypeSimpleSchedulePolicy' 6200 SchedulePolicyType SchedulePolicyType `json:"schedulePolicyType,omitempty"` 6201} 6202 6203func unmarshalBasicSchedulePolicy(body []byte) (BasicSchedulePolicy, error) { 6204 var m map[string]interface{} 6205 err := json.Unmarshal(body, &m) 6206 if err != nil { 6207 return nil, err 6208 } 6209 6210 switch m["schedulePolicyType"] { 6211 case string(SchedulePolicyTypeLongTermSchedulePolicy): 6212 var ltsp LongTermSchedulePolicy 6213 err := json.Unmarshal(body, <sp) 6214 return ltsp, err 6215 case string(SchedulePolicyTypeSimpleSchedulePolicy): 6216 var ssp SimpleSchedulePolicy 6217 err := json.Unmarshal(body, &ssp) 6218 return ssp, err 6219 default: 6220 var sp SchedulePolicy 6221 err := json.Unmarshal(body, &sp) 6222 return sp, err 6223 } 6224} 6225func unmarshalBasicSchedulePolicyArray(body []byte) ([]BasicSchedulePolicy, error) { 6226 var rawMessages []*json.RawMessage 6227 err := json.Unmarshal(body, &rawMessages) 6228 if err != nil { 6229 return nil, err 6230 } 6231 6232 spArray := make([]BasicSchedulePolicy, len(rawMessages)) 6233 6234 for index, rawMessage := range rawMessages { 6235 sp, err := unmarshalBasicSchedulePolicy(*rawMessage) 6236 if err != nil { 6237 return nil, err 6238 } 6239 spArray[index] = sp 6240 } 6241 return spArray, nil 6242} 6243 6244// MarshalJSON is the custom marshaler for SchedulePolicy. 6245func (sp SchedulePolicy) MarshalJSON() ([]byte, error) { 6246 sp.SchedulePolicyType = SchedulePolicyTypeSchedulePolicy 6247 objectMap := make(map[string]interface{}) 6248 if sp.SchedulePolicyType != "" { 6249 objectMap["schedulePolicyType"] = sp.SchedulePolicyType 6250 } 6251 return json.Marshal(objectMap) 6252} 6253 6254// AsLongTermSchedulePolicy is the BasicSchedulePolicy implementation for SchedulePolicy. 6255func (sp SchedulePolicy) AsLongTermSchedulePolicy() (*LongTermSchedulePolicy, bool) { 6256 return nil, false 6257} 6258 6259// AsSimpleSchedulePolicy is the BasicSchedulePolicy implementation for SchedulePolicy. 6260func (sp SchedulePolicy) AsSimpleSchedulePolicy() (*SimpleSchedulePolicy, bool) { 6261 return nil, false 6262} 6263 6264// AsSchedulePolicy is the BasicSchedulePolicy implementation for SchedulePolicy. 6265func (sp SchedulePolicy) AsSchedulePolicy() (*SchedulePolicy, bool) { 6266 return &sp, true 6267} 6268 6269// AsBasicSchedulePolicy is the BasicSchedulePolicy implementation for SchedulePolicy. 6270func (sp SchedulePolicy) AsBasicSchedulePolicy() (BasicSchedulePolicy, bool) { 6271 return &sp, true 6272} 6273 6274// SimpleRetentionPolicy simple policy retention. 6275type SimpleRetentionPolicy struct { 6276 // RetentionDuration - Retention duration of the protection policy. 6277 RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` 6278 // RetentionPolicyType - Possible values include: 'RetentionPolicyTypeRetentionPolicy', 'RetentionPolicyTypeSimpleRetentionPolicy', 'RetentionPolicyTypeLongTermRetentionPolicy' 6279 RetentionPolicyType RetentionPolicyType `json:"retentionPolicyType,omitempty"` 6280} 6281 6282// MarshalJSON is the custom marshaler for SimpleRetentionPolicy. 6283func (srp SimpleRetentionPolicy) MarshalJSON() ([]byte, error) { 6284 srp.RetentionPolicyType = RetentionPolicyTypeSimpleRetentionPolicy 6285 objectMap := make(map[string]interface{}) 6286 if srp.RetentionDuration != nil { 6287 objectMap["retentionDuration"] = srp.RetentionDuration 6288 } 6289 if srp.RetentionPolicyType != "" { 6290 objectMap["retentionPolicyType"] = srp.RetentionPolicyType 6291 } 6292 return json.Marshal(objectMap) 6293} 6294 6295// AsSimpleRetentionPolicy is the BasicRetentionPolicy implementation for SimpleRetentionPolicy. 6296func (srp SimpleRetentionPolicy) AsSimpleRetentionPolicy() (*SimpleRetentionPolicy, bool) { 6297 return &srp, true 6298} 6299 6300// AsLongTermRetentionPolicy is the BasicRetentionPolicy implementation for SimpleRetentionPolicy. 6301func (srp SimpleRetentionPolicy) AsLongTermRetentionPolicy() (*LongTermRetentionPolicy, bool) { 6302 return nil, false 6303} 6304 6305// AsRetentionPolicy is the BasicRetentionPolicy implementation for SimpleRetentionPolicy. 6306func (srp SimpleRetentionPolicy) AsRetentionPolicy() (*RetentionPolicy, bool) { 6307 return nil, false 6308} 6309 6310// AsBasicRetentionPolicy is the BasicRetentionPolicy implementation for SimpleRetentionPolicy. 6311func (srp SimpleRetentionPolicy) AsBasicRetentionPolicy() (BasicRetentionPolicy, bool) { 6312 return &srp, true 6313} 6314 6315// SimpleSchedulePolicy simple policy schedule. 6316type SimpleSchedulePolicy struct { 6317 // ScheduleRunFrequency - Defines the frequency interval (daily or weekly) for the schedule policy. Possible values include: 'ScheduleRunTypeInvalid', 'ScheduleRunTypeDaily', 'ScheduleRunTypeWeekly' 6318 ScheduleRunFrequency ScheduleRunType `json:"scheduleRunFrequency,omitempty"` 6319 // ScheduleRunDays - This list is the days of the week when the schedule runs. 6320 ScheduleRunDays *[]DayOfWeek `json:"scheduleRunDays,omitempty"` 6321 // ScheduleRunTimes - List of times, during a day, when the schedule runs. 6322 ScheduleRunTimes *[]date.Time `json:"scheduleRunTimes,omitempty"` 6323 // ScheduleWeeklyFrequency - The number of times per week the schedule runs. 6324 ScheduleWeeklyFrequency *int32 `json:"scheduleWeeklyFrequency,omitempty"` 6325 // SchedulePolicyType - Possible values include: 'SchedulePolicyTypeSchedulePolicy', 'SchedulePolicyTypeLongTermSchedulePolicy', 'SchedulePolicyTypeSimpleSchedulePolicy' 6326 SchedulePolicyType SchedulePolicyType `json:"schedulePolicyType,omitempty"` 6327} 6328 6329// MarshalJSON is the custom marshaler for SimpleSchedulePolicy. 6330func (ssp SimpleSchedulePolicy) MarshalJSON() ([]byte, error) { 6331 ssp.SchedulePolicyType = SchedulePolicyTypeSimpleSchedulePolicy 6332 objectMap := make(map[string]interface{}) 6333 if ssp.ScheduleRunFrequency != "" { 6334 objectMap["scheduleRunFrequency"] = ssp.ScheduleRunFrequency 6335 } 6336 if ssp.ScheduleRunDays != nil { 6337 objectMap["scheduleRunDays"] = ssp.ScheduleRunDays 6338 } 6339 if ssp.ScheduleRunTimes != nil { 6340 objectMap["scheduleRunTimes"] = ssp.ScheduleRunTimes 6341 } 6342 if ssp.ScheduleWeeklyFrequency != nil { 6343 objectMap["scheduleWeeklyFrequency"] = ssp.ScheduleWeeklyFrequency 6344 } 6345 if ssp.SchedulePolicyType != "" { 6346 objectMap["schedulePolicyType"] = ssp.SchedulePolicyType 6347 } 6348 return json.Marshal(objectMap) 6349} 6350 6351// AsLongTermSchedulePolicy is the BasicSchedulePolicy implementation for SimpleSchedulePolicy. 6352func (ssp SimpleSchedulePolicy) AsLongTermSchedulePolicy() (*LongTermSchedulePolicy, bool) { 6353 return nil, false 6354} 6355 6356// AsSimpleSchedulePolicy is the BasicSchedulePolicy implementation for SimpleSchedulePolicy. 6357func (ssp SimpleSchedulePolicy) AsSimpleSchedulePolicy() (*SimpleSchedulePolicy, bool) { 6358 return &ssp, true 6359} 6360 6361// AsSchedulePolicy is the BasicSchedulePolicy implementation for SimpleSchedulePolicy. 6362func (ssp SimpleSchedulePolicy) AsSchedulePolicy() (*SchedulePolicy, bool) { 6363 return nil, false 6364} 6365 6366// AsBasicSchedulePolicy is the BasicSchedulePolicy implementation for SimpleSchedulePolicy. 6367func (ssp SimpleSchedulePolicy) AsBasicSchedulePolicy() (BasicSchedulePolicy, bool) { 6368 return &ssp, true 6369} 6370 6371// WeeklyRetentionFormat weekly retention format. 6372type WeeklyRetentionFormat struct { 6373 // DaysOfTheWeek - List of days of the week. 6374 DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` 6375 // WeeksOfTheMonth - List of weeks of the month. 6376 WeeksOfTheMonth *[]WeekOfMonth `json:"weeksOfTheMonth,omitempty"` 6377} 6378 6379// WeeklyRetentionSchedule weekly retention schedule. 6380type WeeklyRetentionSchedule struct { 6381 // DaysOfTheWeek - List of the days of the week for the weekly retention policy. 6382 DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` 6383 // RetentionTimes - Retention times of the retention policy. 6384 RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` 6385 // RetentionDuration - Retention duration of retention policy. 6386 RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` 6387} 6388 6389// BasicWorkloadProtectableItem the base class for backup item. Workload-specific backup items are derived from this 6390// class. 6391type BasicWorkloadProtectableItem interface { 6392 AsIaaSVMProtectableItem() (*IaaSVMProtectableItem, bool) 6393 AsBasicIaaSVMProtectableItem() (BasicIaaSVMProtectableItem, bool) 6394 AsAzureIaaSComputeVMProtectableItem() (*AzureIaaSComputeVMProtectableItem, bool) 6395 AsAzureIaaSClassicComputeVMProtectableItem() (*AzureIaaSClassicComputeVMProtectableItem, bool) 6396 AsWorkloadProtectableItem() (*WorkloadProtectableItem, bool) 6397} 6398 6399// WorkloadProtectableItem the base class for backup item. Workload-specific backup items are derived from this 6400// class. 6401type WorkloadProtectableItem struct { 6402 // BackupManagementType - The backup management type. 6403 BackupManagementType *string `json:"backupManagementType,omitempty"` 6404 // FriendlyName - The friendly name of the backup item. 6405 FriendlyName *string `json:"friendlyName,omitempty"` 6406 // ProtectionState - The state of the back up item. Possible values include: 'ProtectionStatusInvalid', 'ProtectionStatusNotProtected', 'ProtectionStatusProtecting', 'ProtectionStatusProtected' 6407 ProtectionState ProtectionStatus `json:"protectionState,omitempty"` 6408 // ProtectableItemType - Possible values include: 'ProtectableItemTypeWorkloadProtectableItem', 'ProtectableItemTypeIaaSVMProtectableItem', 'ProtectableItemTypeMicrosoftComputevirtualMachines', 'ProtectableItemTypeMicrosoftClassicComputevirtualMachines' 6409 ProtectableItemType ProtectableItemType `json:"protectableItemType,omitempty"` 6410} 6411 6412func unmarshalBasicWorkloadProtectableItem(body []byte) (BasicWorkloadProtectableItem, error) { 6413 var m map[string]interface{} 6414 err := json.Unmarshal(body, &m) 6415 if err != nil { 6416 return nil, err 6417 } 6418 6419 switch m["protectableItemType"] { 6420 case string(ProtectableItemTypeIaaSVMProtectableItem): 6421 var ispi IaaSVMProtectableItem 6422 err := json.Unmarshal(body, &ispi) 6423 return ispi, err 6424 case string(ProtectableItemTypeMicrosoftComputevirtualMachines): 6425 var aiscvpi AzureIaaSComputeVMProtectableItem 6426 err := json.Unmarshal(body, &aiscvpi) 6427 return aiscvpi, err 6428 case string(ProtectableItemTypeMicrosoftClassicComputevirtualMachines): 6429 var aisccvpi AzureIaaSClassicComputeVMProtectableItem 6430 err := json.Unmarshal(body, &aisccvpi) 6431 return aisccvpi, err 6432 default: 6433 var wpi WorkloadProtectableItem 6434 err := json.Unmarshal(body, &wpi) 6435 return wpi, err 6436 } 6437} 6438func unmarshalBasicWorkloadProtectableItemArray(body []byte) ([]BasicWorkloadProtectableItem, error) { 6439 var rawMessages []*json.RawMessage 6440 err := json.Unmarshal(body, &rawMessages) 6441 if err != nil { 6442 return nil, err 6443 } 6444 6445 wpiArray := make([]BasicWorkloadProtectableItem, len(rawMessages)) 6446 6447 for index, rawMessage := range rawMessages { 6448 wpi, err := unmarshalBasicWorkloadProtectableItem(*rawMessage) 6449 if err != nil { 6450 return nil, err 6451 } 6452 wpiArray[index] = wpi 6453 } 6454 return wpiArray, nil 6455} 6456 6457// MarshalJSON is the custom marshaler for WorkloadProtectableItem. 6458func (wpi WorkloadProtectableItem) MarshalJSON() ([]byte, error) { 6459 wpi.ProtectableItemType = ProtectableItemTypeWorkloadProtectableItem 6460 objectMap := make(map[string]interface{}) 6461 if wpi.BackupManagementType != nil { 6462 objectMap["backupManagementType"] = wpi.BackupManagementType 6463 } 6464 if wpi.FriendlyName != nil { 6465 objectMap["friendlyName"] = wpi.FriendlyName 6466 } 6467 if wpi.ProtectionState != "" { 6468 objectMap["protectionState"] = wpi.ProtectionState 6469 } 6470 if wpi.ProtectableItemType != "" { 6471 objectMap["protectableItemType"] = wpi.ProtectableItemType 6472 } 6473 return json.Marshal(objectMap) 6474} 6475 6476// AsIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for WorkloadProtectableItem. 6477func (wpi WorkloadProtectableItem) AsIaaSVMProtectableItem() (*IaaSVMProtectableItem, bool) { 6478 return nil, false 6479} 6480 6481// AsBasicIaaSVMProtectableItem is the BasicWorkloadProtectableItem implementation for WorkloadProtectableItem. 6482func (wpi WorkloadProtectableItem) AsBasicIaaSVMProtectableItem() (BasicIaaSVMProtectableItem, bool) { 6483 return nil, false 6484} 6485 6486// AsAzureIaaSComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for WorkloadProtectableItem. 6487func (wpi WorkloadProtectableItem) AsAzureIaaSComputeVMProtectableItem() (*AzureIaaSComputeVMProtectableItem, bool) { 6488 return nil, false 6489} 6490 6491// AsAzureIaaSClassicComputeVMProtectableItem is the BasicWorkloadProtectableItem implementation for WorkloadProtectableItem. 6492func (wpi WorkloadProtectableItem) AsAzureIaaSClassicComputeVMProtectableItem() (*AzureIaaSClassicComputeVMProtectableItem, bool) { 6493 return nil, false 6494} 6495 6496// AsWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for WorkloadProtectableItem. 6497func (wpi WorkloadProtectableItem) AsWorkloadProtectableItem() (*WorkloadProtectableItem, bool) { 6498 return &wpi, true 6499} 6500 6501// AsBasicWorkloadProtectableItem is the BasicWorkloadProtectableItem implementation for WorkloadProtectableItem. 6502func (wpi WorkloadProtectableItem) AsBasicWorkloadProtectableItem() (BasicWorkloadProtectableItem, bool) { 6503 return &wpi, true 6504} 6505 6506// WorkloadProtectableItemResource the base class for the backup item. Workload-specific backup items are 6507// derived from this class. 6508type WorkloadProtectableItemResource struct { 6509 Properties BasicWorkloadProtectableItem `json:"properties,omitempty"` 6510 // ID - Resource ID represents the complete path to the resource. 6511 ID *string `json:"id,omitempty"` 6512 // Name - Resource name associated with the resource. 6513 Name *string `json:"name,omitempty"` 6514 // Type - Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... 6515 Type *string `json:"type,omitempty"` 6516 // Location - Resource location. 6517 Location *string `json:"location,omitempty"` 6518 // Tags - Resource tags. 6519 Tags map[string]*string `json:"tags"` 6520 // ETag - Optional ETag. 6521 ETag *string `json:"eTag,omitempty"` 6522} 6523 6524// MarshalJSON is the custom marshaler for WorkloadProtectableItemResource. 6525func (wpir WorkloadProtectableItemResource) MarshalJSON() ([]byte, error) { 6526 objectMap := make(map[string]interface{}) 6527 objectMap["properties"] = wpir.Properties 6528 if wpir.ID != nil { 6529 objectMap["id"] = wpir.ID 6530 } 6531 if wpir.Name != nil { 6532 objectMap["name"] = wpir.Name 6533 } 6534 if wpir.Type != nil { 6535 objectMap["type"] = wpir.Type 6536 } 6537 if wpir.Location != nil { 6538 objectMap["location"] = wpir.Location 6539 } 6540 if wpir.Tags != nil { 6541 objectMap["tags"] = wpir.Tags 6542 } 6543 if wpir.ETag != nil { 6544 objectMap["eTag"] = wpir.ETag 6545 } 6546 return json.Marshal(objectMap) 6547} 6548 6549// UnmarshalJSON is the custom unmarshaler for WorkloadProtectableItemResource struct. 6550func (wpir *WorkloadProtectableItemResource) UnmarshalJSON(body []byte) error { 6551 var m map[string]*json.RawMessage 6552 err := json.Unmarshal(body, &m) 6553 if err != nil { 6554 return err 6555 } 6556 for k, v := range m { 6557 switch k { 6558 case "properties": 6559 if v != nil { 6560 properties, err := unmarshalBasicWorkloadProtectableItem(*v) 6561 if err != nil { 6562 return err 6563 } 6564 wpir.Properties = properties 6565 } 6566 case "id": 6567 if v != nil { 6568 var ID string 6569 err = json.Unmarshal(*v, &ID) 6570 if err != nil { 6571 return err 6572 } 6573 wpir.ID = &ID 6574 } 6575 case "name": 6576 if v != nil { 6577 var name string 6578 err = json.Unmarshal(*v, &name) 6579 if err != nil { 6580 return err 6581 } 6582 wpir.Name = &name 6583 } 6584 case "type": 6585 if v != nil { 6586 var typeVar string 6587 err = json.Unmarshal(*v, &typeVar) 6588 if err != nil { 6589 return err 6590 } 6591 wpir.Type = &typeVar 6592 } 6593 case "location": 6594 if v != nil { 6595 var location string 6596 err = json.Unmarshal(*v, &location) 6597 if err != nil { 6598 return err 6599 } 6600 wpir.Location = &location 6601 } 6602 case "tags": 6603 if v != nil { 6604 var tags map[string]*string 6605 err = json.Unmarshal(*v, &tags) 6606 if err != nil { 6607 return err 6608 } 6609 wpir.Tags = tags 6610 } 6611 case "eTag": 6612 if v != nil { 6613 var eTag string 6614 err = json.Unmarshal(*v, &eTag) 6615 if err != nil { 6616 return err 6617 } 6618 wpir.ETag = &eTag 6619 } 6620 } 6621 } 6622 6623 return nil 6624} 6625 6626// WorkloadProtectableItemResourceList the list of WorkloadProtectableItem resources. 6627type WorkloadProtectableItemResourceList struct { 6628 autorest.Response `json:"-"` 6629 // Value - List of resources. 6630 Value *[]WorkloadProtectableItemResource `json:"value,omitempty"` 6631 // NextLink - The URI to GET the next page of resources. Call ListNext() gets the next page of resources. 6632 NextLink *string `json:"nextLink,omitempty"` 6633} 6634 6635// WorkloadProtectableItemResourceListIterator provides access to a complete listing of 6636// WorkloadProtectableItemResource values. 6637type WorkloadProtectableItemResourceListIterator struct { 6638 i int 6639 page WorkloadProtectableItemResourceListPage 6640} 6641 6642// NextWithContext advances to the next value. If there was an error making 6643// the request the iterator does not advance and the error is returned. 6644func (iter *WorkloadProtectableItemResourceListIterator) NextWithContext(ctx context.Context) (err error) { 6645 if tracing.IsEnabled() { 6646 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadProtectableItemResourceListIterator.NextWithContext") 6647 defer func() { 6648 sc := -1 6649 if iter.Response().Response.Response != nil { 6650 sc = iter.Response().Response.Response.StatusCode 6651 } 6652 tracing.EndSpan(ctx, sc, err) 6653 }() 6654 } 6655 iter.i++ 6656 if iter.i < len(iter.page.Values()) { 6657 return nil 6658 } 6659 err = iter.page.NextWithContext(ctx) 6660 if err != nil { 6661 iter.i-- 6662 return err 6663 } 6664 iter.i = 0 6665 return nil 6666} 6667 6668// Next advances to the next value. If there was an error making 6669// the request the iterator does not advance and the error is returned. 6670// Deprecated: Use NextWithContext() instead. 6671func (iter *WorkloadProtectableItemResourceListIterator) Next() error { 6672 return iter.NextWithContext(context.Background()) 6673} 6674 6675// NotDone returns true if the enumeration should be started or is not yet complete. 6676func (iter WorkloadProtectableItemResourceListIterator) NotDone() bool { 6677 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6678} 6679 6680// Response returns the raw server response from the last page request. 6681func (iter WorkloadProtectableItemResourceListIterator) Response() WorkloadProtectableItemResourceList { 6682 return iter.page.Response() 6683} 6684 6685// Value returns the current value or a zero-initialized value if the 6686// iterator has advanced beyond the end of the collection. 6687func (iter WorkloadProtectableItemResourceListIterator) Value() WorkloadProtectableItemResource { 6688 if !iter.page.NotDone() { 6689 return WorkloadProtectableItemResource{} 6690 } 6691 return iter.page.Values()[iter.i] 6692} 6693 6694// Creates a new instance of the WorkloadProtectableItemResourceListIterator type. 6695func NewWorkloadProtectableItemResourceListIterator(page WorkloadProtectableItemResourceListPage) WorkloadProtectableItemResourceListIterator { 6696 return WorkloadProtectableItemResourceListIterator{page: page} 6697} 6698 6699// IsEmpty returns true if the ListResult contains no values. 6700func (wpirl WorkloadProtectableItemResourceList) IsEmpty() bool { 6701 return wpirl.Value == nil || len(*wpirl.Value) == 0 6702} 6703 6704// hasNextLink returns true if the NextLink is not empty. 6705func (wpirl WorkloadProtectableItemResourceList) hasNextLink() bool { 6706 return wpirl.NextLink != nil && len(*wpirl.NextLink) != 0 6707} 6708 6709// workloadProtectableItemResourceListPreparer prepares a request to retrieve the next set of results. 6710// It returns nil if no more results exist. 6711func (wpirl WorkloadProtectableItemResourceList) workloadProtectableItemResourceListPreparer(ctx context.Context) (*http.Request, error) { 6712 if !wpirl.hasNextLink() { 6713 return nil, nil 6714 } 6715 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6716 autorest.AsJSON(), 6717 autorest.AsGet(), 6718 autorest.WithBaseURL(to.String(wpirl.NextLink))) 6719} 6720 6721// WorkloadProtectableItemResourceListPage contains a page of WorkloadProtectableItemResource values. 6722type WorkloadProtectableItemResourceListPage struct { 6723 fn func(context.Context, WorkloadProtectableItemResourceList) (WorkloadProtectableItemResourceList, error) 6724 wpirl WorkloadProtectableItemResourceList 6725} 6726 6727// NextWithContext advances to the next page of values. If there was an error making 6728// the request the page does not advance and the error is returned. 6729func (page *WorkloadProtectableItemResourceListPage) NextWithContext(ctx context.Context) (err error) { 6730 if tracing.IsEnabled() { 6731 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadProtectableItemResourceListPage.NextWithContext") 6732 defer func() { 6733 sc := -1 6734 if page.Response().Response.Response != nil { 6735 sc = page.Response().Response.Response.StatusCode 6736 } 6737 tracing.EndSpan(ctx, sc, err) 6738 }() 6739 } 6740 for { 6741 next, err := page.fn(ctx, page.wpirl) 6742 if err != nil { 6743 return err 6744 } 6745 page.wpirl = next 6746 if !next.hasNextLink() || !next.IsEmpty() { 6747 break 6748 } 6749 } 6750 return nil 6751} 6752 6753// Next advances to the next page of values. If there was an error making 6754// the request the page does not advance and the error is returned. 6755// Deprecated: Use NextWithContext() instead. 6756func (page *WorkloadProtectableItemResourceListPage) Next() error { 6757 return page.NextWithContext(context.Background()) 6758} 6759 6760// NotDone returns true if the page enumeration should be started or is not yet complete. 6761func (page WorkloadProtectableItemResourceListPage) NotDone() bool { 6762 return !page.wpirl.IsEmpty() 6763} 6764 6765// Response returns the raw server response from the last page request. 6766func (page WorkloadProtectableItemResourceListPage) Response() WorkloadProtectableItemResourceList { 6767 return page.wpirl 6768} 6769 6770// Values returns the slice of values for the current page or nil if there are no values. 6771func (page WorkloadProtectableItemResourceListPage) Values() []WorkloadProtectableItemResource { 6772 if page.wpirl.IsEmpty() { 6773 return nil 6774 } 6775 return *page.wpirl.Value 6776} 6777 6778// Creates a new instance of the WorkloadProtectableItemResourceListPage type. 6779func NewWorkloadProtectableItemResourceListPage(cur WorkloadProtectableItemResourceList, getNextPage func(context.Context, WorkloadProtectableItemResourceList) (WorkloadProtectableItemResourceList, error)) WorkloadProtectableItemResourceListPage { 6780 return WorkloadProtectableItemResourceListPage{ 6781 fn: getNextPage, 6782 wpirl: cur, 6783 } 6784} 6785 6786// YearlyRetentionSchedule yearly retention schedule. 6787type YearlyRetentionSchedule struct { 6788 // RetentionScheduleFormatType - Retention schedule format for the yearly retention policy. Possible values include: 'RetentionScheduleFormatInvalid', 'RetentionScheduleFormatDaily', 'RetentionScheduleFormatWeekly' 6789 RetentionScheduleFormatType RetentionScheduleFormat `json:"retentionScheduleFormatType,omitempty"` 6790 // MonthsOfYear - List of the months of year for the yearly retention policy. 6791 MonthsOfYear *[]MonthOfYear `json:"monthsOfYear,omitempty"` 6792 // RetentionScheduleDaily - Daily retention format for the yearly retention policy. 6793 RetentionScheduleDaily *DailyRetentionFormat `json:"retentionScheduleDaily,omitempty"` 6794 // RetentionScheduleWeekly - Weekly retention format for the yearly retention policy. 6795 RetentionScheduleWeekly *WeeklyRetentionFormat `json:"retentionScheduleWeekly,omitempty"` 6796 // RetentionTimes - Retention times for the retention policy. 6797 RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` 6798 // RetentionDuration - Retention duration for the retention policy. 6799 RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` 6800} 6801