1. Packages
  2. Vercel
  3. API Docs
  4. getFile
Vercel v1.14.2 published on Sunday, Sep 22, 2024 by Pulumiverse

vercel.getFile

Explore with Pulumi AI

vercel logo
Vercel v1.14.2 published on Sunday, Sep 22, 2024 by Pulumiverse

    Provides information about a file on disk.

    This will read a single file, providing metadata for use with a vercel.Deployment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vercel from "@pulumi/vercel";
    import * as vercel from "@pulumiverse/vercel";
    
    const exampleFile = vercel.getFile({
        path: "index.html",
    });
    const exampleProject = vercel.getProject({
        name: "my-project",
    });
    const exampleDeployment = new vercel.Deployment("exampleDeployment", {
        projectId: exampleProject.then(exampleProject => exampleProject.id),
        files: exampleFile.then(exampleFile => exampleFile.file),
    });
    
    import pulumi
    import pulumi_vercel as vercel
    import pulumiverse_vercel as vercel
    
    example_file = vercel.get_file(path="index.html")
    example_project = vercel.get_project(name="my-project")
    example_deployment = vercel.Deployment("exampleDeployment",
        project_id=example_project.id,
        files=example_file.file)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-vercel/sdk/go/vercel"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleFile, err := vercel.GetFile(ctx, &vercel.GetFileArgs{
    			Path: "index.html",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleProject, err := vercel.LookupProject(ctx, &vercel.LookupProjectArgs{
    			Name: "my-project",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = vercel.NewDeployment(ctx, "exampleDeployment", &vercel.DeploymentArgs{
    			ProjectId: pulumi.String(exampleProject.Id),
    			Files:     pulumi.StringMap(exampleFile.File),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vercel = Pulumi.Vercel;
    using Vercel = Pulumiverse.Vercel;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleFile = Vercel.GetFile.Invoke(new()
        {
            Path = "index.html",
        });
    
        var exampleProject = Vercel.GetProject.Invoke(new()
        {
            Name = "my-project",
        });
    
        var exampleDeployment = new Vercel.Deployment("exampleDeployment", new()
        {
            ProjectId = exampleProject.Apply(getProjectResult => getProjectResult.Id),
            Files = exampleFile.Apply(getFileResult => getFileResult.File),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vercel.VercelFunctions;
    import com.pulumi.vercel.inputs.GetFileArgs;
    import com.pulumi.vercel.inputs.GetProjectArgs;
    import com.pulumi.vercel.Deployment;
    import com.pulumi.vercel.DeploymentArgs;
    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 exampleFile = VercelFunctions.getFile(GetFileArgs.builder()
                .path("index.html")
                .build());
    
            final var exampleProject = VercelFunctions.getProject(GetProjectArgs.builder()
                .name("my-project")
                .build());
    
            var exampleDeployment = new Deployment("exampleDeployment", DeploymentArgs.builder()
                .projectId(exampleProject.applyValue(getProjectResult -> getProjectResult.id()))
                .files(exampleFile.applyValue(getFileResult -> getFileResult.file()))
                .build());
    
        }
    }
    
    resources:
      exampleDeployment:
        type: vercel:Deployment
        properties:
          projectId: ${exampleProject.id}
          files: ${exampleFile.file}
    variables:
      exampleFile:
        fn::invoke:
          Function: vercel:getFile
          Arguments:
            path: index.html
      exampleProject:
        fn::invoke:
          Function: vercel:getProject
          Arguments:
            name: my-project
    

    Using getFile

    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 getFile(args: GetFileArgs, opts?: InvokeOptions): Promise<GetFileResult>
    function getFileOutput(args: GetFileOutputArgs, opts?: InvokeOptions): Output<GetFileResult>
    def get_file(path: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFileResult
    def get_file_output(path: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetFileResult]
    func GetFile(ctx *Context, args *GetFileArgs, opts ...InvokeOption) (*GetFileResult, error)
    func GetFileOutput(ctx *Context, args *GetFileOutputArgs, opts ...InvokeOption) GetFileResultOutput

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

    public static class GetFile 
    {
        public static Task<GetFileResult> InvokeAsync(GetFileArgs args, InvokeOptions? opts = null)
        public static Output<GetFileResult> Invoke(GetFileInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFileResult> getFile(GetFileArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vercel:index/getFile:getFile
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Path string
    Path string
    path String
    path string
    path str
    path String

    getFile Result

    The following output properties are available:

    File Dictionary<string, string>
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    Id string
    The ID of this resource.
    Path string
    File map[string]string
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    Id string
    The ID of this resource.
    Path string
    file Map<String,String>
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id String
    The ID of this resource.
    path String
    file {[key: string]: string}
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id string
    The ID of this resource.
    path string
    file Mapping[str, str]
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id str
    The ID of this resource.
    path str
    file Map<String>
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id String
    The ID of this resource.
    path String

    Package Details

    Repository
    vercel pulumiverse/pulumi-vercel
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vercel Terraform Provider.
    vercel logo
    Vercel v1.14.2 published on Sunday, Sep 22, 2024 by Pulumiverse