コード例 #1
0
ファイル: get.go プロジェクト: harshalhshah/rack
func (command *commandGet) Execute(resource *handler.Resource) {
	keypairName := resource.Params.(*paramsGet).keypair
	keypair, err := keypairs.Get(command.Ctx.ServiceClient, keypairName).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = structs.Map(keypair)
}
コード例 #2
0
ファイル: get.go プロジェクト: hdansou/rack
func (command *commandGet) Execute(resource *handler.Resource) {
	keypairName := resource.Params.(*paramsGet).keypair
	keypair, err := keypairs.Get(command.Ctx.ServiceClient, keypairName).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	result := structs.Map(keypair)
	if command.Ctx.OutputFormat == "json" {
		resource.Result = result
	} else {
		// Assume they want the key directly
		resource.Result = result["PublicKey"]
	}
}