github.com/ns1/terraform@v0.7.10-0.20161109153551-8949419bef40/plugin/ui_output.go (about)

     1  package plugin
     2  
     3  import (
     4  	"net/rpc"
     5  
     6  	"github.com/hashicorp/terraform/terraform"
     7  )
     8  
     9  // UIOutput is an implementatin of terraform.UIOutput that communicates
    10  // over RPC.
    11  type UIOutput struct {
    12  	Client *rpc.Client
    13  }
    14  
    15  func (o *UIOutput) Output(v string) {
    16  	o.Client.Call("Plugin.Output", v, new(interface{}))
    17  }
    18  
    19  // UIOutputServer is the RPC server for serving UIOutput.
    20  type UIOutputServer struct {
    21  	UIOutput terraform.UIOutput
    22  }
    23  
    24  func (s *UIOutputServer) Output(
    25  	v string,
    26  	reply *interface{}) error {
    27  	s.UIOutput.Output(v)
    28  	return nil
    29  }