Class MethodSettings
Provides an API Gateway Method Settings, e.g. logging or monitoring.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var testRestApi = new Aws.ApiGateway.RestApi("testRestApi", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var testDeployment = new Aws.ApiGateway.Deployment("testDeployment", new Aws.ApiGateway.DeploymentArgs
{
RestApi = testRestApi.Id,
StageName = "dev",
});
var testStage = new Aws.ApiGateway.Stage("testStage", new Aws.ApiGateway.StageArgs
{
Deployment = testDeployment.Id,
RestApi = testRestApi.Id,
StageName = "prod",
});
var testResource = new Aws.ApiGateway.Resource("testResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = testRestApi.RootResourceId,
PathPart = "mytestresource",
RestApi = testRestApi.Id,
});
var testMethod = new Aws.ApiGateway.Method("testMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
});
var methodSettings = new Aws.ApiGateway.MethodSettings("methodSettings", new Aws.ApiGateway.MethodSettingsArgs
{
MethodPath = Output.Tuple(testResource.PathPart, testMethod.HttpMethod).Apply(values =>
{
var pathPart = values.Item1;
var httpMethod = values.Item2;
return $"{pathPart}/{httpMethod}";
}),
RestApi = testRestApi.Id,
Settings = new Aws.ApiGateway.Inputs.MethodSettingsSettingsArgs
{
LoggingLevel = "INFO",
MetricsEnabled = true,
},
StageName = testStage.StageName,
});
var testIntegration = new Aws.ApiGateway.Integration("testIntegration", new Aws.ApiGateway.IntegrationArgs
{
HttpMethod = testMethod.HttpMethod,
RequestTemplates =
{
{ "application/xml", @"{
""body"" : $$input.json('$$')
}
" },
},
ResourceId = testResource.Id,
RestApi = testRestApi.Id,
Type = "MOCK",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.ApiGateway
Assembly: Pulumi.Aws.dll
Syntax
public class MethodSettings : CustomResource
Constructors
View SourceMethodSettings(String, MethodSettingsArgs, CustomResourceOptions)
Create a MethodSettings resource with the given unique name, arguments, and options.
Declaration
public MethodSettings(string name, MethodSettingsArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| MethodSettingsArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceMethodPath
Method path defined as {resource_path}/{http_method} for an individual method override, or */* for overriding all methods in the stage.
Declaration
public Output<string> MethodPath { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RestApi
The ID of the REST API
Declaration
public Output<string> RestApi { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Settings
The settings block, see below.
Declaration
public Output<MethodSettingsSettings> Settings { get; }
Property Value
| Type | Description |
|---|---|
| Output<MethodSettingsSettings> |
StageName
The name of the stage
Declaration
public Output<string> StageName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, MethodSettingsState, CustomResourceOptions)
Get an existing MethodSettings resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static MethodSettings Get(string name, Input<string> id, MethodSettingsState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| MethodSettingsState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| MethodSettings |