// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.recoveryservicessiterecovery.generated;

import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationInputProperties;
import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtDiskInput;
import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtEnableMigrationInput;
import java.util.Arrays;

/** Samples for ReplicationMigrationItems Create. */
public final class ReplicationMigrationItemsCreateSamples {
    /*
     * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Create.json
     */
    /**
     * Sample code: Enables migration.
     *
     * @param manager Entry point to SiteRecoveryManager.
     */
    public static void enablesMigration(
        com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager manager) {
        manager
            .replicationMigrationItems()
            .define("virtualmachine1")
            .withExistingReplicationProtectionContainer(
                "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1")
            .withProperties(
                new EnableMigrationInputProperties()
                    .withPolicyId(
                        "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1")
                    .withProviderSpecificDetails(
                        new VMwareCbtEnableMigrationInput()
                            .withVmwareMachineId(
                                "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.OffAzure/VMwareSites/vmwaresite1/machines/virtualmachine1")
                            .withDisksToInclude(
                                Arrays
                                    .asList(
                                        new VMwareCbtDiskInput()
                                            .withDiskId("disk1")
                                            .withIsOSDisk("true")
                                            .withLogStorageAccountId(
                                                "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.Storage/storageAccounts/logStorageAccount1")
                                            .withLogStorageAccountSasSecretName("fakeTokenPlaceholder")))
                            .withDataMoverRunAsAccountId(
                                "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.OffAzure/VMwareSites/vmwaresite1/runasaccounts/dataMoverRunAsAccount1")
                            .withSnapshotRunAsAccountId(
                                "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.OffAzure/VMwareSites/vmwaresite1/runasaccounts/snapshotRunAsAccount1")
                            .withTargetResourceGroupId(
                                "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1")
                            .withTargetNetworkId(
                                "/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.Network/virtualNetworks/virtualNetwork1")))
            .create();
    }
}
