Skip to content

CAVI Go src

Jeff Gregory edited this page Apr 29, 2022 · 1 revision

CAVI Go Source

Types

type FlagOptions struct { ... }

FlagOptions struct

type Products

type Products []string

Products is a list of UUIDs as strings

func (*Products) Set

func (p *Products) Set(v string) error

func (*Products) String

func (p *Products) String() string

CAVI Go package cavi

Variables

AllowableHosts limits the user to this list

var AllowableHosts = map[string]bool{
    "localhost":                       true,
    "cumulus-api.corps.cloud":         true,
    "develop-cumulus-api.corps.cloud": true,
    "water-api.corps.cloud":           true,
    "develop-water-api.corps.cloud":   true,
    "cumulus-api.rsgis.dev":           true,
    "develop-cumulus-api.rsgis.dev":   true,
    "water-api.rsgis.dev":             true,
    "develop-water-api.rsgis.dev":     true,
    "github.com":                      true,
    "raw.githubusercontent.com":       true,
}

Functions

func AllowableHost(s string) error

AllowableHost checks the user input to see if is in the list and active

func CheckService(u string) (*http.Response, error)

CheckService sends a simple GET request to see if the service is up

func Extract

func Extract(url url.URL)

Extract reads the extract payload and writes to standard out

func GetResponse(u string) (*http.Response, error)

GetResponse

func GetResponseBody(u string) ([]byte, error)

GetResponseBody reads the body of the response from a GET request

func GitClone

func GitClone(d string, o *git.CloneOptions) error

GitClone is a simple go-git clone implementation

func GitPull

func GitPull(r *git.Repository, po *git.PullOptions) error

GitPull is a simple go-git pull implementation

func GitRepo

func GitRepo(u string, remote string, ref plumbing.ReferenceName, d string) error

GitRepo is a simple go-git implementation to clone if not exists

func Grid

func Grid(url url.URL, p Payload, t int, tk string) (string, error)

Grid POST request to Cumulus download

Types

type Filename

type Filename string

Filename is a string representing the DSS file

func (*Filename) DownloadDss

func (fn *Filename) DownloadDss(url string, d string) error

DownloadDSS takes the Cumulus returned download url, creates a temporary dirctory on the user's machine, and copies the file to that directory

type Payload

type Payload struct { ... }

Payload struct for posting to the Cumulus API

type Site

type Site struct { ... }

Site struct represents the payload from the extract GET request

type UpdateStatus struct { ... }

UpdateStatus struct to get status from POST

func (*UpdateStatus) GetStatus

func (us *UpdateStatus) GetStatus(u string)

GetStatus unmarshal response to UpdateStatus

func (*UpdateStatus) PostPayload

func (us *UpdateStatus) PostPayload(u string, p Payload, t string) error

PostPayload POST request to URL using a bearer token