1. Packages
  2. Artifactory Provider
  3. API Docs
  4. getFile
artifactory v8.4.0 published on Tuesday, Nov 19, 2024 by Pulumi

artifactory.getFile

Explore with Pulumi AI

artifactory logo
artifactory v8.4.0 published on Tuesday, Nov 19, 2024 by Pulumi

    # Artifactory File Data Source

    Provides an Artifactory file datasource. This can be used to download a file from a given Artifactory repository.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const my-file = artifactory.getFile({
        repository: "repo-key",
        path: "/path/to/the/artifact.zip",
        outputPath: "tmp/artifact.zip",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    my_file = artifactory.get_file(repository="repo-key",
        path="/path/to/the/artifact.zip",
        output_path="tmp/artifact.zip")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v8/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.GetFile(ctx, &artifactory.GetFileArgs{
    			Repository: "repo-key",
    			Path:       "/path/to/the/artifact.zip",
    			OutputPath: "tmp/artifact.zip",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var my_file = Artifactory.GetFile.Invoke(new()
        {
            Repository = "repo-key",
            Path = "/path/to/the/artifact.zip",
            OutputPath = "tmp/artifact.zip",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.ArtifactoryFunctions;
    import com.pulumi.artifactory.inputs.GetFileArgs;
    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 my-file = ArtifactoryFunctions.getFile(GetFileArgs.builder()
                .repository("repo-key")
                .path("/path/to/the/artifact.zip")
                .outputPath("tmp/artifact.zip")
                .build());
    
        }
    }
    
    variables:
      my-file:
        fn::invoke:
          Function: artifactory:getFile
          Arguments:
            repository: repo-key
            path: /path/to/the/artifact.zip
            outputPath: tmp/artifact.zip
    

    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(force_overwrite: Optional[bool] = None,
                 output_path: Optional[str] = None,
                 path: Optional[str] = None,
                 path_is_aliased: Optional[bool] = None,
                 repository: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFileResult
    def get_file_output(force_overwrite: Optional[pulumi.Input[bool]] = None,
                 output_path: Optional[pulumi.Input[str]] = None,
                 path: Optional[pulumi.Input[str]] = None,
                 path_is_aliased: Optional[pulumi.Input[bool]] = None,
                 repository: 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: artifactory:index/getFile:getFile
      arguments:
        # arguments dictionary

    The following arguments are supported:

    OutputPath string
    The local path the file should be downloaded to.
    Path string
    The path to the file within the repository.
    Repository string
    Name of the repository where the file is stored.
    ForceOverwrite bool
    If set to true, an existing file in the output_path will be overwritten. Default: false
    PathIsAliased bool
    If set to true, the provider will get the artifact directly from Artifactory without attempting to resolve it or verify it and will delegate this to artifactory if the file exists. When using a smart remote repository, it is recommended to set this attribute to true. This is necessary to ensure that the provider fetches the artifact directly from Artifactory. If this attribute is not set or is set to false, there is a risk of fetching the -cache directory in Artifactory, potentially resulting in resource expiration and a 404 error.
    OutputPath string
    The local path the file should be downloaded to.
    Path string
    The path to the file within the repository.
    Repository string
    Name of the repository where the file is stored.
    ForceOverwrite bool
    If set to true, an existing file in the output_path will be overwritten. Default: false
    PathIsAliased bool
    If set to true, the provider will get the artifact directly from Artifactory without attempting to resolve it or verify it and will delegate this to artifactory if the file exists. When using a smart remote repository, it is recommended to set this attribute to true. This is necessary to ensure that the provider fetches the artifact directly from Artifactory. If this attribute is not set or is set to false, there is a risk of fetching the -cache directory in Artifactory, potentially resulting in resource expiration and a 404 error.
    outputPath String
    The local path the file should be downloaded to.
    path String
    The path to the file within the repository.
    repository String
    Name of the repository where the file is stored.
    forceOverwrite Boolean
    If set to true, an existing file in the output_path will be overwritten. Default: false
    pathIsAliased Boolean
    If set to true, the provider will get the artifact directly from Artifactory without attempting to resolve it or verify it and will delegate this to artifactory if the file exists. When using a smart remote repository, it is recommended to set this attribute to true. This is necessary to ensure that the provider fetches the artifact directly from Artifactory. If this attribute is not set or is set to false, there is a risk of fetching the -cache directory in Artifactory, potentially resulting in resource expiration and a 404 error.
    outputPath string
    The local path the file should be downloaded to.
    path string
    The path to the file within the repository.
    repository string
    Name of the repository where the file is stored.
    forceOverwrite boolean
    If set to true, an existing file in the output_path will be overwritten. Default: false
    pathIsAliased boolean
    If set to true, the provider will get the artifact directly from Artifactory without attempting to resolve it or verify it and will delegate this to artifactory if the file exists. When using a smart remote repository, it is recommended to set this attribute to true. This is necessary to ensure that the provider fetches the artifact directly from Artifactory. If this attribute is not set or is set to false, there is a risk of fetching the -cache directory in Artifactory, potentially resulting in resource expiration and a 404 error.
    output_path str
    The local path the file should be downloaded to.
    path str
    The path to the file within the repository.
    repository str
    Name of the repository where the file is stored.
    force_overwrite bool
    If set to true, an existing file in the output_path will be overwritten. Default: false
    path_is_aliased bool
    If set to true, the provider will get the artifact directly from Artifactory without attempting to resolve it or verify it and will delegate this to artifactory if the file exists. When using a smart remote repository, it is recommended to set this attribute to true. This is necessary to ensure that the provider fetches the artifact directly from Artifactory. If this attribute is not set or is set to false, there is a risk of fetching the -cache directory in Artifactory, potentially resulting in resource expiration and a 404 error.
    outputPath String
    The local path the file should be downloaded to.
    path String
    The path to the file within the repository.
    repository String
    Name of the repository where the file is stored.
    forceOverwrite Boolean
    If set to true, an existing file in the output_path will be overwritten. Default: false
    pathIsAliased Boolean
    If set to true, the provider will get the artifact directly from Artifactory without attempting to resolve it or verify it and will delegate this to artifactory if the file exists. When using a smart remote repository, it is recommended to set this attribute to true. This is necessary to ensure that the provider fetches the artifact directly from Artifactory. If this attribute is not set or is set to false, there is a risk of fetching the -cache directory in Artifactory, potentially resulting in resource expiration and a 404 error.

    getFile Result

    The following output properties are available:

    Created string
    The time & date when the file was created.
    CreatedBy string
    The user who created the file.
    DownloadUri string
    The URI that can be used to download the file.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastModified string
    The time & date when the file was last modified.
    LastUpdated string
    The time & date when the file was last updated.
    Md5 string
    MD5 checksum of the file.
    Mimetype string
    The mimetype of the file.
    ModifiedBy string
    The user who last modified the file.
    OutputPath string
    Path string
    Repository string
    Sha1 string
    SHA1 checksum of the file.
    Sha256 string
    SHA256 checksum of the file.
    Size int
    The size of the file.
    ForceOverwrite bool
    PathIsAliased bool
    Created string
    The time & date when the file was created.
    CreatedBy string
    The user who created the file.
    DownloadUri string
    The URI that can be used to download the file.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastModified string
    The time & date when the file was last modified.
    LastUpdated string
    The time & date when the file was last updated.
    Md5 string
    MD5 checksum of the file.
    Mimetype string
    The mimetype of the file.
    ModifiedBy string
    The user who last modified the file.
    OutputPath string
    Path string
    Repository string
    Sha1 string
    SHA1 checksum of the file.
    Sha256 string
    SHA256 checksum of the file.
    Size int
    The size of the file.
    ForceOverwrite bool
    PathIsAliased bool
    created String
    The time & date when the file was created.
    createdBy String
    The user who created the file.
    downloadUri String
    The URI that can be used to download the file.
    id String
    The provider-assigned unique ID for this managed resource.
    lastModified String
    The time & date when the file was last modified.
    lastUpdated String
    The time & date when the file was last updated.
    md5 String
    MD5 checksum of the file.
    mimetype String
    The mimetype of the file.
    modifiedBy String
    The user who last modified the file.
    outputPath String
    path String
    repository String
    sha1 String
    SHA1 checksum of the file.
    sha256 String
    SHA256 checksum of the file.
    size Integer
    The size of the file.
    forceOverwrite Boolean
    pathIsAliased Boolean
    created string
    The time & date when the file was created.
    createdBy string
    The user who created the file.
    downloadUri string
    The URI that can be used to download the file.
    id string
    The provider-assigned unique ID for this managed resource.
    lastModified string
    The time & date when the file was last modified.
    lastUpdated string
    The time & date when the file was last updated.
    md5 string
    MD5 checksum of the file.
    mimetype string
    The mimetype of the file.
    modifiedBy string
    The user who last modified the file.
    outputPath string
    path string
    repository string
    sha1 string
    SHA1 checksum of the file.
    sha256 string
    SHA256 checksum of the file.
    size number
    The size of the file.
    forceOverwrite boolean
    pathIsAliased boolean
    created str
    The time & date when the file was created.
    created_by str
    The user who created the file.
    download_uri str
    The URI that can be used to download the file.
    id str
    The provider-assigned unique ID for this managed resource.
    last_modified str
    The time & date when the file was last modified.
    last_updated str
    The time & date when the file was last updated.
    md5 str
    MD5 checksum of the file.
    mimetype str
    The mimetype of the file.
    modified_by str
    The user who last modified the file.
    output_path str
    path str
    repository str
    sha1 str
    SHA1 checksum of the file.
    sha256 str
    SHA256 checksum of the file.
    size int
    The size of the file.
    force_overwrite bool
    path_is_aliased bool
    created String
    The time & date when the file was created.
    createdBy String
    The user who created the file.
    downloadUri String
    The URI that can be used to download the file.
    id String
    The provider-assigned unique ID for this managed resource.
    lastModified String
    The time & date when the file was last modified.
    lastUpdated String
    The time & date when the file was last updated.
    md5 String
    MD5 checksum of the file.
    mimetype String
    The mimetype of the file.
    modifiedBy String
    The user who last modified the file.
    outputPath String
    path String
    repository String
    sha1 String
    SHA1 checksum of the file.
    sha256 String
    SHA256 checksum of the file.
    size Number
    The size of the file.
    forceOverwrite Boolean
    pathIsAliased Boolean

    Package Details

    Repository
    artifactory pulumi/pulumi-artifactory
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the artifactory Terraform Provider.
    artifactory logo
    artifactory v8.4.0 published on Tuesday, Nov 19, 2024 by Pulumi