api

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var Identifier_Type_name = map[int32]string{
	0: "HOST",
	1: "CLIENT",
}
View Source
var Identifier_Type_value = map[string]int32{
	"HOST":   0,
	"CLIENT": 1,
}

Functions

func EncodeIdentifier

func EncodeIdentifier(id *Identifier) (string, error)

func EncodeIdentifierSession

func EncodeIdentifierSession(session *models.APIGetSessionResponse) (string, error)

func RegisterAdminServiceHandler

func RegisterAdminServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAdminServiceHandler registers the http handlers for service AdminService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAdminServiceHandlerClient

func RegisterAdminServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AdminServiceClient) error

RegisterAdminServiceHandlerClient registers the http handlers for service AdminService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AdminServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AdminServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AdminServiceClient" to call the correct interceptors.

func RegisterAdminServiceHandlerFromEndpoint

func RegisterAdminServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAdminServiceHandlerFromEndpoint is same as RegisterAdminServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAdminServiceHandlerServer

func RegisterAdminServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AdminServiceServer) error

RegisterAdminServiceHandlerServer registers the http handlers for service AdminService to "mux". UnaryRPC :call AdminServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterAdminServiceServer

func RegisterAdminServiceServer(s *grpc.Server, srv AdminServiceServer)

Types

type AdminServiceClient

type AdminServiceClient interface {
	GetSession(ctx context.Context, in *GetSessionRequest, opts ...grpc.CallOption) (*GetSessionResponse, error)
}

AdminServiceClient is the client API for AdminService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewAdminServiceClient

func NewAdminServiceClient(cc *grpc.ClientConn) AdminServiceClient

type AdminServiceServer

type AdminServiceServer interface {
	GetSession(context.Context, *GetSessionRequest) (*GetSessionResponse, error)
}

AdminServiceServer is the server API for AdminService service.

type Client added in v0.3.0

type Client struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version              string   `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	Addr                 string   `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
	PublicKeyFingerprint string   `protobuf:"bytes,4,opt,name=public_key_fingerprint,json=publicKeyFingerprint,proto3" json:"public_key_fingerprint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Client) Descriptor added in v0.3.0

func (*Client) Descriptor() ([]byte, []int)

func (*Client) GetAddr added in v0.3.0

func (m *Client) GetAddr() string

func (*Client) GetId added in v0.3.0

func (m *Client) GetId() string

func (*Client) GetPublicKeyFingerprint added in v0.3.0

func (m *Client) GetPublicKeyFingerprint() string

func (*Client) GetVersion added in v0.3.0

func (m *Client) GetVersion() string

func (*Client) ProtoMessage added in v0.3.0

func (*Client) ProtoMessage()

func (*Client) Reset added in v0.3.0

func (m *Client) Reset()

func (*Client) String added in v0.3.0

func (m *Client) String() string

func (*Client) XXX_DiscardUnknown added in v0.3.0

func (m *Client) XXX_DiscardUnknown()

func (*Client) XXX_Marshal added in v0.3.0

func (m *Client) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Client) XXX_Merge added in v0.3.0

func (m *Client) XXX_Merge(src proto.Message)

func (*Client) XXX_Size added in v0.3.0

func (m *Client) XXX_Size() int

func (*Client) XXX_Unmarshal added in v0.3.0

func (m *Client) XXX_Unmarshal(b []byte) error

type GetSessionRequest

type GetSessionRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetSessionRequest) Descriptor

func (*GetSessionRequest) Descriptor() ([]byte, []int)

func (*GetSessionRequest) ProtoMessage

func (*GetSessionRequest) ProtoMessage()

func (*GetSessionRequest) Reset

func (m *GetSessionRequest) Reset()

func (*GetSessionRequest) String

func (m *GetSessionRequest) String() string

func (*GetSessionRequest) XXX_DiscardUnknown

func (m *GetSessionRequest) XXX_DiscardUnknown()

func (*GetSessionRequest) XXX_Marshal

func (m *GetSessionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetSessionRequest) XXX_Merge

func (m *GetSessionRequest) XXX_Merge(src proto.Message)

func (*GetSessionRequest) XXX_Size

func (m *GetSessionRequest) XXX_Size() int

func (*GetSessionRequest) XXX_Unmarshal

func (m *GetSessionRequest) XXX_Unmarshal(b []byte) error

type GetSessionResponse

type GetSessionResponse struct {
	SessionId            string    `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Command              []string  `protobuf:"bytes,2,rep,name=command,proto3" json:"command,omitempty"`
	ForceCommand         []string  `protobuf:"bytes,3,rep,name=force_command,json=forceCommand,proto3" json:"force_command,omitempty"`
	Host                 string    `protobuf:"bytes,4,opt,name=host,proto3" json:"host,omitempty"`
	NodeAddr             string    `protobuf:"bytes,5,opt,name=node_addr,json=nodeAddr,proto3" json:"node_addr,omitempty"`
	ConnectedClients     []*Client `protobuf:"bytes,6,rep,name=connected_clients,json=connectedClients,proto3" json:"connected_clients,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*GetSessionResponse) Descriptor

func (*GetSessionResponse) Descriptor() ([]byte, []int)

func (*GetSessionResponse) GetCommand

func (m *GetSessionResponse) GetCommand() []string

func (*GetSessionResponse) GetConnectedClients added in v0.3.0

func (m *GetSessionResponse) GetConnectedClients() []*Client

func (*GetSessionResponse) GetForceCommand

func (m *GetSessionResponse) GetForceCommand() []string

func (*GetSessionResponse) GetHost

func (m *GetSessionResponse) GetHost() string

func (*GetSessionResponse) GetNodeAddr

func (m *GetSessionResponse) GetNodeAddr() string

func (*GetSessionResponse) GetSessionId

func (m *GetSessionResponse) GetSessionId() string

func (*GetSessionResponse) ProtoMessage

func (*GetSessionResponse) ProtoMessage()

func (*GetSessionResponse) Reset

func (m *GetSessionResponse) Reset()

func (*GetSessionResponse) String

func (m *GetSessionResponse) String() string

func (*GetSessionResponse) XXX_DiscardUnknown

func (m *GetSessionResponse) XXX_DiscardUnknown()

func (*GetSessionResponse) XXX_Marshal

func (m *GetSessionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetSessionResponse) XXX_Merge

func (m *GetSessionResponse) XXX_Merge(src proto.Message)

func (*GetSessionResponse) XXX_Size

func (m *GetSessionResponse) XXX_Size() int

func (*GetSessionResponse) XXX_Unmarshal

func (m *GetSessionResponse) XXX_Unmarshal(b []byte) error

type Identifier

type Identifier struct {
	Id                   string          `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Type                 Identifier_Type `protobuf:"varint,2,opt,name=type,proto3,enum=api.Identifier_Type" json:"type,omitempty"`
	NodeAddr             string          `protobuf:"bytes,3,opt,name=node_addr,json=nodeAddr,proto3" json:"node_addr,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func DecodeIdentifier

func DecodeIdentifier(id, clientVersion string) (*Identifier, error)

func (*Identifier) Descriptor

func (*Identifier) Descriptor() ([]byte, []int)

func (*Identifier) GetId

func (m *Identifier) GetId() string

func (*Identifier) GetNodeAddr

func (m *Identifier) GetNodeAddr() string

func (*Identifier) GetType

func (m *Identifier) GetType() Identifier_Type

func (*Identifier) ProtoMessage

func (*Identifier) ProtoMessage()

func (*Identifier) Reset

func (m *Identifier) Reset()

func (*Identifier) String

func (m *Identifier) String() string

func (*Identifier) XXX_DiscardUnknown

func (m *Identifier) XXX_DiscardUnknown()

func (*Identifier) XXX_Marshal

func (m *Identifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Identifier) XXX_Merge

func (m *Identifier) XXX_Merge(src proto.Message)

func (*Identifier) XXX_Size

func (m *Identifier) XXX_Size() int

func (*Identifier) XXX_Unmarshal

func (m *Identifier) XXX_Unmarshal(b []byte) error

type Identifier_Type

type Identifier_Type int32
const (
	Identifier_HOST   Identifier_Type = 0
	Identifier_CLIENT Identifier_Type = 1
)

func (Identifier_Type) EnumDescriptor

func (Identifier_Type) EnumDescriptor() ([]byte, []int)

func (Identifier_Type) String

func (x Identifier_Type) String() string

type UnimplementedAdminServiceServer

type UnimplementedAdminServiceServer struct {
}

UnimplementedAdminServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAdminServiceServer) GetSession

Directories

Path Synopsis
swagger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL