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

com.pulumi.gcp.apigee.kotlin.Environment.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.apigee.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.apigee.kotlin.outputs.EnvironmentNodeConfig
import com.pulumi.gcp.apigee.kotlin.outputs.EnvironmentNodeConfig.Companion.toKotlin
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

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

    public var args: EnvironmentArgs = EnvironmentArgs()

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

/**
 * An `Environment` in Apigee.
 * To get more information about Environment, see:
 * * [API documentation](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/create)
 * * How-to Guides
 *     * [Creating an environment](https://cloud.google.com/apigee/docs/api-platform/get-started/create-environment)
 * ## Example Usage
 * ### Apigee Environment Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const current = gcp.organizations.getClientConfig({});
 * const apigeeNetwork = new gcp.compute.Network("apigee_network", {name: "apigee-network"});
 * const apigeeRange = new gcp.compute.GlobalAddress("apigee_range", {
 *     name: "apigee-range",
 *     purpose: "VPC_PEERING",
 *     addressType: "INTERNAL",
 *     prefixLength: 16,
 *     network: apigeeNetwork.id,
 * });
 * const apigeeVpcConnection = new gcp.servicenetworking.Connection("apigee_vpc_connection", {
 *     network: apigeeNetwork.id,
 *     service: "servicenetworking.googleapis.com",
 *     reservedPeeringRanges: [apigeeRange.name],
 * });
 * const apigeeOrg = new gcp.apigee.Organization("apigee_org", {
 *     analyticsRegion: "us-central1",
 *     projectId: current.then(current => current.project),
 *     authorizedNetwork: apigeeNetwork.id,
 * }, {
 *     dependsOn: [apigeeVpcConnection],
 * });
 * const env = new gcp.apigee.Environment("env", {
 *     name: "my-environment",
 *     description: "Apigee Environment",
 *     displayName: "environment-1",
 *     orgId: apigeeOrg.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * current = gcp.organizations.get_client_config()
 * apigee_network = gcp.compute.Network("apigee_network", name="apigee-network")
 * apigee_range = gcp.compute.GlobalAddress("apigee_range",
 *     name="apigee-range",
 *     purpose="VPC_PEERING",
 *     address_type="INTERNAL",
 *     prefix_length=16,
 *     network=apigee_network.id)
 * apigee_vpc_connection = gcp.servicenetworking.Connection("apigee_vpc_connection",
 *     network=apigee_network.id,
 *     service="servicenetworking.googleapis.com",
 *     reserved_peering_ranges=[apigee_range.name])
 * apigee_org = gcp.apigee.Organization("apigee_org",
 *     analytics_region="us-central1",
 *     project_id=current.project,
 *     authorized_network=apigee_network.id,
 *     opts = pulumi.ResourceOptions(depends_on=[apigee_vpc_connection]))
 * env = gcp.apigee.Environment("env",
 *     name="my-environment",
 *     description="Apigee Environment",
 *     display_name="environment-1",
 *     org_id=apigee_org.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Gcp.Organizations.GetClientConfig.Invoke();
 *     var apigeeNetwork = new Gcp.Compute.Network("apigee_network", new()
 *     {
 *         Name = "apigee-network",
 *     });
 *     var apigeeRange = new Gcp.Compute.GlobalAddress("apigee_range", new()
 *     {
 *         Name = "apigee-range",
 *         Purpose = "VPC_PEERING",
 *         AddressType = "INTERNAL",
 *         PrefixLength = 16,
 *         Network = apigeeNetwork.Id,
 *     });
 *     var apigeeVpcConnection = new Gcp.ServiceNetworking.Connection("apigee_vpc_connection", new()
 *     {
 *         Network = apigeeNetwork.Id,
 *         Service = "servicenetworking.googleapis.com",
 *         ReservedPeeringRanges = new[]
 *         {
 *             apigeeRange.Name,
 *         },
 *     });
 *     var apigeeOrg = new Gcp.Apigee.Organization("apigee_org", new()
 *     {
 *         AnalyticsRegion = "us-central1",
 *         ProjectId = current.Apply(getClientConfigResult => getClientConfigResult.Project),
 *         AuthorizedNetwork = apigeeNetwork.Id,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             apigeeVpcConnection,
 *         },
 *     });
 *     var env = new Gcp.Apigee.Environment("env", new()
 *     {
 *         Name = "my-environment",
 *         Description = "Apigee Environment",
 *         DisplayName = "environment-1",
 *         OrgId = apigeeOrg.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apigee"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		current, err := organizations.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		apigeeNetwork, err := compute.NewNetwork(ctx, "apigee_network", &compute.NetworkArgs{
 * 			Name: pulumi.String("apigee-network"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		apigeeRange, err := compute.NewGlobalAddress(ctx, "apigee_range", &compute.GlobalAddressArgs{
 * 			Name:         pulumi.String("apigee-range"),
 * 			Purpose:      pulumi.String("VPC_PEERING"),
 * 			AddressType:  pulumi.String("INTERNAL"),
 * 			PrefixLength: pulumi.Int(16),
 * 			Network:      apigeeNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		apigeeVpcConnection, err := servicenetworking.NewConnection(ctx, "apigee_vpc_connection", &servicenetworking.ConnectionArgs{
 * 			Network: apigeeNetwork.ID(),
 * 			Service: pulumi.String("servicenetworking.googleapis.com"),
 * 			ReservedPeeringRanges: pulumi.StringArray{
 * 				apigeeRange.Name,
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		apigeeOrg, err := apigee.NewOrganization(ctx, "apigee_org", &apigee.OrganizationArgs{
 * 			AnalyticsRegion:   pulumi.String("us-central1"),
 * 			ProjectId:         pulumi.String(current.Project),
 * 			AuthorizedNetwork: apigeeNetwork.ID(),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			apigeeVpcConnection,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apigee.NewEnvironment(ctx, "env", &apigee.EnvironmentArgs{
 * 			Name:        pulumi.String("my-environment"),
 * 			Description: pulumi.String("Apigee Environment"),
 * 			DisplayName: pulumi.String("environment-1"),
 * 			OrgId:       apigeeOrg.ID(),
 * 		})
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.GlobalAddress;
 * import com.pulumi.gcp.compute.GlobalAddressArgs;
 * import com.pulumi.gcp.servicenetworking.Connection;
 * import com.pulumi.gcp.servicenetworking.ConnectionArgs;
 * import com.pulumi.gcp.apigee.Organization;
 * import com.pulumi.gcp.apigee.OrganizationArgs;
 * import com.pulumi.gcp.apigee.Environment;
 * import com.pulumi.gcp.apigee.EnvironmentArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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) {
 *         final var current = OrganizationsFunctions.getClientConfig();
 *         var apigeeNetwork = new Network("apigeeNetwork", NetworkArgs.builder()
 *             .name("apigee-network")
 *             .build());
 *         var apigeeRange = new GlobalAddress("apigeeRange", GlobalAddressArgs.builder()
 *             .name("apigee-range")
 *             .purpose("VPC_PEERING")
 *             .addressType("INTERNAL")
 *             .prefixLength(16)
 *             .network(apigeeNetwork.id())
 *             .build());
 *         var apigeeVpcConnection = new Connection("apigeeVpcConnection", ConnectionArgs.builder()
 *             .network(apigeeNetwork.id())
 *             .service("servicenetworking.googleapis.com")
 *             .reservedPeeringRanges(apigeeRange.name())
 *             .build());
 *         var apigeeOrg = new Organization("apigeeOrg", OrganizationArgs.builder()
 *             .analyticsRegion("us-central1")
 *             .projectId(current.applyValue(getClientConfigResult -> getClientConfigResult.project()))
 *             .authorizedNetwork(apigeeNetwork.id())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(apigeeVpcConnection)
 *                 .build());
 *         var env = new Environment("env", EnvironmentArgs.builder()
 *             .name("my-environment")
 *             .description("Apigee Environment")
 *             .displayName("environment-1")
 *             .orgId(apigeeOrg.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   apigeeNetwork:
 *     type: gcp:compute:Network
 *     name: apigee_network
 *     properties:
 *       name: apigee-network
 *   apigeeRange:
 *     type: gcp:compute:GlobalAddress
 *     name: apigee_range
 *     properties:
 *       name: apigee-range
 *       purpose: VPC_PEERING
 *       addressType: INTERNAL
 *       prefixLength: 16
 *       network: ${apigeeNetwork.id}
 *   apigeeVpcConnection:
 *     type: gcp:servicenetworking:Connection
 *     name: apigee_vpc_connection
 *     properties:
 *       network: ${apigeeNetwork.id}
 *       service: servicenetworking.googleapis.com
 *       reservedPeeringRanges:
 *         - ${apigeeRange.name}
 *   apigeeOrg:
 *     type: gcp:apigee:Organization
 *     name: apigee_org
 *     properties:
 *       analyticsRegion: us-central1
 *       projectId: ${current.project}
 *       authorizedNetwork: ${apigeeNetwork.id}
 *     options:
 *       dependson:
 *         - ${apigeeVpcConnection}
 *   env:
 *     type: gcp:apigee:Environment
 *     properties:
 *       name: my-environment
 *       description: Apigee Environment
 *       displayName: environment-1
 *       orgId: ${apigeeOrg.id}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: gcp:organizations:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Environment can be imported using any of these accepted formats:
 * * `{{org_id}}/environments/{{name}}`
 * * `{{org_id}}/{{name}}`
 * When using the `pulumi import` command, Environment can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:apigee/environment:Environment default {{org_id}}/environments/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:apigee/environment:Environment default {{org_id}}/{{name}}
 * ```
 */
