Skip to content

Commit

Permalink
Merge pull request #14 from philips-software/feature/iron
Browse files Browse the repository at this point in the history
IronIO Worker support
  • Loading branch information
loafoe authored Jun 25, 2020
2 parents d962634 + 4554d29 commit 193d128
Show file tree
Hide file tree
Showing 17 changed files with 1,856 additions and 19 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@ A HSDP API client enabling Go programs to interact with various HSDP APIs in a s

The current implement covers only a subset of HSDP APIs. Basically we implement functonality as needed.

- [x] Cartel
- [x] IAM token authorization
- [x] Group management
- [x] Organization management
- [x] Permission management
- [x] Role managemnet
- [x] User management
- [x] Password management
- [ ] Device management
- [x] Proposition management
- [x] Application management
- [x] Service management
- [x] Logging
- [x] Cartel c.q. Container Host management ([examples](cartel/README.md))
- [x] IronIO tasks, codes and schedules management ([examples](iron/README.md))
- [x] HSDP IAM/IDM management
- [x] Group management
- [x] Organization management
- [x] Permission management
- [x] Role managemnet
- [x] User management
- [x] Password management
- [x] Proposition management
- [x] Application management
- [x] Service management
- [ ] Device management
- [x] MFA Policies management
- [x] Logging ([examples](logging/README.md))
- [ ] Auditing
- [x] S3 Credentials Policy management
- [x] MFA Policies management

## Usage

Expand Down Expand Up @@ -64,13 +65,12 @@ func main() {
## TODO

- Increase API coverage
- Increase code coverage

## Issues

- If you have an issue: report it on the [issue tracker](https://github.com/philips-software/go-hsdp-api/issues)

## Author
## Contact / Getting help

Andy Lo-A-Foe (<andy.lo-a-foe@philips.com>)

Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ require (
github.com/go-playground/validator/v10 v10.0.1
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135
github.com/google/uuid v1.1.1
github.com/kr/pretty v0.1.0 // indirect
github.com/philips-software/go-hsdp-signer v1.3.0
github.com/stretchr/testify v1.5.1
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)

go 1.13
12 changes: 10 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 h1:zLTLjkaOF
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/philips-software/go-hsdp-signer v1.3.0 h1:Si1voDE/GHzthmxpasPdntbu8aUW6EYJfI6gHVf7BCc=
Expand All @@ -25,11 +30,14 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
85 changes: 85 additions & 0 deletions iron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Using the Iron API client
HSDP uses Iron.io for container scheduling. This API client
implements a basic set of functionality to create code definitions and queue tasks.
The focus is on Docker code packages.

# Registering a docker image
```go
package main

import (
"fmt"
"github.com/philips-software/go-hsdp-api/iron"
)

var (
projectID = "yourIronProjectID"
projectToken = "yourIronProjectToken"
clusterID = "yourIronClusterID"
)

func main() {
client, err := iron.NewClient(&iron.Config{
ProjectID: projectID,
Token: projectToken,
ClusterInfo: []iron.ClusterInfo{
{
ClusterID: clusterID,
},
},
})
if err != nil {
fmt.Printf("Error creating IRON client: %v\n", err)
return
}
result, resp, err := client.Codes.CreateOrUpdateCode(iron.Code{
Name: "mytest",
Image: "loafoe/siderite:latest",
})
fmt.Printf("%v %v %v\n", result, resp, err)
}

```

# Queueing a task
```go
package main

import (
"fmt"
"github.com/philips-software/go-hsdp-api/iron"
)

var (
projectID = "yourIronProjectID"
projectToken = "yourIronProjectToken"
clusterID = "yourIronClusterID"
taskName = ""
)

func main() {
client, err := iron.NewClient(&iron.Config{
ProjectID: projectID,
Token: projectToken,
ClusterInfo: []iron.ClusterInfo{
{
ClusterID: clusterID,
},
},
})
if err != nil {
fmt.Printf("Error creating IRON client: %v\n", err)
return
}
result, resp, err := client.Tasks.QueueTask(iron.Task{
CodeName: "mytask",
Payload: `{"foo": "bar"}`,
})
fmt.Printf("%v %v %v\n", result, resp, err)
}

```

# Encryption
Some Iron clusters expect the Payload of a task to be encrypted.
You can use the `iron.EncryptPayload` function for this.
Loading

0 comments on commit 193d128

Please sign in to comment.