UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

125 lines 4.58 kB
"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.RepositoryPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an Elastic Container Registry Repository Policy. * * Note that currently only one policy may be applied to a repository. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const exampleRepository = new aws.ecr.Repository("example", {name: "example-repo"}); * const example = aws.iam.getPolicyDocument({ * statements: [{ * sid: "new policy", * effect: "Allow", * principals: [{ * type: "AWS", * identifiers: ["123456789012"], * }], * actions: [ * "ecr:GetDownloadUrlForLayer", * "ecr:BatchGetImage", * "ecr:BatchCheckLayerAvailability", * "ecr:PutImage", * "ecr:InitiateLayerUpload", * "ecr:UploadLayerPart", * "ecr:CompleteLayerUpload", * "ecr:DescribeRepositories", * "ecr:GetRepositoryPolicy", * "ecr:ListImages", * "ecr:DeleteRepository", * "ecr:BatchDeleteImage", * "ecr:SetRepositoryPolicy", * "ecr:DeleteRepositoryPolicy", * ], * }], * }); * const exampleRepositoryPolicy = new aws.ecr.RepositoryPolicy("example", { * repository: exampleRepository.name, * policy: example.then(example => example.json), * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * * `repository` - (String) Name of the ECR repository. * * #### Optional * * - `account_id` (String) AWS Account where this resource is managed. * * - `region` (String) Region where this resource is managed. * * Using `pulumi import`, import ECR Repository Policy using the repository name. For example: * * console * * % pulumi import aws_ecr_repository_policy.example example */ class RepositoryPolicy extends pulumi.CustomResource { /** * Get an existing RepositoryPolicy 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 RepositoryPolicy(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of RepositoryPolicy. 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'] === RepositoryPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["policy"] = state?.policy; resourceInputs["region"] = state?.region; resourceInputs["registryId"] = state?.registryId; resourceInputs["repository"] = state?.repository; } else { const args = argsOrState; if (args?.policy === undefined && !opts.urn) { throw new Error("Missing required property 'policy'"); } if (args?.repository === undefined && !opts.urn) { throw new Error("Missing required property 'repository'"); } resourceInputs["policy"] = args?.policy; resourceInputs["region"] = args?.region; resourceInputs["repository"] = args?.repository; resourceInputs["registryId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RepositoryPolicy.__pulumiType, name, resourceInputs, opts); } } exports.RepositoryPolicy = RepositoryPolicy; /** @internal */ RepositoryPolicy.__pulumiType = 'aws:ecr/repositoryPolicy:RepositoryPolicy'; //# sourceMappingURL=repositoryPolicy.js.map