text: /*
   * Copyright (c) Microsoft Corporation.
   * Licensed under the MIT License.
   *
   * Code generated by Microsoft (R) AutoRest Code Generator.
   * Changes may cause incorrect behavior and will be lost if the code is regenerated.
   */
  
  // Copyright (c) Microsoft Corporation.
  // Licensed under the MIT License.
  /**
   * This sample demonstrates how to Restores the specified backed up data. This is an asynchronous operation. To know the status of this API call, use
  GetProtectedItemOperationResult API.
   *
   * @summary Restores the specified backed up data. This is an asynchronous operation. To know the status of this API call, use
  GetProtectedItemOperationResult API.
   * x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-10-01/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json
   */
  const { RecoveryServicesBackupClient } = require("@azure/arm-recoveryservicesbackup");
  const { DefaultAzureCredential } = require("@azure/identity");
  
  async function restoreDisksWithIaasVMRestoreWithRehydrationRequest() {
    const subscriptionId = "00000000-0000-0000-0000-000000000000";
    const vaultName = "testVault";
    const resourceGroupName = "netsdktestrg";
    const fabricName = "Azure";
    const containerName = "IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1";
    const protectedItemName = "VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1";
    const recoveryPointId = "348916168024334";
    const parameters = {
      properties: {
        createNewCloudService: true,
        encryptionDetails: { encryptionEnabled: false },
        objectType: "IaasVMRestoreWithRehydrationRequest",
        originalStorageAccountOption: false,
        recoveryPointId: "348916168024334",
        recoveryPointRehydrationInfo: {
          rehydrationPriority: "Standard",
          rehydrationRetentionDuration: "P7D",
        },
        recoveryType: "RestoreDisks",
        region: "southeastasia",
        sourceResourceId:
          "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1",
        storageAccountId:
          "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount",
      },
    };
    const credential = new DefaultAzureCredential();
    const client = new RecoveryServicesBackupClient(credential, subscriptionId);
    const result = await client.restores.beginTriggerAndWait(
      vaultName,
      resourceGroupName,
      fabricName,
      containerName,
      protectedItemName,
      recoveryPointId,
      parameters
    );
    console.log(result);
  }
  
  restoreDisksWithIaasVMRestoreWithRehydrationRequest().catch(console.error);
  