sonarqube.QualitygateProjectAssociation
Explore with Pulumi AI
Provides a Sonarqube Quality Gate Project association resource. This can be used to associate a Quality Gate to a Project
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";
//# Example: create a quality gate project association
const mainQualitygate = new sonarqube.Qualitygate("mainQualitygate", {conditions: [{
metric: "new_coverage",
op: "LT",
threshold: "30",
}]});
const mainProject = new sonarqube.Project("mainProject", {
project: "my_project",
visibility: "public",
});
const mainQualitygateProjectAssociation = new sonarqube.QualitygateProjectAssociation("mainQualitygateProjectAssociation", {
gatename: mainQualitygate.qualitygateId,
projectkey: mainProject.project,
});
import pulumi
import pulumi_sonarqube as sonarqube
## Example: create a quality gate project association
main_qualitygate = sonarqube.Qualitygate("mainQualitygate", conditions=[{
"metric": "new_coverage",
"op": "LT",
"threshold": "30",
}])
main_project = sonarqube.Project("mainProject",
project="my_project",
visibility="public")
main_qualitygate_project_association = sonarqube.QualitygateProjectAssociation("mainQualitygateProjectAssociation",
gatename=main_qualitygate.qualitygate_id,
projectkey=main_project.project)
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 {
// # Example: create a quality gate project association
mainQualitygate, err := sonarqube.NewQualitygate(ctx, "mainQualitygate", &sonarqube.QualitygateArgs{
Conditions: sonarqube.QualitygateConditionArray{
&sonarqube.QualitygateConditionArgs{
Metric: pulumi.String("new_coverage"),
Op: pulumi.String("LT"),
Threshold: pulumi.String("30"),
},
},
})
if err != nil {
return err
}
mainProject, err := sonarqube.NewProject(ctx, "mainProject", &sonarqube.ProjectArgs{
Project: pulumi.String("my_project"),
Visibility: pulumi.String("public"),
})
if err != nil {
return err
}
_, err = sonarqube.NewQualitygateProjectAssociation(ctx, "mainQualitygateProjectAssociation", &sonarqube.QualitygateProjectAssociationArgs{
Gatename: mainQualitygate.QualitygateId,
Projectkey: mainProject.Project,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;
return await Deployment.RunAsync(() =>
{
//# Example: create a quality gate project association
var mainQualitygate = new Sonarqube.Qualitygate("mainQualitygate", new()
{
Conditions = new[]
{
new Sonarqube.Inputs.QualitygateConditionArgs
{
Metric = "new_coverage",
Op = "LT",
Threshold = "30",
},
},
});
var mainProject = new Sonarqube.Project("mainProject", new()
{
Project = "my_project",
Visibility = "public",
});
var mainQualitygateProjectAssociation = new Sonarqube.QualitygateProjectAssociation("mainQualitygateProjectAssociation", new()
{
Gatename = mainQualitygate.QualitygateId,
Projectkey = mainProject.Project,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.Qualitygate;
import com.pulumi.sonarqube.QualitygateArgs;
import com.pulumi.sonarqube.inputs.QualitygateConditionArgs;
import com.pulumi.sonarqube.Project;
import com.pulumi.sonarqube.ProjectArgs;
import com.pulumi.sonarqube.QualitygateProjectAssociation;
import com.pulumi.sonarqube.QualitygateProjectAssociationArgs;
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) {
//# Example: create a quality gate project association
var mainQualitygate = new Qualitygate("mainQualitygate", QualitygateArgs.builder()
.conditions(QualitygateConditionArgs.builder()
.metric("new_coverage")
.op("LT")
.threshold("30")
.build())
.build());
var mainProject = new Project("mainProject", ProjectArgs.builder()
.project("my_project")
.visibility("public")
.build());
var mainQualitygateProjectAssociation = new QualitygateProjectAssociation("mainQualitygateProjectAssociation", QualitygateProjectAssociationArgs.builder()
.gatename(mainQualitygate.qualitygateId())
.projectkey(mainProject.project())
.build());
}
}
resources:
## Example: create a quality gate project association
mainQualitygate:
type: sonarqube:Qualitygate
properties:
conditions:
- metric: new_coverage
op: LT
threshold: '30'
mainProject:
type: sonarqube:Project
properties:
project: my_project
visibility: public
mainQualitygateProjectAssociation:
type: sonarqube:QualitygateProjectAssociation
properties:
gatename: ${mainQualitygate.qualitygateId}
projectkey: ${mainProject.project}
Create QualitygateProjectAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new QualitygateProjectAssociation(name: string, args: QualitygateProjectAssociationArgs, opts?: CustomResourceOptions);
@overload
def QualitygateProjectAssociation(resource_name: str,
args: QualitygateProjectAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def QualitygateProjectAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
projectkey: Optional[str] = None,
gateid: Optional[str] = None,
gatename: Optional[str] = None,
qualitygate_project_association_id: Optional[str] = None)
func NewQualitygateProjectAssociation(ctx *Context, name string, args QualitygateProjectAssociationArgs, opts ...ResourceOption) (*QualitygateProjectAssociation, error)
public QualitygateProjectAssociation(string name, QualitygateProjectAssociationArgs args, CustomResourceOptions? opts = null)
public QualitygateProjectAssociation(String name, QualitygateProjectAssociationArgs args)
public QualitygateProjectAssociation(String name, QualitygateProjectAssociationArgs args, CustomResourceOptions options)
type: sonarqube:QualitygateProjectAssociation
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 QualitygateProjectAssociationArgs
- 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 QualitygateProjectAssociationArgs
- 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 QualitygateProjectAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args QualitygateProjectAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args QualitygateProjectAssociationArgs
- 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 qualitygateProjectAssociationResource = new Sonarqube.QualitygateProjectAssociation("qualitygateProjectAssociationResource", new()
{
Projectkey = "string",
Gateid = "string",
Gatename = "string",
QualitygateProjectAssociationId = "string",
});
example, err := sonarqube.NewQualitygateProjectAssociation(ctx, "qualitygateProjectAssociationResource", &sonarqube.QualitygateProjectAssociationArgs{
Projectkey: pulumi.String("string"),
Gateid: pulumi.String("string"),
Gatename: pulumi.String("string"),
QualitygateProjectAssociationId: pulumi.String("string"),
})
var qualitygateProjectAssociationResource = new QualitygateProjectAssociation("qualitygateProjectAssociationResource", QualitygateProjectAssociationArgs.builder()
.projectkey("string")
.gateid("string")
.gatename("string")
.qualitygateProjectAssociationId("string")
.build());
qualitygate_project_association_resource = sonarqube.QualitygateProjectAssociation("qualitygateProjectAssociationResource",
projectkey="string",
gateid="string",
gatename="string",
qualitygate_project_association_id="string")
const qualitygateProjectAssociationResource = new sonarqube.QualitygateProjectAssociation("qualitygateProjectAssociationResource", {
projectkey: "string",
gateid: "string",
gatename: "string",
qualitygateProjectAssociationId: "string",
});
type: sonarqube:QualitygateProjectAssociation
properties:
gateid: string
gatename: string
projectkey: string
qualitygateProjectAssociationId: string
QualitygateProjectAssociation 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 QualitygateProjectAssociation resource accepts the following input properties:
- Projectkey string
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- Gateid string
- Gatename string
- The name of the Quality Gate
- Qualitygate
Project stringAssociation Id - The ID of this resource.
- Projectkey string
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- Gateid string
- Gatename string
- The name of the Quality Gate
- Qualitygate
Project stringAssociation Id - The ID of this resource.
- projectkey String
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- gateid String
- gatename String
- The name of the Quality Gate
- qualitygate
Project StringAssociation Id - The ID of this resource.
- projectkey string
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- gateid string
- gatename string
- The name of the Quality Gate
- qualitygate
Project stringAssociation Id - The ID of this resource.
- projectkey str
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- gateid str
- gatename str
- The name of the Quality Gate
- qualitygate_
project_ strassociation_ id - The ID of this resource.
- projectkey String
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- gateid String
- gatename String
- The name of the Quality Gate
- qualitygate
Project StringAssociation Id - The ID of this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the QualitygateProjectAssociation 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 QualitygateProjectAssociation Resource
Get an existing QualitygateProjectAssociation 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?: QualitygateProjectAssociationState, opts?: CustomResourceOptions): QualitygateProjectAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
gateid: Optional[str] = None,
gatename: Optional[str] = None,
projectkey: Optional[str] = None,
qualitygate_project_association_id: Optional[str] = None) -> QualitygateProjectAssociation
func GetQualitygateProjectAssociation(ctx *Context, name string, id IDInput, state *QualitygateProjectAssociationState, opts ...ResourceOption) (*QualitygateProjectAssociation, error)
public static QualitygateProjectAssociation Get(string name, Input<string> id, QualitygateProjectAssociationState? state, CustomResourceOptions? opts = null)
public static QualitygateProjectAssociation get(String name, Output<String> id, QualitygateProjectAssociationState state, CustomResourceOptions options)
resources: _: type: sonarqube:QualitygateProjectAssociation get: id: ${id}
- 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.
- Gateid string
- Gatename string
- The name of the Quality Gate
- Projectkey string
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- Qualitygate
Project stringAssociation Id - The ID of this resource.
- Gateid string
- Gatename string
- The name of the Quality Gate
- Projectkey string
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- Qualitygate
Project stringAssociation Id - The ID of this resource.
- gateid String
- gatename String
- The name of the Quality Gate
- projectkey String
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- qualitygate
Project StringAssociation Id - The ID of this resource.
- gateid string
- gatename string
- The name of the Quality Gate
- projectkey string
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- qualitygate
Project stringAssociation Id - The ID of this resource.
- gateid str
- gatename str
- The name of the Quality Gate
- projectkey str
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- qualitygate_
project_ strassociation_ id - The ID of this resource.
- gateid String
- gatename String
- The name of the Quality Gate
- projectkey String
- Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
- qualitygate
Project StringAssociation Id - 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.