1. Packages
  2. GitLab
  3. API Docs
  4. getRepositoryFile
GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi

gitlab.getRepositoryFile

Explore with Pulumi AI

gitlab logo
GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi

    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({
        filePath: "README.md",
        project: "example",
        ref: "main",
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    example = gitlab.get_repository_file(file_path="README.md",
        project="example",
        ref="main")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v6/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{
    			FilePath: "README.md",
    			Project:  "example",
    			Ref:      "main",
    		}, 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()
        {
            FilePath = "README.md",
            Project = "example",
            Ref = "main",
        });
    
    });
    
    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()
                .filePath("README.md")
                .project("example")
                .ref("main")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: gitlab:getRepositoryFile
          Arguments:
            filePath: README.md
            project: example
            ref: main
    

    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 dictionary

    The following arguments are supported:

    FilePath string
    The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
    Project string
    The name or ID of the project.
    Ref string
    The name of branch, tag or commit.
    FilePath string
    The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
    Project string
    The name or ID of the project.
    Ref string
    The name of branch, tag or commit.
    filePath String
    The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
    project String
    The name or ID of the project.
    ref String
    The name of branch, tag or commit.
    filePath string
    The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
    project string
    The name or ID of the project.
    ref string
    The name of branch, tag or commit.
    file_path str
    The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
    project str
    The name or ID of the project.
    ref str
    The name of branch, tag or commit.
    filePath String
    The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
    project String
    The name or ID of the project.
    ref String
    The name of branch, tag or commit.

    getRepositoryFile Result

    The following output properties are available:

    BlobId string
    The blob id.
    CommitId string
    The commit id.
    Content string
    File content.
    ContentSha256 string
    File content sha256 digest.
    Encoding string
    The file content encoding.
    ExecuteFilemode bool
    Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
    FileName string
    The filename.
    FilePath 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.
    LastCommitId string
    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.
    BlobId string
    The blob id.
    CommitId string
    The commit id.
    Content string
    File content.
    ContentSha256 string
    File content sha256 digest.
    Encoding string
    The file content encoding.
    ExecuteFilemode bool
    Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
    FileName string
    The filename.
    FilePath 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.
    LastCommitId string
    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.
    blobId String
    The blob id.
    commitId String
    The commit id.
    content String
    File content.
    contentSha256 String
    File content sha256 digest.
    encoding String
    The file content encoding.
    executeFilemode Boolean
    Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
    fileName String
    The filename.
    filePath 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.
    lastCommitId String
    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.
    blobId string
    The blob id.
    commitId string
    The commit id.
    content string
    File content.
    contentSha256 string
    File content sha256 digest.
    encoding string
    The file content encoding.
    executeFilemode boolean
    Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
    fileName string
    The filename.
    filePath 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.
    lastCommitId string
    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_id str
    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.
    blobId String
    The blob id.
    commitId String
    The commit id.
    content String
    File content.
    contentSha256 String
    File content sha256 digest.
    encoding String
    The file content encoding.
    executeFilemode Boolean
    Enables or disables the execute flag on the file. Note: requires GitLab 14.10 or newer.
    fileName String
    The filename.
    filePath 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.
    lastCommitId String
    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 gitlab Terraform Provider.
    gitlab logo
    GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi