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

com.pulumi.azure.apimanagement.kotlin.ApiDiagnostic.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.apimanagement.kotlin

import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticBackendRequest
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticBackendResponse
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticFrontendRequest
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticFrontendResponse
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Double
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticBackendRequest.Companion.toKotlin as apiDiagnosticBackendRequestToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticBackendResponse.Companion.toKotlin as apiDiagnosticBackendResponseToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticFrontendRequest.Companion.toKotlin as apiDiagnosticFrontendRequestToKotlin
import com.pulumi.azure.apimanagement.kotlin.outputs.ApiDiagnosticFrontendResponse.Companion.toKotlin as apiDiagnosticFrontendResponseToKotlin

/**
 * Builder for [ApiDiagnostic].
 */
@PulumiTagMarker
public class ApiDiagnosticResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ApiDiagnosticArgs = ApiDiagnosticArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ApiDiagnosticArgsBuilder.() -> Unit) {
        val builder = ApiDiagnosticArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ApiDiagnostic {
        val builtJavaResource = com.pulumi.azure.apimanagement.ApiDiagnostic(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ApiDiagnostic(builtJavaResource)
    }
}

/**
 * Manages a API Management Service API Diagnostics Logs.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleInsights = new azure.appinsights.Insights("example", {
 *     name: "example-appinsights",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     applicationType: "web",
 * });
 * const exampleService = new azure.apimanagement.Service("example", {
 *     name: "example-apim",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     publisherName: "My Company",
 *     publisherEmail: "[email protected]",
 *     skuName: "Developer_1",
 * });
 * const exampleApi = new azure.apimanagement.Api("example", {
 *     name: "example-api",
 *     resourceGroupName: example.name,
 *     apiManagementName: exampleService.name,
 *     revision: "1",
 *     displayName: "Example API",
 *     path: "example",
 *     protocols: ["https"],
 *     "import": {
 *         contentFormat: "swagger-link-json",
 *         contentValue: "http://conferenceapi.azurewebsites.net/?format=json",
 *     },
 * });
 * const exampleLogger = new azure.apimanagement.Logger("example", {
 *     name: "example-apimlogger",
 *     apiManagementName: exampleService.name,
 *     resourceGroupName: example.name,
 *     applicationInsights: {
 *         instrumentationKey: exampleInsights.instrumentationKey,
 *     },
 * });
 * const exampleApiDiagnostic = new azure.apimanagement.ApiDiagnostic("example", {
 *     identifier: "applicationinsights",
 *     resourceGroupName: example.name,
 *     apiManagementName: exampleService.name,
 *     apiName: exampleApi.name,
 *     apiManagementLoggerId: exampleLogger.id,
 *     samplingPercentage: 5,
 *     alwaysLogErrors: true,
 *     logClientIp: true,
 *     verbosity: "verbose",
 *     httpCorrelationProtocol: "W3C",
 *     frontendRequest: {
 *         bodyBytes: 32,
 *         headersToLogs: [
 *             "content-type",
 *             "accept",
 *             "origin",
 *         ],
 *     },
 *     frontendResponse: {
 *         bodyBytes: 32,
 *         headersToLogs: [
 *             "content-type",
 *             "content-length",
 *             "origin",
 *         ],
 *     },
 *     backendRequest: {
 *         bodyBytes: 32,
 *         headersToLogs: [
 *             "content-type",
 *             "accept",
 *             "origin",
 *         ],
 *     },
 *     backendResponse: {
 *         bodyBytes: 32,
 *         headersToLogs: [
 *             "content-type",
 *             "content-length",
 *             "origin",
 *         ],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_insights = azure.appinsights.Insights("example",
 *     name="example-appinsights",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     application_type="web")
 * example_service = azure.apimanagement.Service("example",
 *     name="example-apim",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     publisher_name="My Company",
 *     publisher_email="[email protected]",
 *     sku_name="Developer_1")
 * example_api = azure.apimanagement.Api("example",
 *     name="example-api",
 *     resource_group_name=example.name,
 *     api_management_name=example_service.name,
 *     revision="1",
 *     display_name="Example API",
 *     path="example",
 *     protocols=["https"],
 *     import_={
 *         "content_format": "swagger-link-json",
 *         "content_value": "http://conferenceapi.azurewebsites.net/?format=json",
 *     })
 * example_logger = azure.apimanagement.Logger("example",
 *     name="example-apimlogger",
 *     api_management_name=example_service.name,
 *     resource_group_name=example.name,
 *     application_insights={
 *         "instrumentation_key": example_insights.instrumentation_key,
 *     })
 * example_api_diagnostic = azure.apimanagement.ApiDiagnostic("example",
 *     identifier="applicationinsights",
 *     resource_group_name=example.name,
 *     api_management_name=example_service.name,
 *     api_name=example_api.name,
 *     api_management_logger_id=example_logger.id,
 *     sampling_percentage=5,
 *     always_log_errors=True,
 *     log_client_ip=True,
 *     verbosity="verbose",
 *     http_correlation_protocol="W3C",
 *     frontend_request={
 *         "body_bytes": 32,
 *         "headers_to_logs": [
 *             "content-type",
 *             "accept",
 *             "origin",
 *         ],
 *     },
 *     frontend_response={
 *         "body_bytes": 32,
 *         "headers_to_logs": [
 *             "content-type",
 *             "content-length",
 *             "origin",
 *         ],
 *     },
 *     backend_request={
 *         "body_bytes": 32,
 *         "headers_to_logs": [
 *             "content-type",
 *             "accept",
 *             "origin",
 *         ],
 *     },
 *     backend_response={
 *         "body_bytes": 32,
 *         "headers_to_logs": [
 *             "content-type",
 *             "content-length",
 *             "origin",
 *         ],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleInsights = new Azure.AppInsights.Insights("example", new()
 *     {
 *         Name = "example-appinsights",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         ApplicationType = "web",
 *     });
 *     var exampleService = new Azure.ApiManagement.Service("example", new()
 *     {
 *         Name = "example-apim",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         PublisherName = "My Company",
 *         PublisherEmail = "[email protected]",
 *         SkuName = "Developer_1",
 *     });
 *     var exampleApi = new Azure.ApiManagement.Api("example", new()
 *     {
 *         Name = "example-api",
 *         ResourceGroupName = example.Name,
 *         ApiManagementName = exampleService.Name,
 *         Revision = "1",
 *         DisplayName = "Example API",
 *         Path = "example",
 *         Protocols = new[]
 *         {
 *             "https",
 *         },
 *         Import = new Azure.ApiManagement.Inputs.ApiImportArgs
 *         {
 *             ContentFormat = "swagger-link-json",
 *             ContentValue = "http://conferenceapi.azurewebsites.net/?format=json",
 *         },
 *     });
 *     var exampleLogger = new Azure.ApiManagement.Logger("example", new()
 *     {
 *         Name = "example-apimlogger",
 *         ApiManagementName = exampleService.Name,
 *         ResourceGroupName = example.Name,
 *         ApplicationInsights = new Azure.ApiManagement.Inputs.LoggerApplicationInsightsArgs
 *         {
 *             InstrumentationKey = exampleInsights.InstrumentationKey,
 *         },
 *     });
 *     var exampleApiDiagnostic = new Azure.ApiManagement.ApiDiagnostic("example", new()
 *     {
 *         Identifier = "applicationinsights",
 *         ResourceGroupName = example.Name,
 *         ApiManagementName = exampleService.Name,
 *         ApiName = exampleApi.Name,
 *         ApiManagementLoggerId = exampleLogger.Id,
 *         SamplingPercentage = 5,
 *         AlwaysLogErrors = true,
 *         LogClientIp = true,
 *         Verbosity = "verbose",
 *         HttpCorrelationProtocol = "W3C",
 *         FrontendRequest = new Azure.ApiManagement.Inputs.ApiDiagnosticFrontendRequestArgs
 *         {
 *             BodyBytes = 32,
 *             HeadersToLogs = new[]
 *             {
 *                 "content-type",
 *                 "accept",
 *                 "origin",
 *             },
 *         },
 *         FrontendResponse = new Azure.ApiManagement.Inputs.ApiDiagnosticFrontendResponseArgs
 *         {
 *             BodyBytes = 32,
 *             HeadersToLogs = new[]
 *             {
 *                 "content-type",
 *                 "content-length",
 *                 "origin",
 *             },
 *         },
 *         BackendRequest = new Azure.ApiManagement.Inputs.ApiDiagnosticBackendRequestArgs
 *         {
 *             BodyBytes = 32,
 *             HeadersToLogs = new[]
 *             {
 *                 "content-type",
 *                 "accept",
 *                 "origin",
 *             },
 *         },
 *         BackendResponse = new Azure.ApiManagement.Inputs.ApiDiagnosticBackendResponseArgs
 *         {
 *             BodyBytes = 32,
 *             HeadersToLogs = new[]
 *             {
 *                 "content-type",
 *                 "content-length",
 *                 "origin",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appinsights"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleInsights, err := appinsights.NewInsights(ctx, "example", &appinsights.InsightsArgs{
 * 			Name:              pulumi.String("example-appinsights"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			ApplicationType:   pulumi.String("web"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleService, err := apimanagement.NewService(ctx, "example", &apimanagement.ServiceArgs{
 * 			Name:              pulumi.String("example-apim"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			PublisherName:     pulumi.String("My Company"),
 * 			PublisherEmail:    pulumi.String("[email protected]"),
 * 			SkuName:           pulumi.String("Developer_1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleApi, err := apimanagement.NewApi(ctx, "example", &apimanagement.ApiArgs{
 * 			Name:              pulumi.String("example-api"),
 * 			ResourceGroupName: example.Name,
 * 			ApiManagementName: exampleService.Name,
 * 			Revision:          pulumi.String("1"),
 * 			DisplayName:       pulumi.String("Example API"),
 * 			Path:              pulumi.String("example"),
 * 			Protocols: pulumi.StringArray{
 * 				pulumi.String("https"),
 * 			},
 * 			Import: &apimanagement.ApiImportArgs{
 * 				ContentFormat: pulumi.String("swagger-link-json"),
 * 				ContentValue:  pulumi.String("http://conferenceapi.azurewebsites.net/?format=json"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleLogger, err := apimanagement.NewLogger(ctx, "example", &apimanagement.LoggerArgs{
 * 			Name:              pulumi.String("example-apimlogger"),
 * 			ApiManagementName: exampleService.Name,
 * 			ResourceGroupName: example.Name,
 * 			ApplicationInsights: &apimanagement.LoggerApplicationInsightsArgs{
 * 				InstrumentationKey: exampleInsights.InstrumentationKey,
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apimanagement.NewApiDiagnostic(ctx, "example", &apimanagement.ApiDiagnosticArgs{
 * 			Identifier:              pulumi.String("applicationinsights"),
 * 			ResourceGroupName:       example.Name,
 * 			ApiManagementName:       exampleService.Name,
 * 			ApiName:                 exampleApi.Name,
 * 			ApiManagementLoggerId:   exampleLogger.ID(),
 * 			SamplingPercentage:      pulumi.Float64(5),
 * 			AlwaysLogErrors:         pulumi.Bool(true),
 * 			LogClientIp:             pulumi.Bool(true),
 * 			Verbosity:               pulumi.String("verbose"),
 * 			HttpCorrelationProtocol: pulumi.String("W3C"),
 * 			FrontendRequest: &apimanagement.ApiDiagnosticFrontendRequestArgs{
 * 				BodyBytes: pulumi.Int(32),
 * 				HeadersToLogs: pulumi.StringArray{
 * 					pulumi.String("content-type"),
 * 					pulumi.String("accept"),
 * 					pulumi.String("origin"),
 * 				},
 * 			},
 * 			FrontendResponse: &apimanagement.ApiDiagnosticFrontendResponseArgs{
 * 				BodyBytes: pulumi.Int(32),
 * 				HeadersToLogs: pulumi.StringArray{
 * 					pulumi.String("content-type"),
 * 					pulumi.String("content-length"),
 * 					pulumi.String("origin"),
 * 				},
 * 			},
 * 			BackendRequest: &apimanagement.ApiDiagnosticBackendRequestArgs{
 * 				BodyBytes: pulumi.Int(32),
 * 				HeadersToLogs: pulumi.StringArray{
 * 					pulumi.String("content-type"),
 * 					pulumi.String("accept"),
 * 					pulumi.String("origin"),
 * 				},
 * 			},
 * 			BackendResponse: &apimanagement.ApiDiagnosticBackendResponseArgs{
 * 				BodyBytes: pulumi.Int(32),
 * 				HeadersToLogs: pulumi.StringArray{
 * 					pulumi.String("content-type"),
 * 					pulumi.String("content-length"),
 * 					pulumi.String("origin"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.appinsights.Insights;
 * import com.pulumi.azure.appinsights.InsightsArgs;
 * import com.pulumi.azure.apimanagement.Service;
 * import com.pulumi.azure.apimanagement.ServiceArgs;
 * import com.pulumi.azure.apimanagement.Api;
 * import com.pulumi.azure.apimanagement.ApiArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiImportArgs;
 * import com.pulumi.azure.apimanagement.Logger;
 * import com.pulumi.azure.apimanagement.LoggerArgs;
 * import com.pulumi.azure.apimanagement.inputs.LoggerApplicationInsightsArgs;
 * import com.pulumi.azure.apimanagement.ApiDiagnostic;
 * import com.pulumi.azure.apimanagement.ApiDiagnosticArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiDiagnosticFrontendRequestArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiDiagnosticFrontendResponseArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiDiagnosticBackendRequestArgs;
 * import com.pulumi.azure.apimanagement.inputs.ApiDiagnosticBackendResponseArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()
 *             .name("example-appinsights")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .applicationType("web")
 *             .build());
 *         var exampleService = new Service("exampleService", ServiceArgs.builder()
 *             .name("example-apim")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .publisherName("My Company")
 *             .publisherEmail("[email protected]")
 *             .skuName("Developer_1")
 *             .build());
 *         var exampleApi = new Api("exampleApi", ApiArgs.builder()
 *             .name("example-api")
 *             .resourceGroupName(example.name())
 *             .apiManagementName(exampleService.name())
 *             .revision("1")
 *             .displayName("Example API")
 *             .path("example")
 *             .protocols("https")
 *             .import_(ApiImportArgs.builder()
 *                 .contentFormat("swagger-link-json")
 *                 .contentValue("http://conferenceapi.azurewebsites.net/?format=json")
 *                 .build())
 *             .build());
 *         var exampleLogger = new Logger("exampleLogger", LoggerArgs.builder()
 *             .name("example-apimlogger")
 *             .apiManagementName(exampleService.name())
 *             .resourceGroupName(example.name())
 *             .applicationInsights(LoggerApplicationInsightsArgs.builder()
 *                 .instrumentationKey(exampleInsights.instrumentationKey())
 *                 .build())
 *             .build());
 *         var exampleApiDiagnostic = new ApiDiagnostic("exampleApiDiagnostic", ApiDiagnosticArgs.builder()
 *             .identifier("applicationinsights")
 *             .resourceGroupName(example.name())
 *             .apiManagementName(exampleService.name())
 *             .apiName(exampleApi.name())
 *             .apiManagementLoggerId(exampleLogger.id())
 *             .samplingPercentage(5)
 *             .alwaysLogErrors(true)
 *             .logClientIp(true)
 *             .verbosity("verbose")
 *             .httpCorrelationProtocol("W3C")
 *             .frontendRequest(ApiDiagnosticFrontendRequestArgs.builder()
 *                 .bodyBytes(32)
 *                 .headersToLogs(
 *                     "content-type",
 *                     "accept",
 *                     "origin")
 *                 .build())
 *             .frontendResponse(ApiDiagnosticFrontendResponseArgs.builder()
 *                 .bodyBytes(32)
 *                 .headersToLogs(
 *                     "content-type",
 *                     "content-length",
 *                     "origin")
 *                 .build())
 *             .backendRequest(ApiDiagnosticBackendRequestArgs.builder()
 *                 .bodyBytes(32)
 *                 .headersToLogs(
 *                     "content-type",
 *                     "accept",
 *                     "origin")
 *                 .build())
 *             .backendResponse(ApiDiagnosticBackendResponseArgs.builder()
 *                 .bodyBytes(32)
 *                 .headersToLogs(
 *                     "content-type",
 *                     "content-length",
 *                     "origin")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleInsights:
 *     type: azure:appinsights:Insights
 *     name: example
 *     properties:
 *       name: example-appinsights
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       applicationType: web
 *   exampleService:
 *     type: azure:apimanagement:Service
 *     name: example
 *     properties:
 *       name: example-apim
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       publisherName: My Company
 *       publisherEmail: [email protected]
 *       skuName: Developer_1
 *   exampleApi:
 *     type: azure:apimanagement:Api
 *     name: example
 *     properties:
 *       name: example-api
 *       resourceGroupName: ${example.name}
 *       apiManagementName: ${exampleService.name}
 *       revision: '1'
 *       displayName: Example API
 *       path: example
 *       protocols:
 *         - https
 *       import:
 *         contentFormat: swagger-link-json
 *         contentValue: http://conferenceapi.azurewebsites.net/?format=json
 *   exampleLogger:
 *     type: azure:apimanagement:Logger
 *     name: example
 *     properties:
 *       name: example-apimlogger
 *       apiManagementName: ${exampleService.name}
 *       resourceGroupName: ${example.name}
 *       applicationInsights:
 *         instrumentationKey: ${exampleInsights.instrumentationKey}
 *   exampleApiDiagnostic:
 *     type: azure:apimanagement:ApiDiagnostic
 *     name: example
 *     properties:
 *       identifier: applicationinsights
 *       resourceGroupName: ${example.name}
 *       apiManagementName: ${exampleService.name}
 *       apiName: ${exampleApi.name}
 *       apiManagementLoggerId: ${exampleLogger.id}
 *       samplingPercentage: 5
 *       alwaysLogErrors: true
 *       logClientIp: true
 *       verbosity: verbose
 *       httpCorrelationProtocol: W3C
 *       frontendRequest:
 *         bodyBytes: 32
 *         headersToLogs:
 *           - content-type
 *           - accept
 *           - origin
 *       frontendResponse:
 *         bodyBytes: 32
 *         headersToLogs:
 *           - content-type
 *           - content-length
 *           - origin
 *       backendRequest:
 *         bodyBytes: 32
 *         headersToLogs:
 *           - content-type
 *           - accept
 *           - origin
 *       backendResponse:
 *         bodyBytes: 32
 *         headersToLogs:
 *           - content-type
 *           - content-length
 *           - origin
 * ```
 * 
 * ## Import
 * API Management Service API Diagnostics Logs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:apimanagement/apiDiagnostic:ApiDiagnostic example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/diagnostics/diagnostic1
 * ```
 */
public class ApiDiagnostic internal constructor(
    override val javaResource: com.pulumi.azure.apimanagement.ApiDiagnostic,
) : KotlinCustomResource(javaResource, ApiDiagnosticMapper) {
    /**
     * Always log errors. Send telemetry if there is an erroneous condition, regardless of sampling settings.
     */
    public val alwaysLogErrors: Output
        get() = javaResource.alwaysLogErrors().applyValue({ args0 -> args0 })

    /**
     * The ID (name) of the Diagnostics Logger.
     */
    public val apiManagementLoggerId: Output
        get() = javaResource.apiManagementLoggerId().applyValue({ args0 -> args0 })

    /**
     * The name of the API Management Service instance. Changing this forces a new API Management Service API Diagnostics Logs to be created.
     */
    public val apiManagementName: Output
        get() = javaResource.apiManagementName().applyValue({ args0 -> args0 })

    /**
     * The name of the API on which to configure the Diagnostics Logs. Changing this forces a new API Management Service API Diagnostics Logs to be created.
     */
    public val apiName: Output
        get() = javaResource.apiName().applyValue({ args0 -> args0 })

    /**
     * A `backend_request` block as defined below.
     */
    public val backendRequest: Output
        get() = javaResource.backendRequest().applyValue({ args0 ->
            args0.let({ args0 ->
                apiDiagnosticBackendRequestToKotlin(args0)
            })
        })

    /**
     * A `backend_response` block as defined below.
     */
    public val backendResponse: Output
        get() = javaResource.backendResponse().applyValue({ args0 ->
            args0.let({ args0 ->
                apiDiagnosticBackendResponseToKotlin(args0)
            })
        })

    /**
     * A `frontend_request` block as defined below.
     */
    public val frontendRequest: Output
        get() = javaResource.frontendRequest().applyValue({ args0 ->
            args0.let({ args0 ->
                apiDiagnosticFrontendRequestToKotlin(args0)
            })
        })

    /**
     * A `frontend_response` block as defined below.
     */
    public val frontendResponse: Output
        get() = javaResource.frontendResponse().applyValue({ args0 ->
            args0.let({ args0 ->
                apiDiagnosticFrontendResponseToKotlin(args0)
            })
        })

    /**
     * The HTTP Correlation Protocol to use. Possible values are `None`, `Legacy` or `W3C`.
     */
    public val httpCorrelationProtocol: Output
        get() = javaResource.httpCorrelationProtocol().applyValue({ args0 -> args0 })

    /**
     * Identifier of the Diagnostics Logs. Possible values are `applicationinsights` and `azuremonitor`. Changing this forces a new API Management Service API Diagnostics Logs to be created.
     */
    public val identifier: Output
        get() = javaResource.identifier().applyValue({ args0 -> args0 })

    /**
     * Log client IP address.
     */
    public val logClientIp: Output
        get() = javaResource.logClientIp().applyValue({ args0 -> args0 })

    /**
     * The format of the Operation Name for Application Insights telemetries. Possible values are `Name`, and `Url`. Defaults to `Name`.
     */
    public val operationNameFormat: Output?
        get() = javaResource.operationNameFormat().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the API Management Service API Diagnostics Logs should exist. Changing this forces a new API Management Service API Diagnostics Logs to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Sampling (%). For high traffic APIs, please read this [documentation](https://docs.microsoft.com/azure/api-management/api-management-howto-app-insights#performance-implications-and-log-sampling) to understand performance implications and log sampling. Valid values are between `0.0` and `100.0`.
     */
    public val samplingPercentage: Output
        get() = javaResource.samplingPercentage().applyValue({ args0 -> args0 })

    /**
     * Logging verbosity. Possible values are `verbose`, `information` or `error`.
     */
    public val verbosity: Output
        get() = javaResource.verbosity().applyValue({ args0 -> args0 })
}

public object ApiDiagnosticMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.apimanagement.ApiDiagnostic::class == javaResource::class

    override fun map(javaResource: Resource): ApiDiagnostic = ApiDiagnostic(
        javaResource as
            com.pulumi.azure.apimanagement.ApiDiagnostic,
    )
}

/**
 * @see [ApiDiagnostic].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ApiDiagnostic].
 */
public suspend fun apiDiagnostic(
    name: String,
    block: suspend ApiDiagnosticResourceBuilder.() -> Unit,
): ApiDiagnostic {
    val builder = ApiDiagnosticResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ApiDiagnostic].
 * @param name The _unique_ name of the resulting resource.
 */
public fun apiDiagnostic(name: String): ApiDiagnostic {
    val builder = ApiDiagnosticResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy