Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 193d128

Browse files
authored
Merge pull request #14 from philips-software/feature/iron
IronIO Worker support
2 parents d962634 + 4554d29 commit 193d128

17 files changed

+1856
-19
lines changed

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@ A HSDP API client enabling Go programs to interact with various HSDP APIs in a s
1212

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

15-
- [x] Cartel
16-
- [x] IAM token authorization
17-
- [x] Group management
18-
- [x] Organization management
19-
- [x] Permission management
20-
- [x] Role managemnet
21-
- [x] User management
22-
- [x] Password management
23-
- [ ] Device management
24-
- [x] Proposition management
25-
- [x] Application management
26-
- [x] Service management
27-
- [x] Logging
15+
- [x] Cartel c.q. Container Host management ([examples](cartel/README.md))
16+
- [x] IronIO tasks, codes and schedules management ([examples](iron/README.md))
17+
- [x] HSDP IAM/IDM management
18+
- [x] Group management
19+
- [x] Organization management
20+
- [x] Permission management
21+
- [x] Role managemnet
22+
- [x] User management
23+
- [x] Password management
24+
- [x] Proposition management
25+
- [x] Application management
26+
- [x] Service management
27+
- [ ] Device management
28+
- [x] MFA Policies management
29+
- [x] Logging ([examples](logging/README.md))
2830
- [ ] Auditing
2931
- [x] S3 Credentials Policy management
30-
- [x] MFA Policies management
3132

3233
## Usage
3334

@@ -64,13 +65,12 @@ func main() {
6465
## TODO
6566

6667
- Increase API coverage
67-
- Increase code coverage
6868

6969
## Issues
7070

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

73-
## Author
73+
## Contact / Getting help
7474

7575
Andy Lo-A-Foe (<[email protected]>)
7676

go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ require (
55
github.com/go-playground/validator/v10 v10.0.1
66
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135
77
github.com/google/uuid v1.1.1
8+
github.com/kr/pretty v0.1.0 // indirect
89
github.com/philips-software/go-hsdp-signer v1.3.0
910
github.com/stretchr/testify v1.5.1
10-
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
11+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
12+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
1113
)
1214

1315
go 1.13

go.sum

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 h1:zLTLjkaOF
1414
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
1515
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
1616
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
17+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
18+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
19+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
20+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
21+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
1722
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
1823
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
1924
github.com/philips-software/go-hsdp-signer v1.3.0 h1:Si1voDE/GHzthmxpasPdntbu8aUW6EYJfI6gHVf7BCc=
@@ -25,11 +30,14 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
2530
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
2631
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
2732
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
33+
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
2834
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
2935
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
30-
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
31-
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
36+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
37+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3238
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3339
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
40+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
41+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3442
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
3543
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

iron/README.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Using the Iron API client
2+
HSDP uses Iron.io for container scheduling. This API client
3+
implements a basic set of functionality to create code definitions and queue tasks.
4+
The focus is on Docker code packages.
5+
6+
# Registering a docker image
7+
```go
8+
package main
9+
10+
import (
11+
"fmt"
12+
"github.com/philips-software/go-hsdp-api/iron"
13+
)
14+
15+
var (
16+
projectID = "yourIronProjectID"
17+
projectToken = "yourIronProjectToken"
18+
clusterID = "yourIronClusterID"
19+
)
20+
21+
func main() {
22+
client, err := iron.NewClient(&iron.Config{
23+
ProjectID: projectID,
24+
Token: projectToken,
25+
ClusterInfo: []iron.ClusterInfo{
26+
{
27+
ClusterID: clusterID,
28+
},
29+
},
30+
})
31+
if err != nil {
32+
fmt.Printf("Error creating IRON client: %v\n", err)
33+
return
34+
}
35+
result, resp, err := client.Codes.CreateOrUpdateCode(iron.Code{
36+
Name: "mytest",
37+
Image: "loafoe/siderite:latest",
38+
})
39+
fmt.Printf("%v %v %v\n", result, resp, err)
40+
}
41+
42+
```
43+
44+
# Queueing a task
45+
```go
46+
package main
47+
48+
import (
49+
"fmt"
50+
"github.com/philips-software/go-hsdp-api/iron"
51+
)
52+
53+
var (
54+
projectID = "yourIronProjectID"
55+
projectToken = "yourIronProjectToken"
56+
clusterID = "yourIronClusterID"
57+
taskName = ""
58+
)
59+
60+
func main() {
61+
client, err := iron.NewClient(&iron.Config{
62+
ProjectID: projectID,
63+
Token: projectToken,
64+
ClusterInfo: []iron.ClusterInfo{
65+
{
66+
ClusterID: clusterID,
67+
},
68+
},
69+
})
70+
if err != nil {
71+
fmt.Printf("Error creating IRON client: %v\n", err)
72+
return
73+
}
74+
result, resp, err := client.Tasks.QueueTask(iron.Task{
75+
CodeName: "mytask",
76+
Payload: `{"foo": "bar"}`,
77+
})
78+
fmt.Printf("%v %v %v\n", result, resp, err)
79+
}
80+
81+
```
82+
83+
# Encryption
84+
Some Iron clusters expect the Payload of a task to be encrypted.
85+
You can use the `iron.EncryptPayload` function for this.

0 commit comments

Comments
 (0)