@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
156 lines • 5.7 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.MethodSettings = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages API Gateway Stage Method Settings. For example, CloudWatch logging and metrics.
*
* > **NOTE:** We recommend using this resource in conjunction with the `aws.apigateway.Stage` resource instead of a stage managed by the `aws.apigateway.Deployment` resource optional `stageName` argument. Stages managed by the `aws.apigateway.Deployment` resource are recreated on redeployment and this resource will require a second apply to recreate the method settings.
*
* ## Example Usage
*
* ### End-to-end
*
* ### Off
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pathSpecific = new aws.apigateway.MethodSettings("path_specific", {
* restApi: example.id,
* stageName: exampleAwsApiGatewayStage.stageName,
* methodPath: "path1/GET",
* settings: {
* loggingLevel: "OFF",
* },
* });
* ```
*
* ### Errors Only
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pathSpecific = new aws.apigateway.MethodSettings("path_specific", {
* restApi: example.id,
* stageName: exampleAwsApiGatewayStage.stageName,
* methodPath: "path1/GET",
* settings: {
* loggingLevel: "ERROR",
* metricsEnabled: true,
* dataTraceEnabled: false,
* },
* });
* ```
*
* ### Errors and Info Logs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pathSpecific = new aws.apigateway.MethodSettings("path_specific", {
* restApi: example.id,
* stageName: exampleAwsApiGatewayStage.stageName,
* methodPath: "path1/GET",
* settings: {
* loggingLevel: "INFO",
* metricsEnabled: true,
* dataTraceEnabled: false,
* },
* });
* ```
*
* ### Full Request and Response Logs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pathSpecific = new aws.apigateway.MethodSettings("path_specific", {
* restApi: example.id,
* stageName: exampleAwsApiGatewayStage.stageName,
* methodPath: "path1/GET",
* settings: {
* loggingLevel: "INFO",
* metricsEnabled: true,
* dataTraceEnabled: true,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_api_gateway_method_settings` using `REST-API-ID/STAGE-NAME/METHOD-PATH`. For example:
*
* ```sh
* $ pulumi import aws:apigateway/methodSettings:MethodSettings example 12345abcde/example/test/GET
* ```
*/
class MethodSettings extends pulumi.CustomResource {
/**
* Get an existing MethodSettings 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 MethodSettings(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of MethodSettings. 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'] === MethodSettings.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["methodPath"] = state?.methodPath;
resourceInputs["region"] = state?.region;
resourceInputs["restApi"] = state?.restApi;
resourceInputs["settings"] = state?.settings;
resourceInputs["stageName"] = state?.stageName;
}
else {
const args = argsOrState;
if (args?.methodPath === undefined && !opts.urn) {
throw new Error("Missing required property 'methodPath'");
}
if (args?.restApi === undefined && !opts.urn) {
throw new Error("Missing required property 'restApi'");
}
if (args?.settings === undefined && !opts.urn) {
throw new Error("Missing required property 'settings'");
}
if (args?.stageName === undefined && !opts.urn) {
throw new Error("Missing required property 'stageName'");
}
resourceInputs["methodPath"] = args?.methodPath;
resourceInputs["region"] = args?.region;
resourceInputs["restApi"] = args?.restApi;
resourceInputs["settings"] = args?.settings;
resourceInputs["stageName"] = args?.stageName;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MethodSettings.__pulumiType, name, resourceInputs, opts);
}
}
exports.MethodSettings = MethodSettings;
/** @internal */
MethodSettings.__pulumiType = 'aws:apigateway/methodSettings:MethodSettings';
//# sourceMappingURL=methodSettings.js.map