com.pulumi.gitlab.kotlin.ClusterAgentArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gitlab-kotlin Show documentation
Show all versions of pulumi-gitlab-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.gitlab.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gitlab.ClusterAgentArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* The `gitlab.ClusterAgent` resource allows to manage the lifecycle of a GitLab Agent for Kubernetes.
* > Note that this resource only registers the agent, but doesn't configure it.
* The configuration needs to be manually added as described in
* [the docs](https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file).
* However, a `gitlab.RepositoryFile` resource may be used to achieve that.
* > Requires at least maintainer permissions on the project.
* > Requires at least GitLab 14.10
* **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/cluster_agents.html)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gitlab from "@pulumi/gitlab";
* import * as std from "@pulumi/std";
* const example = new gitlab.ClusterAgent("example", {
* project: "12345",
* name: "agent-1",
* });
* // Optionally, configure the agent as described in
* // https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
* const exampleAgentConfig = new gitlab.RepositoryFile("example_agent_config", {
* project: example.project,
* branch: "main",
* filePath: pulumi.interpolate`.gitlab/agents/${example.name}/config.yaml`,
* content: std.base64encode({
* input: "# the GitLab Agent for Kubernetes configuration goes here ...\n",
* }).then(invoke => invoke.result),
* authorEmail: "[email protected]",
* authorName: "Terraform",
* commitMessage: pulumi.interpolate`feature: add agent config for ${example.name} [skip ci]`,
* });
* ```
* ```python
* import pulumi
* import pulumi_gitlab as gitlab
* import pulumi_std as std
* example = gitlab.ClusterAgent("example",
* project="12345",
* name="agent-1")
* # Optionally, configure the agent as described in
* # https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
* example_agent_config = gitlab.RepositoryFile("example_agent_config",
* project=example.project,
* branch="main",
* file_path=example.name.apply(lambda name: f".gitlab/agents/{name}/config.yaml"),
* content=std.base64encode(input="# the GitLab Agent for Kubernetes configuration goes here ...\n").result,
* author_email="[email protected]",
* author_name="Terraform",
* commit_message=example.name.apply(lambda name: f"feature: add agent config for {name} [skip ci]"))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using GitLab = Pulumi.GitLab;
* using Std = Pulumi.Std;
* return await Deployment.RunAsync(() =>
* {
* var example = new GitLab.ClusterAgent("example", new()
* {
* Project = "12345",
* Name = "agent-1",
* });
* // Optionally, configure the agent as described in
* // https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
* var exampleAgentConfig = new GitLab.RepositoryFile("example_agent_config", new()
* {
* Project = example.Project,
* Branch = "main",
* FilePath = example.Name.Apply(name => $".gitlab/agents/{name}/config.yaml"),
* Content = Std.Base64encode.Invoke(new()
* {
* Input = @"# the GitLab Agent for Kubernetes configuration goes here ...
* ",
* }).Apply(invoke => invoke.Result),
* AuthorEmail = "[email protected]",
* AuthorName = "Terraform",
* CommitMessage = example.Name.Apply(name => $"feature: add agent config for {name} [skip ci]"),
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
* "github.com/pulumi/pulumi-std/sdk/go/std"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := gitlab.NewClusterAgent(ctx, "example", &gitlab.ClusterAgentArgs{
* Project: pulumi.String("12345"),
* Name: pulumi.String("agent-1"),
* })
* if err != nil {
* return err
* }
* invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
* Input: "# the GitLab Agent for Kubernetes configuration goes here ...\n",
* }, nil)
* if err != nil {
* return err
* }
* // Optionally, configure the agent as described in
* // https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
* _, err = gitlab.NewRepositoryFile(ctx, "example_agent_config", &gitlab.RepositoryFileArgs{
* Project: example.Project,
* Branch: pulumi.String("main"),
* FilePath: example.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf(".gitlab/agents/%v/config.yaml", name), nil
* }).(pulumi.StringOutput),
* Content: invokeBase64encode.Result,
* AuthorEmail: pulumi.String("[email protected]"),
* AuthorName: pulumi.String("Terraform"),
* CommitMessage: example.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("feature: add agent config for %v [skip ci]", name), nil
* }).(pulumi.StringOutput),
* })
* 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.ClusterAgent;
* import com.pulumi.gitlab.ClusterAgentArgs;
* import com.pulumi.gitlab.RepositoryFile;
* import com.pulumi.gitlab.RepositoryFileArgs;
* 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 example = new ClusterAgent("example", ClusterAgentArgs.builder()
* .project("12345")
* .name("agent-1")
* .build());
* // Optionally, configure the agent as described in
* // https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
* var exampleAgentConfig = new RepositoryFile("exampleAgentConfig", RepositoryFileArgs.builder()
* .project(example.project())
* .branch("main")
* .filePath(example.name().applyValue(name -> String.format(".gitlab/agents/%s/config.yaml", name)))
* .content(StdFunctions.base64encode(Base64encodeArgs.builder()
* .input("""
* # the GitLab Agent for Kubernetes configuration goes here ...
* """)
* .build()).result())
* .authorEmail("[email protected]")
* .authorName("Terraform")
* .commitMessage(example.name().applyValue(name -> String.format("feature: add agent config for %s [skip ci]", name)))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: gitlab:ClusterAgent
* properties:
* project: '12345'
* name: agent-1
* # Optionally, configure the agent as described in
* # // https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
* exampleAgentConfig:
* type: gitlab:RepositoryFile
* name: example_agent_config
* properties:
* project: ${example.project}
* branch: main
* filePath: .gitlab/agents/${example.name}/config.yaml
* content:
* fn::invoke:
* Function: std:base64encode
* Arguments:
* input: |
* # the GitLab Agent for Kubernetes configuration goes here ...
* Return: result
* authorEmail: [email protected]
* authorName: Terraform
* commitMessage: 'feature: add agent config for ${example.name} [skip ci]'
* ```
*
* ## Import
* GitLab Agent for Kubernetes can be imported with the following command and the id pattern `:`
* ```sh
* $ pulumi import gitlab:index/clusterAgent:ClusterAgent example '12345:42'
* ```
* @property name The Name of the agent.
* @property project ID or full path of the project maintained by the authenticated user.
*/
public data class ClusterAgentArgs(
public val name: Output? = null,
public val project: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gitlab.ClusterAgentArgs =
com.pulumi.gitlab.ClusterAgentArgs.builder()
.name(name?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [ClusterAgentArgs].
*/
@PulumiTagMarker
public class ClusterAgentArgsBuilder internal constructor() {
private var name: Output? = null
private var project: Output? = null
/**
* @param value The Name of the agent.
*/
@JvmName("fykyushcsrrsmjak")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value ID or full path of the project maintained by the authenticated user.
*/
@JvmName("uvscqwwlytwlqolv")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value The Name of the agent.
*/
@JvmName("jlkvbiomyjotlakr")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value ID or full path of the project maintained by the authenticated user.
*/
@JvmName("vbuikpamlwdnfowm")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
internal fun build(): ClusterAgentArgs = ClusterAgentArgs(
name = name,
project = project,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy