@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
146 lines • 6.38 kB
JavaScript
// *** 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.OauthClient = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents an OAuth Client. Used to access Google Cloud resources on behalf of a
* Workforce Identity Federation user by using OAuth 2.0 Protocol to obtain an access
* token from Google Cloud.
*
* To get more information about OauthClient, see:
*
* * [API documentation](https://cloud.google.com/iam/docs/reference/rest/v1/projects.locations.oauthClients)
* * How-to Guides
* * [Managing OAuth clients](https://cloud.google.com/iam/docs/workforce-manage-oauth-app#manage-clients)
*
* ## Example Usage
*
* ### Iam Oauth Client Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.iam.OauthClient("example", {
* oauthClientId: "example-client-id",
* displayName: "Display Name of OAuth client",
* description: "A sample OAuth client",
* location: "global",
* disabled: false,
* allowedGrantTypes: ["AUTHORIZATION_CODE_GRANT"],
* allowedRedirectUris: ["https://www.example.com"],
* allowedScopes: ["https://www.googleapis.com/auth/cloud-platform"],
* clientType: "CONFIDENTIAL_CLIENT",
* });
* ```
*
* ## Import
*
* OauthClient can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/oauthClients/{{oauth_client_id}}`
*
* * `{{project}}/{{location}}/{{oauth_client_id}}`
*
* * `{{location}}/{{oauth_client_id}}`
*
* When using the `pulumi import` command, OauthClient can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:iam/oauthClient:OauthClient default projects/{{project}}/locations/{{location}}/oauthClients/{{oauth_client_id}}
* ```
*
* ```sh
* $ pulumi import gcp:iam/oauthClient:OauthClient default {{project}}/{{location}}/{{oauth_client_id}}
* ```
*
* ```sh
* $ pulumi import gcp:iam/oauthClient:OauthClient default {{location}}/{{oauth_client_id}}
* ```
*/
class OauthClient extends pulumi.CustomResource {
/**
* Get an existing OauthClient 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 OauthClient(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of OauthClient. 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'] === OauthClient.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowedGrantTypes"] = state?.allowedGrantTypes;
resourceInputs["allowedRedirectUris"] = state?.allowedRedirectUris;
resourceInputs["allowedScopes"] = state?.allowedScopes;
resourceInputs["clientId"] = state?.clientId;
resourceInputs["clientType"] = state?.clientType;
resourceInputs["description"] = state?.description;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["expireTime"] = state?.expireTime;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["oauthClientId"] = state?.oauthClientId;
resourceInputs["project"] = state?.project;
resourceInputs["state"] = state?.state;
}
else {
const args = argsOrState;
if (args?.allowedGrantTypes === undefined && !opts.urn) {
throw new Error("Missing required property 'allowedGrantTypes'");
}
if (args?.allowedRedirectUris === undefined && !opts.urn) {
throw new Error("Missing required property 'allowedRedirectUris'");
}
if (args?.allowedScopes === undefined && !opts.urn) {
throw new Error("Missing required property 'allowedScopes'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.oauthClientId === undefined && !opts.urn) {
throw new Error("Missing required property 'oauthClientId'");
}
resourceInputs["allowedGrantTypes"] = args?.allowedGrantTypes;
resourceInputs["allowedRedirectUris"] = args?.allowedRedirectUris;
resourceInputs["allowedScopes"] = args?.allowedScopes;
resourceInputs["clientType"] = args?.clientType;
resourceInputs["description"] = args?.description;
resourceInputs["disabled"] = args?.disabled;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["location"] = args?.location;
resourceInputs["oauthClientId"] = args?.oauthClientId;
resourceInputs["project"] = args?.project;
resourceInputs["clientId"] = undefined /*out*/;
resourceInputs["expireTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OauthClient.__pulumiType, name, resourceInputs, opts);
}
}
exports.OauthClient = OauthClient;
/** @internal */
OauthClient.__pulumiType = 'gcp:iam/oauthClient:OauthClient';
//# sourceMappingURL=oauthClient.js.map
;