github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/rpc/ui_output.go (about)

     1  package rpc
     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  	Name   string
    14  }
    15  
    16  func (o *UIOutput) Output(v string) {
    17  	o.Client.Call(o.Name+".Output", v, new(interface{}))
    18  }
    19  
    20  // UIOutputServer is the RPC server for serving UIOutput.
    21  type UIOutputServer struct {
    22  	UIOutput terraform.UIOutput
    23  }
    24  
    25  func (s *UIOutputServer) Output(
    26  	v string,
    27  	reply *interface{}) error {
    28  	s.UIOutput.Output(v)
    29  	return nil
    30  }