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

sonarqube.NewCodePeriods

Explore with Pulumi AI

Provides a Sonarqube New Code Periods resource. This can be used to manage Sonarqube New Code Periods.

Example Usage

Example: Set the global new code period to a number of days

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

const codePeriod = new sonarqube.NewCodePeriods("codePeriod", {
    type: "NUMBER_OF_DAYS",
    value: "7",
});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

code_period = sonarqube.NewCodePeriods("codePeriod",
    type="NUMBER_OF_DAYS",
    value="7")
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.NewNewCodePeriods(ctx, "codePeriod", &sonarqube.NewCodePeriodsArgs{
			Type:  pulumi.String("NUMBER_OF_DAYS"),
			Value: pulumi.String("7"),
		})
		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 codePeriod = new Sonarqube.NewCodePeriods("codePeriod", new()
    {
        Type = "NUMBER_OF_DAYS",
        Value = "7",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.NewCodePeriods;
import com.pulumi.sonarqube.NewCodePeriodsArgs;
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 codePeriod = new NewCodePeriods("codePeriod", NewCodePeriodsArgs.builder()
            .type("NUMBER_OF_DAYS")
            .value("7")
            .build());

    }
}
Copy
resources:
  codePeriod:
    type: sonarqube:NewCodePeriods
    properties:
      type: NUMBER_OF_DAYS
      value: '7'
Copy

Create NewCodePeriods Resource

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

Constructor syntax

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

@overload
def NewCodePeriods(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   type: Optional[str] = None,
                   branch: Optional[str] = None,
                   new_code_periods_id: Optional[str] = None,
                   project: Optional[str] = None,
                   value: Optional[str] = None)
func NewNewCodePeriods(ctx *Context, name string, args NewCodePeriodsArgs, opts ...ResourceOption) (*NewCodePeriods, error)
public NewCodePeriods(string name, NewCodePeriodsArgs args, CustomResourceOptions? opts = null)
public NewCodePeriods(String name, NewCodePeriodsArgs args)
public NewCodePeriods(String name, NewCodePeriodsArgs args, CustomResourceOptions options)
type: sonarqube:NewCodePeriods
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. NewCodePeriodsArgs
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. NewCodePeriodsArgs
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. NewCodePeriodsArgs
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. NewCodePeriodsArgs
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. NewCodePeriodsArgs
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 newCodePeriodsResource = new Sonarqube.NewCodePeriods("newCodePeriodsResource", new()
{
    Type = "string",
    Branch = "string",
    NewCodePeriodsId = "string",
    Project = "string",
    Value = "string",
});
Copy
example, err := sonarqube.NewNewCodePeriods(ctx, "newCodePeriodsResource", &sonarqube.NewCodePeriodsArgs{
Type: pulumi.String("string"),
Branch: pulumi.String("string"),
NewCodePeriodsId: pulumi.String("string"),
Project: pulumi.String("string"),
Value: pulumi.String("string"),
})
Copy
var newCodePeriodsResource = new NewCodePeriods("newCodePeriodsResource", NewCodePeriodsArgs.builder()
    .type("string")
    .branch("string")
    .newCodePeriodsId("string")
    .project("string")
    .value("string")
    .build());
Copy
new_code_periods_resource = sonarqube.NewCodePeriods("newCodePeriodsResource",
    type="string",
    branch="string",
    new_code_periods_id="string",
    project="string",
    value="string")
Copy
const newCodePeriodsResource = new sonarqube.NewCodePeriods("newCodePeriodsResource", {
    type: "string",
    branch: "string",
    newCodePeriodsId: "string",
    project: "string",
    value: "string",
});
Copy
type: sonarqube:NewCodePeriods
properties:
    branch: string
    newCodePeriodsId: string
    project: string
    type: string
    value: string
Copy

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

Type This property is required. string
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
Branch string
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
NewCodePeriodsId string
The ID of this resource.
Project string
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
Value string
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
Type This property is required. string
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
Branch string
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
NewCodePeriodsId string
The ID of this resource.
Project string
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
Value string
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
type This property is required. String
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
branch String
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
newCodePeriodsId String
The ID of this resource.
project String
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
value String
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
type This property is required. string
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
branch string
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
newCodePeriodsId string
The ID of this resource.
project string
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
value string
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
type This property is required. str
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
branch str
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
new_code_periods_id str
The ID of this resource.
project str
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
value str
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
type This property is required. String
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
branch String
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
newCodePeriodsId String
The ID of this resource.
project String
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
value String
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.

Outputs

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

Get an existing NewCodePeriods 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?: NewCodePeriodsState, opts?: CustomResourceOptions): NewCodePeriods
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        branch: Optional[str] = None,
        new_code_periods_id: Optional[str] = None,
        project: Optional[str] = None,
        type: Optional[str] = None,
        value: Optional[str] = None) -> NewCodePeriods
func GetNewCodePeriods(ctx *Context, name string, id IDInput, state *NewCodePeriodsState, opts ...ResourceOption) (*NewCodePeriods, error)
public static NewCodePeriods Get(string name, Input<string> id, NewCodePeriodsState? state, CustomResourceOptions? opts = null)
public static NewCodePeriods get(String name, Output<String> id, NewCodePeriodsState state, CustomResourceOptions options)
resources:  _:    type: sonarqube:NewCodePeriods    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:
Branch string
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
NewCodePeriodsId string
The ID of this resource.
Project string
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
Type string
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
Value string
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
Branch string
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
NewCodePeriodsId string
The ID of this resource.
Project string
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
Type string
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
Value string
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
branch String
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
newCodePeriodsId String
The ID of this resource.
project String
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
type String
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
value String
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
branch string
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
newCodePeriodsId string
The ID of this resource.
project string
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
type string
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
value string
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
branch str
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
new_code_periods_id str
The ID of this resource.
project str
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
type str
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
value str
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.
branch String
The name of a branch of a project for which the new code period will be configured. Changing this will force a new resource to be created. Setting this also requires setting the 'project' argument.
newCodePeriodsId String
The ID of this resource.
project String
The key of a project for which the new code period will be configured. Changing this will force a new resource to be created.
type String
The kind of new code period to use. Supported values are SPECIFICANALYSIS, PREVIOUSVERSION, NUMBEROFDAYS, or REFERENCE_BRANCH.
value String
The desired value of the new code period. Varies based on the 'type'. For SPECIFICANALYIS, the value must be the UUID of a previous analysis. For NUMBEROFDAYS it must be a numeric string. For REFERENCEBRANCH it should be the name of branch on the project. For PREVIOUS_VERSION it must not be set.

Package Details

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