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

com.pulumi.gcp.apigateway.kotlin.ApiConfig.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.apigateway.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigGatewayConfig
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigGrpcService
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigManagedServiceConfig
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigOpenapiDocument
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigGatewayConfig.Companion.toKotlin as apiConfigGatewayConfigToKotlin
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigGrpcService.Companion.toKotlin as apiConfigGrpcServiceToKotlin
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigManagedServiceConfig.Companion.toKotlin as apiConfigManagedServiceConfigToKotlin
import com.pulumi.gcp.apigateway.kotlin.outputs.ApiConfigOpenapiDocument.Companion.toKotlin as apiConfigOpenapiDocumentToKotlin

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

    public var args: ApiConfigArgs = ApiConfigArgs()

    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 ApiConfigArgsBuilder.() -> Unit) {
        val builder = ApiConfigArgsBuilder()
        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(): ApiConfig {
        val builtJavaResource = com.pulumi.gcp.apigateway.ApiConfig(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ApiConfig(builtJavaResource)
    }
}

/**
 * An API Configuration is an association of an API Controller Config and a Gateway Config
 * To get more information about ApiConfig, see:
 * * [API documentation](https://cloud.google.com/api-gateway/docs/reference/rest/v1beta/projects.locations.apis.configs)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/api-gateway/docs/creating-api-config)
 * ## Example Usage
 * ### Apigateway Api Config Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const apiCfg = new gcp.apigateway.Api("api_cfg", {apiId: "my-api"});
 * const apiCfgApiConfig = new gcp.apigateway.ApiConfig("api_cfg", {
 *     api: apiCfg.apiId,
 *     apiConfigId: "my-config",
 *     openapiDocuments: [{
 *         document: {
 *             path: "spec.yaml",
 *             contents: std.filebase64({
 *                 input: "test-fixtures/openapi.yaml",
 *             }).then(invoke => invoke.result),
 *         },
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * api_cfg = gcp.apigateway.Api("api_cfg", api_id="my-api")
 * api_cfg_api_config = gcp.apigateway.ApiConfig("api_cfg",
 *     api=api_cfg.api_id,
 *     api_config_id="my-config",
 *     openapi_documents=[gcp.apigateway.ApiConfigOpenapiDocumentArgs(
 *         document=gcp.apigateway.ApiConfigOpenapiDocumentDocumentArgs(
 *             path="spec.yaml",
 *             contents=std.filebase64(input="test-fixtures/openapi.yaml").result,
 *         ),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var apiCfg = new Gcp.ApiGateway.Api("api_cfg", new()
 *     {
 *         ApiId = "my-api",
 *     });
 *     var apiCfgApiConfig = new Gcp.ApiGateway.ApiConfig("api_cfg", new()
 *     {
 *         Api = apiCfg.ApiId,
 *         ApiConfigId = "my-config",
 *         OpenapiDocuments = new[]
 *         {
 *             new Gcp.ApiGateway.Inputs.ApiConfigOpenapiDocumentArgs
 *             {
 *                 Document = new Gcp.ApiGateway.Inputs.ApiConfigOpenapiDocumentDocumentArgs
 *                 {
 *                     Path = "spec.yaml",
 *                     Contents = Std.Filebase64.Invoke(new()
 *                     {
 *                         Input = "test-fixtures/openapi.yaml",
 *                     }).Apply(invoke => invoke.Result),
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apigateway"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		apiCfg, err := apigateway.NewApi(ctx, "api_cfg", &apigateway.ApiArgs{
 * 			ApiId: pulumi.String("my-api"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "test-fixtures/openapi.yaml",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apigateway.NewApiConfig(ctx, "api_cfg", &apigateway.ApiConfigArgs{
 * 			Api:         apiCfg.ApiId,
 * 			ApiConfigId: pulumi.String("my-config"),
 * 			OpenapiDocuments: apigateway.ApiConfigOpenapiDocumentArray{
 * 				&apigateway.ApiConfigOpenapiDocumentArgs{
 * 					Document: &apigateway.ApiConfigOpenapiDocumentDocumentArgs{
 * 						Path:     pulumi.String("spec.yaml"),
 * 						Contents: invokeFilebase64.Result,
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.gcp.apigateway.Api;
 * import com.pulumi.gcp.apigateway.ApiArgs;
 * import com.pulumi.gcp.apigateway.ApiConfig;
 * import com.pulumi.gcp.apigateway.ApiConfigArgs;
 * import com.pulumi.gcp.apigateway.inputs.ApiConfigOpenapiDocumentArgs;
 * import com.pulumi.gcp.apigateway.inputs.ApiConfigOpenapiDocumentDocumentArgs;
 * 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 apiCfg = new Api("apiCfg", ApiArgs.builder()
 *             .apiId("my-api")
 *             .build());
 *         var apiCfgApiConfig = new ApiConfig("apiCfgApiConfig", ApiConfigArgs.builder()
 *             .api(apiCfg.apiId())
 *             .apiConfigId("my-config")
 *             .openapiDocuments(ApiConfigOpenapiDocumentArgs.builder()
 *                 .document(ApiConfigOpenapiDocumentDocumentArgs.builder()
 *                     .path("spec.yaml")
 *                     .contents(StdFunctions.filebase64(Filebase64Args.builder()
 *                         .input("test-fixtures/openapi.yaml")
 *                         .build()).result())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   apiCfg:
 *     type: gcp:apigateway:Api
 *     name: api_cfg
 *     properties:
 *       apiId: my-api
 *   apiCfgApiConfig:
 *     type: gcp:apigateway:ApiConfig
 *     name: api_cfg
 *     properties:
 *       api: ${apiCfg.apiId}
 *       apiConfigId: my-config
 *       openapiDocuments:
 *         - document:
 *             path: spec.yaml
 *             contents:
 *               fn::invoke:
 *                 Function: std:filebase64
 *                 Arguments:
 *                   input: test-fixtures/openapi.yaml
 *                 Return: result
 * ```
 * 
 * ### Apigateway Api Config Grpc
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const apiCfg = new gcp.apigateway.Api("api_cfg", {apiId: "my-api"});
 * const apiCfgApiConfig = new gcp.apigateway.ApiConfig("api_cfg", {
 *     api: apiCfg.apiId,
 *     apiConfigId: "my-config",
 *     grpcServices: [{
 *         fileDescriptorSet: {
 *             path: "api_descriptor.pb",
 *             contents: std.filebase64({
 *                 input: "test-fixtures/api_descriptor.pb",
 *             }).then(invoke => invoke.result),
 *         },
 *     }],
 *     managedServiceConfigs: [{
 *         path: "api_config.yaml",
 *         contents: std.base64encodeOutput({
 *             input: pulumi.interpolate`type: google.api.Service
 * config_version: 3
 * name: ${apiCfg.managedService}
 * title: gRPC API example
 * apis:
 *   - name: endpoints.examples.bookstore.Bookstore
 * usage:
 *   rules:
 *   - selector: endpoints.examples.bookstore.Bookstore.ListShelves
 *     allow_unregistered_calls: true
 * backend:
 *   rules:
 *     - selector: "*"
 *       address: grpcs://example.com
 *       disable_auth: true
 * `,
 *         }).apply(invoke => invoke.result),
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * api_cfg = gcp.apigateway.Api("api_cfg", api_id="my-api")
 * api_cfg_api_config = gcp.apigateway.ApiConfig("api_cfg",
 *     api=api_cfg.api_id,
 *     api_config_id="my-config",
 *     grpc_services=[gcp.apigateway.ApiConfigGrpcServiceArgs(
 *         file_descriptor_set=gcp.apigateway.ApiConfigGrpcServiceFileDescriptorSetArgs(
 *             path="api_descriptor.pb",
 *             contents=std.filebase64(input="test-fixtures/api_descriptor.pb").result,
 *         ),
 *     )],
 *     managed_service_configs=[gcp.apigateway.ApiConfigManagedServiceConfigArgs(
 *         path="api_config.yaml",
 *         contents=std.base64encode_output(input=api_cfg.managed_service.apply(lambda managed_service: f"""type: google.api.Service
 * config_version: 3
 * name: {managed_service}
 * title: gRPC API example
 * apis:
 *   - name: endpoints.examples.bookstore.Bookstore
 * usage:
 *   rules:
 *   - selector: endpoints.examples.bookstore.Bookstore.ListShelves
 *     allow_unregistered_calls: true
 * backend:
 *   rules:
 *     - selector: "*"
 *       address: grpcs://example.com
 *       disable_auth: true
 * """)).apply(lambda invoke: invoke.result),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var apiCfg = new Gcp.ApiGateway.Api("api_cfg", new()
 *     {
 *         ApiId = "my-api",
 *     });
 *     var apiCfgApiConfig = new Gcp.ApiGateway.ApiConfig("api_cfg", new()
 *     {
 *         Api = apiCfg.ApiId,
 *         ApiConfigId = "my-config",
 *         GrpcServices = new[]
 *         {
 *             new Gcp.ApiGateway.Inputs.ApiConfigGrpcServiceArgs
 *             {
 *                 FileDescriptorSet = new Gcp.ApiGateway.Inputs.ApiConfigGrpcServiceFileDescriptorSetArgs
 *                 {
 *                     Path = "api_descriptor.pb",
 *                     Contents = Std.Filebase64.Invoke(new()
 *                     {
 *                         Input = "test-fixtures/api_descriptor.pb",
 *                     }).Apply(invoke => invoke.Result),
 *                 },
 *             },
 *         },
 *         ManagedServiceConfigs = new[]
 *         {
 *             new Gcp.ApiGateway.Inputs.ApiConfigManagedServiceConfigArgs
 *             {
 *                 Path = "api_config.yaml",
 *                 Contents = Std.Base64encode.Invoke(new()
 *                 {
 *                     Input = apiCfg.ManagedService.Apply(managedService => @$"type: google.api.Service
 * config_version: 3
 * name: {managedService}
 * title: gRPC API example
 * apis:
 *   - name: endpoints.examples.bookstore.Bookstore
 * usage:
 *   rules:
 *   - selector: endpoints.examples.bookstore.Bookstore.ListShelves
 *     allow_unregistered_calls: true
 * backend:
 *   rules:
 *     - selector: ""*""
 *       address: grpcs://example.com
 *       disable_auth: true
 * "),
 *                 }).Apply(invoke => invoke.Result),
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apigateway"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		apiCfg, err := apigateway.NewApi(ctx, "api_cfg", &apigateway.ApiArgs{
 * 			ApiId: pulumi.String("my-api"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "test-fixtures/api_descriptor.pb",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apigateway.NewApiConfig(ctx, "api_cfg", &apigateway.ApiConfigArgs{
 * 			Api:         apiCfg.ApiId,
 * 			ApiConfigId: pulumi.String("my-config"),
 * 			GrpcServices: apigateway.ApiConfigGrpcServiceArray{
 * 				&apigateway.ApiConfigGrpcServiceArgs{
 * 					FileDescriptorSet: &apigateway.ApiConfigGrpcServiceFileDescriptorSetArgs{
 * 						Path:     pulumi.String("api_descriptor.pb"),
 * 						Contents: invokeFilebase64.Result,
 * 					},
 * 				},
 * 			},
 * 			ManagedServiceConfigs: apigateway.ApiConfigManagedServiceConfigArray{
 * 				&apigateway.ApiConfigManagedServiceConfigArgs{
 * 					Path: pulumi.String("api_config.yaml"),
 * 					Contents: std.Base64encodeOutput(ctx, std.Base64encodeOutputArgs{
 * 						Input: apiCfg.ManagedService.ApplyT(func(managedService string) (string, error) {
 * 							return fmt.Sprintf(`type: google.api.Service
 * config_version: 3
 * name: %v
 * title: gRPC API example
 * apis:
 *   - name: endpoints.examples.bookstore.Bookstore
 * usage:
 *   rules:
 *   - selector: endpoints.examples.bookstore.Bookstore.ListShelves
 *     allow_unregistered_calls: true
 * backend:
 *   rules:
 *     - selector: "*"
 *       address: grpcs://example.com
 *       disable_auth: true
 * `, managedService), nil
 * 						}).(pulumi.StringOutput),
 * 					}, nil).ApplyT(func(invoke std.Base64encodeResult) (*string, error) {
 * 						return invoke.Result, nil
 * 					}).(pulumi.StringPtrOutput),
 * 				},
 * 			},
 * 		})
 * 		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.gcp.apigateway.Api;
 * import com.pulumi.gcp.apigateway.ApiArgs;
 * import com.pulumi.gcp.apigateway.ApiConfig;
 * import com.pulumi.gcp.apigateway.ApiConfigArgs;
 * import com.pulumi.gcp.apigateway.inputs.ApiConfigGrpcServiceArgs;
 * import com.pulumi.gcp.apigateway.inputs.ApiConfigGrpcServiceFileDescriptorSetArgs;
 * import com.pulumi.gcp.apigateway.inputs.ApiConfigManagedServiceConfigArgs;
 * 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 apiCfg = new Api("apiCfg", ApiArgs.builder()
 *             .apiId("my-api")
 *             .build());
 *         var apiCfgApiConfig = new ApiConfig("apiCfgApiConfig", ApiConfigArgs.builder()
 *             .api(apiCfg.apiId())
 *             .apiConfigId("my-config")
 *             .grpcServices(ApiConfigGrpcServiceArgs.builder()
 *                 .fileDescriptorSet(ApiConfigGrpcServiceFileDescriptorSetArgs.builder()
 *                     .path("api_descriptor.pb")
 *                     .contents(StdFunctions.filebase64(Filebase64Args.builder()
 *                         .input("test-fixtures/api_descriptor.pb")
 *                         .build()).result())
 *                     .build())
 *                 .build())
 *             .managedServiceConfigs(ApiConfigManagedServiceConfigArgs.builder()
 *                 .path("api_config.yaml")
 *                 .contents(StdFunctions.base64encode().applyValue(invoke -> invoke.result()))
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   apiCfg:
 *     type: gcp:apigateway:Api
 *     name: api_cfg
 *     properties:
 *       apiId: my-api
 *   apiCfgApiConfig:
 *     type: gcp:apigateway:ApiConfig
 *     name: api_cfg
 *     properties:
 *       api: ${apiCfg.apiId}
 *       apiConfigId: my-config
 *       grpcServices:
 *         - fileDescriptorSet:
 *             path: api_descriptor.pb
 *             contents:
 *               fn::invoke:
 *                 Function: std:filebase64
 *                 Arguments:
 *                   input: test-fixtures/api_descriptor.pb
 *                 Return: result
 *       managedServiceConfigs:
 *         - path: api_config.yaml
 *           contents:
 *             fn::invoke:
 *               Function: std:base64encode
 *               Arguments:
 *                 input: |+
 *                   type: google.api.Service
 *                   config_version: 3
 *                   name: ${apiCfg.managedService}
 *                   title: gRPC API example
 *                   apis:
 *                     - name: endpoints.examples.bookstore.Bookstore
 *                   usage:
 *                     rules:
 *                     - selector: endpoints.examples.bookstore.Bookstore.ListShelves
 *                       allow_unregistered_calls: true
 *                   backend:
 *                     rules:
 *                       - selector: "*"
 *                         address: grpcs://example.com
 *                         disable_auth: true
 *               Return: result
 * ```
 * 
 * ## Import
 * ApiConfig can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/global/apis/{{api}}/configs/{{api_config_id}}`
 * * `{{project}}/{{api}}/{{api_config_id}}`
 * * `{{api}}/{{api_config_id}}`
 * When using the `pulumi import` command, ApiConfig can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:apigateway/apiConfig:ApiConfig default projects/{{project}}/locations/global/apis/{{api}}/configs/{{api_config_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:apigateway/apiConfig:ApiConfig default {{project}}/{{api}}/{{api_config_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:apigateway/apiConfig:ApiConfig default {{api}}/{{api_config_id}}
 * ```
 */
public class ApiConfig internal constructor(
    override val javaResource: com.pulumi.gcp.apigateway.ApiConfig,
) : KotlinCustomResource(javaResource, ApiConfigMapper) {
    /**
     * The API to attach the config to.
     * - - -
     */
    public val api: Output
        get() = javaResource.api().applyValue({ args0 -> args0 })

    /**
     * Identifier to assign to the API Config. Must be unique within scope of the parent resource(api).
     */
    public val apiConfigId: Output
        get() = javaResource.apiConfigId().applyValue({ args0 -> args0 })

    /**
     * Creates a unique name beginning with the
     * specified prefix. If this and api_config_id are unspecified, a random value is chosen for the name.
     */
    public val apiConfigIdPrefix: Output
        get() = javaResource.apiConfigIdPrefix().applyValue({ args0 -> args0 })

    /**
     * A user-visible name for the API.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Immutable. Gateway specific configuration.
     * If not specified, backend authentication will be set to use OIDC authentication using the default compute service account
     * Structure is documented below.
     */
    public val gatewayConfig: Output?
        get() = javaResource.gatewayConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> apiConfigGatewayConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * gRPC service definition files. If specified, openapiDocuments must not be included.
     * Structure is documented below.
     */
    public val grpcServices: Output>?
        get() = javaResource.grpcServices().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> apiConfigGrpcServiceToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Resource labels to represent user-provided metadata.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Optional. Service Configuration files. At least one must be included when using gRPC service definitions. See https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#service_configuration_overview for the expected file contents.
     * If multiple files are specified, the files are merged with the following rules: * All singular scalar fields are merged using "last one wins" semantics in the order of the files uploaded. * Repeated fields are concatenated. * Singular embedded messages are merged using these rules for nested fields.
     * Structure is documented below.
     */
    public val managedServiceConfigs: Output>?
        get() = javaResource.managedServiceConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        apiConfigManagedServiceConfigToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The resource name of the API Config.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * OpenAPI specification documents. If specified, grpcServices and managedServiceConfigs must not be included.
     * Structure is documented below.
     */
    public val openapiDocuments: Output>?
        get() = javaResource.openapiDocuments().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        apiConfigOpenapiDocumentToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The ID of the associated Service Config (https://cloud.google.com/service-infrastructure/docs/glossary#config).
     */
    public val serviceConfigId: Output
        get() = javaResource.serviceConfigId().applyValue({ args0 -> args0 })
}

public object ApiConfigMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.apigateway.ApiConfig::class == javaResource::class

    override fun map(javaResource: Resource): ApiConfig = ApiConfig(
        javaResource as
            com.pulumi.gcp.apigateway.ApiConfig,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy