GitLab

v4.8.0 published on Friday, Jul 15, 2022 by Pulumi

getBranch

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 Pulumi;
using GitLab = Pulumi.GitLab;

class MyStack : Stack
{
    public MyStack()
    {
        var foo = Output.Create(GitLab.GetBranch.InvokeAsync(new GitLab.GetBranchArgs
        {
            Name = "example",
            Project = "foo/bar",
        }));
    }

}
package main

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

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

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var foo = Output.of(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";

// By project full path
const foo = pulumi.output(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
Project string
Name string
Project string
name String
project String
name string
project string
name str
project str
name String
project String

getBranch Result

The following output properties are available:

CanPush bool
Commits List<Pulumi.GitLab.Outputs.GetBranchCommit>
Default bool
DeveloperCanMerge bool
DeveloperCanPush bool
Id string

The provider-assigned unique ID for this managed resource.

Merged bool
Name string
Project string
Protected bool
WebUrl string
CanPush bool
Commits []GetBranchCommit
Default bool
DeveloperCanMerge bool
DeveloperCanPush bool
Id string

The provider-assigned unique ID for this managed resource.

Merged bool
Name string
Project string
Protected bool
WebUrl string
canPush Boolean
commits List<GetBranchCommit>
default_ Boolean
developerCanMerge Boolean
developerCanPush Boolean
id String

The provider-assigned unique ID for this managed resource.

merged Boolean
name String
project String
protected_ Boolean
webUrl String
canPush boolean
commits GetBranchCommit[]
default boolean
developerCanMerge boolean
developerCanPush boolean
id string

The provider-assigned unique ID for this managed resource.

merged boolean
name string
project string
protected boolean
webUrl string
can_push bool
commits Sequence[GetBranchCommit]
default bool
developer_can_merge bool
developer_can_push bool
id str

The provider-assigned unique ID for this managed resource.

merged bool
name str
project str
protected bool
web_url str
canPush Boolean
commits List<Property Map>
default Boolean
developerCanMerge Boolean
developerCanPush Boolean
id String

The provider-assigned unique ID for this managed resource.

merged Boolean
name String
project String
protected Boolean
webUrl String

Supporting Types

GetBranchCommit

AuthorEmail string
AuthorName string
AuthoredDate string
CommittedDate string
CommitterEmail string
CommitterName string
Id string
Message string
ParentIds List<string>
ShortId string
Title string
AuthorEmail string
AuthorName string
AuthoredDate string
CommittedDate string
CommitterEmail string
CommitterName string
Id string
Message string
ParentIds []string
ShortId string
Title string
authorEmail String
authorName String
authoredDate String
committedDate String
committerEmail String
committerName String
id String
message String
parentIds List<String>
shortId String
title String
authorEmail string
authorName string
authoredDate string
committedDate string
committerEmail string
committerName string
id string
message string
parentIds string[]
shortId string
title string
authorEmail String
authorName String
authoredDate String
committedDate String
committerEmail String
committerName String
id String
message String
parentIds List<String>
shortId String
title String

Package Details

Repository
https://github.com/pulumi/pulumi-gitlab
License
Apache-2.0
Notes

This Pulumi package is based on the gitlab Terraform Provider.