// 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.DatabaseLicenseType;
import com.azure.resourcemanager.sql.models.DatabaseUpdate;
import com.azure.resourcemanager.sql.models.Sku;

/** Samples for Databases Update. */
public final class DatabasesUpdateSamples {
    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json
     */
    /**
     * Sample code: Assigns maintenance window to a database.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void assignsMaintenanceWindowToADatabase(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabases()
            .update(
                "Default-SQL-SouthEastAsia",
                "testsvr",
                "testdb",
                new DatabaseUpdate()
                    .withSku(new Sku().withName("BC_Gen5_4"))
                    .withMaintenanceConfigurationId(
                        "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1"),
                Context.NONE);
    }

    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json
     */
    /**
     * Sample code: Resets maintenance window of a database to default.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void resetsMaintenanceWindowOfADatabaseToDefault(
        com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabases()
            .update(
                "Default-SQL-SouthEastAsia",
                "testsvr",
                "testdb",
                new DatabaseUpdate()
                    .withSku(new Sku().withName("BC_Gen5_4"))
                    .withMaintenanceConfigurationId(
                        "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"),
                Context.NONE);
    }

    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/PatchVCoreDatabase.json
     */
    /**
     * Sample code: Updates a database.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void updatesADatabase(com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getDatabases()
            .update(
                "Default-SQL-SouthEastAsia",
                "testsvr",
                "testdb",
                new DatabaseUpdate()
                    .withSku(new Sku().withName("BC_Gen4_4"))
                    .withMaxSizeBytes(1073741824L)
                    .withLicenseType(DatabaseLicenseType.LICENSE_INCLUDED),
                Context.NONE);
    }
}
