@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
132 lines • 5.58 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.GcpUserAccessBinding = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Restricts access to Cloud Console and Google Cloud APIs for a set of users using Context-Aware Access.
*
* To get more information about GcpUserAccessBinding, see:
*
* * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/organizations.gcpUserAccessBindings)
*
* ## Example Usage
*
* ### Access Context Manager Gcp User Access Binding Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const group = new gcp.cloudidentity.Group("group", {
* displayName: "my-identity-group",
* parent: "customers/A01b123xz",
* groupKey: {
* id: "my-identity-group@example.com",
* },
* labels: {
* "cloudidentity.googleapis.com/groups.discussion_forum": "",
* },
* });
* const access_policy = new gcp.accesscontextmanager.AccessPolicy("access-policy", {
* parent: "organizations/123456789",
* title: "my policy",
* });
* const accessLevelIdForUserAccessBinding = new gcp.accesscontextmanager.AccessLevel("access_level_id_for_user_access_binding", {
* parent: pulumi.interpolate`accessPolicies/${access_policy.name}`,
* name: pulumi.interpolate`accessPolicies/${access_policy.name}/accessLevels/chromeos_no_lock`,
* title: "chromeos_no_lock",
* basic: {
* conditions: [{
* devicePolicy: {
* requireScreenLock: true,
* osConstraints: [{
* osType: "DESKTOP_CHROME_OS",
* }],
* },
* regions: ["US"],
* }],
* },
* });
* const gcpUserAccessBinding = new gcp.accesscontextmanager.GcpUserAccessBinding("gcp_user_access_binding", {
* organizationId: "123456789",
* groupKey: std.trimprefixOutput({
* input: group.id,
* prefix: "groups/",
* }).apply(invoke => invoke.result),
* accessLevels: accessLevelIdForUserAccessBinding.name,
* });
* ```
*
* ## Import
*
* GcpUserAccessBinding can be imported using any of these accepted formats:
*
* * `{{name}}`
*
* When using the `pulumi import` command, GcpUserAccessBinding can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:accesscontextmanager/gcpUserAccessBinding:GcpUserAccessBinding default {{name}}
* ```
*/
class GcpUserAccessBinding extends pulumi.CustomResource {
/**
* Get an existing GcpUserAccessBinding 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 GcpUserAccessBinding(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of GcpUserAccessBinding. 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'] === GcpUserAccessBinding.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessLevels"] = state ? state.accessLevels : undefined;
resourceInputs["groupKey"] = state ? state.groupKey : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["organizationId"] = state ? state.organizationId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.accessLevels === undefined) && !opts.urn) {
throw new Error("Missing required property 'accessLevels'");
}
if ((!args || args.groupKey === undefined) && !opts.urn) {
throw new Error("Missing required property 'groupKey'");
}
if ((!args || args.organizationId === undefined) && !opts.urn) {
throw new Error("Missing required property 'organizationId'");
}
resourceInputs["accessLevels"] = args ? args.accessLevels : undefined;
resourceInputs["groupKey"] = args ? args.groupKey : undefined;
resourceInputs["organizationId"] = args ? args.organizationId : undefined;
resourceInputs["name"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GcpUserAccessBinding.__pulumiType, name, resourceInputs, opts);
}
}
exports.GcpUserAccessBinding = GcpUserAccessBinding;
/** @internal */
GcpUserAccessBinding.__pulumiType = 'gcp:accesscontextmanager/gcpUserAccessBinding:GcpUserAccessBinding';
//# sourceMappingURL=gcpUserAccessBinding.js.map