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

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

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

package com.pulumi.gcp.apigee.kotlin

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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: EnvGroupArgs = EnvGroupArgs()

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

/**
 * An `Environment group` in Apigee.
 * To get more information about Envgroup, see:
 * * [API documentation](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.envgroups/create)
 * * How-to Guides
 *     * [Creating an environment](https://cloud.google.com/apigee/docs/api-platform/get-started/create-environment)
 * ## Example Usage
 * ### Apigee Environment Group 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 envGrp = new gcp.apigee.EnvGroup("env_grp", {
 *     name: "my-envgroup",
 *     hostnames: ["abc.foo.com"],
 *     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_grp = gcp.apigee.EnvGroup("env_grp",
 *     name="my-envgroup",
 *     hostnames=["abc.foo.com"],
 *     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 envGrp = new Gcp.Apigee.EnvGroup("env_grp", new()
 *     {
 *         Name = "my-envgroup",
 *         Hostnames = new[]
 *         {
 *             "abc.foo.com",
 *         },
 *         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.NewEnvGroup(ctx, "env_grp", &apigee.EnvGroupArgs{
 * 			Name: pulumi.String("my-envgroup"),
 * 			Hostnames: pulumi.StringArray{
 * 				pulumi.String("abc.foo.com"),
 * 			},
 * 			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.EnvGroup;
 * import com.pulumi.gcp.apigee.EnvGroupArgs;
 * 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 envGrp = new EnvGroup("envGrp", EnvGroupArgs.builder()
 *             .name("my-envgroup")
 *             .hostnames("abc.foo.com")
 *             .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}
 *   envGrp:
 *     type: gcp:apigee:EnvGroup
 *     name: env_grp
 *     properties:
 *       name: my-envgroup
 *       hostnames:
 *         - abc.foo.com
 *       orgId: ${apigeeOrg.id}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: gcp:organizations:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Envgroup can be imported using any of these accepted formats:
 * * `{{org_id}}/envgroups/{{name}}`
 * * `{{org_id}}/{{name}}`
 * When using the `pulumi import` command, Envgroup can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:apigee/envGroup:EnvGroup default {{org_id}}/envgroups/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:apigee/envGroup:EnvGroup default {{org_id}}/{{name}}
 * ```
 */
public class EnvGroup internal constructor(
    override val javaResource: com.pulumi.gcp.apigee.EnvGroup,
) : KotlinCustomResource(javaResource, EnvGroupMapper) {
    /**
     * Hostnames of the environment group.
     */
    public val hostnames: Output>?
        get() = javaResource.hostnames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

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

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy