blob: 825acae6b4fcd22ec0a15bed3bc92462f976bbd9 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
// Source: discharger.vdl
package security
import (
// VDL system imports
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
// VDL user imports
"v.io/v23/security"
)
// DischargerClientMethods is the client interface
// containing Discharger methods.
//
// Discharger is the interface for obtaining discharges for ThirdPartyCaveats.
type DischargerClientMethods interface {
// Discharge is called by a principal that holds a blessing with a third
// party caveat and seeks to get a discharge that proves the fulfillment of
// this caveat.
Discharge(ctx *context.T, Caveat security.Caveat, Impetus security.DischargeImpetus, opts ...rpc.CallOpt) (Discharge security.Discharge, err error)
}
// DischargerClientStub adds universal methods to DischargerClientMethods.
type DischargerClientStub interface {
DischargerClientMethods
rpc.UniversalServiceMethods
}
// DischargerClient returns a client stub for Discharger.
func DischargerClient(name string, opts ...rpc.BindOpt) DischargerClientStub {
var client rpc.Client
for _, opt := range opts {
if clientOpt, ok := opt.(rpc.Client); ok {
client = clientOpt
}
}
return implDischargerClientStub{name, client}
}
type implDischargerClientStub struct {
name string
client rpc.Client
}
func (c implDischargerClientStub) c(ctx *context.T) rpc.Client {
if c.client != nil {
return c.client
}
return v23.GetClient(ctx)
}
func (c implDischargerClientStub) Discharge(ctx *context.T, i0 security.Caveat, i1 security.DischargeImpetus, opts ...rpc.CallOpt) (o0 security.Discharge, err error) {
var call rpc.ClientCall
if call, err = c.c(ctx).StartCall(ctx, c.name, "Discharge", []interface{}{i0, i1}, opts...); err != nil {
return
}
err = call.Finish(&o0)
return
}
// DischargerServerMethods is the interface a server writer
// implements for Discharger.
//
// Discharger is the interface for obtaining discharges for ThirdPartyCaveats.
type DischargerServerMethods interface {
// Discharge is called by a principal that holds a blessing with a third
// party caveat and seeks to get a discharge that proves the fulfillment of
// this caveat.
Discharge(call rpc.ServerCall, Caveat security.Caveat, Impetus security.DischargeImpetus) (Discharge security.Discharge, err error)
}
// DischargerServerStubMethods is the server interface containing
// Discharger methods, as expected by rpc.Server.
// There is no difference between this interface and DischargerServerMethods
// since there are no streaming methods.
type DischargerServerStubMethods DischargerServerMethods
// DischargerServerStub adds universal methods to DischargerServerStubMethods.
type DischargerServerStub interface {
DischargerServerStubMethods
// Describe the Discharger interfaces.
Describe__() []rpc.InterfaceDesc
}
// DischargerServer returns a server stub for Discharger.
// It converts an implementation of DischargerServerMethods into
// an object that may be used by rpc.Server.
func DischargerServer(impl DischargerServerMethods) DischargerServerStub {
stub := implDischargerServerStub{
impl: impl,
}
// Initialize GlobState; always check the stub itself first, to handle the
// case where the user has the Glob method defined in their VDL source.
if gs := rpc.NewGlobState(stub); gs != nil {
stub.gs = gs
} else if gs := rpc.NewGlobState(impl); gs != nil {
stub.gs = gs
}
return stub
}
type implDischargerServerStub struct {
impl DischargerServerMethods
gs *rpc.GlobState
}
func (s implDischargerServerStub) Discharge(call rpc.ServerCall, i0 security.Caveat, i1 security.DischargeImpetus) (security.Discharge, error) {
return s.impl.Discharge(call, i0, i1)
}
func (s implDischargerServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implDischargerServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{DischargerDesc}
}
// DischargerDesc describes the Discharger interface.
var DischargerDesc rpc.InterfaceDesc = descDischarger
// descDischarger hides the desc to keep godoc clean.
var descDischarger = rpc.InterfaceDesc{
Name: "Discharger",
PkgPath: "v.io/x/ref/services/security",
Doc: "// Discharger is the interface for obtaining discharges for ThirdPartyCaveats.",
Methods: []rpc.MethodDesc{
{
Name: "Discharge",
Doc: "// Discharge is called by a principal that holds a blessing with a third\n// party caveat and seeks to get a discharge that proves the fulfillment of\n// this caveat.",
InArgs: []rpc.ArgDesc{
{"Caveat", ``}, // security.Caveat
{"Impetus", ``}, // security.DischargeImpetus
},
OutArgs: []rpc.ArgDesc{
{"Discharge", ``}, // security.Discharge
},
},
},
}