1. Packages
  2. Sonarqube Provider
  3. API Docs
  4. Webhook
sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata

sonarqube.Webhook

Explore with Pulumi AI

Provides a Sonarqube Webhook resource. This can be used to manage Sonarqube webhooks.

Example Usage

Example: create a webhook

import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";

const webhook = new sonarqube.Webhook("webhook", {url: "https://my-webhook-destination.example.com"});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

webhook = sonarqube.Webhook("webhook", url="https://my-webhook-destination.example.com")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/sonarqube/sonarqube"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sonarqube.NewWebhook(ctx, "webhook", &sonarqube.WebhookArgs{
			Url: pulumi.String("https://my-webhook-destination.example.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;

return await Deployment.RunAsync(() => 
{
    var webhook = new Sonarqube.Webhook("webhook", new()
    {
        Url = "https://my-webhook-destination.example.com",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.Webhook;
import com.pulumi.sonarqube.WebhookArgs;
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 webhook = new Webhook("webhook", WebhookArgs.builder()
            .url("https://my-webhook-destination.example.com")
            .build());

    }
}
Copy
resources:
  webhook:
    type: sonarqube:Webhook
    properties:
      url: https://my-webhook-destination.example.com
Copy

Example: create a webhook owned by a project

import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";

const project = new sonarqube.Project("project", {
    project: "project",
    visibility: "public",
});
const webhook = new sonarqube.Webhook("webhook", {
    url: "https://my-webhook-destination.example.com",
    project: project.name,
});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

project = sonarqube.Project("project",
    project="project",
    visibility="public")
webhook = sonarqube.Webhook("webhook",
    url="https://my-webhook-destination.example.com",
    project=project.name)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/sonarqube/sonarqube"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := sonarqube.NewProject(ctx, "project", &sonarqube.ProjectArgs{
			Project:    pulumi.String("project"),
			Visibility: pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		_, err = sonarqube.NewWebhook(ctx, "webhook", &sonarqube.WebhookArgs{
			Url:     pulumi.String("https://my-webhook-destination.example.com"),
			Project: project.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;

return await Deployment.RunAsync(() => 
{
    var project = new Sonarqube.Project("project", new()
    {
        Project = "project",
        Visibility = "public",
    });

    var webhook = new Sonarqube.Webhook("webhook", new()
    {
        Url = "https://my-webhook-destination.example.com",
        Project = project.Name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.Project;
import com.pulumi.sonarqube.ProjectArgs;
import com.pulumi.sonarqube.Webhook;
import com.pulumi.sonarqube.WebhookArgs;
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()
            .project("project")
            .visibility("public")
            .build());

        var webhook = new Webhook("webhook", WebhookArgs.builder()
            .url("https://my-webhook-destination.example.com")
            .project(project.name())
            .build());

    }
}
Copy
resources:
  project:
    type: sonarqube:Project
    properties:
      project: project
      visibility: public
  webhook:
    type: sonarqube:Webhook
    properties:
      url: https://my-webhook-destination.example.com
      project: ${project.name}
Copy

Create Webhook Resource

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

Constructor syntax

new Webhook(name: string, args: WebhookArgs, opts?: CustomResourceOptions);
@overload
def Webhook(resource_name: str,
            args: WebhookArgs,
            opts: Optional[ResourceOptions] = None)

@overload
def Webhook(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            url: Optional[str] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            secret: Optional[str] = None,
            webhook_id: Optional[str] = None)
func NewWebhook(ctx *Context, name string, args WebhookArgs, opts ...ResourceOption) (*Webhook, error)
public Webhook(string name, WebhookArgs args, CustomResourceOptions? opts = null)
public Webhook(String name, WebhookArgs args)
public Webhook(String name, WebhookArgs args, CustomResourceOptions options)
type: sonarqube:Webhook
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WebhookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WebhookArgs
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 webhookResource = new Sonarqube.Webhook("webhookResource", new()
{
    Url = "string",
    Name = "string",
    Project = "string",
    Secret = "string",
    WebhookId = "string",
});
Copy
example, err := sonarqube.NewWebhook(ctx, "webhookResource", &sonarqube.WebhookArgs{
Url: pulumi.String("string"),
Name: pulumi.String("string"),
Project: pulumi.String("string"),
Secret: pulumi.String("string"),
WebhookId: pulumi.String("string"),
})
Copy
var webhookResource = new Webhook("webhookResource", WebhookArgs.builder()
    .url("string")
    .name("string")
    .project("string")
    .secret("string")
    .webhookId("string")
    .build());
Copy
webhook_resource = sonarqube.Webhook("webhookResource",
    url="string",
    name="string",
    project="string",
    secret="string",
    webhook_id="string")
Copy
const webhookResource = new sonarqube.Webhook("webhookResource", {
    url: "string",
    name: "string",
    project: "string",
    secret: "string",
    webhookId: "string",
});
Copy
type: sonarqube:Webhook
properties:
    name: string
    project: string
    secret: string
    url: string
    webhookId: string
Copy

Webhook 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 Webhook resource accepts the following input properties:

Url This property is required. string
The URL to send event payloads to. This must begin with either https:// or http://.
Name string
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
Project string
The key of the project that will own the webhook.
Secret string
The secret to send with the event payload.
WebhookId string
The ID of this resource.
Url This property is required. string
The URL to send event payloads to. This must begin with either https:// or http://.
Name string
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
Project string
The key of the project that will own the webhook.
Secret string
The secret to send with the event payload.
WebhookId string
The ID of this resource.
url This property is required. String
The URL to send event payloads to. This must begin with either https:// or http://.
name String
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project String
The key of the project that will own the webhook.
secret String
The secret to send with the event payload.
webhookId String
The ID of this resource.
url This property is required. string
The URL to send event payloads to. This must begin with either https:// or http://.
name string
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project string
The key of the project that will own the webhook.
secret string
The secret to send with the event payload.
webhookId string
The ID of this resource.
url This property is required. str
The URL to send event payloads to. This must begin with either https:// or http://.
name str
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project str
The key of the project that will own the webhook.
secret str
The secret to send with the event payload.
webhook_id str
The ID of this resource.
url This property is required. String
The URL to send event payloads to. This must begin with either https:// or http://.
name String
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project String
The key of the project that will own the webhook.
secret String
The secret to send with the event payload.
webhookId String
The ID of this resource.

Outputs

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

Get an existing Webhook 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?: WebhookState, opts?: CustomResourceOptions): Webhook
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        secret: Optional[str] = None,
        url: Optional[str] = None,
        webhook_id: Optional[str] = None) -> Webhook
func GetWebhook(ctx *Context, name string, id IDInput, state *WebhookState, opts ...ResourceOption) (*Webhook, error)
public static Webhook Get(string name, Input<string> id, WebhookState? state, CustomResourceOptions? opts = null)
public static Webhook get(String name, Output<String> id, WebhookState state, CustomResourceOptions options)
resources:  _:    type: sonarqube:Webhook    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Name string
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
Project string
The key of the project that will own the webhook.
Secret string
The secret to send with the event payload.
Url string
The URL to send event payloads to. This must begin with either https:// or http://.
WebhookId string
The ID of this resource.
Name string
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
Project string
The key of the project that will own the webhook.
Secret string
The secret to send with the event payload.
Url string
The URL to send event payloads to. This must begin with either https:// or http://.
WebhookId string
The ID of this resource.
name String
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project String
The key of the project that will own the webhook.
secret String
The secret to send with the event payload.
url String
The URL to send event payloads to. This must begin with either https:// or http://.
webhookId String
The ID of this resource.
name string
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project string
The key of the project that will own the webhook.
secret string
The secret to send with the event payload.
url string
The URL to send event payloads to. This must begin with either https:// or http://.
webhookId string
The ID of this resource.
name str
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project str
The key of the project that will own the webhook.
secret str
The secret to send with the event payload.
url str
The URL to send event payloads to. This must begin with either https:// or http://.
webhook_id str
The ID of this resource.
name String
The name of the webhook to create. This will be displayed in the Sonarqube administration console.
project String
The key of the project that will own the webhook.
secret String
The secret to send with the event payload.
url String
The URL to send event payloads to. This must begin with either https:// or http://.
webhookId String
The ID of this resource.

Package Details

Repository
sonarqube jdamata/terraform-provider-sonarqube
License
Notes
This Pulumi package is based on the sonarqube Terraform Provider.