gitlab.ProjectBadge
Explore with Pulumi AI
The gitlab.ProjectBadge
resource allows to manage the lifecycle of project badges.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const foo = new gitlab.Project("foo", {name: "foo-project"});
const example = new gitlab.ProjectBadge("example", {
project: foo.id,
linkUrl: "https://example.com/badge-123",
imageUrl: "https://example.com/badge-123.svg",
name: "badge-123",
});
// Pipeline status badges with placeholders will be enabled
const gitlabPipeline = new gitlab.ProjectBadge("gitlab_pipeline", {
project: foo.id,
linkUrl: "https://gitlab.example.com/%{project_path}/-/pipelines?ref=%{default_branch}",
imageUrl: "https://gitlab.example.com/%{project_path}/badges/%{default_branch}/pipeline.svg",
name: "badge-pipeline",
});
// Test coverage report badges with placeholders will be enabled
const gitlabCoverage = new gitlab.ProjectBadge("gitlab_coverage", {
project: foo.id,
linkUrl: "https://gitlab.example.com/%{project_path}/-/jobs",
imageUrl: "https://gitlab.example.com/%{project_path}/badges/%{default_branch}/coverage.svg",
name: "badge-coverage",
});
// Latest release badges with placeholders will be enabled
const gitlabRelease = new gitlab.ProjectBadge("gitlab_release", {
project: foo.id,
linkUrl: "https://gitlab.example.com/%{project_path}/-/releases",
imageUrl: "https://gitlab.example.com/%{project_path}/-/badges/release.svg",
name: "badge-release",
});
import pulumi
import pulumi_gitlab as gitlab
foo = gitlab.Project("foo", name="foo-project")
example = gitlab.ProjectBadge("example",
project=foo.id,
link_url="https://example.com/badge-123",
image_url="https://example.com/badge-123.svg",
name="badge-123")
# Pipeline status badges with placeholders will be enabled
gitlab_pipeline = gitlab.ProjectBadge("gitlab_pipeline",
project=foo.id,
link_url="https://gitlab.example.com/%{project_path}/-/pipelines?ref=%{default_branch}",
image_url="https://gitlab.example.com/%{project_path}/badges/%{default_branch}/pipeline.svg",
name="badge-pipeline")
# Test coverage report badges with placeholders will be enabled
gitlab_coverage = gitlab.ProjectBadge("gitlab_coverage",
project=foo.id,
link_url="https://gitlab.example.com/%{project_path}/-/jobs",
image_url="https://gitlab.example.com/%{project_path}/badges/%{default_branch}/coverage.svg",
name="badge-coverage")
# Latest release badges with placeholders will be enabled
gitlab_release = gitlab.ProjectBadge("gitlab_release",
project=foo.id,
link_url="https://gitlab.example.com/%{project_path}/-/releases",
image_url="https://gitlab.example.com/%{project_path}/-/badges/release.svg",
name="badge-release")
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
foo, err := gitlab.NewProject(ctx, "foo", &gitlab.ProjectArgs{
Name: pulumi.String("foo-project"),
})
if err != nil {
return err
}
_, err = gitlab.NewProjectBadge(ctx, "example", &gitlab.ProjectBadgeArgs{
Project: foo.ID(),
LinkUrl: pulumi.String("https://example.com/badge-123"),
ImageUrl: pulumi.String("https://example.com/badge-123.svg"),
Name: pulumi.String("badge-123"),
})
if err != nil {
return err
}
// Pipeline status badges with placeholders will be enabled
_, err = gitlab.NewProjectBadge(ctx, "gitlab_pipeline", &gitlab.ProjectBadgeArgs{
Project: foo.ID(),
LinkUrl: pulumi.String("https://gitlab.example.com/%{project_path}/-/pipelines?ref=%{default_branch}"),
ImageUrl: pulumi.String("https://gitlab.example.com/%{project_path}/badges/%{default_branch}/pipeline.svg"),
Name: pulumi.String("badge-pipeline"),
})
if err != nil {
return err
}
// Test coverage report badges with placeholders will be enabled
_, err = gitlab.NewProjectBadge(ctx, "gitlab_coverage", &gitlab.ProjectBadgeArgs{
Project: foo.ID(),
LinkUrl: pulumi.String("https://gitlab.example.com/%{project_path}/-/jobs"),
ImageUrl: pulumi.String("https://gitlab.example.com/%{project_path}/badges/%{default_branch}/coverage.svg"),
Name: pulumi.String("badge-coverage"),
})
if err != nil {
return err
}
// Latest release badges with placeholders will be enabled
_, err = gitlab.NewProjectBadge(ctx, "gitlab_release", &gitlab.ProjectBadgeArgs{
Project: foo.ID(),
LinkUrl: pulumi.String("https://gitlab.example.com/%{project_path}/-/releases"),
ImageUrl: pulumi.String("https://gitlab.example.com/%{project_path}/-/badges/release.svg"),
Name: pulumi.String("badge-release"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var foo = new GitLab.Project("foo", new()
{
Name = "foo-project",
});
var example = new GitLab.ProjectBadge("example", new()
{
Project = foo.Id,
LinkUrl = "https://example.com/badge-123",
ImageUrl = "https://example.com/badge-123.svg",
Name = "badge-123",
});
// Pipeline status badges with placeholders will be enabled
var gitlabPipeline = new GitLab.ProjectBadge("gitlab_pipeline", new()
{
Project = foo.Id,
LinkUrl = "https://gitlab.example.com/%{project_path}/-/pipelines?ref=%{default_branch}",
ImageUrl = "https://gitlab.example.com/%{project_path}/badges/%{default_branch}/pipeline.svg",
Name = "badge-pipeline",
});
// Test coverage report badges with placeholders will be enabled
var gitlabCoverage = new GitLab.ProjectBadge("gitlab_coverage", new()
{
Project = foo.Id,
LinkUrl = "https://gitlab.example.com/%{project_path}/-/jobs",
ImageUrl = "https://gitlab.example.com/%{project_path}/badges/%{default_branch}/coverage.svg",
Name = "badge-coverage",
});
// Latest release badges with placeholders will be enabled
var gitlabRelease = new GitLab.ProjectBadge("gitlab_release", new()
{
Project = foo.Id,
LinkUrl = "https://gitlab.example.com/%{project_path}/-/releases",
ImageUrl = "https://gitlab.example.com/%{project_path}/-/badges/release.svg",
Name = "badge-release",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.ProjectBadge;
import com.pulumi.gitlab.ProjectBadgeArgs;
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 foo = new Project("foo", ProjectArgs.builder()
.name("foo-project")
.build());
var example = new ProjectBadge("example", ProjectBadgeArgs.builder()
.project(foo.id())
.linkUrl("https://example.com/badge-123")
.imageUrl("https://example.com/badge-123.svg")
.name("badge-123")
.build());
// Pipeline status badges with placeholders will be enabled
var gitlabPipeline = new ProjectBadge("gitlabPipeline", ProjectBadgeArgs.builder()
.project(foo.id())
.linkUrl("https://gitlab.example.com/%{project_path}/-/pipelines?ref=%{default_branch}")
.imageUrl("https://gitlab.example.com/%{project_path}/badges/%{default_branch}/pipeline.svg")
.name("badge-pipeline")
.build());
// Test coverage report badges with placeholders will be enabled
var gitlabCoverage = new ProjectBadge("gitlabCoverage", ProjectBadgeArgs.builder()
.project(foo.id())
.linkUrl("https://gitlab.example.com/%{project_path}/-/jobs")
.imageUrl("https://gitlab.example.com/%{project_path}/badges/%{default_branch}/coverage.svg")
.name("badge-coverage")
.build());
// Latest release badges with placeholders will be enabled
var gitlabRelease = new ProjectBadge("gitlabRelease", ProjectBadgeArgs.builder()
.project(foo.id())
.linkUrl("https://gitlab.example.com/%{project_path}/-/releases")
.imageUrl("https://gitlab.example.com/%{project_path}/-/badges/release.svg")
.name("badge-release")
.build());
}
}
resources:
foo:
type: gitlab:Project
properties:
name: foo-project
example:
type: gitlab:ProjectBadge
properties:
project: ${foo.id}
linkUrl: https://example.com/badge-123
imageUrl: https://example.com/badge-123.svg
name: badge-123
# Pipeline status badges with placeholders will be enabled
gitlabPipeline:
type: gitlab:ProjectBadge
name: gitlab_pipeline
properties:
project: ${foo.id}
linkUrl: https://gitlab.example.com/%{project_path}/-/pipelines?ref=%{default_branch}
imageUrl: https://gitlab.example.com/%{project_path}/badges/%{default_branch}/pipeline.svg
name: badge-pipeline
# Test coverage report badges with placeholders will be enabled
gitlabCoverage:
type: gitlab:ProjectBadge
name: gitlab_coverage
properties:
project: ${foo.id}
linkUrl: https://gitlab.example.com/%{project_path}/-/jobs
imageUrl: https://gitlab.example.com/%{project_path}/badges/%{default_branch}/coverage.svg
name: badge-coverage
# Latest release badges with placeholders will be enabled
gitlabRelease:
type: gitlab:ProjectBadge
name: gitlab_release
properties:
project: ${foo.id}
linkUrl: https://gitlab.example.com/%{project_path}/-/releases
imageUrl: https://gitlab.example.com/%{project_path}/-/badges/release.svg
name: badge-release
Create ProjectBadge Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectBadge(name: string, args: ProjectBadgeArgs, opts?: CustomResourceOptions);
@overload
def ProjectBadge(resource_name: str,
args: ProjectBadgeArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectBadge(resource_name: str,
opts: Optional[ResourceOptions] = None,
image_url: Optional[str] = None,
link_url: Optional[str] = None,
project: Optional[str] = None,
name: Optional[str] = None)
func NewProjectBadge(ctx *Context, name string, args ProjectBadgeArgs, opts ...ResourceOption) (*ProjectBadge, error)
public ProjectBadge(string name, ProjectBadgeArgs args, CustomResourceOptions? opts = null)
public ProjectBadge(String name, ProjectBadgeArgs args)
public ProjectBadge(String name, ProjectBadgeArgs args, CustomResourceOptions options)
type: gitlab:ProjectBadge
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 ProjectBadgeArgs
- 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 ProjectBadgeArgs
- 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 ProjectBadgeArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectBadgeArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectBadgeArgs
- 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 projectBadgeResource = new GitLab.ProjectBadge("projectBadgeResource", new()
{
ImageUrl = "string",
LinkUrl = "string",
Project = "string",
Name = "string",
});
example, err := gitlab.NewProjectBadge(ctx, "projectBadgeResource", &gitlab.ProjectBadgeArgs{
ImageUrl: pulumi.String("string"),
LinkUrl: pulumi.String("string"),
Project: pulumi.String("string"),
Name: pulumi.String("string"),
})
var projectBadgeResource = new ProjectBadge("projectBadgeResource", ProjectBadgeArgs.builder()
.imageUrl("string")
.linkUrl("string")
.project("string")
.name("string")
.build());
project_badge_resource = gitlab.ProjectBadge("projectBadgeResource",
image_url="string",
link_url="string",
project="string",
name="string")
const projectBadgeResource = new gitlab.ProjectBadge("projectBadgeResource", {
imageUrl: "string",
linkUrl: "string",
project: "string",
name: "string",
});
type: gitlab:ProjectBadge
properties:
imageUrl: string
linkUrl: string
name: string
project: string
ProjectBadge 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 ProjectBadge resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectBadge resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Rendered
Image stringUrl - The image_url argument rendered (in case of use of placeholders).
- Rendered
Link stringUrl - The link_url argument rendered (in case of use of placeholders).
- Id string
- The provider-assigned unique ID for this managed resource.
- Rendered
Image stringUrl - The image_url argument rendered (in case of use of placeholders).
- Rendered
Link stringUrl - The link_url argument rendered (in case of use of placeholders).
- id String
- The provider-assigned unique ID for this managed resource.
- rendered
Image StringUrl - The image_url argument rendered (in case of use of placeholders).
- rendered
Link StringUrl - The link_url argument rendered (in case of use of placeholders).
- id string
- The provider-assigned unique ID for this managed resource.
- rendered
Image stringUrl - The image_url argument rendered (in case of use of placeholders).
- rendered
Link stringUrl - The link_url argument rendered (in case of use of placeholders).
- id str
- The provider-assigned unique ID for this managed resource.
- rendered_
image_ strurl - The image_url argument rendered (in case of use of placeholders).
- rendered_
link_ strurl - The link_url argument rendered (in case of use of placeholders).
- id String
- The provider-assigned unique ID for this managed resource.
- rendered
Image StringUrl - The image_url argument rendered (in case of use of placeholders).
- rendered
Link StringUrl - The link_url argument rendered (in case of use of placeholders).
Look up Existing ProjectBadge Resource
Get an existing ProjectBadge 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?: ProjectBadgeState, opts?: CustomResourceOptions): ProjectBadge
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
image_url: Optional[str] = None,
link_url: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
rendered_image_url: Optional[str] = None,
rendered_link_url: Optional[str] = None) -> ProjectBadge
func GetProjectBadge(ctx *Context, name string, id IDInput, state *ProjectBadgeState, opts ...ResourceOption) (*ProjectBadge, error)
public static ProjectBadge Get(string name, Input<string> id, ProjectBadgeState? state, CustomResourceOptions? opts = null)
public static ProjectBadge get(String name, Output<String> id, ProjectBadgeState 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.
- Image
Url string - The image url which will be presented on project overview.
- Link
Url string - The url linked with the badge.
- Name string
- The name of the badge.
- Project string
- The id of the project to add the badge to.
- Rendered
Image stringUrl - The image_url argument rendered (in case of use of placeholders).
- Rendered
Link stringUrl - The link_url argument rendered (in case of use of placeholders).
- Image
Url string - The image url which will be presented on project overview.
- Link
Url string - The url linked with the badge.
- Name string
- The name of the badge.
- Project string
- The id of the project to add the badge to.
- Rendered
Image stringUrl - The image_url argument rendered (in case of use of placeholders).
- Rendered
Link stringUrl - The link_url argument rendered (in case of use of placeholders).
- image
Url String - The image url which will be presented on project overview.
- link
Url String - The url linked with the badge.
- name String
- The name of the badge.
- project String
- The id of the project to add the badge to.
- rendered
Image StringUrl - The image_url argument rendered (in case of use of placeholders).
- rendered
Link StringUrl - The link_url argument rendered (in case of use of placeholders).
- image
Url string - The image url which will be presented on project overview.
- link
Url string - The url linked with the badge.
- name string
- The name of the badge.
- project string
- The id of the project to add the badge to.
- rendered
Image stringUrl - The image_url argument rendered (in case of use of placeholders).
- rendered
Link stringUrl - The link_url argument rendered (in case of use of placeholders).
- image_
url str - The image url which will be presented on project overview.
- link_
url str - The url linked with the badge.
- name str
- The name of the badge.
- project str
- The id of the project to add the badge to.
- rendered_
image_ strurl - The image_url argument rendered (in case of use of placeholders).
- rendered_
link_ strurl - The link_url argument rendered (in case of use of placeholders).
- image
Url String - The image url which will be presented on project overview.
- link
Url String - The url linked with the badge.
- name String
- The name of the badge.
- project String
- The id of the project to add the badge to.
- rendered
Image StringUrl - The image_url argument rendered (in case of use of placeholders).
- rendered
Link StringUrl - The link_url argument rendered (in case of use of placeholders).
Import
GitLab project badges can be imported using an id made up of {project_id}:{badge_id}
, e.g.
$ pulumi import gitlab:index/projectBadge:ProjectBadge foo 1:3
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlab
Terraform Provider.