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

package com.azure.resourcemanager.sql.generated;

import com.azure.core.util.Context;
import com.azure.resourcemanager.sql.models.DatabaseExtensions;
import com.azure.resourcemanager.sql.models.OperationMode;
import com.azure.resourcemanager.sql.models.StorageKeyType;

/** Samples for DatabaseExtensionsOperation CreateOrUpdate. */
public final class DatabaseExtensionsOperationCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/ImportDatabaseUsingDatabaseExtensions.json
     */
    /**
     * Sample code: Import database using database extension.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void importDatabaseUsingDatabaseExtension(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabaseExtensionsOperations()
            .createOrUpdate(
                "rg_062866bf-c4f4-41f9-abf0-b59132ca7924",
                "srv_2d6be2d2-26c8-4930-8fb6-82a5e95e0e82",
                "db_2a47e946-e414-4c00-94ac-ed886bb78302",
                "Import",
                new DatabaseExtensions()
                    .withOperationMode(OperationMode.IMPORT)
                    .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY)
                    .withStorageKey("fakeTokenPlaceholder")
                    .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml")
                    .withAdministratorLogin("login")
                    .withAdministratorLoginPassword("fakeTokenPlaceholder")
                    .withAuthenticationType("Sql"),
                Context.NONE);
    }

    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/ExportDatabaseUsingDatabaseExtensions.json
     */
    /**
     * Sample code: Export database using database extension.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void exportDatabaseUsingDatabaseExtension(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabaseExtensionsOperations()
            .createOrUpdate(
                "rg_d1ef9eae-044d-4710-ba59-b82e84ad3157",
                "srv_9243d320-ac4e-4f97-8e06-b1167dae5f4c",
                "db_7fe424c8-23cf-4ac3-bdc3-e21f424bdb68",
                "Export",
                new DatabaseExtensions()
                    .withOperationMode(OperationMode.EXPORT)
                    .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY)
                    .withStorageKey("fakeTokenPlaceholder")
                    .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml")
                    .withAdministratorLogin("login")
                    .withAdministratorLoginPassword("fakeTokenPlaceholder")
                    .withAuthenticationType("Sql"),
                Context.NONE);
    }

    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/CreateOrUpdateDatabaseExtensions.json
     */
    /**
     * Sample code: Create or Update database extensions.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void createOrUpdateDatabaseExtensions(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabaseExtensionsOperations()
            .createOrUpdate(
                "rg_20cbe0f0-c2d9-4522-9177-5469aad53029",
                "srv_1ffd1cf8-9951-47fb-807d-a9c384763849",
                "878e303f-1ea0-4f17-aa3d-a22ac5e9da08",
                "polybaseimport",
                new DatabaseExtensions()
                    .withOperationMode(OperationMode.POLYBASE_IMPORT)
                    .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY)
                    .withStorageKey("fakeTokenPlaceholder")
                    .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml"),
                Context.NONE);
    }
}
