"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegistryCredentialSet = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Container Registry Credential Set.
 *
 * ## Example Usage
 *
 * ### Minimal)
 *
 * > **Note:** Be aware that you will need to permit the Identity that is created for the Container Registry to have `get` on secrets to the Key Vault, e.g. using the `azure.keyvault.AccessPolicy` resource.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleRegistry = new azure.containerservice.Registry("example", {
 *     name: "exampleContainerRegistry",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Basic",
 * });
 * const exampleRegistryCredentialSet = new azure.containerservice.RegistryCredentialSet("example", {
 *     name: "exampleCredentialSet",
 *     containerRegistryId: exampleRegistry.id,
 *     loginServer: "docker.io",
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 *     authenticationCredentials: {
 *         usernameSecretId: "https://example-keyvault.vault.azure.net/secrets/example-user-name",
 *         passwordSecretId: "https://example-keyvault.vault.azure.net/secrets/example-user-password",
 *     },
 * });
 * ```
 *
 * ### Full)
 *
 * This example provisions a key vault with two secrets, a container registry, a container registry credential set, and an access policy to allow the container registry to read the secrets from the key vault.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const current = azure.core.getClientConfig({});
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "examplekeyvault",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     tenantId: current.then(current => current.tenantId),
 *     skuName: "standard",
 *     softDeleteRetentionDays: 7,
 *     accessPolicies: [{
 *         tenantId: current.then(current => current.tenantId),
 *         objectId: current.then(current => current.objectId),
 *         certificatePermissions: [],
 *         keyPermissions: [],
 *         secretPermissions: [
 *             "Get",
 *             "Set",
 *             "Delete",
 *             "Purge",
 *         ],
 *     }],
 * });
 * const exampleUser = new azure.keyvault.Secret("example_user", {
 *     keyVaultId: exampleKeyVault.id,
 *     name: "example-user-name",
 *     value: "name",
 * });
 * const examplePassword = new azure.keyvault.Secret("example_password", {
 *     keyVaultId: exampleKeyVault.id,
 *     name: "example-user-password",
 *     value: "password",
 * });
 * const exampleRegistry = new azure.containerservice.Registry("example", {
 *     name: "exampleContainerRegistry",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Basic",
 * });
 * const exampleRegistryCredentialSet = new azure.containerservice.RegistryCredentialSet("example", {
 *     name: "exampleCredentialSet",
 *     containerRegistryId: exampleRegistry.id,
 *     loginServer: "docker.io",
 *     identity: {
 *         type: "SystemAssigned",
 *     },
 *     authenticationCredentials: {
 *         usernameSecretId: exampleUser.versionlessId,
 *         passwordSecretId: examplePassword.versionlessId,
 *     },
 * });
 * const readSecrets = new azure.keyvault.AccessPolicy("read_secrets", {
 *     keyVaultId: exampleKeyVault.id,
 *     tenantId: exampleRegistryCredentialSet.identity.apply(identity => identity.tenantId),
 *     objectId: exampleRegistryCredentialSet.identity.apply(identity => identity.principalId),
 *     secretPermissions: ["Get"],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.ContainerRegistry` - 2023-07-01
 *
 * ## Import
 *
 * Container Registry Credential Sets can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:containerservice/registryCredentialSet:RegistryCredentialSet example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ContainerRegistry/registries/registry1/credentialSets/credentialSet1
 * ```
 */
class RegistryCredentialSet extends pulumi.CustomResource {
    /**
     * Get an existing RegistryCredentialSet resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new RegistryCredentialSet(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:containerservice/registryCredentialSet:RegistryCredentialSet';
    /**
     * Returns true if the given object is an instance of RegistryCredentialSet.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === RegistryCredentialSet.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["authenticationCredentials"] = state?.authenticationCredentials;
            resourceInputs["containerRegistryId"] = state?.containerRegistryId;
            resourceInputs["identity"] = state?.identity;
            resourceInputs["loginServer"] = state?.loginServer;
            resourceInputs["name"] = state?.name;
        }
        else {
            const args = argsOrState;
            if (args?.authenticationCredentials === undefined && !opts.urn) {
                throw new Error("Missing required property 'authenticationCredentials'");
            }
            if (args?.containerRegistryId === undefined && !opts.urn) {
                throw new Error("Missing required property 'containerRegistryId'");
            }
            if (args?.identity === undefined && !opts.urn) {
                throw new Error("Missing required property 'identity'");
            }
            if (args?.loginServer === undefined && !opts.urn) {
                throw new Error("Missing required property 'loginServer'");
            }
            resourceInputs["authenticationCredentials"] = args?.authenticationCredentials;
            resourceInputs["containerRegistryId"] = args?.containerRegistryId;
            resourceInputs["identity"] = args?.identity;
            resourceInputs["loginServer"] = args?.loginServer;
            resourceInputs["name"] = args?.name;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(RegistryCredentialSet.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RegistryCredentialSet = RegistryCredentialSet;
//# sourceMappingURL=registryCredentialSet.js.map