Azure DevOps v2.7.0, Mar 27 23
Azure DevOps v2.7.0, Mar 27 23
azuredevops.ServicehookPermissions
Explore with Pulumi AI
Manages permissions for service hooks
Permission levels
Permissions for service hooks within Azure DevOps can be applied on the Organizational level or, if the optional attribute project_id
is specified, on Project level.
Those levels are reflected by specifying (or omitting) values for the argument project_id
.
Relevant Links
PAT Permissions Required
- Project & Team: vso.security_manage - Grants the ability to read, write, and manage security permissions.
Example Usage
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var example = new AzureDevOps.Project("example", new()
{
WorkItemTemplate = "Agile",
VersionControl = "Git",
Visibility = "private",
Description = "Managed by Terraform",
});
var example_readers = AzureDevOps.GetGroup.Invoke(new()
{
ProjectId = example.Id,
Name = "Readers",
});
var example_permissions = new AzureDevOps.ServicehookPermissions("example-permissions", new()
{
ProjectId = example.Id,
Principal = example_readers.Apply(example_readers => example_readers.Apply(getGroupResult => getGroupResult.Id)),
Permissions =
{
{ "ViewSubscriptions", "allow" },
{ "EditSubscriptions", "allow" },
{ "DeleteSubscriptions", "allow" },
{ "PublishEvents", "allow" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
WorkItemTemplate: pulumi.String("Agile"),
VersionControl: pulumi.String("Git"),
Visibility: pulumi.String("private"),
Description: pulumi.String("Managed by Terraform"),
})
if err != nil {
return err
}
example_readers := azuredevops.LookupGroupOutput(ctx, azuredevops.GetGroupOutputArgs{
ProjectId: example.ID(),
Name: pulumi.String("Readers"),
}, nil)
_, err = azuredevops.NewServicehookPermissions(ctx, "example-permissions", &azuredevops.ServicehookPermissionsArgs{
ProjectId: example.ID(),
Principal: example_readers.ApplyT(func(example_readers azuredevops.GetGroupResult) (*string, error) {
return &example_readers.Id, nil
}).(pulumi.StringPtrOutput),
Permissions: pulumi.StringMap{
"ViewSubscriptions": pulumi.String("allow"),
"EditSubscriptions": pulumi.String("allow"),
"DeleteSubscriptions": pulumi.String("allow"),
"PublishEvents": pulumi.String("allow"),
},
})
if err != nil {
return err
}
return nil
})
}
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.ServicehookPermissions;
import com.pulumi.azuredevops.ServicehookPermissionsArgs;
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 example = new Project("example", ProjectArgs.builder()
.workItemTemplate("Agile")
.versionControl("Git")
.visibility("private")
.description("Managed by Terraform")
.build());
final var example-readers = AzuredevopsFunctions.getGroup(GetGroupArgs.builder()
.projectId(example.id())
.name("Readers")
.build());
var example_permissions = new ServicehookPermissions("example-permissions", ServicehookPermissionsArgs.builder()
.projectId(example.id())
.principal(example_readers.applyValue(example_readers -> example_readers.id()))
.permissions(Map.ofEntries(
Map.entry("ViewSubscriptions", "allow"),
Map.entry("EditSubscriptions", "allow"),
Map.entry("DeleteSubscriptions", "allow"),
Map.entry("PublishEvents", "allow")
))
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example = azuredevops.Project("example",
work_item_template="Agile",
version_control="Git",
visibility="private",
description="Managed by Terraform")
example_readers = azuredevops.get_group_output(project_id=example.id,
name="Readers")
example_permissions = azuredevops.ServicehookPermissions("example-permissions",
project_id=example.id,
principal=example_readers.id,
permissions={
"ViewSubscriptions": "allow",
"EditSubscriptions": "allow",
"DeleteSubscriptions": "allow",
"PublishEvents": "allow",
})
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const example = new azuredevops.Project("example", {
workItemTemplate: "Agile",
versionControl: "Git",
visibility: "private",
description: "Managed by Terraform",
});
const example-readers = azuredevops.getGroupOutput({
projectId: example.id,
name: "Readers",
});
const example_permissions = new azuredevops.ServicehookPermissions("example-permissions", {
projectId: example.id,
principal: example_readers.apply(example_readers => example_readers.id),
permissions: {
ViewSubscriptions: "allow",
EditSubscriptions: "allow",
DeleteSubscriptions: "allow",
PublishEvents: "allow",
},
});
resources:
example:
type: azuredevops:Project
properties:
workItemTemplate: Agile
versionControl: Git
visibility: private
description: Managed by Terraform
example-permissions:
type: azuredevops:ServicehookPermissions
properties:
projectId: ${example.id}
principal: ${["example-readers"].id}
permissions:
ViewSubscriptions: allow
EditSubscriptions: allow
DeleteSubscriptions: allow
PublishEvents: allow
variables:
example-readers:
fn::invoke:
Function: azuredevops:getGroup
Arguments:
projectId: ${example.id}
name: Readers
Create ServicehookPermissions Resource
new ServicehookPermissions(name: string, args: ServicehookPermissionsArgs, opts?: CustomResourceOptions);
@overload
def ServicehookPermissions(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)
@overload
def ServicehookPermissions(resource_name: str,
args: ServicehookPermissionsArgs,
opts: Optional[ResourceOptions] = None)
func NewServicehookPermissions(ctx *Context, name string, args ServicehookPermissionsArgs, opts ...ResourceOption) (*ServicehookPermissions, error)
public ServicehookPermissions(string name, ServicehookPermissionsArgs args, CustomResourceOptions? opts = null)
public ServicehookPermissions(String name, ServicehookPermissionsArgs args)
public ServicehookPermissions(String name, ServicehookPermissionsArgs args, CustomResourceOptions options)
type: azuredevops:ServicehookPermissions
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServicehookPermissionsArgs
- 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 ServicehookPermissionsArgs
- 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 ServicehookPermissionsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServicehookPermissionsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServicehookPermissionsArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ServicehookPermissions 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 ServicehookPermissions 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.
- Project
Id string The ID of the project.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
- Permissions map[string]string
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
- permissions Map<String,String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
- permissions {[key: string]: string}
the permissions to assign. The following permissions are available.
- principal string
The group principal to assign the permissions.
- project
Id string The ID of the project.
- replace boolean
Replace (
true
) or merge (false
) the permissions. Default:true
- 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
- permissions Map<String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
Outputs
All input properties are implicitly available as output properties. Additionally, the ServicehookPermissions 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 ServicehookPermissions Resource
Get an existing ServicehookPermissions 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?: ServicehookPermissionsState, opts?: CustomResourceOptions): ServicehookPermissions
@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) -> ServicehookPermissions
func GetServicehookPermissions(ctx *Context, name string, id IDInput, state *ServicehookPermissionsState, opts ...ResourceOption) (*ServicehookPermissions, error)
public static ServicehookPermissions Get(string name, Input<string> id, ServicehookPermissionsState? state, CustomResourceOptions? opts = null)
public static ServicehookPermissions get(String name, Output<String> id, ServicehookPermissionsState 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.
- Permissions Dictionary<string, string>
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
- Permissions map[string]string
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
- permissions Map<String,String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
- permissions {[key: string]: string}
the permissions to assign. The following permissions are available.
- principal string
The group principal to assign the permissions.
- project
Id string The ID of the project.
- replace boolean
Replace (
true
) or merge (false
) the permissions. Default:true
- 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
- permissions Map<String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
Import
The resource does not support import.
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azuredevops
Terraform Provider.