"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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.OauthClientCredential = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Represents an OAuth Client Credential. Used to authenticate an OAuth Client
 * while accessing Google Cloud resources on behalf of a Workforce Identity Federation user
 * by using OAuth 2.0 Protocol.
 *
 * To get more information about OauthClientCredential, see:
 *
 * * [API documentation](https://cloud.google.com/iam/docs/reference/rest/v1/projects.locations.oauthClients.credentials)
 * * How-to Guides
 *     * [Managing OAuth clients](https://cloud.google.com/iam/docs/workforce-manage-oauth-app#manage-clients)
 *
 * ## Example Usage
 *
 * ### Iam Oauth Client Credential Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const oauthClient = new gcp.iam.OauthClient("oauth_client", {
 *     oauthClientId: "example-client-id",
 *     location: "global",
 *     allowedGrantTypes: ["AUTHORIZATION_CODE_GRANT"],
 *     allowedRedirectUris: ["https://www.example.com"],
 *     allowedScopes: ["https://www.googleapis.com/auth/cloud-platform"],
 *     clientType: "CONFIDENTIAL_CLIENT",
 * });
 * const example = new gcp.iam.OauthClientCredential("example", {
 *     oauthclient: oauthClient.oauthClientId,
 *     location: oauthClient.location,
 *     oauthClientCredentialId: "cred-id",
 *     disabled: true,
 *     displayName: "Display Name of credential",
 * });
 * ```
 *
 * ## Import
 *
 * OauthClientCredential can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/oauthClients/{{oauthclient}}/credentials/{{oauth_client_credential_id}}`
 *
 * * `{{project}}/{{location}}/{{oauthclient}}/{{oauth_client_credential_id}}`
 *
 * * `{{location}}/{{oauthclient}}/{{oauth_client_credential_id}}`
 *
 * When using the `pulumi import` command, OauthClientCredential can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:iam/oauthClientCredential:OauthClientCredential default projects/{{project}}/locations/{{location}}/oauthClients/{{oauthclient}}/credentials/{{oauth_client_credential_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:iam/oauthClientCredential:OauthClientCredential default {{project}}/{{location}}/{{oauthclient}}/{{oauth_client_credential_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:iam/oauthClientCredential:OauthClientCredential default {{location}}/{{oauthclient}}/{{oauth_client_credential_id}}
 * ```
 */
class OauthClientCredential extends pulumi.CustomResource {
    /**
     * Get an existing OauthClientCredential 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 OauthClientCredential(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of OauthClientCredential.  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'] === OauthClientCredential.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["clientSecret"] = state?.clientSecret;
            resourceInputs["disabled"] = state?.disabled;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["oauthClientCredentialId"] = state?.oauthClientCredentialId;
            resourceInputs["oauthclient"] = state?.oauthclient;
            resourceInputs["project"] = state?.project;
        }
        else {
            const args = argsOrState;
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.oauthClientCredentialId === undefined && !opts.urn) {
                throw new Error("Missing required property 'oauthClientCredentialId'");
            }
            if (args?.oauthclient === undefined && !opts.urn) {
                throw new Error("Missing required property 'oauthclient'");
            }
            resourceInputs["disabled"] = args?.disabled;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["location"] = args?.location;
            resourceInputs["oauthClientCredentialId"] = args?.oauthClientCredentialId;
            resourceInputs["oauthclient"] = args?.oauthclient;
            resourceInputs["project"] = args?.project;
            resourceInputs["clientSecret"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["clientSecret"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(OauthClientCredential.__pulumiType, name, resourceInputs, opts);
    }
}
exports.OauthClientCredential = OauthClientCredential;
/** @internal */
OauthClientCredential.__pulumiType = 'gcp:iam/oauthClientCredential:OauthClientCredential';
//# sourceMappingURL=oauthClientCredential.js.map