com.pulumi.gitlab.kotlin.GroupSecurityPolicyAttachmentArgs.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.GroupSecurityPolicyAttachmentArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gitlab from "@pulumi/gitlab";
* // This resource can be used to attach a security policy to a pre-existing group
* const foo = new gitlab.GroupSecurityPolicyAttachment("foo", {
* group: "1234",
* policyProject: "4567",
* });
* // Or Terraform can create a new project, add a policy to that project,
* // then attach that policy project to other groups.
* const my_policy_project = new gitlab.Project("my-policy-project", {name: "security-policy-project"});
* const policy_yml = new gitlab.RepositoryFile("policy-yml", {
* project: my_policy_project.id,
* filePath: ".gitlab/security-policies/my-policy.yml",
* branch: "master",
* encoding: "text",
* content: `---
* approval_policy:
* - name: test
* description: test
* enabled: true
* rules:
* - type: any_merge_request
* branch_type: protected
* commits: any
* approval_settings:
* block_branch_modification: true
* prevent_pushing_and_force_pushing: true
* prevent_approval_by_author: true
* prevent_approval_by_commit_author: true
* remove_approvals_with_new_commit: true
* require_password_to_approve: false
* fallback_behavior:
* fail: closed
* policy_scope:
* compliance_frameworks:
* - id: 1010101
* - id: 0101010
* actions:
* - type: send_bot_message
* enabled: true
* `,
* });
* // Multiple policies can be attached to a single project by repeating this resource or using a `for_each`
* const my_policy = new gitlab.GroupSecurityPolicyAttachment("my-policy", {
* group: "1234",
* policyProject: my_policy_project.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gitlab as gitlab
* # This resource can be used to attach a security policy to a pre-existing group
* foo = gitlab.GroupSecurityPolicyAttachment("foo",
* group="1234",
* policy_project="4567")
* # Or Terraform can create a new project, add a policy to that project,
* # then attach that policy project to other groups.
* my_policy_project = gitlab.Project("my-policy-project", name="security-policy-project")
* policy_yml = gitlab.RepositoryFile("policy-yml",
* project=my_policy_project.id,
* file_path=".gitlab/security-policies/my-policy.yml",
* branch="master",
* encoding="text",
* content="""---
* approval_policy:
* - name: test
* description: test
* enabled: true
* rules:
* - type: any_merge_request
* branch_type: protected
* commits: any
* approval_settings:
* block_branch_modification: true
* prevent_pushing_and_force_pushing: true
* prevent_approval_by_author: true
* prevent_approval_by_commit_author: true
* remove_approvals_with_new_commit: true
* require_password_to_approve: false
* fallback_behavior:
* fail: closed
* policy_scope:
* compliance_frameworks:
* - id: 1010101
* - id: 0101010
* actions:
* - type: send_bot_message
* enabled: true
* """)
* # Multiple policies can be attached to a single project by repeating this resource or using a `for_each`
* my_policy = gitlab.GroupSecurityPolicyAttachment("my-policy",
* group="1234",
* policy_project=my_policy_project.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using GitLab = Pulumi.GitLab;
* return await Deployment.RunAsync(() =>
* {
* // This resource can be used to attach a security policy to a pre-existing group
* var foo = new GitLab.GroupSecurityPolicyAttachment("foo", new()
* {
* Group = "1234",
* PolicyProject = "4567",
* });
* // Or Terraform can create a new project, add a policy to that project,
* // then attach that policy project to other groups.
* var my_policy_project = new GitLab.Project("my-policy-project", new()
* {
* Name = "security-policy-project",
* });
* var policy_yml = new GitLab.RepositoryFile("policy-yml", new()
* {
* Project = my_policy_project.Id,
* FilePath = ".gitlab/security-policies/my-policy.yml",
* Branch = "master",
* Encoding = "text",
* Content = @"---
* approval_policy:
* - name: test
* description: test
* enabled: true
* rules:
* - type: any_merge_request
* branch_type: protected
* commits: any
* approval_settings:
* block_branch_modification: true
* prevent_pushing_and_force_pushing: true
* prevent_approval_by_author: true
* prevent_approval_by_commit_author: true
* remove_approvals_with_new_commit: true
* require_password_to_approve: false
* fallback_behavior:
* fail: closed
* policy_scope:
* compliance_frameworks:
* - id: 1010101
* - id: 0101010
* actions:
* - type: send_bot_message
* enabled: true
* ",
* });
* // Multiple policies can be attached to a single project by repeating this resource or using a `for_each`
* var my_policy = new GitLab.GroupSecurityPolicyAttachment("my-policy", new()
* {
* Group = "1234",
* PolicyProject = my_policy_project.Id,
* });
* });
* ```
* ```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 resource can be used to attach a security policy to a pre-existing group
* _, err := gitlab.NewGroupSecurityPolicyAttachment(ctx, "foo", &gitlab.GroupSecurityPolicyAttachmentArgs{
* Group: pulumi.String("1234"),
* PolicyProject: pulumi.String("4567"),
* })
* if err != nil {
* return err
* }
* // Or Terraform can create a new project, add a policy to that project,
* // then attach that policy project to other groups.
* _, err = gitlab.NewProject(ctx, "my-policy-project", &gitlab.ProjectArgs{
* Name: pulumi.String("security-policy-project"),
* })
* if err != nil {
* return err
* }
* _, err = gitlab.NewRepositoryFile(ctx, "policy-yml", &gitlab.RepositoryFileArgs{
* Project: my_policy_project.ID(),
* FilePath: pulumi.String(".gitlab/security-policies/my-policy.yml"),
* Branch: pulumi.String("master"),
* Encoding: pulumi.String("text"),
* Content: pulumi.String(`---
* approval_policy:
* - name: test
* description: test
* enabled: true
* rules:
* - type: any_merge_request
* branch_type: protected
* commits: any
* approval_settings:
* block_branch_modification: true
* prevent_pushing_and_force_pushing: true
* prevent_approval_by_author: true
* prevent_approval_by_commit_author: true
* remove_approvals_with_new_commit: true
* require_password_to_approve: false
* fallback_behavior:
* fail: closed
* policy_scope:
* compliance_frameworks:
* - id: 1010101
* - id: 0101010
* actions:
* - type: send_bot_message
* enabled: true
* `),
* })
* if err != nil {
* return err
* }
* // Multiple policies can be attached to a single project by repeating this resource or using a `for_each`
* _, err = gitlab.NewGroupSecurityPolicyAttachment(ctx, "my-policy", &gitlab.GroupSecurityPolicyAttachmentArgs{
* Group: pulumi.String("1234"),
* PolicyProject: my_policy_project.ID(),
* })
* 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.GroupSecurityPolicyAttachment;
* import com.pulumi.gitlab.GroupSecurityPolicyAttachmentArgs;
* import com.pulumi.gitlab.Project;
* import com.pulumi.gitlab.ProjectArgs;
* 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) {
* // This resource can be used to attach a security policy to a pre-existing group
* var foo = new GroupSecurityPolicyAttachment("foo", GroupSecurityPolicyAttachmentArgs.builder()
* .group(1234)
* .policyProject(4567)
* .build());
* // Or Terraform can create a new project, add a policy to that project,
* // then attach that policy project to other groups.
* var my_policy_project = new Project("my-policy-project", ProjectArgs.builder()
* .name("security-policy-project")
* .build());
* var policy_yml = new RepositoryFile("policy-yml", RepositoryFileArgs.builder()
* .project(my_policy_project.id())
* .filePath(".gitlab/security-policies/my-policy.yml")
* .branch("master")
* .encoding("text")
* .content("""
* ---
* approval_policy:
* - name: test
* description: test
* enabled: true
* rules:
* - type: any_merge_request
* branch_type: protected
* commits: any
* approval_settings:
* block_branch_modification: true
* prevent_pushing_and_force_pushing: true
* prevent_approval_by_author: true
* prevent_approval_by_commit_author: true
* remove_approvals_with_new_commit: true
* require_password_to_approve: false
* fallback_behavior:
* fail: closed
* policy_scope:
* compliance_frameworks:
* - id: 1010101
* - id: 0101010
* actions:
* - type: send_bot_message
* enabled: true
* """)
* .build());
* // Multiple policies can be attached to a single project by repeating this resource or using a `for_each`
* var my_policy = new GroupSecurityPolicyAttachment("my-policy", GroupSecurityPolicyAttachmentArgs.builder()
* .group(1234)
* .policyProject(my_policy_project.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* # This resource can be used to attach a security policy to a pre-existing group
* foo:
* type: gitlab:GroupSecurityPolicyAttachment
* properties:
* group: 1234
* policyProject: 4567
* # Or Terraform can create a new project, add a policy to that project,
* # then attach that policy project to other groups.
* my-policy-project:
* type: gitlab:Project
* properties:
* name: security-policy-project
* policy-yml:
* type: gitlab:RepositoryFile
* properties:
* project: ${["my-policy-project"].id}
* filePath: .gitlab/security-policies/my-policy.yml
* branch: master
* encoding: text
* content: |
* ---
* approval_policy:
* - name: test
* description: test
* enabled: true
* rules:
* - type: any_merge_request
* branch_type: protected
* commits: any
* approval_settings:
* block_branch_modification: true
* prevent_pushing_and_force_pushing: true
* prevent_approval_by_author: true
* prevent_approval_by_commit_author: true
* remove_approvals_with_new_commit: true
* require_password_to_approve: false
* fallback_behavior:
* fail: closed
* policy_scope:
* compliance_frameworks:
* - id: 1010101
* - id: 0101010
* actions:
* - type: send_bot_message
* enabled: true
* # Multiple policies can be attached to a single project by repeating this resource or using a `for_each`
* my-policy:
* type: gitlab:GroupSecurityPolicyAttachment
* properties:
* group: 1234
* policyProject: ${["my-policy-project"].id}
* ```
*
* ## Import
* Starting in Terraform v1.5.0 you can use an import block to import `gitlab_group_security_policy_attachment`. For example:
* terraform
* import {
* to = gitlab_group_security_policy_attachment.example
* id = "see CLI command below for ID"
* }
* Import using the CLI is supported using the following syntax:
* GitLab group security policy attachments can be imported using an id made up of `group:policy_project_id` where the policy project ID is the project ID of the policy project, e.g.
* ```sh
* $ pulumi import gitlab:index/groupSecurityPolicyAttachment:GroupSecurityPolicyAttachment foo 1:2
* ```
* @property group The ID or Full Path of the group which will have the security policy project assigned to it.
* @property policyProject The ID or Full Path of the security policy project.
*/
public data class GroupSecurityPolicyAttachmentArgs(
public val group: Output? = null,
public val policyProject: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gitlab.GroupSecurityPolicyAttachmentArgs =
com.pulumi.gitlab.GroupSecurityPolicyAttachmentArgs.builder()
.group(group?.applyValue({ args0 -> args0 }))
.policyProject(policyProject?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [GroupSecurityPolicyAttachmentArgs].
*/
@PulumiTagMarker
public class GroupSecurityPolicyAttachmentArgsBuilder internal constructor() {
private var group: Output? = null
private var policyProject: Output? = null
/**
* @param value The ID or Full Path of the group which will have the security policy project assigned to it.
*/
@JvmName("chhesjwuehqmerqh")
public suspend fun group(`value`: Output) {
this.group = value
}
/**
* @param value The ID or Full Path of the security policy project.
*/
@JvmName("awsbocjgfrudqjyp")
public suspend fun policyProject(`value`: Output) {
this.policyProject = value
}
/**
* @param value The ID or Full Path of the group which will have the security policy project assigned to it.
*/
@JvmName("nhsdcigropbbpvxu")
public suspend fun group(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.group = mapped
}
/**
* @param value The ID or Full Path of the security policy project.
*/
@JvmName("odqgujmyktuujbmk")
public suspend fun policyProject(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.policyProject = mapped
}
internal fun build(): GroupSecurityPolicyAttachmentArgs = GroupSecurityPolicyAttachmentArgs(
group = group,
policyProject = policyProject,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy