ratio

package
v0.0.0-...-757d304 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RateLimitResponse_Code_name = map[int32]string{
	0: "UNKNOWN",
	1: "OK",
	2: "OVER_LIMIT",
}
View Source
var RateLimitResponse_Code_value = map[string]int32{
	"UNKNOWN":    0,
	"OK":         1,
	"OVER_LIMIT": 2,
}

Functions

func RegisterRateLimitServiceServer

func RegisterRateLimitServiceServer(s *grpc.Server, srv RateLimitServiceServer)

Types

type RateLimitRequest

type RateLimitRequest struct {
	// The owner of the target resource. Usually the service name from where
	// the request was made. Used for storing the hits in a dedicated bucket
	// per service.
	//
	// Examples:
	//   1. my-awesome-service
	Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
	// The target resource behind the rate limit.
	//
	// Examples:
	//   1. /v1/order/pay
	//   2. /v1/order/pay#customer123
	//   3. graphql_resolver_root
	Resource             string   `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The main request message made to the RateLimitService.

func (*RateLimitRequest) Descriptor

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

func (*RateLimitRequest) GetOwner

func (m *RateLimitRequest) GetOwner() string

func (*RateLimitRequest) GetResource

func (m *RateLimitRequest) GetResource() string

func (*RateLimitRequest) ProtoMessage

func (*RateLimitRequest) ProtoMessage()

func (*RateLimitRequest) Reset

func (m *RateLimitRequest) Reset()

func (*RateLimitRequest) String

func (m *RateLimitRequest) String() string

func (*RateLimitRequest) XXX_DiscardUnknown

func (m *RateLimitRequest) XXX_DiscardUnknown()

func (*RateLimitRequest) XXX_Marshal

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

func (*RateLimitRequest) XXX_Merge

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

func (*RateLimitRequest) XXX_Size

func (m *RateLimitRequest) XXX_Size() int

func (*RateLimitRequest) XXX_Unmarshal

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

type RateLimitResponse

type RateLimitResponse struct {
	Code                 RateLimitResponse_Code `protobuf:"varint,1,opt,name=code,proto3,enum=RateLimitResponse_Code" json:"code,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

The response of RateLimit. Strongly based on Envoy. See https://github.com/envoyproxy/envoy/blob/master/api/envoy/service/ratelimit/v2/rls.proto

func (*RateLimitResponse) Descriptor

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

func (*RateLimitResponse) GetCode

func (*RateLimitResponse) ProtoMessage

func (*RateLimitResponse) ProtoMessage()

func (*RateLimitResponse) Reset

func (m *RateLimitResponse) Reset()

func (*RateLimitResponse) String

func (m *RateLimitResponse) String() string

func (*RateLimitResponse) XXX_DiscardUnknown

func (m *RateLimitResponse) XXX_DiscardUnknown()

func (*RateLimitResponse) XXX_Marshal

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

func (*RateLimitResponse) XXX_Merge

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

func (*RateLimitResponse) XXX_Size

func (m *RateLimitResponse) XXX_Size() int

func (*RateLimitResponse) XXX_Unmarshal

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

type RateLimitResponse_Code

type RateLimitResponse_Code int32
const (
	RateLimitResponse_UNKNOWN    RateLimitResponse_Code = 0
	RateLimitResponse_OK         RateLimitResponse_Code = 1
	RateLimitResponse_OVER_LIMIT RateLimitResponse_Code = 2
)

func (RateLimitResponse_Code) EnumDescriptor

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

func (RateLimitResponse_Code) String

func (x RateLimitResponse_Code) String() string

type RateLimitServiceClient

type RateLimitServiceClient interface {
	// Provides info about whether the rate limit should apply or not.
	RateLimit(ctx context.Context, in *RateLimitRequest, opts ...grpc.CallOption) (*RateLimitResponse, error)
}

RateLimitServiceClient is the client API for RateLimitService service.

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

func NewRateLimitServiceClient

func NewRateLimitServiceClient(cc *grpc.ClientConn) RateLimitServiceClient

type RateLimitServiceServer

type RateLimitServiceServer interface {
	// Provides info about whether the rate limit should apply or not.
	RateLimit(context.Context, *RateLimitRequest) (*RateLimitResponse, error)
}

RateLimitServiceServer is the server API for RateLimitService service.

Jump to

Keyboard shortcuts

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