gitlab logo
GitLab v5.0.2, May 23 23

gitlab.getBranch

Explore with Pulumi AI

The gitlab.Branch data source allows details of a repository branch to be retrieved by its name and project.

Upstream API: GitLab REST API docs

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;

return await Deployment.RunAsync(() => 
{
    var foo = GitLab.GetBranch.Invoke(new()
    {
        Name = "example",
        Project = "foo/bar",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gitlab/sdk/v5/go/gitlab"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gitlab.LookupBranch(ctx, &gitlab.LookupBranchArgs{
			Name:    "example",
			Project: "foo/bar",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetBranchArgs;
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) {
        final var foo = GitlabFunctions.getBranch(GetBranchArgs.builder()
            .name("example")
            .project("foo/bar")
            .build());

    }
}
import pulumi
import pulumi_gitlab as gitlab

foo = gitlab.get_branch(name="example",
    project="foo/bar")
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";

const foo = gitlab.getBranch({
    name: "example",
    project: "foo/bar",
});
variables:
  foo:
    fn::invoke:
      Function: gitlab:getBranch
      Arguments:
        name: example
        project: foo/bar

Using getBranch

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getBranch(args: GetBranchArgs, opts?: InvokeOptions): Promise<GetBranchResult>
function getBranchOutput(args: GetBranchOutputArgs, opts?: InvokeOptions): Output<GetBranchResult>
def get_branch(name: Optional[str] = None,
               project: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetBranchResult
def get_branch_output(name: Optional[pulumi.Input[str]] = None,
               project: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetBranchResult]
func LookupBranch(ctx *Context, args *LookupBranchArgs, opts ...InvokeOption) (*LookupBranchResult, error)
func LookupBranchOutput(ctx *Context, args *LookupBranchOutputArgs, opts ...InvokeOption) LookupBranchResultOutput

> Note: This function is named LookupBranch in the Go SDK.

public static class GetBranch 
{
    public static Task<GetBranchResult> InvokeAsync(GetBranchArgs args, InvokeOptions? opts = null)
    public static Output<GetBranchResult> Invoke(GetBranchInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetBranchResult> getBranch(GetBranchArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gitlab:index/getBranch:getBranch
  arguments:
    # arguments dictionary

The following arguments are supported:

Name string

The name of the branch.

Project string

The full path or id of the project.

Name string

The name of the branch.

Project string

The full path or id of the project.

name String

The name of the branch.

project String

The full path or id of the project.

name string

The name of the branch.

project string

The full path or id of the project.

name str

The name of the branch.

project str

The full path or id of the project.

name String

The name of the branch.

project String

The full path or id of the project.

getBranch Result

The following output properties are available:

CanPush bool

Bool, true if you can push to the branch.

Commits List<Pulumi.GitLab.Outputs.GetBranchCommit>

The commit associated with the branch ref.

Default bool

Bool, true if branch is the default branch for the project.

DeveloperCanMerge bool

Bool, true if developer level access allows to merge branch.

DeveloperCanPush bool

Bool, true if developer level access allows git push.

Id string

The provider-assigned unique ID for this managed resource.

Merged bool

Bool, true if the branch has been merged into it's parent.

Name string

The name of the branch.

Project string

The full path or id of the project.

Protected bool

Bool, true if branch has branch protection.

WebUrl string

The url of the created branch (https.)

CanPush bool

Bool, true if you can push to the branch.

Commits []GetBranchCommit

The commit associated with the branch ref.

Default bool

Bool, true if branch is the default branch for the project.

DeveloperCanMerge bool

Bool, true if developer level access allows to merge branch.

DeveloperCanPush bool

Bool, true if developer level access allows git push.

Id string

The provider-assigned unique ID for this managed resource.

Merged bool

Bool, true if the branch has been merged into it's parent.

Name string

The name of the branch.

Project string

The full path or id of the project.

Protected bool

Bool, true if branch has branch protection.

WebUrl string

The url of the created branch (https.)

canPush Boolean

Bool, true if you can push to the branch.

commits List<GetBranchCommit>

The commit associated with the branch ref.

default_ Boolean

Bool, true if branch is the default branch for the project.

developerCanMerge Boolean

Bool, true if developer level access allows to merge branch.

developerCanPush Boolean

Bool, true if developer level access allows git push.

id String

The provider-assigned unique ID for this managed resource.

merged Boolean

Bool, true if the branch has been merged into it's parent.

name String

The name of the branch.

project String

The full path or id of the project.

protected_ Boolean

Bool, true if branch has branch protection.

webUrl String

The url of the created branch (https.)

canPush boolean

Bool, true if you can push to the branch.

commits GetBranchCommit[]

The commit associated with the branch ref.

default boolean

Bool, true if branch is the default branch for the project.

developerCanMerge boolean

Bool, true if developer level access allows to merge branch.

developerCanPush boolean

Bool, true if developer level access allows git push.

id string

The provider-assigned unique ID for this managed resource.

merged boolean

Bool, true if the branch has been merged into it's parent.

name string

The name of the branch.

project string

The full path or id of the project.

protected boolean

Bool, true if branch has branch protection.

webUrl string

The url of the created branch (https.)

can_push bool

Bool, true if you can push to the branch.

commits Sequence[GetBranchCommit]

The commit associated with the branch ref.

default bool

Bool, true if branch is the default branch for the project.

developer_can_merge bool

Bool, true if developer level access allows to merge branch.

developer_can_push bool

Bool, true if developer level access allows git push.

id str

The provider-assigned unique ID for this managed resource.

merged bool

Bool, true if the branch has been merged into it's parent.

name str

The name of the branch.

project str

The full path or id of the project.

protected bool

Bool, true if branch has branch protection.

web_url str

The url of the created branch (https.)

canPush Boolean

Bool, true if you can push to the branch.

commits List<Property Map>

The commit associated with the branch ref.

default Boolean

Bool, true if branch is the default branch for the project.

developerCanMerge Boolean

Bool, true if developer level access allows to merge branch.

developerCanPush Boolean

Bool, true if developer level access allows git push.

id String

The provider-assigned unique ID for this managed resource.

merged Boolean

Bool, true if the branch has been merged into it's parent.

name String

The name of the branch.

project String

The full path or id of the project.

protected Boolean

Bool, true if branch has branch protection.

webUrl String

The url of the created branch (https.)

Supporting Types

GetBranchCommit

AuthorEmail string
AuthorName string
AuthoredDate string
CommittedDate string
CommitterEmail string
CommitterName string
Id string

The ID of this resource.

Message string
ParentIds List<string>
ShortId string
Title string
AuthorEmail string
AuthorName string
AuthoredDate string
CommittedDate string
CommitterEmail string
CommitterName string
Id string

The ID of this resource.

Message string
ParentIds []string
ShortId string
Title string
authorEmail String
authorName String
authoredDate String
committedDate String
committerEmail String
committerName String
id String

The ID of this resource.

message String
parentIds List<String>
shortId String
title String
authorEmail string
authorName string
authoredDate string
committedDate string
committerEmail string
committerName string
id string

The ID of this resource.

message string
parentIds string[]
shortId string
title string
author_email str
author_name str
authored_date str
committed_date str
committer_email str
committer_name str
id str

The ID of this resource.

message str
parent_ids Sequence[str]
short_id str
title str
authorEmail String
authorName String
authoredDate String
committedDate String
committerEmail String
committerName String
id String

The ID of this resource.

message String
parentIds List<String>
shortId String
title String

Package Details

Repository
GitLab pulumi/pulumi-gitlab
License
Apache-2.0
Notes

This Pulumi package is based on the gitlab Terraform Provider.