public class Environment internal constructor(
    override val javaResource: com.pulumi.gcp.apigee.Environment,
) : KotlinCustomResource(javaResource, EnvironmentMapper) {
    /**
     * Optional. API Proxy type supported by the environment. The type can be set when creating
     * the Environment and cannot be changed.
     * Possible values are: `API_PROXY_TYPE_UNSPECIFIED`, `PROGRAMMABLE`, `CONFIGURABLE`.
     */
    public val apiProxyType: Output
        get() = javaResource.apiProxyType().applyValue({ args0 -> args0 })

    /**
     * Optional. Deployment type supported by the environment. The deployment type can be
     * set when creating the environment and cannot be changed. When you enable archive
     * deployment, you will be prevented from performing a subset of actions within the
     * environment, including:
     * Managing the deployment of API proxy or shared flow revisions;
     * Creating, updating, or deleting resource files;
     * Creating, updating, or deleting target servers.
     * Possible values are: `DEPLOYMENT_TYPE_UNSPECIFIED`, `PROXY`, `ARCHIVE`.
     */
    public val deploymentType: Output
        get() = javaResource.deploymentType().applyValue({ args0 -> args0 })

    /**
     * Description of the environment.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Display name of the environment.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Optional. URI of the forward proxy to be applied to the runtime instances in this environment. Must be in the format of {scheme}://{hostname}:{port}. Note that the scheme must be one of "http" or "https", and the port must be supplied.
     */
    public val forwardProxyUri: Output?
        get() = javaResource.forwardProxyUri().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * NodeConfig for setting the min/max number of nodes associated with the environment.
     * Structure is documented below.
     */
    public val nodeConfig: Output
        get() = javaResource.nodeConfig().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })

    /**
     * The Apigee Organization associated with the Apigee environment,
     * in the format `organizations/{{org_name}}`.
     * - - -
     */
    public val orgId: Output
        get() = javaResource.orgId().applyValue({ args0 -> args0 })

    /**
     * Types that can be selected for an Environment. Each of the types are
     * limited by capability and capacity. Refer to Apigee's public documentation
     * to understand about each of these types in details.
     * An Apigee org can support heterogeneous Environments.
     * Possible values are: `ENVIRONMENT_TYPE_UNSPECIFIED`, `BASE`, `INTERMEDIATE`, `COMPREHENSIVE`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object EnvironmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.apigee.Environment::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy