com.pulumi.gitlab.kotlin.GroupServiceAccount.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.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 [GroupServiceAccount].
*/
@PulumiTagMarker
public class GroupServiceAccountResourceBuilder internal constructor() {
public var name: String? = null
public var args: GroupServiceAccountArgs = GroupServiceAccountArgs()
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 GroupServiceAccountArgsBuilder.() -> Unit) {
val builder = GroupServiceAccountArgsBuilder()
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(): GroupServiceAccount {
val builtJavaResource = com.pulumi.gitlab.GroupServiceAccount(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return GroupServiceAccount(builtJavaResource)
}
}
/**
* 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
* ```
*/
public class GroupServiceAccount internal constructor(
override val javaResource: com.pulumi.gitlab.GroupServiceAccount,
) : KotlinCustomResource(javaResource, GroupServiceAccountMapper) {
/**
* The ID or URL-encoded path of the group that the service account is created in. Must be a top level group.
*/
public val group: Output
get() = javaResource.group().applyValue({ args0 -> args0 })
/**
* The name of the user. If not specified, the default Service account user name is used.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The service account id.
*/
public val serviceAccountId: Output
get() = javaResource.serviceAccountId().applyValue({ args0 -> args0 })
/**
* The username of the user. If not specified, it’s automatically generated.
*/
public val username: Output?
get() = javaResource.username().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object GroupServiceAccountMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gitlab.GroupServiceAccount::class == javaResource::class
override fun map(javaResource: Resource): GroupServiceAccount = GroupServiceAccount(
javaResource
as com.pulumi.gitlab.GroupServiceAccount,
)
}
/**
* @see [GroupServiceAccount].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [GroupServiceAccount].
*/
public suspend fun groupServiceAccount(
name: String,
block: suspend GroupServiceAccountResourceBuilder.() -> Unit,
): GroupServiceAccount {
val builder = GroupServiceAccountResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [GroupServiceAccount].
* @param name The _unique_ name of the resulting resource.
*/
public fun groupServiceAccount(name: String): GroupServiceAccount {
val builder = GroupServiceAccountResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy