Created
April 28, 2016 18:56
-
-
Save yifan-gu/6361fa62bd51ce46f0b6d067cdd25c28 to your computer and use it in GitHub Desktop.
rkt_api_list.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/coreos/rkt/api/v1alpha" | |
"golang.org/x/net/context" | |
"google.golang.org/grpc" | |
) | |
func main() { | |
conn, err := grpc.Dial("localhost:15441", grpc.WithInsecure()) | |
if err != nil { | |
fmt.Println(err) | |
os.Exit(1) | |
} | |
c := v1alpha.NewPublicAPIClient(conn) | |
defer conn.Close() | |
// List pods. | |
podResp, err := c.ListPods(context.Background(), &v1alpha.ListPodsRequest{Detail: true}) | |
if err != nil { | |
fmt.Println(err) | |
os.Exit(1) | |
} | |
fmt.Println(podResp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment