1. Packages
  2. AzureDevOps
  3. API Docs
  4. LibraryPermissions
Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi

azuredevops.LibraryPermissions

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi

    Manages permissions for a Library

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const project = new azuredevops.Project("project", {
        description: "Testing-description",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const tf-project-readers = azuredevops.getGroupOutput({
        projectId: project.id,
        name: "Readers",
    });
    const permissions = new azuredevops.LibraryPermissions("permissions", {
        projectId: project.id,
        principal: tf_project_readers.apply(tf_project_readers => tf_project_readers.id),
        permissions: {
            View: "allow",
            Administer: "allow",
            Use: "allow",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    project = azuredevops.Project("project",
        description="Testing-description",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    tf_project_readers = azuredevops.get_group_output(project_id=project.id,
        name="Readers")
    permissions = azuredevops.LibraryPermissions("permissions",
        project_id=project.id,
        principal=tf_project_readers.id,
        permissions={
            "View": "allow",
            "Administer": "allow",
            "Use": "allow",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		project, err := azuredevops.NewProject(ctx, "project", &azuredevops.ProjectArgs{
    			Description:      pulumi.String("Testing-description"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		tf_project_readers := azuredevops.LookupGroupOutput(ctx, azuredevops.GetGroupOutputArgs{
    			ProjectId: project.ID(),
    			Name:      pulumi.String("Readers"),
    		}, nil)
    		_, err = azuredevops.NewLibraryPermissions(ctx, "permissions", &azuredevops.LibraryPermissionsArgs{
    			ProjectId: project.ID(),
    			Principal: tf_project_readers.ApplyT(func(tf_project_readers azuredevops.GetGroupResult) (*string, error) {
    				return &tf_project_readers.Id, nil
    			}).(pulumi.StringPtrOutput),
    			Permissions: pulumi.StringMap{
    				"View":       pulumi.String("allow"),
    				"Administer": pulumi.String("allow"),
    				"Use":        pulumi.String("allow"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new AzureDevOps.Project("project", new()
        {
            Description = "Testing-description",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var tf_project_readers = AzureDevOps.GetGroup.Invoke(new()
        {
            ProjectId = project.Id,
            Name = "Readers",
        });
    
        var permissions = new AzureDevOps.LibraryPermissions("permissions", new()
        {
            ProjectId = project.Id,
            Principal = tf_project_readers.Apply(tf_project_readers => tf_project_readers.Apply(getGroupResult => getGroupResult.Id)),
            Permissions = 
            {
                { "View", "allow" },
                { "Administer", "allow" },
                { "Use", "allow" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.AzuredevopsFunctions;
    import com.pulumi.azuredevops.inputs.GetGroupArgs;
    import com.pulumi.azuredevops.LibraryPermissions;
    import com.pulumi.azuredevops.LibraryPermissionsArgs;
    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 project = new Project("project", ProjectArgs.builder()        
                .description("Testing-description")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            final var tf-project-readers = AzuredevopsFunctions.getGroup(GetGroupArgs.builder()
                .projectId(project.id())
                .name("Readers")
                .build());
    
            var permissions = new LibraryPermissions("permissions", LibraryPermissionsArgs.builder()        
                .projectId(project.id())
                .principal(tf_project_readers.applyValue(tf_project_readers -> tf_project_readers.id()))
                .permissions(Map.ofEntries(
                    Map.entry("View", "allow"),
                    Map.entry("Administer", "allow"),
                    Map.entry("Use", "allow")
                ))
                .build());
    
        }
    }
    
    resources:
      project:
        type: azuredevops:Project
        properties:
          description: Testing-description
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      permissions:
        type: azuredevops:LibraryPermissions
        properties:
          projectId: ${project.id}
          principal: ${["tf-project-readers"].id}
          permissions:
            View: allow
            Administer: allow
            Use: allow
    variables:
      tf-project-readers:
        fn::invoke:
          Function: azuredevops:getGroup
          Arguments:
            projectId: ${project.id}
            name: Readers
    

    Roles

    The Azure DevOps UI uses roles to assign permissions for the Library.

    RoleAllowed Permissions
    ReaderView
    CreatorView, Create
    UserView, Use
    AdministratorView, Use, Administer

    PAT Permissions Required

    • Project & Team: vso.security_manage - Grants the ability to read, write, and manage security permissions.

    Create LibraryPermissions Resource

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

    Constructor syntax

    new LibraryPermissions(name: string, args: LibraryPermissionsArgs, opts?: CustomResourceOptions);
    @overload
    def LibraryPermissions(resource_name: str,
                           args: LibraryPermissionsArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def LibraryPermissions(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           permissions: Optional[Mapping[str, str]] = None,
                           principal: Optional[str] = None,
                           project_id: Optional[str] = None,
                           replace: Optional[bool] = None)
    func NewLibraryPermissions(ctx *Context, name string, args LibraryPermissionsArgs, opts ...ResourceOption) (*LibraryPermissions, error)
    public LibraryPermissions(string name, LibraryPermissionsArgs args, CustomResourceOptions? opts = null)
    public LibraryPermissions(String name, LibraryPermissionsArgs args)
    public LibraryPermissions(String name, LibraryPermissionsArgs args, CustomResourceOptions options)
    
    type: azuredevops:LibraryPermissions
    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 LibraryPermissionsArgs
    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 LibraryPermissionsArgs
    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 LibraryPermissionsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LibraryPermissionsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LibraryPermissionsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var libraryPermissionsResource = new AzureDevOps.LibraryPermissions("libraryPermissionsResource", new()
    {
        Permissions = 
        {
            { "string", "string" },
        },
        Principal = "string",
        ProjectId = "string",
        Replace = false,
    });
    
    example, err := azuredevops.NewLibraryPermissions(ctx, "libraryPermissionsResource", &azuredevops.LibraryPermissionsArgs{
    	Permissions: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Principal: pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	Replace:   pulumi.Bool(false),
    })
    
    var libraryPermissionsResource = new LibraryPermissions("libraryPermissionsResource", LibraryPermissionsArgs.builder()        
        .permissions(Map.of("string", "string"))
        .principal("string")
        .projectId("string")
        .replace(false)
        .build());
    
    library_permissions_resource = azuredevops.LibraryPermissions("libraryPermissionsResource",
        permissions={
            "string": "string",
        },
        principal="string",
        project_id="string",
        replace=False)
    
    const libraryPermissionsResource = new azuredevops.LibraryPermissions("libraryPermissionsResource", {
        permissions: {
            string: "string",
        },
        principal: "string",
        projectId: "string",
        replace: false,
    });
    
    type: azuredevops:LibraryPermissions
    properties:
        permissions:
            string: string
        principal: string
        projectId: string
        replace: false
    

    LibraryPermissions Resource Properties

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

    Inputs

    The LibraryPermissions resource accepts the following input properties:

    Permissions Dictionary<string, string>
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    Permissions map[string]string
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Map<String,String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions {[key: string]: string}
    the permissions to assign. The following permissions are available.
    principal string
    The group principal to assign the permissions.
    projectId string
    The ID of the project.
    replace boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Mapping[str, str]
    the permissions to assign. The following permissions are available.
    principal str
    The group principal to assign the permissions.
    project_id str
    The ID of the project.
    replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Map<String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    Outputs

    All input properties are implicitly available as output properties. Additionally, the LibraryPermissions 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 LibraryPermissions Resource

    Get an existing LibraryPermissions 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?: LibraryPermissionsState, opts?: CustomResourceOptions): LibraryPermissions
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            permissions: Optional[Mapping[str, str]] = None,
            principal: Optional[str] = None,
            project_id: Optional[str] = None,
            replace: Optional[bool] = None) -> LibraryPermissions
    func GetLibraryPermissions(ctx *Context, name string, id IDInput, state *LibraryPermissionsState, opts ...ResourceOption) (*LibraryPermissions, error)
    public static LibraryPermissions Get(string name, Input<string> id, LibraryPermissionsState? state, CustomResourceOptions? opts = null)
    public static LibraryPermissions get(String name, Output<String> id, LibraryPermissionsState 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:
    Permissions Dictionary<string, string>
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    Permissions map[string]string
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Map<String,String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions {[key: string]: string}
    the permissions to assign. The following permissions are available.
    principal string
    The group principal to assign the permissions.
    projectId string
    The ID of the project.
    replace boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Mapping[str, str]
    the permissions to assign. The following permissions are available.
    principal str
    The group principal to assign the permissions.
    project_id str
    The ID of the project.
    replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Map<String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    Import

    The resource does not support import.

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

    Package Details

    Repository
    Azure DevOps pulumi/pulumi-azuredevops
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuredevops Terraform Provider.
    azuredevops logo
    Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi