Giter VIP home page Giter VIP logo

cremotefile's Introduction

Included DSC Resources

  • cRemoteFile
  • cS3RemoteFile

These custom Desired State Configuration (DSC) resources utilise .NET stream objects and overcome the OutOfMemoryException errors incurred by the in-built Invoke-WebRequest or Read-S3Object Powershell cmdlets.

cRemoteFile

By default, the MSFT_xRemoteFile will not check that a file has already been download during the Test-TargetResource pass. The cRemoteFile resource will only download a file if it's not present or the MD5 checksum is different/incorrect. ###Syntax

cRemoteFile [string]
{
    DestinationPath = [string]
    Uri = [string]
    [Checksum = [string]]
    [Credential = [PSCredential]]
}

###Properties

  • DestinationPath: Fully-qualified path under which downloaded file should be accessible after operation.
  • Uri: HTTP/HTTPS location fo the file which should be downloaded.
  • Checksum: The optional MD5 checksum used to verify the local file.
  • Credential: Specifies optional credential of a user which has permissions to send the request.

###Configuration

Configuration cRemoteFileExample {
    Import-DscResource -ModuleName cRemoteFile
    cRemoteFile MyExampleFile {
        DestinationPath = 'C:\Resources\output.txt'
        Uri = 'http://uri_to_download_from.com/example.txt'
        Checksum = '4767B1052744A0469348BAF3406DA944'
    }
}

cS3RemoteFile

The cS3RemoteFile resource can download a private Amazon Web Services file from S3 - complete with a MD5 checksum. This resource is handy for files/resources that cannot be made publically available due to electronic distribution rights restrictions. This DSC resource requires the AWS Powershell Tools to already be installed on the system executing this resource (obviously the cRemoteFile resource could be used to download the file for installation). ###Syntax

cS3RemoteFile [string]
{
    DestinationPath = [string]
    Region = [string]
    BucketName = [string]
    Key = [string]
    Credential = [PSCredential]
    [Checksum = [string]]
}

###Properties

  • DestinationPath: Fully-qualified path under which downloaded file should be accessible after operation.
  • Region: AWS S3 region end-point containing the resource to download.
  • BucketName: AWS S3 bucket name containing the resource to download.
  • Key: AWS S3 resource key/name to download.
  • Credential: Specifies AWS credential of a user which has permissions to send the request. The Credential object property username must be the AWS Access Key and the password the AWS Key Secret.
  • Checksum: The optional MD5 checksum used to verify the local file.

###Configuration

Configuration cS3RemoteFileExample {
    Import-DscResource -ModuleName cRemoteFile
    cS3RemoteFile MyExampleS3File {
        DestinationPath = 'C:\Resources\output.txt'
        Region = 'eu-central-1'
        BucketName = 'MyAwsS3Bucket'
        Key = 'example.txt'
        Credential = (Get-Credential -Credential 'MyAwsAccessKey')
        Checksum = '4767B1052744A0469348BAF3406DA944'
    }
}

Note: to download publically accessible AWS S3 files use the cRemoteFile resource instead.

cremotefile's People

Contributors

iainbrighton avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.