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

com.pulumi.gcp.apigee.kotlin.TargetServer.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.apigee.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.apigee.kotlin.outputs.TargetServerSSlInfo
import com.pulumi.gcp.apigee.kotlin.outputs.TargetServerSSlInfo.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: TargetServerArgs = TargetServerArgs()

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

/**
 * TargetServer configuration. TargetServers are used to decouple a proxy TargetEndpoint HTTPTargetConnections from concrete URLs for backend services.
 * To get more information about TargetServer, see:
 * * [API documentation](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.targetservers/create)
 * * How-to Guides
 *     * [Load balancing across backend servers](https://cloud.google.com/apigee/docs/api-platform/deploy/load-balancing-across-backend-servers)
 * ## Example Usage
 * ### Apigee Target Server Test Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = new gcp.organizations.Project("project", {
 *     projectId: "my-project",
 *     name: "my-project",
 *     orgId: "123456789",
 *     billingAccount: "000000-0000000-0000000-000000",
 * });
 * const apigee = new gcp.projects.Service("apigee", {
 *     project: project.projectId,
 *     service: "apigee.googleapis.com",
 * });
 * const servicenetworking = new gcp.projects.Service("servicenetworking", {
 *     project: project.projectId,
 *     service: "servicenetworking.googleapis.com",
 * });
 * const compute = new gcp.projects.Service("compute", {
 *     project: project.projectId,
 *     service: "compute.googleapis.com",
 * });
 * const apigeeNetwork = new gcp.compute.Network("apigee_network", {
 *     name: "apigee-network",
 *     project: project.projectId,
 * });
 * const apigeeRange = new gcp.compute.GlobalAddress("apigee_range", {
 *     name: "apigee-range",
 *     purpose: "VPC_PEERING",
 *     addressType: "INTERNAL",
 *     prefixLength: 16,
 *     network: apigeeNetwork.id,
 *     project: project.projectId,
 * });
 * 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: project.projectId,
 *     authorizedNetwork: apigeeNetwork.id,
 * });
 * const apigeeEnvironment = new gcp.apigee.Environment("apigee_environment", {
 *     orgId: apigeeOrg.id,
 *     name: "my-environment-name",
 *     description: "Apigee Environment",
 *     displayName: "environment-1",
 * });
 * const apigeeTargetServer = new gcp.apigee.TargetServer("apigee_target_server", {
 *     name: "my-target-server",
 *     description: "Apigee Target Server",
 *     protocol: "HTTP",
 *     host: "abc.foo.com",
 *     port: 8080,
 *     envId: apigeeEnvironment.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.Project("project",
 *     project_id="my-project",
 *     name="my-project",
 *     org_id="123456789",
 *     billing_account="000000-0000000-0000000-000000")
 * apigee = gcp.projects.Service("apigee",
 *     project=project.project_id,
 *     service="apigee.googleapis.com")
 * servicenetworking = gcp.projects.Service("servicenetworking",
 *     project=project.project_id,
 *     service="servicenetworking.googleapis.com")
 * compute = gcp.projects.Service("compute",
 *     project=project.project_id,
 *     service="compute.googleapis.com")
 * apigee_network = gcp.compute.Network("apigee_network",
 *     name="apigee-network",
 *     project=project.project_id)
 * apigee_range = gcp.compute.GlobalAddress("apigee_range",
 *     name="apigee-range",
 *     purpose="VPC_PEERING",
 *     address_type="INTERNAL",
 *     prefix_length=16,
 *     network=apigee_network.id,
 *     project=project.project_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=project.project_id,
 *     authorized_network=apigee_network.id)
 * apigee_environment = gcp.apigee.Environment("apigee_environment",
 *     org_id=apigee_org.id,
 *     name="my-environment-name",
 *     description="Apigee Environment",
 *     display_name="environment-1")
 * apigee_target_server = gcp.apigee.TargetServer("apigee_target_server",
 *     name="my-target-server",
 *     description="Apigee Target Server",
 *     protocol="HTTP",
 *     host="abc.foo.com",
 *     port=8080,
 *     env_id=apigee_environment.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = new Gcp.Organizations.Project("project", new()
 *     {
 *         ProjectId = "my-project",
 *         Name = "my-project",
 *         OrgId = "123456789",
 *         BillingAccount = "000000-0000000-0000000-000000",
 *     });
 *     var apigee = new Gcp.Projects.Service("apigee", new()
 *     {
 *         Project = project.ProjectId,
 *         ServiceName = "apigee.googleapis.com",
 *     });
 *     var servicenetworking = new Gcp.Projects.Service("servicenetworking", new()
 *     {
 *         Project = project.ProjectId,
 *         ServiceName = "servicenetworking.googleapis.com",
 *     });
 *     var compute = new Gcp.Projects.Service("compute", new()
 *     {
 *         Project = project.ProjectId,
 *         ServiceName = "compute.googleapis.com",
 *     });
 *     var apigeeNetwork = new Gcp.Compute.Network("apigee_network", new()
 *     {
 *         Name = "apigee-network",
 *         Project = project.ProjectId,
 *     });
 *     var apigeeRange = new Gcp.Compute.GlobalAddress("apigee_range", new()
 *     {
 *         Name = "apigee-range",
 *         Purpose = "VPC_PEERING",
 *         AddressType = "INTERNAL",
 *         PrefixLength = 16,
 *         Network = apigeeNetwork.Id,
 *         Project = project.ProjectId,
 *     });
 *     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 = project.ProjectId,
 *         AuthorizedNetwork = apigeeNetwork.Id,
 *     });
 *     var apigeeEnvironment = new Gcp.Apigee.Environment("apigee_environment", new()
 *     {
 *         OrgId = apigeeOrg.Id,
 *         Name = "my-environment-name",
 *         Description = "Apigee Environment",
 *         DisplayName = "environment-1",
 *     });
 *     var apigeeTargetServer = new Gcp.Apigee.TargetServer("apigee_target_server", new()
 *     {
 *         Name = "my-target-server",
 *         Description = "Apigee Target Server",
 *         Protocol = "HTTP",
 *         Host = "abc.foo.com",
 *         Port = 8080,
 *         EnvId = apigeeEnvironment.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/projects"
 * 	"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 {
 * 		project, err := organizations.NewProject(ctx, "project", &organizations.ProjectArgs{
 * 			ProjectId:      pulumi.String("my-project"),
 * 			Name:           pulumi.String("my-project"),
 * 			OrgId:          pulumi.String("123456789"),
 * 			BillingAccount: pulumi.String("000000-0000000-0000000-000000"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = projects.NewService(ctx, "apigee", &projects.ServiceArgs{
 * 			Project: project.ProjectId,
 * 			Service: pulumi.String("apigee.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = projects.NewService(ctx, "servicenetworking", &projects.ServiceArgs{
 * 			Project: project.ProjectId,
 * 			Service: pulumi.String("servicenetworking.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = projects.NewService(ctx, "compute", &projects.ServiceArgs{
 * 			Project: project.ProjectId,
 * 			Service: pulumi.String("compute.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		apigeeNetwork, err := compute.NewNetwork(ctx, "apigee_network", &compute.NetworkArgs{
 * 			Name:    pulumi.String("apigee-network"),
 * 			Project: project.ProjectId,
 * 		})
 * 		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(),
 * 			Project:      project.ProjectId,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, 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:         project.ProjectId,
 * 			AuthorizedNetwork: apigeeNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		apigeeEnvironment, err := apigee.NewEnvironment(ctx, "apigee_environment", &apigee.EnvironmentArgs{
 * 			OrgId:       apigeeOrg.ID(),
 * 			Name:        pulumi.String("my-environment-name"),
 * 			Description: pulumi.String("Apigee Environment"),
 * 			DisplayName: pulumi.String("environment-1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apigee.NewTargetServer(ctx, "apigee_target_server", &apigee.TargetServerArgs{
 * 			Name:        pulumi.String("my-target-server"),
 * 			Description: pulumi.String("Apigee Target Server"),
 * 			Protocol:    pulumi.String("HTTP"),
 * 			Host:        pulumi.String("abc.foo.com"),
 * 			Port:        pulumi.Int(8080),
 * 			EnvId:       apigeeEnvironment.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.Project;
 * import com.pulumi.gcp.organizations.ProjectArgs;
 * import com.pulumi.gcp.projects.Service;
 * import com.pulumi.gcp.projects.ServiceArgs;
 * 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.gcp.apigee.TargetServer;
 * import com.pulumi.gcp.apigee.TargetServerArgs;
 * 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 project = new Project("project", ProjectArgs.builder()
 *             .projectId("my-project")
 *             .name("my-project")
 *             .orgId("123456789")
 *             .billingAccount("000000-0000000-0000000-000000")
 *             .build());
 *         var apigee = new Service("apigee", ServiceArgs.builder()
 *             .project(project.projectId())
 *             .service("apigee.googleapis.com")
 *             .build());
 *         var servicenetworking = new Service("servicenetworking", ServiceArgs.builder()
 *             .project(project.projectId())
 *             .service("servicenetworking.googleapis.com")
 *             .build());
 *         var compute = new Service("compute", ServiceArgs.builder()
 *             .project(project.projectId())
 *             .service("compute.googleapis.com")
 *             .build());
 *         var apigeeNetwork = new Network("apigeeNetwork", NetworkArgs.builder()
 *             .name("apigee-network")
 *             .project(project.projectId())
 *             .build());
 *         var apigeeRange = new GlobalAddress("apigeeRange", GlobalAddressArgs.builder()
 *             .name("apigee-range")
 *             .purpose("VPC_PEERING")
 *             .addressType("INTERNAL")
 *             .prefixLength(16)
 *             .network(apigeeNetwork.id())
 *             .project(project.projectId())
 *             .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(project.projectId())
 *             .authorizedNetwork(apigeeNetwork.id())
 *             .build());
 *         var apigeeEnvironment = new Environment("apigeeEnvironment", EnvironmentArgs.builder()
 *             .orgId(apigeeOrg.id())
 *             .name("my-environment-name")
 *             .description("Apigee Environment")
 *             .displayName("environment-1")
 *             .build());
 *         var apigeeTargetServer = new TargetServer("apigeeTargetServer", TargetServerArgs.builder()
 *             .name("my-target-server")
 *             .description("Apigee Target Server")
 *             .protocol("HTTP")
 *             .host("abc.foo.com")
 *             .port(8080)
 *             .envId(apigeeEnvironment.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   project:
 *     type: gcp:organizations:Project
 *     properties:
 *       projectId: my-project
 *       name: my-project
 *       orgId: '123456789'
 *       billingAccount: 000000-0000000-0000000-000000
 *   apigee:
 *     type: gcp:projects:Service
 *     properties:
 *       project: ${project.projectId}
 *       service: apigee.googleapis.com
 *   servicenetworking:
 *     type: gcp:projects:Service
 *     properties:
 *       project: ${project.projectId}
 *       service: servicenetworking.googleapis.com
 *   compute:
 *     type: gcp:projects:Service
 *     properties:
 *       project: ${project.projectId}
 *       service: compute.googleapis.com
 *   apigeeNetwork:
 *     type: gcp:compute:Network
 *     name: apigee_network
 *     properties:
 *       name: apigee-network
 *       project: ${project.projectId}
 *   apigeeRange:
 *     type: gcp:compute:GlobalAddress
 *     name: apigee_range
 *     properties:
 *       name: apigee-range
 *       purpose: VPC_PEERING
 *       addressType: INTERNAL
 *       prefixLength: 16
 *       network: ${apigeeNetwork.id}
 *       project: ${project.projectId}
 *   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: ${project.projectId}
 *       authorizedNetwork: ${apigeeNetwork.id}
 *   apigeeEnvironment:
 *     type: gcp:apigee:Environment
 *     name: apigee_environment
 *     properties:
 *       orgId: ${apigeeOrg.id}
 *       name: my-environment-name
 *       description: Apigee Environment
 *       displayName: environment-1
 *   apigeeTargetServer:
 *     type: gcp:apigee:TargetServer
 *     name: apigee_target_server
 *     properties:
 *       name: my-target-server
 *       description: Apigee Target Server
 *       protocol: HTTP
 *       host: abc.foo.com
 *       port: 8080
 *       envId: ${apigeeEnvironment.id}
 * ```
 * 
 * ## Import
 * TargetServer can be imported using any of these accepted formats:
 * * `{{env_id}}/targetservers/{{name}}`
 * * `{{env_id}}/{{name}}`
 * When using the `pulumi import` command, TargetServer can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:apigee/targetServer:TargetServer default {{env_id}}/targetservers/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:apigee/targetServer:TargetServer default {{env_id}}/{{name}}
 * ```
 */
