converge: github.com/asteris-llc/converge/resource/file/fetch Index | Files

package fetch

import "github.com/asteris-llc/converge/resource/file/fetch"

Index

Package Files

fetch.go preparer.go

type Fetch Uses

type Fetch struct {
    // location of the file to fetch
    Source string `export:"source"`

    // destination for the fetched file
    Destination string `export:"destination"`

    // hash function used to generate the checksum hash; value is available for
    // lookup if set in the hcl
    HashType string `export:"hash_type"`

    // the checksum hash; value is available for lookup if set in the hcl
    Hash string `export:"hash"`

    // whether the file will be fetched if it already exists
    Force bool `export:"force"`

    // whether the fetched file will be unarchived
    Unarchive bool
    // contains filtered or unexported fields
}

Fetch gets a file and makes it available on disk

func (*Fetch) Apply Uses

func (f *Fetch) Apply(ctx context.Context) (resource.TaskStatus, error)

Apply changes for Fetch

func (*Fetch) Check Uses

func (f *Fetch) Check(ctx context.Context, r resource.Renderer) (resource.TaskStatus, error)

Check if changes are needed for Fetch

func (*Fetch) DiffFile Uses

func (f *Fetch) DiffFile(status *resource.Status, hsh hash.Hash) (*resource.Status, error)

DiffFile evaluates the differences of the file to be fetched and the current state of the system

type Hash Uses

type Hash string

Hash type for Fetch

const (
    // HashMD5 indicates hash type md5
    HashMD5 Hash = "md5"

    // HashSHA1 indicates hash type sha1
    HashSHA1 Hash = "sha1"

    // HashSHA256 indicates hash type sha256
    HashSHA256 Hash = "sha256"

    // HashSHA512 indicates hash type sha512
    HashSHA512 Hash = "sha512"
)

type Preparer Uses

type Preparer struct {
    // Source is the location of the file to fetch
    Source string `hcl:"source" required:"true" nonempty:"true"`

    // Destination for the fetched file
    Destination string `hcl:"destination" required:"true" nonempty:"true"`

    // HashType is the hash function used to generate the checksum hash
    // Valid types are md5, sha1, sha256, and sha512
    HashType *string `hcl:"hash_type"`

    // Hash is the checksum hash
    Hash *string `hcl:"hash" nonempty:"true"`

    // Force indicates whether the file will be fetched if it already exists
    // If true, the file will be fetched if:
    // 1. no checksum is provided
    // 2. the checksum of the existing file differs from the checksum provided
    Force bool `hcl:"force"`
}

Preparer for file fetch

Fetch is responsible for fetching files

func (*Preparer) Prepare Uses

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare a new fetch task

Package fetch imports 16 packages (graph) and is imported by 2 packages. Updated 2017-03-13. Refresh now. Tools for package owners.