api

package
v0.0.0-...-288c61e Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: MIT Imports: 14 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

This section is empty.

Functions

func RegisterObjectHandler

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

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

func RegisterObjectHandlerClient

func RegisterObjectHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ObjectClient) error

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

func RegisterObjectHandlerFromEndpoint

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

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

func RegisterObjectServer

func RegisterObjectServer(s *grpc.Server, srv ObjectServer)

Types

type CreateObjectRequest

type CreateObjectRequest struct {
	ObjectID             string   `protobuf:"bytes,1,opt,name=objectID,proto3" json:"objectID,omitempty"`
	ObjectDescription    string   `protobuf:"bytes,2,opt,name=objectDescription,proto3" json:"objectDescription,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateObjectRequest) Descriptor

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

func (*CreateObjectRequest) GetObjectDescription

func (m *CreateObjectRequest) GetObjectDescription() string

func (*CreateObjectRequest) GetObjectID

func (m *CreateObjectRequest) GetObjectID() string

func (*CreateObjectRequest) ProtoMessage

func (*CreateObjectRequest) ProtoMessage()

func (*CreateObjectRequest) Reset

func (m *CreateObjectRequest) Reset()

func (*CreateObjectRequest) String

func (m *CreateObjectRequest) String() string

func (*CreateObjectRequest) XXX_DiscardUnknown

func (m *CreateObjectRequest) XXX_DiscardUnknown()

func (*CreateObjectRequest) XXX_Marshal

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

func (*CreateObjectRequest) XXX_Merge

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

func (*CreateObjectRequest) XXX_Size

func (m *CreateObjectRequest) XXX_Size() int

func (*CreateObjectRequest) XXX_Unmarshal

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

type CreateObjectResponse

type CreateObjectResponse struct {
	Status               string   `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	Message              string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateObjectResponse) Descriptor

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

func (*CreateObjectResponse) GetMessage

func (m *CreateObjectResponse) GetMessage() string

func (*CreateObjectResponse) GetStatus

func (m *CreateObjectResponse) GetStatus() string

func (*CreateObjectResponse) ProtoMessage

func (*CreateObjectResponse) ProtoMessage()

func (*CreateObjectResponse) Reset

func (m *CreateObjectResponse) Reset()

func (*CreateObjectResponse) String

func (m *CreateObjectResponse) String() string

func (*CreateObjectResponse) XXX_DiscardUnknown

func (m *CreateObjectResponse) XXX_DiscardUnknown()

func (*CreateObjectResponse) XXX_Marshal

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

func (*CreateObjectResponse) XXX_Merge

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

func (*CreateObjectResponse) XXX_Size

func (m *CreateObjectResponse) XXX_Size() int

func (*CreateObjectResponse) XXX_Unmarshal

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

type DeleteObjectRequest

type DeleteObjectRequest struct {
	ObjectID             string   `protobuf:"bytes,1,opt,name=objectID,proto3" json:"objectID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteObjectRequest) Descriptor

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

func (*DeleteObjectRequest) GetObjectID

func (m *DeleteObjectRequest) GetObjectID() string

func (*DeleteObjectRequest) ProtoMessage

func (*DeleteObjectRequest) ProtoMessage()

func (*DeleteObjectRequest) Reset

func (m *DeleteObjectRequest) Reset()

func (*DeleteObjectRequest) String

func (m *DeleteObjectRequest) String() string

func (*DeleteObjectRequest) XXX_DiscardUnknown

func (m *DeleteObjectRequest) XXX_DiscardUnknown()

func (*DeleteObjectRequest) XXX_Marshal

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

func (*DeleteObjectRequest) XXX_Merge

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

func (*DeleteObjectRequest) XXX_Size

func (m *DeleteObjectRequest) XXX_Size() int

func (*DeleteObjectRequest) XXX_Unmarshal

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

type DeleteObjectResponse

type DeleteObjectResponse struct {
	Status               string   `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	Message              string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteObjectResponse) Descriptor

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

func (*DeleteObjectResponse) GetMessage

func (m *DeleteObjectResponse) GetMessage() string

func (*DeleteObjectResponse) GetStatus

func (m *DeleteObjectResponse) GetStatus() string

func (*DeleteObjectResponse) ProtoMessage

func (*DeleteObjectResponse) ProtoMessage()

func (*DeleteObjectResponse) Reset

func (m *DeleteObjectResponse) Reset()

func (*DeleteObjectResponse) String

func (m *DeleteObjectResponse) String() string

func (*DeleteObjectResponse) XXX_DiscardUnknown

func (m *DeleteObjectResponse) XXX_DiscardUnknown()

func (*DeleteObjectResponse) XXX_Marshal

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

func (*DeleteObjectResponse) XXX_Merge

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

func (*DeleteObjectResponse) XXX_Size

func (m *DeleteObjectResponse) XXX_Size() int

func (*DeleteObjectResponse) XXX_Unmarshal

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

type ObjectClient

type ObjectClient interface {
	CreateObject(ctx context.Context, in *CreateObjectRequest, opts ...grpc.CallOption) (*CreateObjectResponse, error)
	DeleteObject(ctx context.Context, in *DeleteObjectRequest, opts ...grpc.CallOption) (*DeleteObjectResponse, error)
}

ObjectClient is the client API for Object service.

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

func NewObjectClient

func NewObjectClient(cc *grpc.ClientConn) ObjectClient

type ObjectServer

type ObjectServer interface {
	CreateObject(context.Context, *CreateObjectRequest) (*CreateObjectResponse, error)
	DeleteObject(context.Context, *DeleteObjectRequest) (*DeleteObjectResponse, error)
}

ObjectServer is the server API for Object service.

type Server

type Server struct {
}

Server represents the gRPC server

func (*Server) CreateObject

func (s *Server) CreateObject(ctx context.Context, in *CreateObjectRequest) (*CreateObjectResponse, error)

SayHello generates response to a Ping request

func (*Server) DeleteObject

func (s *Server) DeleteObject(ctx context.Context, in *DeleteObjectRequest) (*DeleteObjectResponse, error)

Jump to

Keyboard shortcuts

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