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

com.pulumi.gitlab.kotlin.ProjectCluster.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.4.2.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

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

    public var args: ProjectClusterArgs = ProjectClusterArgs()

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

/**
 * The `gitlab.ProjectCluster` resource allows to manage the lifecycle of a project cluster.
 * > This is deprecated GitLab feature since 14.5
 * **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/project_clusters.html)
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gitlab from "@pulumi/gitlab";
 * const foo = new gitlab.Project("foo", {name: "foo-project"});
 * const bar = new gitlab.ProjectCluster("bar", {
 *     project: foo.id,
 *     name: "bar-cluster",
 *     domain: "example.com",
 *     enabled: true,
 *     kubernetesApiUrl: "https://124.124.124",
 *     kubernetesToken: "some-token",
 *     kubernetesCaCert: "some-cert",
 *     kubernetesNamespace: "namespace",
 *     kubernetesAuthorizationType: "rbac",
 *     environmentScope: "*",
 *     managementProjectId: "123456",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gitlab as gitlab
 * foo = gitlab.Project("foo", name="foo-project")
 * bar = gitlab.ProjectCluster("bar",
 *     project=foo.id,
 *     name="bar-cluster",
 *     domain="example.com",
 *     enabled=True,
 *     kubernetes_api_url="https://124.124.124",
 *     kubernetes_token="some-token",
 *     kubernetes_ca_cert="some-cert",
 *     kubernetes_namespace="namespace",
 *     kubernetes_authorization_type="rbac",
 *     environment_scope="*",
 *     management_project_id="123456")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using GitLab = Pulumi.GitLab;
 * return await Deployment.RunAsync(() =>
 * {
 *     var foo = new GitLab.Project("foo", new()
 *     {
 *         Name = "foo-project",
 *     });
 *     var bar = new GitLab.ProjectCluster("bar", new()
 *     {
 *         Project = foo.Id,
 *         Name = "bar-cluster",
 *         Domain = "example.com",
 *         Enabled = true,
 *         KubernetesApiUrl = "https://124.124.124",
 *         KubernetesToken = "some-token",
 *         KubernetesCaCert = "some-cert",
 *         KubernetesNamespace = "namespace",
 *         KubernetesAuthorizationType = "rbac",
 *         EnvironmentScope = "*",
 *         ManagementProjectId = "123456",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		foo, err := gitlab.NewProject(ctx, "foo", &gitlab.ProjectArgs{
 * 			Name: pulumi.String("foo-project"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = gitlab.NewProjectCluster(ctx, "bar", &gitlab.ProjectClusterArgs{
 * 			Project:                     foo.ID(),
 * 			Name:                        pulumi.String("bar-cluster"),
 * 			Domain:                      pulumi.String("example.com"),
 * 			Enabled:                     pulumi.Bool(true),
 * 			KubernetesApiUrl:            pulumi.String("https://124.124.124"),
 * 			KubernetesToken:             pulumi.String("some-token"),
 * 			KubernetesCaCert:            pulumi.String("some-cert"),
 * 			KubernetesNamespace:         pulumi.String("namespace"),
 * 			KubernetesAuthorizationType: pulumi.String("rbac"),
 * 			EnvironmentScope:            pulumi.String("*"),
 * 			ManagementProjectId:         pulumi.String("123456"),
 * 		})
 * 		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.gitlab.Project;
 * import com.pulumi.gitlab.ProjectArgs;
 * import com.pulumi.gitlab.ProjectCluster;
 * import com.pulumi.gitlab.ProjectClusterArgs;
 * 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 foo = new Project("foo", ProjectArgs.builder()
 *             .name("foo-project")
 *             .build());
 *         var bar = new ProjectCluster("bar", ProjectClusterArgs.builder()
 *             .project(foo.id())
 *             .name("bar-cluster")
 *             .domain("example.com")
 *             .enabled(true)
 *             .kubernetesApiUrl("https://124.124.124")
 *             .kubernetesToken("some-token")
 *             .kubernetesCaCert("some-cert")
 *             .kubernetesNamespace("namespace")
 *             .kubernetesAuthorizationType("rbac")
 *             .environmentScope("*")
 *             .managementProjectId("123456")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   foo:
 *     type: gitlab:Project
 *     properties:
 *       name: foo-project
 *   bar:
 *     type: gitlab:ProjectCluster
 *     properties:
 *       project: ${foo.id}
 *       name: bar-cluster
 *       domain: example.com
 *       enabled: true
 *       kubernetesApiUrl: https://124.124.124
 *       kubernetesToken: some-token
 *       kubernetesCaCert: some-cert
 *       kubernetesNamespace: namespace
 *       kubernetesAuthorizationType: rbac
 *       environmentScope: '*'
 *       managementProjectId: '123456'
 * ```
 * 
 * ## Import
 * GitLab project clusters can be imported using an id made up of `projectid:clusterid`, e.g.
 * ```sh
 * $ pulumi import gitlab:index/projectCluster:ProjectCluster bar 123:321
 * ```
 */
public class ProjectCluster internal constructor(
    override val javaResource: com.pulumi.gitlab.ProjectCluster,
) : KotlinCustomResource(javaResource, ProjectClusterMapper) {
    /**
     * Cluster type.
     */
    public val clusterType: Output
        get() = javaResource.clusterType().applyValue({ args0 -> args0 })

    /**
     * Create time.
     */
    public val createdAt: Output
        get() = javaResource.createdAt().applyValue({ args0 -> args0 })

    /**
     * The base domain of the cluster.
     */
    public val domain: Output?
        get() = javaResource.domain().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Determines if cluster is active or not. Defaults to `true`. This attribute cannot be read.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The associated environment to the cluster. Defaults to `*`.
     */
    public val environmentScope: Output?
        get() = javaResource.environmentScope().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The URL to access the Kubernetes API.
     */
    public val kubernetesApiUrl: Output
        get() = javaResource.kubernetesApiUrl().applyValue({ args0 -> args0 })

    /**
     * The cluster authorization type. Valid values are `rbac`, `abac`, `unknown_authorization`. Defaults to `rbac`.
     */
    public val kubernetesAuthorizationType: Output?
        get() = javaResource.kubernetesAuthorizationType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * TLS certificate (needed if API is using a self-signed TLS certificate).
     */
    public val kubernetesCaCert: Output?
        get() = javaResource.kubernetesCaCert().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The unique namespace related to the project.
     */
    public val kubernetesNamespace: Output?
        get() = javaResource.kubernetesNamespace().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The token to authenticate against Kubernetes.
     */
    public val kubernetesToken: Output
        get() = javaResource.kubernetesToken().applyValue({ args0 -> args0 })

    /**
     * Determines if cluster is managed by gitlab or not. Defaults to `true`. This attribute cannot be read.
     */
    public val managed: Output?
        get() = javaResource.managed().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ID of the management project for the cluster.
     */
    public val managementProjectId: Output?
        get() = javaResource.managementProjectId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of cluster.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Platform type.
     */
    public val platformType: Output
        get() = javaResource.platformType().applyValue({ args0 -> args0 })

    /**
     * The id of the project to add the cluster to.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Provider type.
     */
    public val providerType: Output
        get() = javaResource.providerType().applyValue({ args0 -> args0 })
}

public object ProjectClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gitlab.ProjectCluster::class == javaResource::class

    override fun map(javaResource: Resource): ProjectCluster = ProjectCluster(
        javaResource as
            com.pulumi.gitlab.ProjectCluster,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy