All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.compute.kotlin.SharedVPCHostProject.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.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
/**
* Builder for [SharedVPCHostProject].
*/
@PulumiTagMarker
public class SharedVPCHostProjectResourceBuilder internal constructor() {
public var name: String? = null
public var args: SharedVPCHostProjectArgs = SharedVPCHostProjectArgs()
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 SharedVPCHostProjectArgsBuilder.() -> Unit) {
val builder = SharedVPCHostProjectArgsBuilder()
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(): SharedVPCHostProject {
val builtJavaResource = com.pulumi.gcp.compute.SharedVPCHostProject(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SharedVPCHostProject(builtJavaResource)
}
}
/**
* Enables the Google Compute Engine
* [Shared VPC](https://cloud.google.com/compute/docs/shared-vpc)
* feature for a project, assigning it as a Shared VPC host project.
* For more information, see,
* [the Project API documentation](https://cloud.google.com/compute/docs/reference/latest/projects),
* where the Shared VPC feature is referred to by its former name "XPN".
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* // A host project provides network resources to associated service projects.
* const host = new gcp.compute.SharedVPCHostProject("host", {project: "host-project-id"});
* // A service project gains access to network resources provided by its
* // associated host project.
* const service1 = new gcp.compute.SharedVPCServiceProject("service1", {
* hostProject: host.project,
* serviceProject: "service-project-id-1",
* });
* const service2 = new gcp.compute.SharedVPCServiceProject("service2", {
* hostProject: host.project,
* serviceProject: "service-project-id-2",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* # A host project provides network resources to associated service projects.
* host = gcp.compute.SharedVPCHostProject("host", project="host-project-id")
* # A service project gains access to network resources provided by its
* # associated host project.
* service1 = gcp.compute.SharedVPCServiceProject("service1",
* host_project=host.project,
* service_project="service-project-id-1")
* service2 = gcp.compute.SharedVPCServiceProject("service2",
* host_project=host.project,
* service_project="service-project-id-2")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* // A host project provides network resources to associated service projects.
* var host = new Gcp.Compute.SharedVPCHostProject("host", new()
* {
* Project = "host-project-id",
* });
* // A service project gains access to network resources provided by its
* // associated host project.
* var service1 = new Gcp.Compute.SharedVPCServiceProject("service1", new()
* {
* HostProject = host.Project,
* ServiceProject = "service-project-id-1",
* });
* var service2 = new Gcp.Compute.SharedVPCServiceProject("service2", new()
* {
* HostProject = host.Project,
* ServiceProject = "service-project-id-2",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* // A host project provides network resources to associated service projects.
* host, err := compute.NewSharedVPCHostProject(ctx, "host", &compute.SharedVPCHostProjectArgs{
* Project: pulumi.String("host-project-id"),
* })
* if err != nil {
* return err
* }
* // A service project gains access to network resources provided by its
* // associated host project.
* _, err = compute.NewSharedVPCServiceProject(ctx, "service1", &compute.SharedVPCServiceProjectArgs{
* HostProject: host.Project,
* ServiceProject: pulumi.String("service-project-id-1"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewSharedVPCServiceProject(ctx, "service2", &compute.SharedVPCServiceProjectArgs{
* HostProject: host.Project,
* ServiceProject: pulumi.String("service-project-id-2"),
* })
* 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.compute.SharedVPCHostProject;
* import com.pulumi.gcp.compute.SharedVPCHostProjectArgs;
* import com.pulumi.gcp.compute.SharedVPCServiceProject;
* import com.pulumi.gcp.compute.SharedVPCServiceProjectArgs;
* 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) {
* // A host project provides network resources to associated service projects.
* var host = new SharedVPCHostProject("host", SharedVPCHostProjectArgs.builder()
* .project("host-project-id")
* .build());
* // A service project gains access to network resources provided by its
* // associated host project.
* var service1 = new SharedVPCServiceProject("service1", SharedVPCServiceProjectArgs.builder()
* .hostProject(host.project())
* .serviceProject("service-project-id-1")
* .build());
* var service2 = new SharedVPCServiceProject("service2", SharedVPCServiceProjectArgs.builder()
* .hostProject(host.project())
* .serviceProject("service-project-id-2")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* # A host project provides network resources to associated service projects.
* host:
* type: gcp:compute:SharedVPCHostProject
* properties:
* project: host-project-id
* # A service project gains access to network resources provided by its
* # associated host project.
* service1:
* type: gcp:compute:SharedVPCServiceProject
* properties:
* hostProject: ${host.project}
* serviceProject: service-project-id-1
* service2:
* type: gcp:compute:SharedVPCServiceProject
* properties:
* hostProject: ${host.project}
* serviceProject: service-project-id-2
* ```
*
* ## Import
* Google Compute Engine Shared VPC host project feature can be imported using `project`, e.g.
* * `{{project_id}}`
* When using the `pulumi import` command, Google Compute Engine Shared VPC host projects can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/sharedVPCHostProject:SharedVPCHostProject default {{project_id}}
* ```
*/
public class SharedVPCHostProject internal constructor(
override val javaResource: com.pulumi.gcp.compute.SharedVPCHostProject,
) : KotlinCustomResource(javaResource, SharedVPCHostProjectMapper) {
/**
* The ID of the project that will serve as a Shared VPC host project
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
}
public object SharedVPCHostProjectMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.SharedVPCHostProject::class == javaResource::class
override fun map(javaResource: Resource): SharedVPCHostProject = SharedVPCHostProject(
javaResource
as com.pulumi.gcp.compute.SharedVPCHostProject,
)
}
/**
* @see [SharedVPCHostProject].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SharedVPCHostProject].
*/
public suspend fun sharedVPCHostProject(
name: String,
block: suspend SharedVPCHostProjectResourceBuilder.() -> Unit,
): SharedVPCHostProject {
val builder = SharedVPCHostProjectResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SharedVPCHostProject].
* @param name The _unique_ name of the resulting resource.
*/
public fun sharedVPCHostProject(name: String): SharedVPCHostProject {
val builder = SharedVPCHostProjectResourceBuilder()
builder.name(name)
return builder.build()
}