github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/pot/pot_rpc.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  package pot
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  	"io"
     9  
    10  	api "git.fd.io/govpp.git/api"
    11  	memclnt "github.com/edwarnicke/govpp/binapi/memclnt"
    12  )
    13  
    14  // RPCService defines RPC service pot.
    15  type RPCService interface {
    16  	PotProfileActivate(ctx context.Context, in *PotProfileActivate) (*PotProfileActivateReply, error)
    17  	PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error)
    18  	PotProfileDel(ctx context.Context, in *PotProfileDel) (*PotProfileDelReply, error)
    19  	PotProfileShowConfigDump(ctx context.Context, in *PotProfileShowConfigDump) (RPCService_PotProfileShowConfigDumpClient, error)
    20  }
    21  
    22  type serviceClient struct {
    23  	conn api.Connection
    24  }
    25  
    26  func NewServiceClient(conn api.Connection) RPCService {
    27  	return &serviceClient{conn}
    28  }
    29  
    30  func (c *serviceClient) PotProfileActivate(ctx context.Context, in *PotProfileActivate) (*PotProfileActivateReply, error) {
    31  	out := new(PotProfileActivateReply)
    32  	err := c.conn.Invoke(ctx, in, out)
    33  	if err != nil {
    34  		return nil, err
    35  	}
    36  	return out, api.RetvalToVPPApiError(out.Retval)
    37  }
    38  
    39  func (c *serviceClient) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) {
    40  	out := new(PotProfileAddReply)
    41  	err := c.conn.Invoke(ctx, in, out)
    42  	if err != nil {
    43  		return nil, err
    44  	}
    45  	return out, api.RetvalToVPPApiError(out.Retval)
    46  }
    47  
    48  func (c *serviceClient) PotProfileDel(ctx context.Context, in *PotProfileDel) (*PotProfileDelReply, error) {
    49  	out := new(PotProfileDelReply)
    50  	err := c.conn.Invoke(ctx, in, out)
    51  	if err != nil {
    52  		return nil, err
    53  	}
    54  	return out, api.RetvalToVPPApiError(out.Retval)
    55  }
    56  
    57  func (c *serviceClient) PotProfileShowConfigDump(ctx context.Context, in *PotProfileShowConfigDump) (RPCService_PotProfileShowConfigDumpClient, error) {
    58  	stream, err := c.conn.NewStream(ctx)
    59  	if err != nil {
    60  		return nil, err
    61  	}
    62  	x := &serviceClient_PotProfileShowConfigDumpClient{stream}
    63  	if err := x.Stream.SendMsg(in); err != nil {
    64  		return nil, err
    65  	}
    66  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
    67  		return nil, err
    68  	}
    69  	return x, nil
    70  }
    71  
    72  type RPCService_PotProfileShowConfigDumpClient interface {
    73  	Recv() (*PotProfileShowConfigDetails, error)
    74  	api.Stream
    75  }
    76  
    77  type serviceClient_PotProfileShowConfigDumpClient struct {
    78  	api.Stream
    79  }
    80  
    81  func (c *serviceClient_PotProfileShowConfigDumpClient) Recv() (*PotProfileShowConfigDetails, error) {
    82  	msg, err := c.Stream.RecvMsg()
    83  	if err != nil {
    84  		return nil, err
    85  	}
    86  	switch m := msg.(type) {
    87  	case *PotProfileShowConfigDetails:
    88  		return m, nil
    89  	case *memclnt.ControlPingReply:
    90  		err = c.Stream.Close()
    91  		if err != nil {
    92  			return nil, err
    93  		}
    94  		return nil, io.EOF
    95  	default:
    96  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
    97  	}
    98  }