Documentation ¶
Index ¶
- func AptInstall(packages []string) error
- func AptUpdate() error
- func DoClose(output io.Closer)
- func DownloadFromURL(url, targetPath string) error
- func GroupExist(groupname string) (bool, error)
- func NewSystemGroup(groupname string) error
- func NewSystemUser(username string) error
- func RunCommand(cmdName string, cmdArgs []string) error
- func UserExist(username string) (bool, error)
- type ExitError
- type IamRole
- type IotEndpoint
- type IotPolicy
- type SSHSession
- type Svcs
- func (s *Svcs) AttachPrincipalPolicy(thingCreds *ThingCreds, policy *IotPolicy) error
- func (s *Svcs) AttachThingPrincipal(thing *Thing, thingCreds *ThingCreds) error
- func (s *Svcs) CreateIotPolicy(policyName, document string) (*IotPolicy, error)
- func (s *Svcs) CreateKeysAndCertificates() (*ThingCreds, error)
- func (s *Svcs) CreateOrGetIamRole(roleName, description, document string) (*IamRole, error)
- func (s *Svcs) CreateOrGetServiceRoleForAccount() (*IamRole, error)
- func (s *Svcs) CreateThing(thingName string) (*Thing, error)
- func (s *Svcs) CreateThingPolicy(thingName string) (*IotPolicy, error)
- func (s *Svcs) GetIoTEndpoint() (*IotEndpoint, error)
- type Thing
- type ThingConfig
- type ThingCreds
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AptInstall ¶
AptInstall run apt install and install the specified package(s)
func DownloadFromURL ¶
DownloadFromURL Download file from URL to location
func GroupExist ¶
GroupExist check if group exists on the system
func NewSystemGroup ¶
NewSystemGroup create a new system group
func NewSystemUser ¶
NewSystemUser create a new system user
func RunCommand ¶
RunCommand run a command with the supplied arguments
Types ¶
type SSHSession ¶
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 ¶
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 ¶
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 ¶
CreateOrGetIamRole create or get the existing iam role by name
func (*Svcs) CreateOrGetServiceRoleForAccount ¶
CreateOrGetServiceRoleForAccount create or get the service role
func (*Svcs) CreateThing ¶
CreateThing create an AWS IoT thing
func (*Svcs) CreateThingPolicy ¶
CreateThingPolicy create a thing policy
func (*Svcs) GetIoTEndpoint ¶
func (s *Svcs) GetIoTEndpoint() (*IotEndpoint, error)
GetIoTEndpoint get the iot endpoint information
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