// 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.fluent.models.ServerVulnerabilityAssessmentInner;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentName;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentRecurringScansProperties;
import java.util.Arrays;

/** Samples for ServerVulnerabilityAssessments CreateOrUpdate. */
public final class ServerVulnerabilityAssessmentsCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/ServerVulnerabilityAssessmentCreateMax.json
     */
    /**
     * Sample code: Create a server's vulnerability assessment with all parameters.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void createAServerSVulnerabilityAssessmentWithAllParameters(
        com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getServerVulnerabilityAssessments()
            .createOrUpdateWithResponse(
                "vulnerabilityaseessmenttest-4799",
                "vulnerabilityaseessmenttest-6440",
                VulnerabilityAssessmentName.DEFAULT,
                new ServerVulnerabilityAssessmentInner()
                    .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/")
                    .withStorageContainerSasKey("fakeTokenPlaceholder")
                    .withStorageAccountAccessKey("fakeTokenPlaceholder")
                    .withRecurringScans(
                        new VulnerabilityAssessmentRecurringScansProperties()
                            .withIsEnabled(true)
                            .withEmailSubscriptionAdmins(true)
                            .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))),
                Context.NONE);
    }

    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json
     */
    /**
     * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is
     * specified.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified(
        com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getServerVulnerabilityAssessments()
            .createOrUpdateWithResponse(
                "vulnerabilityaseessmenttest-4799",
                "vulnerabilityaseessmenttest-6440",
                VulnerabilityAssessmentName.DEFAULT,
                new ServerVulnerabilityAssessmentInner()
                    .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/")
                    .withStorageAccountAccessKey("fakeTokenPlaceholder"),
                Context.NONE);
    }

    /*
     * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2021-11-01/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json
     */
    /**
     * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is
     * specified.
     *
     * @param azure The entry point for accessing resource management APIs in Azure.
     */
    public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified(
        com.azure.resourcemanager.AzureResourceManager azure) {
        azure
            .sqlServers()
            .manager()
            .serviceClient()
            .getServerVulnerabilityAssessments()
            .createOrUpdateWithResponse(
                "vulnerabilityaseessmenttest-4799",
                "vulnerabilityaseessmenttest-6440",
                VulnerabilityAssessmentName.DEFAULT,
                new ServerVulnerabilityAssessmentInner()
                    .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/")
                    .withStorageContainerSasKey("fakeTokenPlaceholder"),
                Context.NONE);
    }
}