public class TargetServer internal constructor(
    override val javaResource: com.pulumi.gcp.apigee.TargetServer,
) : KotlinCustomResource(javaResource, TargetServerMapper) {
    /**
     * A human-readable description of this TargetServer.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The host name this target connects to. Value must be a valid hostname as described by RFC-1123.
     */
    public val host: Output
        get() = javaResource.host().applyValue({ args0 -> args0 })

    /**
     * Enabling/disabling a TargetServer is useful when TargetServers are used in load balancing configurations, and one or more TargetServers need to taken out of rotation periodically. Defaults to true.
     */
    public val isEnabled: Output?
        get() = javaResource.isEnabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The resource id of this reference. Values must match the regular expression [\w\s-.]+.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The port number this target connects to on the given host. Value must be between 1 and 65535, inclusive.
     */
    public val port: Output
        get() = javaResource.port().applyValue({ args0 -> args0 })

    /**
     * Immutable. The protocol used by this TargetServer.
     * Possible values are: `HTTP`, `HTTP2`, `GRPC_TARGET`, `GRPC`, `EXTERNAL_CALLOUT`.
     */
    public val protocol: Output
        get() = javaResource.protocol().applyValue({ args0 -> args0 })

    /**
     * Specifies TLS configuration info for this TargetServer. The JSON name is sSLInfo for legacy/backwards compatibility reasons -- Edge originally supported SSL, and the name is still used for TLS configuration.
     * Structure is documented below.
     */
    public val sSlInfo: Output?
        get() = javaResource.sSlInfo().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy