Exemplo n.º 1
0
func main() {
	tree := node{label: "parent", children: []node{node{label: "child"}}}

	// uses go-spew, see https://github.com/davecgh/go-spew
	hopwatch.Dump(tree).Break()
	hopwatch.Dumpf("kids %#+v", tree.children).Break()
}
func resourceKuberetesPodCreate(d *schema.ResourceData, meta interface{}) error {
	c := meta.(Config)

	//	podName := d.Get("name")
	//	podImage := d.Get("image")
	endpoint := c.Endpoint
	username := c.Username
	pass := c.Password
	var jsonStr = []byte(`{
  "kind": "Pod",
  "apiVersion": "v1",
  "metadata": {
    "name": "helloworld"
  },
  "spec": {
    "containers": [
      {
        "name": "helloworld",
        "image": "tutum/hello-world"
      }
    ]
  }
}`)
	req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(jsonStr))
	req.SetBasicAuth(username, pass)
	req.Header.Set("Content-Type", "application/json")
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}

	client := &http.Client{Transport: tr}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println("response Body:", string(body))

	//d.SetId(uniqueID)
	hopwatch.Dump("responsebody", string(body))

	d.SetId("238746523846238746283746283746")
	return nil
}
Exemplo n.º 3
0
func liveOfPi() {
	hopwatch.Dump(math.Pi).Break()
}
func main() {
	hopwatch.Dump(8).Dump(8).Break()
	hopwatch.Dumpf("%v", 9).Dumpf("%v", 9).Break()
}
Exemplo n.º 5
0
func dumpArgs() {
	hopwatch.Dump(os.Args).Break()
	waitHere()
}