
com.pulumi.gcp.apphub.kotlin.ServiceProjectAttachment.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.apphub.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 [ServiceProjectAttachment].
*/
@PulumiTagMarker
public class ServiceProjectAttachmentResourceBuilder internal constructor() {
public var name: String? = null
public var args: ServiceProjectAttachmentArgs = ServiceProjectAttachmentArgs()
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 ServiceProjectAttachmentArgsBuilder.() -> Unit) {
val builder = ServiceProjectAttachmentArgsBuilder()
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(): ServiceProjectAttachment {
val builtJavaResource = com.pulumi.gcp.apphub.ServiceProjectAttachment(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ServiceProjectAttachment(builtJavaResource)
}
}
/**
* Represents a Service project attachment to the Host Project.
* ## Example Usage
* ### Service Project Attachment Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumi/time";
* const serviceProject = new gcp.organizations.Project("service_project", {
* projectId: "project-1",
* name: "Service Project",
* orgId: "123456789",
* deletionPolicy: "DELETE",
* });
* const wait120s = new time.index.Sleep("wait_120s", {createDuration: "120s"}, {
* dependsOn: [serviceProject],
* });
* const example = new gcp.apphub.ServiceProjectAttachment("example", {serviceProjectAttachmentId: serviceProject.projectId}, {
* dependsOn: [wait120s],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_time as time
* service_project = gcp.organizations.Project("service_project",
* project_id="project-1",
* name="Service Project",
* org_id="123456789",
* deletion_policy="DELETE")
* wait120s = time.index.Sleep("wait_120s", create_duration=120s,
* opts = pulumi.ResourceOptions(depends_on=[service_project]))
* example = gcp.apphub.ServiceProjectAttachment("example", service_project_attachment_id=service_project.project_id,
* opts = pulumi.ResourceOptions(depends_on=[wait120s]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Time = Pulumi.Time;
* return await Deployment.RunAsync(() =>
* {
* var serviceProject = new Gcp.Organizations.Project("service_project", new()
* {
* ProjectId = "project-1",
* Name = "Service Project",
* OrgId = "123456789",
* DeletionPolicy = "DELETE",
* });
* var wait120s = new Time.Index.Sleep("wait_120s", new()
* {
* CreateDuration = "120s",
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* serviceProject,
* },
* });
* var example = new Gcp.Apphub.ServiceProjectAttachment("example", new()
* {
* ServiceProjectAttachmentId = serviceProject.ProjectId,
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* wait120s,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/apphub"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
* "github.com/pulumi/pulumi-time/sdk/go/time"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* serviceProject, err := organizations.NewProject(ctx, "service_project", &organizations.ProjectArgs{
* ProjectId: pulumi.String("project-1"),
* Name: pulumi.String("Service Project"),
* OrgId: pulumi.String("123456789"),
* DeletionPolicy: pulumi.String("DELETE"),
* })
* if err != nil {
* return err
* }
* wait120s, err := time.NewSleep(ctx, "wait_120s", &time.SleepArgs{
* CreateDuration: "120s",
* }, pulumi.DependsOn([]pulumi.Resource{
* serviceProject,
* }))
* if err != nil {
* return err
* }
* _, err = apphub.NewServiceProjectAttachment(ctx, "example", &apphub.ServiceProjectAttachmentArgs{
* ServiceProjectAttachmentId: serviceProject.ProjectId,
* }, pulumi.DependsOn([]pulumi.Resource{
* wait120s,
* }))
* 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.time.sleep;
* import com.pulumi.time.SleepArgs;
* import com.pulumi.gcp.apphub.ServiceProjectAttachment;
* import com.pulumi.gcp.apphub.ServiceProjectAttachmentArgs;
* 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) {
* var serviceProject = new Project("serviceProject", ProjectArgs.builder()
* .projectId("project-1")
* .name("Service Project")
* .orgId("123456789")
* .deletionPolicy("DELETE")
* .build());
* var wait120s = new Sleep("wait120s", SleepArgs.builder()
* .createDuration("120s")
* .build(), CustomResourceOptions.builder()
* .dependsOn(serviceProject)
* .build());
* var example = new ServiceProjectAttachment("example", ServiceProjectAttachmentArgs.builder()
* .serviceProjectAttachmentId(serviceProject.projectId())
* .build(), CustomResourceOptions.builder()
* .dependsOn(wait120s)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: gcp:apphub:ServiceProjectAttachment
* properties:
* serviceProjectAttachmentId: ${serviceProject.projectId}
* options:
* dependsOn:
* - ${wait120s}
* serviceProject:
* type: gcp:organizations:Project
* name: service_project
* properties:
* projectId: project-1
* name: Service Project
* orgId: '123456789'
* deletionPolicy: DELETE
* wait120s:
* type: time:sleep
* name: wait_120s
* properties:
* createDuration: 120s
* options:
* dependsOn:
* - ${serviceProject}
* ```
*
* ### Service Project Attachment Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumi/time";
* const serviceProjectFull = new gcp.organizations.Project("service_project_full", {
* projectId: "project-1",
* name: "Service Project Full",
* orgId: "123456789",
* deletionPolicy: "DELETE",
* });
* const wait120s = new time.index.Sleep("wait_120s", {createDuration: "120s"}, {
* dependsOn: [serviceProjectFull],
* });
* const example2 = new gcp.apphub.ServiceProjectAttachment("example2", {
* serviceProjectAttachmentId: serviceProjectFull.projectId,
* serviceProject: serviceProjectFull.projectId,
* }, {
* dependsOn: [wait120s],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_time as time
* service_project_full = gcp.organizations.Project("service_project_full",
* project_id="project-1",
* name="Service Project Full",
* org_id="123456789",
* deletion_policy="DELETE")
* wait120s = time.index.Sleep("wait_120s", create_duration=120s,
* opts = pulumi.ResourceOptions(depends_on=[service_project_full]))
* example2 = gcp.apphub.ServiceProjectAttachment("example2",
* service_project_attachment_id=service_project_full.project_id,
* service_project=service_project_full.project_id,
* opts = pulumi.ResourceOptions(depends_on=[wait120s]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Time = Pulumi.Time;
* return await Deployment.RunAsync(() =>
* {
* var serviceProjectFull = new Gcp.Organizations.Project("service_project_full", new()
* {
* ProjectId = "project-1",
* Name = "Service Project Full",
* OrgId = "123456789",
* DeletionPolicy = "DELETE",
* });
* var wait120s = new Time.Index.Sleep("wait_120s", new()
* {
* CreateDuration = "120s",
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* serviceProjectFull,
* },
* });
* var example2 = new Gcp.Apphub.ServiceProjectAttachment("example2", new()
* {
* ServiceProjectAttachmentId = serviceProjectFull.ProjectId,
* ServiceProject = serviceProjectFull.ProjectId,
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* wait120s,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/apphub"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
* "github.com/pulumi/pulumi-time/sdk/go/time"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* serviceProjectFull, err := organizations.NewProject(ctx, "service_project_full", &organizations.ProjectArgs{
* ProjectId: pulumi.String("project-1"),
* Name: pulumi.String("Service Project Full"),
* OrgId: pulumi.String("123456789"),
* DeletionPolicy: pulumi.String("DELETE"),
* })
* if err != nil {
* return err
* }
* wait120s, err := time.NewSleep(ctx, "wait_120s", &time.SleepArgs{
* CreateDuration: "120s",
* }, pulumi.DependsOn([]pulumi.Resource{
* serviceProjectFull,
* }))
* if err != nil {
* return err
* }
* _, err = apphub.NewServiceProjectAttachment(ctx, "example2", &apphub.ServiceProjectAttachmentArgs{
* ServiceProjectAttachmentId: serviceProjectFull.ProjectId,
* ServiceProject: serviceProjectFull.ProjectId,
* }, pulumi.DependsOn([]pulumi.Resource{
* wait120s,
* }))
* 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.time.sleep;
* import com.pulumi.time.SleepArgs;
* import com.pulumi.gcp.apphub.ServiceProjectAttachment;
* import com.pulumi.gcp.apphub.ServiceProjectAttachmentArgs;
* 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) {
* var serviceProjectFull = new Project("serviceProjectFull", ProjectArgs.builder()
* .projectId("project-1")
* .name("Service Project Full")
* .orgId("123456789")
* .deletionPolicy("DELETE")
* .build());
* var wait120s = new Sleep("wait120s", SleepArgs.builder()
* .createDuration("120s")
* .build(), CustomResourceOptions.builder()
* .dependsOn(serviceProjectFull)
* .build());
* var example2 = new ServiceProjectAttachment("example2", ServiceProjectAttachmentArgs.builder()
* .serviceProjectAttachmentId(serviceProjectFull.projectId())
* .serviceProject(serviceProjectFull.projectId())
* .build(), CustomResourceOptions.builder()
* .dependsOn(wait120s)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example2:
* type: gcp:apphub:ServiceProjectAttachment
* properties:
* serviceProjectAttachmentId: ${serviceProjectFull.projectId}
* serviceProject: ${serviceProjectFull.projectId}
* options:
* dependsOn:
* - ${wait120s}
* serviceProjectFull:
* type: gcp:organizations:Project
* name: service_project_full
* properties:
* projectId: project-1
* name: Service Project Full
* orgId: '123456789'
* deletionPolicy: DELETE
* wait120s:
* type: time:sleep
* name: wait_120s
* properties:
* createDuration: 120s
* options:
* dependsOn:
* - ${serviceProjectFull}
* ```
*
* ## Import
* ServiceProjectAttachment can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/global/serviceProjectAttachments/{{service_project_attachment_id}}`
* * `{{project}}/{{service_project_attachment_id}}`
* * `{{service_project_attachment_id}}`
* When using the `pulumi import` command, ServiceProjectAttachment can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:apphub/serviceProjectAttachment:ServiceProjectAttachment default projects/{{project}}/locations/global/serviceProjectAttachments/{{service_project_attachment_id}}
* ```
* ```sh
* $ pulumi import gcp:apphub/serviceProjectAttachment:ServiceProjectAttachment default {{project}}/{{service_project_attachment_id}}
* ```
* ```sh
* $ pulumi import gcp:apphub/serviceProjectAttachment:ServiceProjectAttachment default {{service_project_attachment_id}}
* ```
*/
public class ServiceProjectAttachment internal constructor(
override val javaResource: com.pulumi.gcp.apphub.ServiceProjectAttachment,
) : KotlinCustomResource(javaResource, ServiceProjectAttachmentMapper) {
/**
* Output only. Create time.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* "Identifier. The resource name of a ServiceProjectAttachment. Format:\"projects/{host-project-id}/locations/global/serviceProjectAttachments/{service-project-id}.\""
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* 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 })
/**
* "Immutable. Service project name in the format: \"projects/abc\"
* or \"projects/123\". As input, project name with either project id or number
* are accepted. As output, this field will contain project number."
*/
public val serviceProject: Output?
get() = javaResource.serviceProject().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Required. The service project attachment identifier must contain the project_id of the service project specified in the service_project_attachment.service_project field. Hint: "projects/{project_id}"
* - - -
*/
public val serviceProjectAttachmentId: Output
get() = javaResource.serviceProjectAttachmentId().applyValue({ args0 -> args0 })
/**
* ServiceProjectAttachment state.
*/
public val state: Output
get() = javaResource.state().applyValue({ args0 -> args0 })
/**
* Output only. A globally unique identifier (in UUID4 format) for the `ServiceProjectAttachment`.
*/
public val uid: Output
get() = javaResource.uid().applyValue({ args0 -> args0 })
}
public object ServiceProjectAttachmentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.apphub.ServiceProjectAttachment::class == javaResource::class
override fun map(javaResource: Resource): ServiceProjectAttachment =
ServiceProjectAttachment(javaResource as com.pulumi.gcp.apphub.ServiceProjectAttachment)
}
/**
* @see [ServiceProjectAttachment].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ServiceProjectAttachment].
*/
public suspend fun serviceProjectAttachment(
name: String,
block: suspend ServiceProjectAttachmentResourceBuilder.() -> Unit,
): ServiceProjectAttachment {
val builder = ServiceProjectAttachmentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ServiceProjectAttachment].
* @param name The _unique_ name of the resulting resource.
*/
public fun serviceProjectAttachment(name: String): ServiceProjectAttachment {
val builder = ServiceProjectAttachmentResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy