// 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.administration.generated;

import com.azure.analytics.purview.administration.ResourceSetRulesClient;
import com.azure.analytics.purview.administration.ResourceSetRulesClientBuilder;
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 ResourceSetRulesCreateOrUpdateResourceSetRule {
    public static void main(String[] args) {
        ResourceSetRulesClient resourceSetRulesClient =
                new ResourceSetRulesClientBuilder()
                        .credential(new DefaultAzureCredentialBuilder().build())
                        .endpoint("{endpoint}")
                        .buildClient();
        // BEGIN:com.azure.analytics.purview.administration.generated.resourcesetrulescreateorupdateresourcesetrule.resourcesetrulescreateorupdateresourcesetrule
        BinaryData resourceSetRuleConfig =
                BinaryData.fromString(
                        "{\"advancedResourceSet\":{\"resourceSetProcessing\":\"Default\"},\"pathPatternConfig\":{\"acceptedPatterns\":[],\"complexReplacers\":[{\"name\":\"SparkPath\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"typeName\":\"Microsoft.DataMap.PathPattern.SparkPathReplacer\"}],\"createdBy\":\"AzureDataCatalog\",\"enableDefaultPatterns\":true,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regexReplacers\":[{\"name\":\"Guid\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minHex\":32,\"options\":9,\"regexStr\":\"([0-9A-F]{32}|[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\"},\"replaceWith\":\"{GUID}\"},{\"name\":\"Number\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":1,\"options\":8,\"regexStr\":\"^\\\\d+$\"},\"replaceWith\":\"{N}\"},{\"name\":\"yyyy-mm-ddThh-MM-ss\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":12,\"options\":8,\"regexStr\":\"(20)[1-9][0-9]([-\\\\._@]?)(0[1-9]|1[012])([-\\\\._@]?)(0[1-9]|[12][0-9]|3[01])([T])(2[0-3]|[01]?[0-9])([-\\\\._@]?)([0-5][0-9])([-\\\\._@]?)([0-5][0-9])(Z)?\"},\"replaceWith\":\"{N}$2{N}$4{N}$6{N}$8{N}$10{N}$12\"},{\"name\":\"yyyy-mm-ddThh\",\"description\":null,\"condition\":\"ApplyToNonFileName\",\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":8,\"options\":8,\"regexStr\":\"(20)[1-9][0-9]([-\\\\._@]?)(0[1-9]|1[012])([-\\\\._@]?)(0[1-9]|[12][0-9]|3[01])([T])(2[0-3]|[01]?[0-9])(Z)?\"},\"replaceWith\":\"{N}$2{N}$4{N}$6{N}$8\"},{\"name\":\"yyyy-mm-ddZ\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":6,\"options\":8,\"regexStr\":\"(20)[1-9][0-9]([-\\\\._@]?)(0[1-9]|1[012])([-\\\\._@]?)(0[1-9]|[12][0-9]|3[01])(Z)\"},\"replaceWith\":\"{N}$2{N}$4{N}$6\"},{\"name\":\"yyyy-mm-dd-hhZ\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":8,\"options\":8,\"regexStr\":\"(20)[1-9][0-9]([-\\\\._@]?)(0[1-9]|1[012])([-\\\\._@]?)(0[1-9]|[12][0-9]|3[01])([-\\\\._@]?)(2[0-3]|[01]?[0-9])(Z)\"},\"replaceWith\":\"{N}$2{N}$4{N}$6{N}$8\"},{\"name\":\"NumberBetweenDelimiter\",\"description\":null,\"condition\":\"ApplyToFileNameOrNonVersionString\",\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"doNotReplaceRegex\":{\"minDigits\":1,\"minLetters\":1,\"options\":9,\"regexStr\":\"(?<=[-\\\\._@]|^)[v](\\\\d+)[\\\\.](\\\\d+)[\\\\.]?(\\\\d+)?(?=[-\\\\._@]|$)\"},\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":1,\"options\":8,\"regexStr\":\"(?<=[-\\\\._@])([\\\\d]+)(?=[-\\\\._@])|^(\\\\d+)(?=[-\\\\._@])|(?<=[-\\\\._@])(\\\\d+)$\"},\"replaceWith\":\"{N}\"},{\"name\":\"4ByteHex\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"doNotReplaceRegex\":{\"minDigits\":1,\"minLetters\":1,\"options\":9,\"regexStr\":\"(?<=[-\\\\._@]|^)[v](\\\\d+)[\\\\.](\\\\d+)[\\\\.]?(\\\\d+)?(?=[-\\\\._@]|$)\"},\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigitsOrLetters\":8,\"options\":9,\"regexStr\":\"(?<=[-\\\\._@]|^)([0-9A-F]{8,16})(?=[-\\\\._@]|$)\"},\"replaceWith\":\"{HEX}\"},{\"name\":\"NumberInFile\",\"description\":null,\"condition\":\"ApplyToFileName\",\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"doNotReplaceRegex\":{\"minDigits\":1,\"minLetters\":1,\"options\":9,\"regexStr\":\"(?<=[-\\\\._@]|^)[v](\\\\d+)[\\\\.](\\\\d+)[\\\\.]?(\\\\d+)?(?=[-\\\\._@]|$)\"},\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDigits\":1,\"options\":8,\"regexStr\":\"(\\\\d+)\"},\"replaceWith\":\"{N}\"},{\"name\":\"Localization(DashSeparated)\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minDashes\":1,\"minLetters\":4,\"options\":9,\"regexStr\":\"(?<=[-\\\\._@]|^)(ar-eg|ar-sa|cy-gb|da-dk|de-at|de-ch|de-de|en-au|en-ca|en-gb|en-ie|en-in|en-my|en-nz|en-ph|en-sg|en-us|en-ww|en-xa|en-za|es-ar|es-cl|es-es|es-mx|es-us|es-xl|fi-fi|fr-be|fr-ca|fr-ch|fr-fr|gu-in|hi-in|id-id|it-it|ja-jp|nb-no|nl-nl|nl-be|pt-br|pt-pt|pl-pl|ru-ru|sv-se|ta-in|te-in|zh-cn|zh-hk|zh-tw|ko-kr|tr-tr)(?=[-\\\\._@]|$)\"},\"replaceWith\":\"{LOC}\"},{\"name\":\"Localization(UnderscoreSeparated)\",\"description\":null,\"createdBy\":\"AzureDataCatalog\",\"disabled\":false,\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\",\"regex\":{\"minLetters\":4,\"minUnderscores\":1,\"options\":9,\"regexStr\":\"(?<=[-\\\\._@]|^)(ar_eg|ar_sa|cy_gb|da_dk|de_at|de_ch|de_de|en_au|en_ca|en_gb|en_ie|en_in|en_my|en_nz|en_ph|en_sg|en_us|en_ww|en_xa|en_za|es_ar|es_cl|es_es|es_mx|es_us|es_xl|fi_fi|fr_be|fr_ca|fr_ch|fr_fr|gu_in|hi_in|id_id|it_it|ja_jp|nb_no|nl_nl|nl_be|pt_br|pt_pt|pl_pl|ru_ru|sv_se|ta_in|te_in|zh_cn|zh_hk|zh_tw|ko_kr|tr_tr)(?=[-\\\\._@]|$)\"},\"replaceWith\":\"{LOC}\"}],\"rejectedPatterns\":[{\"name\":\"OfficeDocuments\",\"path\":\"^.*\\\\.(?i)(DOC|DOCM|DOCX|DOT|ODP|ODS|ODT|PDF|POT|PPS|PPSX|PPT|PPTM|PPTX|XLC|XLS|XLSB|XLSM|XLSX|XLT)(?-i)$\",\"createdBy\":\"AzureDataCatalog\",\"filterType\":\"Regex\",\"lastUpdatedTimestamp\":0,\"modifiedBy\":\"AzureDataCatalog\"}]}}");
        RequestOptions requestOptions = new RequestOptions();
        Response<BinaryData> response =
                resourceSetRulesClient.createOrUpdateResourceSetRuleWithResponse(resourceSetRuleConfig, requestOptions);
        // END:com.azure.analytics.purview.administration.generated.resourcesetrulescreateorupdateresourcesetrule.resourcesetrulescreateorupdateresourcesetrule
    }
}
