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

com.pulumi.gcp.billing.kotlin.ProjectInfo.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.billing.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 [ProjectInfo].
 */
@PulumiTagMarker
public class ProjectInfoResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ProjectInfoArgs = ProjectInfoArgs()

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

/**
 * Billing information for a project.
 * To get more information about ProjectInfo, see:
 * * [API documentation](https://cloud.google.com/billing/docs/reference/rest/v1/projects)
 * * How-to Guides
 *     * [Enable, disable, or change billing for a project](https://cloud.google.com/billing/docs/how-to/modify-project)
 * ## Example Usage
 * ### Billing Project Info Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = new gcp.organizations.Project("project", {
 *     projectId: "tf-test_81126",
 *     name: "tf-test_88717",
 *     orgId: "123456789",
 * });
 * const _default = new gcp.billing.ProjectInfo("default", {
 *     project: project.projectId,
 *     billingAccount: "000000-0000000-0000000-000000",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.Project("project",
 *     project_id="tf-test_81126",
 *     name="tf-test_88717",
 *     org_id="123456789")
 * default = gcp.billing.ProjectInfo("default",
 *     project=project.project_id,
 *     billing_account="000000-0000000-0000000-000000")
 * ```
 * ```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 = "tf-test_81126",
 *         Name = "tf-test_88717",
 *         OrgId = "123456789",
 *     });
 *     var @default = new Gcp.Billing.ProjectInfo("default", new()
 *     {
 *         Project = project.ProjectId,
 *         BillingAccount = "000000-0000000-0000000-000000",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/billing"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"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("tf-test_81126"),
 * 			Name:      pulumi.String("tf-test_88717"),
 * 			OrgId:     pulumi.String("123456789"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = billing.NewProjectInfo(ctx, "default", &billing.ProjectInfoArgs{
 * 			Project:        project.ProjectId,
 * 			BillingAccount: pulumi.String("000000-0000000-0000000-000000"),
 * 		})
 * 		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.billing.ProjectInfo;
 * import com.pulumi.gcp.billing.ProjectInfoArgs;
 * 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("tf-test_81126")
 *             .name("tf-test_88717")
 *             .orgId("123456789")
 *             .build());
 *         var default_ = new ProjectInfo("default", ProjectInfoArgs.builder()
 *             .project(project.projectId())
 *             .billingAccount("000000-0000000-0000000-000000")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   project:
 *     type: gcp:organizations:Project
 *     properties:
 *       projectId: tf-test_81126
 *       name: tf-test_88717
 *       orgId: '123456789'
 *   default:
 *     type: gcp:billing:ProjectInfo
 *     properties:
 *       project: ${project.projectId}
 *       billingAccount: 000000-0000000-0000000-000000
 * ```
 * 
 * ## Import
 * ProjectInfo can be imported using any of these accepted formats:
 * * `projects/{{project}}`
 * * `{{project}}`
 * When using the `pulumi import` command, ProjectInfo can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:billing/projectInfo:ProjectInfo default projects/{{project}}
 * ```
 * ```sh
 * $ pulumi import gcp:billing/projectInfo:ProjectInfo default {{project}}
 * ```
 */
public class ProjectInfo internal constructor(
    override val javaResource: com.pulumi.gcp.billing.ProjectInfo,
) : KotlinCustomResource(javaResource, ProjectInfoMapper) {
    /**
     * The ID of the billing account associated with the project, if
     * any. Set to empty string to disable billing for the project.
     * For example, `"012345-567890-ABCDEF"` or `""`.
     * - - -
     */
    public val billingAccount: Output
        get() = javaResource.billingAccount().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 })
}

public object ProjectInfoMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.billing.ProjectInfo::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy