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

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.resourcemanager.dataprotection.models.BackupInstance;
import com.azure.resourcemanager.dataprotection.models.Datasource;
import com.azure.resourcemanager.dataprotection.models.DatasourceSet;
import com.azure.resourcemanager.dataprotection.models.PolicyInfo;
import com.azure.resourcemanager.dataprotection.models.SecretStoreBasedAuthCredentials;
import com.azure.resourcemanager.dataprotection.models.SecretStoreResource;
import com.azure.resourcemanager.dataprotection.models.SecretStoreType;
import com.azure.resourcemanager.dataprotection.models.ValidateForBackupRequest;

/** Samples for BackupInstances ValidateForBackup. */
public final class BackupInstancesValidateForBackupSamples {
    /*
     * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-01-01/examples/BackupInstanceOperations/ValidateForBackup.json
     */
    /**
     * Sample code: Validate For Backup.
     *
     * @param manager Entry point to DataProtectionManager.
     */
    public static void validateForBackup(com.azure.resourcemanager.dataprotection.DataProtectionManager manager) {
        manager
            .backupInstances()
            .validateForBackup(
                "000pikumar",
                "PratikPrivatePreviewVault1",
                new ValidateForBackupRequest()
                    .withBackupInstance(
                        new BackupInstance()
                            .withFriendlyName("harshitbi2")
                            .withDataSourceInfo(
                                new Datasource()
                                    .withDatasourceType("OssDB")
                                    .withObjectType("Datasource")
                                    .withResourceId(
                                        "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb")
                                    .withResourceLocation("")
                                    .withResourceName("testdb")
                                    .withResourceType("Microsoft.DBforPostgreSQL/servers/databases")
                                    .withResourceUri(""))
                            .withDataSourceSetInfo(
                                new DatasourceSet()
                                    .withDatasourceType("OssDB")
                                    .withObjectType("DatasourceSet")
                                    .withResourceId(
                                        "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest")
                                    .withResourceLocation("")
                                    .withResourceName("viveksipgtest")
                                    .withResourceType("Microsoft.DBforPostgreSQL/servers")
                                    .withResourceUri(""))
                            .withPolicyInfo(
                                new PolicyInfo()
                                    .withPolicyId(
                                        "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1"))
                            .withDatasourceAuthCredentials(
                                new SecretStoreBasedAuthCredentials()
                                    .withSecretStoreResource(
                                        new SecretStoreResource()
                                            .withUri("https://samplevault.vault.azure.net/secrets/credentials")
                                            .withSecretStoreType(SecretStoreType.AZURE_KEY_VAULT)))
                            .withObjectType("BackupInstance")),
                com.azure.core.util.Context.NONE);
    }
}
