@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
116 lines • 5.32 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.AccessGrant = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to manage an S3 Access Grant.
* Each access grant has its own ID and gives an IAM user or role or a directory user, or group (the grantee) access to a registered location. You determine the level of access, such as `READ` or `READWRITE`.
* Before you can create a grant, you must have an S3 Access Grants instance in the same Region as the S3 data.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3control.AccessGrantsInstance("example", {});
* const exampleAccessGrantsLocation = new aws.s3control.AccessGrantsLocation("example", {
* iamRoleArn: exampleAwsIamRole.arn,
* locationScope: `s3://${exampleAwsS3Bucket.bucket}/prefixA*`,
* }, {
* dependsOn: [example],
* });
* const exampleAccessGrant = new aws.s3control.AccessGrant("example", {
* accessGrantsLocationId: exampleAccessGrantsLocation.accessGrantsLocationId,
* permission: "READ",
* accessGrantsLocationConfiguration: {
* s3SubPrefix: "prefixB*",
* },
* grantee: {
* granteeType: "IAM",
* granteeIdentifier: exampleAwsIamUser.arn,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import S3 Access Grants using the `account_id` and `access_grant_id`, separated by a comma (`,`). For example:
*
* ```sh
* $ pulumi import aws:s3control/accessGrant:AccessGrant example 123456789012,04549c5e-2f3c-4a07-824d-2cafe720aa22
* ```
*/
class AccessGrant extends pulumi.CustomResource {
/**
* Get an existing AccessGrant 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 AccessGrant(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AccessGrant. 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'] === AccessGrant.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessGrantArn"] = state?.accessGrantArn;
resourceInputs["accessGrantId"] = state?.accessGrantId;
resourceInputs["accessGrantsLocationConfiguration"] = state?.accessGrantsLocationConfiguration;
resourceInputs["accessGrantsLocationId"] = state?.accessGrantsLocationId;
resourceInputs["accountId"] = state?.accountId;
resourceInputs["grantScope"] = state?.grantScope;
resourceInputs["grantee"] = state?.grantee;
resourceInputs["permission"] = state?.permission;
resourceInputs["region"] = state?.region;
resourceInputs["s3PrefixType"] = state?.s3PrefixType;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
if (args?.accessGrantsLocationId === undefined && !opts.urn) {
throw new Error("Missing required property 'accessGrantsLocationId'");
}
if (args?.permission === undefined && !opts.urn) {
throw new Error("Missing required property 'permission'");
}
resourceInputs["accessGrantsLocationConfiguration"] = args?.accessGrantsLocationConfiguration;
resourceInputs["accessGrantsLocationId"] = args?.accessGrantsLocationId;
resourceInputs["accountId"] = args?.accountId;
resourceInputs["grantee"] = args?.grantee;
resourceInputs["permission"] = args?.permission;
resourceInputs["region"] = args?.region;
resourceInputs["s3PrefixType"] = args?.s3PrefixType;
resourceInputs["tags"] = args?.tags;
resourceInputs["accessGrantArn"] = undefined /*out*/;
resourceInputs["accessGrantId"] = undefined /*out*/;
resourceInputs["grantScope"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AccessGrant.__pulumiType, name, resourceInputs, opts);
}
}
exports.AccessGrant = AccessGrant;
/** @internal */
AccessGrant.__pulumiType = 'aws:s3control/accessGrant:AccessGrant';
//# sourceMappingURL=accessGrant.js.map
;