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
.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const example = new azuredevops.Project("example", {
name: "Example Project",
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",
},
});
import pulumi
import pulumi_azuredevops as azuredevops
example = azuredevops.Project("example",
name="Example Project",
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",
})
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 {
example, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
Name: pulumi.String("Example Project"),
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: pulumi.String(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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var example = new AzureDevOps.Project("example", new()
{
Name = "Example Project",
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 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()
.name("Example Project")
.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());
}
}
resources:
example:
type: azuredevops:Project
properties:
name: Example Project
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
Relevant Links
PAT Permissions Required
- Project & Team: vso.security_manage - Grants the ability to read, write, and manage security permissions.
Create ServicehookPermissions Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServicehookPermissions(name: string, args: ServicehookPermissionsArgs, opts?: CustomResourceOptions);
@overload
def ServicehookPermissions(resource_name: str,
args: ServicehookPermissionsArgs,
opts: Optional[ResourceOptions] = None)
@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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var servicehookPermissionsResource = new AzureDevOps.ServicehookPermissions("servicehookPermissionsResource", new()
{
Permissions =
{
{ "string", "string" },
},
Principal = "string",
ProjectId = "string",
Replace = false,
});
example, err := azuredevops.NewServicehookPermissions(ctx, "servicehookPermissionsResource", &azuredevops.ServicehookPermissionsArgs{
Permissions: pulumi.StringMap{
"string": pulumi.String("string"),
},
Principal: pulumi.String("string"),
ProjectId: pulumi.String("string"),
Replace: pulumi.Bool(false),
})
var servicehookPermissionsResource = new ServicehookPermissions("servicehookPermissionsResource", ServicehookPermissionsArgs.builder()
.permissions(Map.of("string", "string"))
.principal("string")
.projectId("string")
.replace(false)
.build());
servicehook_permissions_resource = azuredevops.ServicehookPermissions("servicehookPermissionsResource",
permissions={
"string": "string",
},
principal="string",
project_id="string",
replace=False)
const servicehookPermissionsResource = new azuredevops.ServicehookPermissions("servicehookPermissionsResource", {
permissions: {
string: "string",
},
principal: "string",
projectId: "string",
replace: false,
});
type: azuredevops:ServicehookPermissions
properties:
permissions:
string: string
principal: string
projectId: string
replace: false
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
- 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
| Name | Permission Description | | ------------------ | ------------------------ | | ViewSubscriptions | View Subscriptions | | EditSubscriptions | Edit Subscription | | DeleteSubscriptions| Delete Subscriptions | | PublishEvents | Publish Events |
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.