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