nelson

package
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &NelsonConfig{
	Endpoint: "",
	Session: &NelsonSession{
		Token:     "",
		ExpiresAt: 0,
	},
}

Functions

func LibraryVersion

func LibraryVersion() string

Types

type BlueprintResponse

type BlueprintResponse struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Revision    string `json:"revision"`
	Sha256      string `json:"sha256"`
	Template    string `json:"template"`
	CreatedAt   int64  `json:"created_at"`
}

type CreateBlueprintRequest

type CreateBlueprintRequest struct {
	// Example: gpu-general-deployment
	Name string `json:"name"`

	// Example: a blueprint for intensive graphics consumption
	Description string `json:"description"`

	// Sha256 sum of the template for versioning purposes
	Sha256 string `json:"sha256"`

	// Base64 Encoding of the blueprint template
	Template string `json:"template"`
}

type CreateSessionRequest

type CreateSessionRequest struct {
	AccessToken string `json:"access_token"`
}

type Nelson

type Nelson struct {
	Client *http.Client

	NelsonConfig *NelsonConfig
	// contains filtered or unexported fields
}

Nelson is a data struct that contains an http client. This client will be used to make secure calls to the Nelson server.

func CreateNelson

func CreateNelson(address string, version string, configPath string) (*Nelson, error)

CreateNelson creates a client from a given config. In the config is the path to the .nelson/config.yml. We need that file to grab the token.

func (*Nelson) CreateBlueprint

func (n *Nelson) CreateBlueprint(cbr CreateBlueprintRequest) error

func (*Nelson) CreateWebhook

func (n *Nelson) CreateWebhook(owner string, repo string)

CreateWebhook puts a webhook on a repository to enable nelson on a given repository. https://nelson.local/v1/repos/getnelson/terraform-provider-nelson/hook

func (*Nelson) DeleteWebhook

func (n *Nelson) DeleteWebhook(owner string, repo string)

DeleteWebhook tells Nelson to delete a webhook on the repository.

func (*Nelson) GetBlueprint

func (n *Nelson) GetBlueprint(blueprintName string) (*BlueprintResponse, error)

func (*Nelson) GetBlueprints

func (n *Nelson) GetBlueprints() ([]*BlueprintResponse, error)

func (*Nelson) GetRepos

func (n *Nelson) GetRepos(owner string)

GetRepos uses the http.Client in Nelson api struct to talk to the Nelson server https://nelson.local/v1/repos?owner=githubuser360

func (*Nelson) Login

func (n *Nelson) Login(githubToken string) error

type NelsonConfig

type NelsonConfig struct {
	Endpoint string         `yaml:"endpoint"`
	Session  *NelsonSession `yaml:"session"`
}

type NelsonSession

type NelsonSession struct {
	Token     string `yaml:"token" json:"session_token"`
	ExpiresAt int64  `yaml:"expires_at" json:"expires_at"`
}

type Repos

type Repos struct {
	Repository string     `json:"repository"`
	Slug       string     `json:"slug"`
	ID         uint32     `json:"id"`
	Hook       *ReposHook `json:"hook"`
	Owner      string     `json:"owner"`
	Access     string     `json:"access"`
}

Repos list of repos that come back

type ReposHook

type ReposHook struct {
	IsActive bool   `json:"is_active"`
	ID       uint32 `json:"id"`
}

ReposHook is the small bit that says whether the thing is on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL