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

package com.azure.analytics.purview.scanning.generated;

import com.azure.analytics.purview.scanning.PurviewScanningClientBuilder;
import com.azure.analytics.purview.scanning.ScansClient;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
import com.azure.identity.DefaultAzureCredentialBuilder;

public class ScansCreateOrUpdate {
    public static void main(String[] args) {
        ScansClient scansClient =
                new PurviewScanningClientBuilder()
                        .credential(new DefaultAzureCredentialBuilder().build())
                        .endpoint("{Endpoint}")
                        .buildScansClient();
        // BEGIN:com.azure.analytics.purview.scanning.generated.scanscreateorupdate.scanscreateorupdate
        BinaryData body =
                BinaryData.fromString(
                        "{\"kind\":\"AzureStorageCredential\",\"properties\":{\"collection\":{\"type\":\"CollectionReference\",\"referenceName\":\"Collection-rZX\"},\"connectedVia\":null,\"credential\":{\"credentialType\":\"AccountKey\",\"referenceName\":\"CredentialAKV\"},\"scanRulesetName\":\"AzureStorage\",\"scanRulesetType\":\"System\"}}");
        RequestOptions requestOptions = new RequestOptions();
        Response<BinaryData> response =
                scansClient.createOrUpdateWithResponse("myDataSource", "myScanName", body, requestOptions);
        // END:com.azure.analytics.purview.scanning.generated.scanscreateorupdate.scanscreateorupdate
    }
}
