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

package com.azure.resourcemanager.videoanalyzer.generated;

import com.azure.resourcemanager.videoanalyzer.models.AccessPolicyEccAlgo;
import com.azure.resourcemanager.videoanalyzer.models.AccessPolicyRsaAlgo;
import com.azure.resourcemanager.videoanalyzer.models.EccTokenKey;
import com.azure.resourcemanager.videoanalyzer.models.JwtAuthentication;
import com.azure.resourcemanager.videoanalyzer.models.RsaTokenKey;
import com.azure.resourcemanager.videoanalyzer.models.TokenClaim;
import java.util.Arrays;

/** Samples for AccessPolicies CreateOrUpdate. */
public final class AccessPoliciesCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/access-policy-create.json
     */
    /**
     * Sample code: Register access policy entity.
     *
     * @param manager Entry point to VideoAnalyzerManager.
     */
    public static void registerAccessPolicyEntity(
        com.azure.resourcemanager.videoanalyzer.VideoAnalyzerManager manager) {
        manager
            .accessPolicies()
            .define("accessPolicyName1")
            .withExistingVideoAnalyzer("testrg", "testaccount2")
            .withAuthentication(
                new JwtAuthentication()
                    .withIssuers(Arrays.asList("issuer1", "issuer2"))
                    .withAudiences(Arrays.asList("audience1"))
                    .withClaims(
                        Arrays
                            .asList(
                                new TokenClaim().withName("claimname1").withValue("claimvalue1"),
                                new TokenClaim().withName("claimname2").withValue("claimvalue2")))
                    .withKeys(
                        Arrays
                            .asList(
                                new RsaTokenKey()
                                    .withKid("123")
                                    .withAlg(AccessPolicyRsaAlgo.RS256)
                                    .withN("YmFzZTY0IQ==")
                                    .withE("ZLFzZTY0IQ=="),
                                new EccTokenKey()
                                    .withKid("124")
                                    .withAlg(AccessPolicyEccAlgo.ES256)
                                    .withX("XX==")
                                    .withY("YY=="))))
            .create();
    }
}
