github.com/richardmarshall/terraform@v0.9.5-0.20170429023105-15704cc6ee35/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  }