GitLab v8.1.0 published on Friday, Jun 21, 2024 by Pulumi
gitlab.getRepositoryFile
Explore with Pulumi AI
The gitlab.RepositoryFile data source allows details of a file in a repository to be retrieved.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const example = gitlab.getRepositoryFile({
    project: "example",
    ref: "main",
    filePath: "README.md",
});
import pulumi
import pulumi_gitlab as gitlab
example = gitlab.get_repository_file(project="example",
    ref="main",
    file_path="README.md")
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 {
		_, err := gitlab.LookupRepositoryFile(ctx, &gitlab.LookupRepositoryFileArgs{
			Project:  "example",
			Ref:      "main",
			FilePath: "README.md",
		}, nil)
		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 example = GitLab.GetRepositoryFile.Invoke(new()
    {
        Project = "example",
        Ref = "main",
        FilePath = "README.md",
    });
});
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.GetRepositoryFileArgs;
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 example = GitlabFunctions.getRepositoryFile(GetRepositoryFileArgs.builder()
            .project("example")
            .ref("main")
            .filePath("README.md")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      Function: gitlab:getRepositoryFile
      Arguments:
        project: example
        ref: main
        filePath: README.md
Using getRepositoryFile
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 getRepositoryFile(args: GetRepositoryFileArgs, opts?: InvokeOptions): Promise<GetRepositoryFileResult>
function getRepositoryFileOutput(args: GetRepositoryFileOutputArgs, opts?: InvokeOptions): Output<GetRepositoryFileResult>def get_repository_file(file_path: Optional[str] = None,
                        project: Optional[str] = None,
                        ref: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetRepositoryFileResult
def get_repository_file_output(file_path: Optional[pulumi.Input[str]] = None,
                        project: Optional[pulumi.Input[str]] = None,
                        ref: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetRepositoryFileResult]func LookupRepositoryFile(ctx *Context, args *LookupRepositoryFileArgs, opts ...InvokeOption) (*LookupRepositoryFileResult, error)
func LookupRepositoryFileOutput(ctx *Context, args *LookupRepositoryFileOutputArgs, opts ...InvokeOption) LookupRepositoryFileResultOutput> Note: This function is named LookupRepositoryFile in the Go SDK.
public static class GetRepositoryFile 
{
    public static Task<GetRepositoryFileResult> InvokeAsync(GetRepositoryFileArgs args, InvokeOptions? opts = null)
    public static Output<GetRepositoryFileResult> Invoke(GetRepositoryFileInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRepositoryFileResult> getRepositoryFile(GetRepositoryFileArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gitlab:index/getRepositoryFile:getRepositoryFile
  arguments:
    # arguments dictionaryThe following arguments are supported:
getRepositoryFile Result
The following output properties are available:
- Blob
Id string - The blob id.
 - Commit
Id string - The commit id.
 - Content string
 - File content.
 - Content
Sha256 string - File content sha256 digest.
 - Encoding string
 - The file content encoding.
 - Execute
Filemode bool - Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
 - File
Name string - The filename.
 - File
Path string - The full path of the file. It must be relative to the root of the project without a leading slash 
/or./. - Id string
 - The provider-assigned unique ID for this managed resource.
 - Last
Commit stringId  - The last known commit id.
 - Project string
 - The name or ID of the project.
 - Ref string
 - The name of branch, tag or commit.
 - Size int
 - The file size.
 
- Blob
Id string - The blob id.
 - Commit
Id string - The commit id.
 - Content string
 - File content.
 - Content
Sha256 string - File content sha256 digest.
 - Encoding string
 - The file content encoding.
 - Execute
Filemode bool - Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
 - File
Name string - The filename.
 - File
Path string - The full path of the file. It must be relative to the root of the project without a leading slash 
/or./. - Id string
 - The provider-assigned unique ID for this managed resource.
 - Last
Commit stringId  - The last known commit id.
 - Project string
 - The name or ID of the project.
 - Ref string
 - The name of branch, tag or commit.
 - Size int
 - The file size.
 
- blob
Id String - The blob id.
 - commit
Id String - The commit id.
 - content String
 - File content.
 - content
Sha256 String - File content sha256 digest.
 - encoding String
 - The file content encoding.
 - execute
Filemode Boolean - Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
 - file
Name String - The filename.
 - file
Path String - The full path of the file. It must be relative to the root of the project without a leading slash 
/or./. - id String
 - The provider-assigned unique ID for this managed resource.
 - last
Commit StringId  - The last known commit id.
 - project String
 - The name or ID of the project.
 - ref String
 - The name of branch, tag or commit.
 - size Integer
 - The file size.
 
- blob
Id string - The blob id.
 - commit
Id string - The commit id.
 - content string
 - File content.
 - content
Sha256 string - File content sha256 digest.
 - encoding string
 - The file content encoding.
 - execute
Filemode boolean - Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
 - file
Name string - The filename.
 - file
Path string - The full path of the file. It must be relative to the root of the project without a leading slash 
/or./. - id string
 - The provider-assigned unique ID for this managed resource.
 - last
Commit stringId  - The last known commit id.
 - project string
 - The name or ID of the project.
 - ref string
 - The name of branch, tag or commit.
 - size number
 - The file size.
 
- blob_
id str - The blob id.
 - commit_
id str - The commit id.
 - content str
 - File content.
 - content_
sha256 str - File content sha256 digest.
 - encoding str
 - The file content encoding.
 - execute_
filemode bool - Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
 - file_
name str - The filename.
 - file_
path str - The full path of the file. It must be relative to the root of the project without a leading slash 
/or./. - id str
 - The provider-assigned unique ID for this managed resource.
 - last_
commit_ strid  - The last known commit id.
 - project str
 - The name or ID of the project.
 - ref str
 - The name of branch, tag or commit.
 - size int
 - The file size.
 
- blob
Id String - The blob id.
 - commit
Id String - The commit id.
 - content String
 - File content.
 - content
Sha256 String - File content sha256 digest.
 - encoding String
 - The file content encoding.
 - execute
Filemode Boolean - Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
 - file
Name String - The filename.
 - file
Path String - The full path of the file. It must be relative to the root of the project without a leading slash 
/or./. - id String
 - The provider-assigned unique ID for this managed resource.
 - last
Commit StringId  - The last known commit id.
 - project String
 - The name or ID of the project.
 - ref String
 - The name of branch, tag or commit.
 - size Number
 - The file size.
 
Package Details
- Repository
 - GitLab pulumi/pulumi-gitlab
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
gitlabTerraform Provider.