ggprov

package module
v0.0.0-...-090a3e9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: MIT Imports: 24 Imported by: 0

README

ggprov

The ggprov project is a suite of tools to provision, configure and deploy AWS greengrass to a linaro based platform such as the Dragonboard 410c.

overview

The project consists of a few command line tools which are:

  • gg-prov which provisions all the greengrass and IoT related resources, then exports a configuration file.
  • gg-deploy which copies the deployable files to the linaro based system.
  • gg-config which installs and configures greengrass on the linaro based system.

disclaimer

This is a work in progress at the moment.

licence

This code is released under MIT License, and is copyright Mark Wolfe.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AptInstall

func AptInstall(packages []string) error

AptInstall run apt install and install the specified package(s)

func AptUpdate

func AptUpdate() error

AptUpdate run apt update

func DoClose

func DoClose(output io.Closer)

DoClose close the "closer" and log any errors

func DownloadFromURL

func DownloadFromURL(url, targetPath string) error

DownloadFromURL Download file from URL to location

func GroupExist

func GroupExist(groupname string) (bool, error)

GroupExist check if group exists on the system

func NewSystemGroup

func NewSystemGroup(groupname string) error

NewSystemGroup create a new system group

func NewSystemUser

func NewSystemUser(username string) error

NewSystemUser create a new system user

func RunCommand

func RunCommand(cmdName string, cmdArgs []string) error

RunCommand run a command with the supplied arguments

func UserExist

func UserExist(username string) (bool, error)

UserExist check if user exists on the system

Types

type ExitError

type ExitError struct {
	*os.ProcessState
	ExitCode int
	Stderr   []byte
}

func (*ExitError) Error

func (ee *ExitError) Error() string

type IamRole

type IamRole struct {
	Arn string
}

IamRole IAM role

func (*IamRole) String

func (r *IamRole) String() string

type IotEndpoint

type IotEndpoint struct {
	Hostname string
}

IotEndpoint IoT Service Endpoint

type IotPolicy

type IotPolicy struct {
	Name string
	Arn  string
}

IotPolicy IAM role

type SSHSession

type SSHSession struct {
	Client *ssh.Client
}

SSHSession state for the ssh session

func NewSSHSession

func NewSSHSession(hostname, port, username, keyPath string) (*SSHSession, error)

NewSSHSession create an ssh session

func (*SSHSession) Copy

func (ss *SSHSession) Copy(size int64, mode os.FileMode, fileName string, contents io.Reader, destinationPath string) error

Copy copy a file with the supplied name, mode and contents

func (*SSHSession) CopyPath

func (ss *SSHSession) CopyPath(filePath, destinationPath string) error

CopyPath copy a file

type Svcs

type Svcs struct {
	GreengrassAPI greengrassiface.GreengrassAPI
	IAMAPI        iamiface.IAMAPI
	IoTAPI        iotiface.IoTAPI
	Session       *session.Session
}

Svcs holds aws session and svcs

func CreateSvcs

func CreateSvcs() (*Svcs, error)

CreateSvcs create an aws session and configure the svcs

func (*Svcs) AttachPrincipalPolicy

func (s *Svcs) AttachPrincipalPolicy(thingCreds *ThingCreds, policy *IotPolicy) error

AttachPrincipalPolicy attach the thing policy to the principal

func (*Svcs) AttachThingPrincipal

func (s *Svcs) AttachThingPrincipal(thing *Thing, thingCreds *ThingCreds) error

AttachThingPrincipal attach thing to principal

func (*Svcs) CreateIotPolicy

func (s *Svcs) CreateIotPolicy(policyName, document string) (*IotPolicy, error)

CreateIotPolicy create an iam policy

func (*Svcs) CreateKeysAndCertificates

func (s *Svcs) CreateKeysAndCertificates() (*ThingCreds, error)

CreateKeysAndCertificates create and active thing certificates and keys

func (*Svcs) CreateOrGetIamRole

func (s *Svcs) CreateOrGetIamRole(roleName, description, document string) (*IamRole, error)

CreateOrGetIamRole create or get the existing iam role by name

func (*Svcs) CreateOrGetServiceRoleForAccount

func (s *Svcs) CreateOrGetServiceRoleForAccount() (*IamRole, error)

CreateOrGetServiceRoleForAccount create or get the service role

func (*Svcs) CreateThing

func (s *Svcs) CreateThing(thingName string) (*Thing, error)

CreateThing create an AWS IoT thing

func (*Svcs) CreateThingPolicy

func (s *Svcs) CreateThingPolicy(thingName string) (*IotPolicy, error)

CreateThingPolicy create a thing policy

func (*Svcs) GetIoTEndpoint

func (s *Svcs) GetIoTEndpoint() (*IotEndpoint, error)

GetIoTEndpoint get the iot endpoint information

type Thing

type Thing struct {
	Name string
	Arn  string
}

Thing an aws thing

type ThingConfig

type ThingConfig struct {
	ThingRole   *IamRole
	ThingPolicy *IotPolicy
	Thing       *Thing
	ThingCreds  *ThingCreds
	IotEndpoint *IotEndpoint
}

ThingConfig used to store thing details

func Load

func Load(filePath string) (*ThingConfig, error)

Load the configuration from the supplied path

func NewThingConfig

func NewThingConfig(thingRole *IamRole, thingPolicy *IotPolicy, thing *Thing, thingCreds *ThingCreds, endpoint *IotEndpoint) *ThingConfig

NewThingConfig create a new thing config

func (*ThingConfig) Save

func (tc *ThingConfig) Save(name string) error

Save the configuration to a YAML file with the name used as the filename

type ThingCreds

type ThingCreds struct {
	CertificateArn string
	CertificatePem string
	PrivateKey     string
	PublicKey      string
}

ThingCreds the certificates and keys for aws thing

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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