com.pulumi.gitlab.kotlin.GroupServiceAccountArgs.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.
The newest version!
@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.GroupServiceAccountArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* The `gitlab.GroupServiceAccount` resource allows creating a GitLab group service account.
* **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/group_service_accounts.html)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gitlab from "@pulumi/gitlab";
* // This must be a top-level group
* const example = new gitlab.Group("example", {
* name: "example",
* path: "example",
* description: "An example group",
* });
* // The service account against the top-level group
* const exampleSa = new gitlab.GroupServiceAccount("example_sa", {
* group: example.id,
* name: "example-name",
* username: "example-username",
* });
* // Group to assign the service account to. Can be the same top-level group resource as above, or a subgroup of that group.
* const exampleSubgroup = new gitlab.Group("example_subgroup", {
* name: "subgroup",
* path: "example/subgroup",
* description: "An example subgroup",
* });
* // To assign the service account to a group
* const exampleMembership = new gitlab.GroupMembership("example_membership", {
* groupId: exampleSubgroup.id,
* userId: exampleSa.serviceAccountId,
* accessLevel: "developer",
* expiresAt: "2020-03-14",
* });
* ```
* ```python
* import pulumi
* import pulumi_gitlab as gitlab
* # This must be a top-level group
* example = gitlab.Group("example",
* name="example",
* path="example",
* description="An example group")
* # The service account against the top-level group
* example_sa = gitlab.GroupServiceAccount("example_sa",
* group=example.id,
* name="example-name",
* username="example-username")
* # Group to assign the service account to. Can be the same top-level group resource as above, or a subgroup of that group.
* example_subgroup = gitlab.Group("example_subgroup",
* name="subgroup",
* path="example/subgroup",
* description="An example subgroup")
* # To assign the service account to a group
* example_membership = gitlab.GroupMembership("example_membership",
* group_id=example_subgroup.id,
* user_id=example_sa.service_account_id,
* access_level="developer",
* expires_at="2020-03-14")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using GitLab = Pulumi.GitLab;
* return await Deployment.RunAsync(() =>
* {
* // This must be a top-level group
* var example = new GitLab.Group("example", new()
* {
* Name = "example",
* Path = "example",
* Description = "An example group",
* });
* // The service account against the top-level group
* var exampleSa = new GitLab.GroupServiceAccount("example_sa", new()
* {
* Group = example.Id,
* Name = "example-name",
* Username = "example-username",
* });
* // Group to assign the service account to. Can be the same top-level group resource as above, or a subgroup of that group.
* var exampleSubgroup = new GitLab.Group("example_subgroup", new()
* {
* Name = "subgroup",
* Path = "example/subgroup",
* Description = "An example subgroup",
* });
* // To assign the service account to a group
* var exampleMembership = new GitLab.GroupMembership("example_membership", new()
* {
* GroupId = exampleSubgroup.Id,
* UserId = exampleSa.ServiceAccountId,
* AccessLevel = "developer",
* ExpiresAt = "2020-03-14",
* });
* });
* ```
* ```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 {
* // This must be a top-level group
* example, err := gitlab.NewGroup(ctx, "example", &gitlab.GroupArgs{
* Name: pulumi.String("example"),
* Path: pulumi.String("example"),
* Description: pulumi.String("An example group"),
* })
* if err != nil {
* return err
* }
* // The service account against the top-level group
* exampleSa, err := gitlab.NewGroupServiceAccount(ctx, "example_sa", &gitlab.GroupServiceAccountArgs{
* Group: example.ID(),
* Name: pulumi.String("example-name"),
* Username: pulumi.String("example-username"),
* })
* if err != nil {
* return err
* }
* // Group to assign the service account to. Can be the same top-level group resource as above, or a subgroup of that group.
* exampleSubgroup, err := gitlab.NewGroup(ctx, "example_subgroup", &gitlab.GroupArgs{
* Name: pulumi.String("subgroup"),
* Path: pulumi.String("example/subgroup"),
* Description: pulumi.String("An example subgroup"),
* })
* if err != nil {
* return err
* }
* // To assign the service account to a group
* _, err = gitlab.NewGroupMembership(ctx, "example_membership", &gitlab.GroupMembershipArgs{
* GroupId: exampleSubgroup.ID(),
* UserId: exampleSa.ServiceAccountId,
* AccessLevel: pulumi.String("developer"),
* ExpiresAt: pulumi.String("2020-03-14"),
* })
* 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.Group;
* import com.pulumi.gitlab.GroupArgs;
* import com.pulumi.gitlab.GroupServiceAccount;
* import com.pulumi.gitlab.GroupServiceAccountArgs;
* import com.pulumi.gitlab.GroupMembership;
* import com.pulumi.gitlab.GroupMembershipArgs;
* 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) {
* // This must be a top-level group
* var example = new Group("example", GroupArgs.builder()
* .name("example")
* .path("example")
* .description("An example group")
* .build());
* // The service account against the top-level group
* var exampleSa = new GroupServiceAccount("exampleSa", GroupServiceAccountArgs.builder()
* .group(example.id())
* .name("example-name")
* .username("example-username")
* .build());
* // Group to assign the service account to. Can be the same top-level group resource as above, or a subgroup of that group.
* var exampleSubgroup = new Group("exampleSubgroup", GroupArgs.builder()
* .name("subgroup")
* .path("example/subgroup")
* .description("An example subgroup")
* .build());
* // To assign the service account to a group
* var exampleMembership = new GroupMembership("exampleMembership", GroupMembershipArgs.builder()
* .groupId(exampleSubgroup.id())
* .userId(exampleSa.serviceAccountId())
* .accessLevel("developer")
* .expiresAt("2020-03-14")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* # This must be a top-level group
* example:
* type: gitlab:Group
* properties:
* name: example
* path: example
* description: An example group
* # The service account against the top-level group
* exampleSa:
* type: gitlab:GroupServiceAccount
* name: example_sa
* properties:
* group: ${example.id}
* name: example-name
* username: example-username
* # Group to assign the service account to. Can be the same top-level group resource as above, or a subgroup of that group.
* exampleSubgroup:
* type: gitlab:Group
* name: example_subgroup
* properties:
* name: subgroup
* path: example/subgroup
* description: An example subgroup
* # To assign the service account to a group
* exampleMembership:
* type: gitlab:GroupMembership
* name: example_membership
* properties:
* groupId: ${exampleSubgroup.id}
* userId: ${exampleSa.serviceAccountId}
* accessLevel: developer
* expiresAt: 2020-03-14
* ```
*
* ## Import
* Starting in Terraform v1.5.0 you can use an import block to import `gitlab_group_service_account`. For example:
* terraform
* import {
* to = gitlab_group_service_account.example
* id = "see CLI command below for ID"
* }
* Import using the CLI is supported using the following syntax:
* ```sh
* $ pulumi import gitlab:index/groupServiceAccount:GroupServiceAccount You can import a group service account using ` `. The
* ```
* `id` is in the form of :
* ```sh
* $ pulumi import gitlab:index/groupServiceAccount:GroupServiceAccount example example
* ```
* @property group The ID or URL-encoded path of the group that the service account is created in. Must be a top level group.
* @property name The name of the user. If not specified, the default Service account user name is used.
* @property username The username of the user. If not specified, it’s automatically generated.
*/
public data class GroupServiceAccountArgs(
public val group: Output? = null,
public val name: Output? = null,
public val username: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gitlab.GroupServiceAccountArgs =
com.pulumi.gitlab.GroupServiceAccountArgs.builder()
.group(group?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.username(username?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [GroupServiceAccountArgs].
*/
@PulumiTagMarker
public class GroupServiceAccountArgsBuilder internal constructor() {
private var group: Output? = null
private var name: Output? = null
private var username: Output? = null
/**
* @param value The ID or URL-encoded path of the group that the service account is created in. Must be a top level group.
*/
@JvmName("tpjrwuibdnvfjsho")
public suspend fun group(`value`: Output) {
this.group = value
}
/**
* @param value The name of the user. If not specified, the default Service account user name is used.
*/
@JvmName("jfjahfaxhaupwxca")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The username of the user. If not specified, it’s automatically generated.
*/
@JvmName("vmkgtfomnxwoxndx")
public suspend fun username(`value`: Output) {
this.username = value
}
/**
* @param value The ID or URL-encoded path of the group that the service account is created in. Must be a top level group.
*/
@JvmName("veifvahtxhopmxpq")
public suspend fun group(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.group = mapped
}
/**
* @param value The name of the user. If not specified, the default Service account user name is used.
*/
@JvmName("cmngwumajbvioids")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value The username of the user. If not specified, it’s automatically generated.
*/
@JvmName("mtaunytutlwukrbu")
public suspend fun username(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.username = mapped
}
internal fun build(): GroupServiceAccountArgs = GroupServiceAccountArgs(
group = group,
name = name,
username = username,
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy