@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
94 lines • 4.28 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.PullThroughCacheRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an Elastic Container Registry Pull Through Cache Rule.
*
* More information about pull through cache rules, including the set of supported
* upstream repositories, see [Using pull through cache rules](https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache.html).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ecr.PullThroughCacheRule("example", {
* ecrRepositoryPrefix: "ecr-public",
* upstreamRegistryUrl: "public.ecr.aws",
* credentialArn: "arn:aws:secretsmanager:us-east-1:123456789:secret:ecr-pullthroughcache/ecrpublic",
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import a pull-through cache rule using the `ecr_repository_prefix`. For example:
*
* ```sh
* $ pulumi import aws:ecr/pullThroughCacheRule:PullThroughCacheRule example ecr-public
* ```
*/
class PullThroughCacheRule extends pulumi.CustomResource {
/**
* Get an existing PullThroughCacheRule 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 PullThroughCacheRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of PullThroughCacheRule. 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'] === PullThroughCacheRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["credentialArn"] = state?.credentialArn;
resourceInputs["customRoleArn"] = state?.customRoleArn;
resourceInputs["ecrRepositoryPrefix"] = state?.ecrRepositoryPrefix;
resourceInputs["region"] = state?.region;
resourceInputs["registryId"] = state?.registryId;
resourceInputs["upstreamRegistryUrl"] = state?.upstreamRegistryUrl;
resourceInputs["upstreamRepositoryPrefix"] = state?.upstreamRepositoryPrefix;
}
else {
const args = argsOrState;
if (args?.ecrRepositoryPrefix === undefined && !opts.urn) {
throw new Error("Missing required property 'ecrRepositoryPrefix'");
}
if (args?.upstreamRegistryUrl === undefined && !opts.urn) {
throw new Error("Missing required property 'upstreamRegistryUrl'");
}
resourceInputs["credentialArn"] = args?.credentialArn;
resourceInputs["customRoleArn"] = args?.customRoleArn;
resourceInputs["ecrRepositoryPrefix"] = args?.ecrRepositoryPrefix;
resourceInputs["region"] = args?.region;
resourceInputs["upstreamRegistryUrl"] = args?.upstreamRegistryUrl;
resourceInputs["upstreamRepositoryPrefix"] = args?.upstreamRepositoryPrefix;
resourceInputs["registryId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PullThroughCacheRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.PullThroughCacheRule = PullThroughCacheRule;
/** @internal */
PullThroughCacheRule.__pulumiType = 'aws:ecr/pullThroughCacheRule:PullThroughCacheRule';
//# sourceMappingURL=pullThroughCacheRule.js.map
;