1. Packages
  2. Gitlab Provider
  3. API Docs
  4. TagProtection
GitLab v8.5.0 published on Friday, Oct 18, 2024 by Pulumi

gitlab.TagProtection

Explore with Pulumi AI

gitlab logo
GitLab v8.5.0 published on Friday, Oct 18, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    const tagProtect = new gitlab.TagProtection("TagProtect", {
        project: "12345",
        tag: "TagProtected",
        createAccessLevel: "developer",
        allowedToCreates: [
            {
                userId: 42,
            },
            {
                groupId: 43,
            },
        ],
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    tag_protect = gitlab.TagProtection("TagProtect",
        project="12345",
        tag="TagProtected",
        create_access_level="developer",
        allowed_to_creates=[
            {
                "user_id": 42,
            },
            {
                "group_id": 43,
            },
        ])
    
    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 {
    		_, err := gitlab.NewTagProtection(ctx, "TagProtect", &gitlab.TagProtectionArgs{
    			Project:           pulumi.String("12345"),
    			Tag:               pulumi.String("TagProtected"),
    			CreateAccessLevel: pulumi.String("developer"),
    			AllowedToCreates: gitlab.TagProtectionAllowedToCreateArray{
    				&gitlab.TagProtectionAllowedToCreateArgs{
    					UserId: pulumi.Int(42),
    				},
    				&gitlab.TagProtectionAllowedToCreateArgs{
    					GroupId: pulumi.Int(43),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        var tagProtect = new GitLab.TagProtection("TagProtect", new()
        {
            Project = "12345",
            Tag = "TagProtected",
            CreateAccessLevel = "developer",
            AllowedToCreates = new[]
            {
                new GitLab.Inputs.TagProtectionAllowedToCreateArgs
                {
                    UserId = 42,
                },
                new GitLab.Inputs.TagProtectionAllowedToCreateArgs
                {
                    GroupId = 43,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.TagProtection;
    import com.pulumi.gitlab.TagProtectionArgs;
    import com.pulumi.gitlab.inputs.TagProtectionAllowedToCreateArgs;
    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 tagProtect = new TagProtection("tagProtect", TagProtectionArgs.builder()
                .project("12345")
                .tag("TagProtected")
                .createAccessLevel("developer")
                .allowedToCreates(            
                    TagProtectionAllowedToCreateArgs.builder()
                        .userId(42)
                        .build(),
                    TagProtectionAllowedToCreateArgs.builder()
                        .groupId(43)
                        .build())
                .build());
    
        }
    }
    
    resources:
      tagProtect:
        type: gitlab:TagProtection
        name: TagProtect
        properties:
          project: '12345'
          tag: TagProtected
          createAccessLevel: developer
          allowedToCreates:
            - userId: 42
            - groupId: 43
    

    Create TagProtection Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TagProtection(name: string, args: TagProtectionArgs, opts?: CustomResourceOptions);
    @overload
    def TagProtection(resource_name: str,
                      args: TagProtectionArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def TagProtection(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      project: Optional[str] = None,
                      tag: Optional[str] = None,
                      allowed_to_creates: Optional[Sequence[TagProtectionAllowedToCreateArgs]] = None,
                      create_access_level: Optional[str] = None)
    func NewTagProtection(ctx *Context, name string, args TagProtectionArgs, opts ...ResourceOption) (*TagProtection, error)
    public TagProtection(string name, TagProtectionArgs args, CustomResourceOptions? opts = null)
    public TagProtection(String name, TagProtectionArgs args)
    public TagProtection(String name, TagProtectionArgs args, CustomResourceOptions options)
    
    type: gitlab:TagProtection
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args TagProtectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TagProtectionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TagProtectionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TagProtectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TagProtectionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var tagProtectionResource = new GitLab.TagProtection("tagProtectionResource", new()
    {
        Project = "string",
        Tag = "string",
        AllowedToCreates = new[]
        {
            new GitLab.Inputs.TagProtectionAllowedToCreateArgs
            {
                AccessLevel = "string",
                AccessLevelDescription = "string",
                GroupId = 0,
                UserId = 0,
            },
        },
        CreateAccessLevel = "string",
    });
    
    example, err := gitlab.NewTagProtection(ctx, "tagProtectionResource", &gitlab.TagProtectionArgs{
    	Project: pulumi.String("string"),
    	Tag:     pulumi.String("string"),
    	AllowedToCreates: gitlab.TagProtectionAllowedToCreateArray{
    		&gitlab.TagProtectionAllowedToCreateArgs{
    			AccessLevel:            pulumi.String("string"),
    			AccessLevelDescription: pulumi.String("string"),
    			GroupId:                pulumi.Int(0),
    			UserId:                 pulumi.Int(0),
    		},
    	},
    	CreateAccessLevel: pulumi.String("string"),
    })
    
    var tagProtectionResource = new TagProtection("tagProtectionResource", TagProtectionArgs.builder()
        .project("string")
        .tag("string")
        .allowedToCreates(TagProtectionAllowedToCreateArgs.builder()
            .accessLevel("string")
            .accessLevelDescription("string")
            .groupId(0)
            .userId(0)
            .build())
        .createAccessLevel("string")
        .build());
    
    tag_protection_resource = gitlab.TagProtection("tagProtectionResource",
        project="string",
        tag="string",
        allowed_to_creates=[{
            "access_level": "string",
            "access_level_description": "string",
            "group_id": 0,
            "user_id": 0,
        }],
        create_access_level="string")
    
    const tagProtectionResource = new gitlab.TagProtection("tagProtectionResource", {
        project: "string",
        tag: "string",
        allowedToCreates: [{
            accessLevel: "string",
            accessLevelDescription: "string",
            groupId: 0,
            userId: 0,
        }],
        createAccessLevel: "string",
    });
    
    type: gitlab:TagProtection
    properties:
        allowedToCreates:
            - accessLevel: string
              accessLevelDescription: string
              groupId: 0
              userId: 0
        createAccessLevel: string
        project: string
        tag: string
    

    TagProtection Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The TagProtection resource accepts the following input properties:

    Project string
    The id of the project.
    Tag string
    Name of the tag or wildcard.
    AllowedToCreates List<Pulumi.GitLab.Inputs.TagProtectionAllowedToCreate>
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    CreateAccessLevel string
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    Project string
    The id of the project.
    Tag string
    Name of the tag or wildcard.
    AllowedToCreates []TagProtectionAllowedToCreateArgs
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    CreateAccessLevel string
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project String
    The id of the project.
    tag String
    Name of the tag or wildcard.
    allowedToCreates List<TagProtectionAllowedToCreate>
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    createAccessLevel String
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project string
    The id of the project.
    tag string
    Name of the tag or wildcard.
    allowedToCreates TagProtectionAllowedToCreate[]
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    createAccessLevel string
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project str
    The id of the project.
    tag str
    Name of the tag or wildcard.
    allowed_to_creates Sequence[TagProtectionAllowedToCreateArgs]
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    create_access_level str
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project String
    The id of the project.
    tag String
    Name of the tag or wildcard.
    allowedToCreates List<Property Map>
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    createAccessLevel String
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TagProtection resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing TagProtection Resource

    Get an existing TagProtection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TagProtectionState, opts?: CustomResourceOptions): TagProtection
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allowed_to_creates: Optional[Sequence[TagProtectionAllowedToCreateArgs]] = None,
            create_access_level: Optional[str] = None,
            project: Optional[str] = None,
            tag: Optional[str] = None) -> TagProtection
    func GetTagProtection(ctx *Context, name string, id IDInput, state *TagProtectionState, opts ...ResourceOption) (*TagProtection, error)
    public static TagProtection Get(string name, Input<string> id, TagProtectionState? state, CustomResourceOptions? opts = null)
    public static TagProtection get(String name, Output<String> id, TagProtectionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AllowedToCreates List<Pulumi.GitLab.Inputs.TagProtectionAllowedToCreate>
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    CreateAccessLevel string
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    Project string
    The id of the project.
    Tag string
    Name of the tag or wildcard.
    AllowedToCreates []TagProtectionAllowedToCreateArgs
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    CreateAccessLevel string
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    Project string
    The id of the project.
    Tag string
    Name of the tag or wildcard.
    allowedToCreates List<TagProtectionAllowedToCreate>
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    createAccessLevel String
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project String
    The id of the project.
    tag String
    Name of the tag or wildcard.
    allowedToCreates TagProtectionAllowedToCreate[]
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    createAccessLevel string
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project string
    The id of the project.
    tag string
    Name of the tag or wildcard.
    allowed_to_creates Sequence[TagProtectionAllowedToCreateArgs]
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    create_access_level str
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project str
    The id of the project.
    tag str
    Name of the tag or wildcard.
    allowedToCreates List<Property Map>
    Array of access levels/user(s)/group(s) allowed to create protected tags.
    createAccessLevel String
    Access levels allowed to create. Default value of maintainer. The default value is always sent if not provided in the configuration. Valid values are: no one, developer, maintainer.
    project String
    The id of the project.
    tag String
    Name of the tag or wildcard.

    Supporting Types

    TagProtectionAllowedToCreate, TagProtectionAllowedToCreateArgs

    AccessLevel string
    Access levels allowed to create protected tags. Valid values are: no one, developer, maintainer.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
    AccessLevel string
    Access levels allowed to create protected tags. Valid values are: no one, developer, maintainer.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
    accessLevel String
    Access levels allowed to create protected tags. Valid values are: no one, developer, maintainer.
    accessLevelDescription String
    Readable description of access level.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
    accessLevel string
    Access levels allowed to create protected tags. Valid values are: no one, developer, maintainer.
    accessLevelDescription string
    Readable description of access level.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
    userId number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
    access_level str
    Access levels allowed to create protected tags. Valid values are: no one, developer, maintainer.
    access_level_description str
    Readable description of access level.
    group_id int
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
    accessLevel String
    Access levels allowed to create protected tags. Valid values are: no one, developer, maintainer.
    accessLevelDescription String
    Readable description of access level.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.

    Import

    Tag protections can be imported using an id made up of project_id:tag_name, e.g.

    $ pulumi import gitlab:index/tagProtection:TagProtection example 123456789:v1.0.0
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    GitLab v8.5.0 published on Friday, Oct 18, 2024 by Pulumi