All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.apigateway.MethodSettings Maven / Gradle / Ivy

// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.aws.apigateway;

import com.pulumi.aws.Utilities;
import com.pulumi.aws.apigateway.MethodSettingsArgs;
import com.pulumi.aws.apigateway.inputs.MethodSettingsState;
import com.pulumi.aws.apigateway.outputs.MethodSettingsSettings;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import javax.annotation.Nullable;

/**
 * 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 `stage_name` 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
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.apigateway.MethodSettings;
 * import com.pulumi.aws.apigateway.MethodSettingsArgs;
 * import com.pulumi.aws.apigateway.inputs.MethodSettingsSettingsArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var pathSpecific = new MethodSettings("pathSpecific", MethodSettingsArgs.builder()
 *             .restApi(example.id())
 *             .stageName(exampleAwsApiGatewayStage.stageName())
 *             .methodPath("path1/GET")
 *             .settings(MethodSettingsSettingsArgs.builder()
 *                 .loggingLevel("OFF")
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ### Errors Only * * <!--Start PulumiCodeChooser --> *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.apigateway.MethodSettings;
 * import com.pulumi.aws.apigateway.MethodSettingsArgs;
 * import com.pulumi.aws.apigateway.inputs.MethodSettingsSettingsArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var pathSpecific = new MethodSettings("pathSpecific", MethodSettingsArgs.builder()
 *             .restApi(example.id())
 *             .stageName(exampleAwsApiGatewayStage.stageName())
 *             .methodPath("path1/GET")
 *             .settings(MethodSettingsSettingsArgs.builder()
 *                 .loggingLevel("ERROR")
 *                 .metricsEnabled(true)
 *                 .dataTraceEnabled(false)
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ### Errors and Info Logs * * <!--Start PulumiCodeChooser --> *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.apigateway.MethodSettings;
 * import com.pulumi.aws.apigateway.MethodSettingsArgs;
 * import com.pulumi.aws.apigateway.inputs.MethodSettingsSettingsArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var pathSpecific = new MethodSettings("pathSpecific", MethodSettingsArgs.builder()
 *             .restApi(example.id())
 *             .stageName(exampleAwsApiGatewayStage.stageName())
 *             .methodPath("path1/GET")
 *             .settings(MethodSettingsSettingsArgs.builder()
 *                 .loggingLevel("INFO")
 *                 .metricsEnabled(true)
 *                 .dataTraceEnabled(false)
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ### Full Request and Response Logs * * <!--Start PulumiCodeChooser --> *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.apigateway.MethodSettings;
 * import com.pulumi.aws.apigateway.MethodSettingsArgs;
 * import com.pulumi.aws.apigateway.inputs.MethodSettingsSettingsArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var pathSpecific = new MethodSettings("pathSpecific", MethodSettingsArgs.builder()
 *             .restApi(example.id())
 *             .stageName(exampleAwsApiGatewayStage.stageName())
 *             .methodPath("path1/GET")
 *             .settings(MethodSettingsSettingsArgs.builder()
 *                 .loggingLevel("INFO")
 *                 .metricsEnabled(true)
 *                 .dataTraceEnabled(true)
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## 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 * ``` * */ @ResourceType(type="aws:apigateway/methodSettings:MethodSettings") public class MethodSettings extends com.pulumi.resources.CustomResource { /** * Method path defined as `{resource_path}/{http_method}` for an individual method override, or `*/*` for overriding all methods in the stage. Ensure to trim any leading forward slashes in the path (e.g., `trimprefix(aws_api_gateway_resource.example.path, "/")`). * */ @Export(name="methodPath", refs={String.class}, tree="[0]") private Output methodPath; /** * @return Method path defined as `{resource_path}/{http_method}` for an individual method override, or `*/*` for overriding all methods in the stage. Ensure to trim any leading forward slashes in the path (e.g., `trimprefix(aws_api_gateway_resource.example.path, "/")`). * */ public Output methodPath() { return this.methodPath; } /** * ID of the REST API * */ @Export(name="restApi", refs={String.class}, tree="[0]") private Output restApi; /** * @return ID of the REST API * */ public Output restApi() { return this.restApi; } /** * Settings block, see below. * */ @Export(name="settings", refs={MethodSettingsSettings.class}, tree="[0]") private Output settings; /** * @return Settings block, see below. * */ public Output settings() { return this.settings; } /** * Name of the stage * */ @Export(name="stageName", refs={String.class}, tree="[0]") private Output stageName; /** * @return Name of the stage * */ public Output stageName() { return this.stageName; } /** * * @param name The _unique_ name of the resulting resource. */ public MethodSettings(java.lang.String name) { this(name, MethodSettingsArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public MethodSettings(java.lang.String name, MethodSettingsArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public MethodSettings(java.lang.String name, MethodSettingsArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:apigateway/methodSettings:MethodSettings", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private MethodSettings(java.lang.String name, Output id, @Nullable MethodSettingsState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:apigateway/methodSettings:MethodSettings", name, state, makeResourceOptions(options, id), false); } private static MethodSettingsArgs makeArgs(MethodSettingsArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? MethodSettingsArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host 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 * @param options Optional settings to control the behavior of the CustomResource. */ public static MethodSettings get(java.lang.String name, Output id, @Nullable MethodSettingsState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new MethodSettings(name, id, state, options); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy