Skip to content

Latest commit

 

History

History
45 lines (39 loc) · 987 Bytes

go-mktmpio.md

File metadata and controls

45 lines (39 loc) · 987 Bytes
title
go-mktmpio

go-mktmpio

A simple Go library for accessing the mktmpio service. This is what powers our official CLI, which also serves as our primary usage example.

GitHub
mktmpio/go-mktmpio
GoDoc
github.com/mktmpio/go-mktmpio
package main

import (
  "fmt"
  "github.com/mktmpio/go-mktmpio"
)

func main() {
  client, err := mktmpio.NewClient()
  if err != nil {
    fmt.Printf("Error initializing client: %s\n", err)
    return
  }
  instance, err := client.Create("redis")
  if err != nil {
    fmt.Printf("Error creating instance: %s\n", err)
    return
  }
  defer func() {
    if err := instance.Destroy(); err != nil {
      fmt.Printf("Error terminating instance: %v\n", err)
    } else {
      fmt.Printf("Instance %s terminated.\n", instance.ID)
    }
  }()

  // Do stuff here
}