# README
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
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
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.
# Functions
DecryptPayload decrypts a base64 encoded payload using private key.
EncryptPayload encrypts pbytes using publicKey.
FormatBrokenPubkey fixes to broken service broker pubkey format.
NewClient returns a new HSDP Iron API client.
# Constants
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
A Client manages communication with IronIO.
Cluster describes an Iron cluster.
ClusterInfo contains details on an Iron cluster.
ClustersServices implements API calls to get details on Iron clusters.
No description provided by the author
ClusterUser can share resources on a cluster.
Code describes a Iron code package.
No description provided by the author
Config contains the configuration of a client.
DockerCredentials describes a set of docker credentials.
Machine is a node in an Iron cluster.
Response is a HSDP IAM API response.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
OptionFunc is the function signature function for options.