Import library in your project
import "github.com/eyevinn/osaas-client-go"
Example of creating, listing and removing an instance
package main
import "github.com/eyevinn/osaas-client-go"
import "fmt"
import "os"
func main() {
config := &osaasclient.ContextConfig{
PersonalAccessToken: os.Getenv("OSC_PAT"),
Environment: "dev",
}
ctx, err := osaasclient.NewContext(config)
if err != nil {
fmt.Println("Error creating context:", err)
return
}
token, err := ctx.GetServiceAccessToken("encore")
if err != nil {
fmt.Println("Error getting service access token:", err)
return
}
instances, err := osaasclient.ListInstances(ctx, "encore", token)
if err == nil {
fmt.Printf("instances: %s\n", instances)
} else {
fmt.Println("Error listing instances:", err)
}
instanceName := "test-instance"
instance, err := osaasclient.CreateInstance(ctx, "encore", token, map[string]interface{}{
"name": instanceName,
})
if err != nil {
fmt.Println("Error creating instance:", err)
} else {
fmt.Printf("Instance created: %s\n", instance)
}
err = osaasclient.RemoveInstance(ctx, "encore", instanceName, token)
if err != nil {
fmt.Println("Error removing instance:", err)
} else {
fmt.Printf("Instance %s removed\n", instanceName)
}
}
See CONTRIBUTING
This project is licensed under the MIT License, see LICENSE.
Join our community on Slack where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:
- Further development of this component
- Customization and integration of this component into your platform
- Support and maintenance agreement
Contact [email protected] if you are interested.
Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in blogs and by open sourcing the code we have written.
Want to know more about Eyevinn and how it is to work here. Contact us at [email protected]!