@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
144 lines • 6.02 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.SamplingRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Creates and manages an AWS XRay Sampling Rule.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.xray.SamplingRule("example", {
* ruleName: "example",
* priority: 9999,
* version: 1,
* reservoirSize: 1,
* fixedRate: 0.05,
* urlPath: "*",
* host: "*",
* httpMethod: "*",
* serviceType: "*",
* serviceName: "*",
* resourceArn: "*",
* attributes: {
* Hello: "Tris",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import XRay Sampling Rules using the name. For example:
*
* ```sh
* $ pulumi import aws:xray/samplingRule:SamplingRule example example
* ```
*/
class SamplingRule extends pulumi.CustomResource {
/**
* Get an existing SamplingRule 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 SamplingRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SamplingRule. 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'] === SamplingRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["attributes"] = state?.attributes;
resourceInputs["fixedRate"] = state?.fixedRate;
resourceInputs["host"] = state?.host;
resourceInputs["httpMethod"] = state?.httpMethod;
resourceInputs["priority"] = state?.priority;
resourceInputs["region"] = state?.region;
resourceInputs["reservoirSize"] = state?.reservoirSize;
resourceInputs["resourceArn"] = state?.resourceArn;
resourceInputs["ruleName"] = state?.ruleName;
resourceInputs["serviceName"] = state?.serviceName;
resourceInputs["serviceType"] = state?.serviceType;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["urlPath"] = state?.urlPath;
resourceInputs["version"] = state?.version;
}
else {
const args = argsOrState;
if (args?.fixedRate === undefined && !opts.urn) {
throw new Error("Missing required property 'fixedRate'");
}
if (args?.host === undefined && !opts.urn) {
throw new Error("Missing required property 'host'");
}
if (args?.httpMethod === undefined && !opts.urn) {
throw new Error("Missing required property 'httpMethod'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
if (args?.reservoirSize === undefined && !opts.urn) {
throw new Error("Missing required property 'reservoirSize'");
}
if (args?.resourceArn === undefined && !opts.urn) {
throw new Error("Missing required property 'resourceArn'");
}
if (args?.serviceName === undefined && !opts.urn) {
throw new Error("Missing required property 'serviceName'");
}
if (args?.serviceType === undefined && !opts.urn) {
throw new Error("Missing required property 'serviceType'");
}
if (args?.urlPath === undefined && !opts.urn) {
throw new Error("Missing required property 'urlPath'");
}
if (args?.version === undefined && !opts.urn) {
throw new Error("Missing required property 'version'");
}
resourceInputs["attributes"] = args?.attributes;
resourceInputs["fixedRate"] = args?.fixedRate;
resourceInputs["host"] = args?.host;
resourceInputs["httpMethod"] = args?.httpMethod;
resourceInputs["priority"] = args?.priority;
resourceInputs["region"] = args?.region;
resourceInputs["reservoirSize"] = args?.reservoirSize;
resourceInputs["resourceArn"] = args?.resourceArn;
resourceInputs["ruleName"] = args?.ruleName;
resourceInputs["serviceName"] = args?.serviceName;
resourceInputs["serviceType"] = args?.serviceType;
resourceInputs["tags"] = args?.tags;
resourceInputs["urlPath"] = args?.urlPath;
resourceInputs["version"] = args?.version;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SamplingRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.SamplingRule = SamplingRule;
/** @internal */
SamplingRule.__pulumiType = 'aws:xray/samplingRule:SamplingRule';
//# sourceMappingURL=samplingRule.js.map
;