proto

package
v0.0.0-...-821c574 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyType_name = map[int32]string{
		0: "UNKNOWN",
		1: "DIAGNOSED",
	}
	KeyType_value = map[string]int32{
		"UNKNOWN":   0,
		"DIAGNOSED": 1,
	}
)

Enum value maps for KeyType.

View Source
var File_commons_proto protoreflect.FileDescriptor

Functions

func RegisterDiagnosisDBHandler

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

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

func RegisterDiagnosisDBHandlerClient

func RegisterDiagnosisDBHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DiagnosisDBClient) error

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

func RegisterDiagnosisDBHandlerFromEndpoint

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

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

func RegisterDiagnosisDBHandlerServer

func RegisterDiagnosisDBHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DiagnosisDBServer) error

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

func RegisterDiagnosisDBServer

func RegisterDiagnosisDBServer(s *grpc.Server, srv DiagnosisDBServer)

Types

type AddReportResponse

type AddReportResponse struct {
	Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*AddReportResponse) Descriptor deprecated

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

Deprecated: Use AddReportResponse.ProtoReflect.Descriptor instead.

func (*AddReportResponse) GetError

func (x *AddReportResponse) GetError() string

func (*AddReportResponse) ProtoMessage

func (*AddReportResponse) ProtoMessage()

func (*AddReportResponse) ProtoReflect

func (x *AddReportResponse) ProtoReflect() protoreflect.Message

func (*AddReportResponse) Reset

func (x *AddReportResponse) Reset()

func (*AddReportResponse) String

func (x *AddReportResponse) String() string

type DiagnosisDBClient

type DiagnosisDBClient interface {
	// add an authorized report to the database
	AddReport(ctx context.Context, in *Report, opts ...grpc.CallOption) (*AddReportResponse, error)
	// query for all TEK+ENIN pairs matching the given filter. Predicates include:
	// - for a health authority
	// - between two timestamps
	GetDiagnosisKeys(ctx context.Context, in *GetKeyRequest, opts ...grpc.CallOption) (DiagnosisDB_GetDiagnosisKeysClient, error)
	// allows authorized healthcare professional to obtain a unique authorization
	// key to give to a patient
	GetAuthorizationToken(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*TokenResponse, error)
}

DiagnosisDBClient is the client API for DiagnosisDB service.

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

type DiagnosisDBServer

type DiagnosisDBServer interface {
	// add an authorized report to the database
	AddReport(context.Context, *Report) (*AddReportResponse, error)
	// query for all TEK+ENIN pairs matching the given filter. Predicates include:
	// - for a health authority
	// - between two timestamps
	GetDiagnosisKeys(*GetKeyRequest, DiagnosisDB_GetDiagnosisKeysServer) error
	// allows authorized healthcare professional to obtain a unique authorization
	// key to give to a patient
	GetAuthorizationToken(context.Context, *TokenRequest) (*TokenResponse, error)
}

DiagnosisDBServer is the server API for DiagnosisDB service.

type DiagnosisDB_GetDiagnosisKeysClient

type DiagnosisDB_GetDiagnosisKeysClient interface {
	Recv() (*GetDiagnosisKeyResponse, error)
	grpc.ClientStream
}

type DiagnosisDB_GetDiagnosisKeysServer

type DiagnosisDB_GetDiagnosisKeysServer interface {
	Send(*GetDiagnosisKeyResponse) error
	grpc.ServerStream
}

type GetDiagnosisKeyResponse

type GetDiagnosisKeyResponse struct {
	Error  string          `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	Record *TimestampedTEK `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"`
	// contains filtered or unexported fields
}

func (*GetDiagnosisKeyResponse) Descriptor deprecated

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

Deprecated: Use GetDiagnosisKeyResponse.ProtoReflect.Descriptor instead.

func (*GetDiagnosisKeyResponse) GetError

func (x *GetDiagnosisKeyResponse) GetError() string

func (*GetDiagnosisKeyResponse) GetRecord

func (x *GetDiagnosisKeyResponse) GetRecord() *TimestampedTEK

func (*GetDiagnosisKeyResponse) ProtoMessage

func (*GetDiagnosisKeyResponse) ProtoMessage()

func (*GetDiagnosisKeyResponse) ProtoReflect

func (x *GetDiagnosisKeyResponse) ProtoReflect() protoreflect.Message

func (*GetDiagnosisKeyResponse) Reset

func (x *GetDiagnosisKeyResponse) Reset()

func (*GetDiagnosisKeyResponse) String

func (x *GetDiagnosisKeyResponse) String() string

type GetKeyRequest

type GetKeyRequest struct {

	// retrieve keys for the given health authority
	AuthorityId []byte `protobuf:"bytes,1,opt,name=authority_id,json=authorityId,proto3" json:"authority_id,omitempty"`
	// retrieve keys for the given day (ENIN rounded 'down'
	// to the nearest day)
	ENIN uint32 `protobuf:"varint,2,opt,name=ENIN,proto3" json:"ENIN,omitempty"`
	// alternatively fetch a temporal range of keys
	Hrange *HistoricalRange `protobuf:"bytes,3,opt,name=hrange,proto3" json:"hrange,omitempty"`
	// contains filtered or unexported fields
}

func (*GetKeyRequest) Descriptor deprecated

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

Deprecated: Use GetKeyRequest.ProtoReflect.Descriptor instead.

func (*GetKeyRequest) GetAuthorityId

func (x *GetKeyRequest) GetAuthorityId() []byte

func (*GetKeyRequest) GetENIN

func (x *GetKeyRequest) GetENIN() uint32

func (*GetKeyRequest) GetHrange

func (x *GetKeyRequest) GetHrange() *HistoricalRange

func (*GetKeyRequest) ProtoMessage

func (*GetKeyRequest) ProtoMessage()

func (*GetKeyRequest) ProtoReflect

func (x *GetKeyRequest) ProtoReflect() protoreflect.Message

func (*GetKeyRequest) Reset

func (x *GetKeyRequest) Reset()

func (*GetKeyRequest) String

func (x *GetKeyRequest) String() string

type HistoricalRange

type HistoricalRange struct {

	// YYYY-MM-DD  of *end* of day range; defaults to the current day
	StartDate string `protobuf:"bytes,1,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"`
	// how many days back to retrieve records; defaults to 1
	Days uint32 `protobuf:"varint,2,opt,name=days,proto3" json:"days,omitempty"`
	// contains filtered or unexported fields
}

func (*HistoricalRange) Descriptor deprecated

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

Deprecated: Use HistoricalRange.ProtoReflect.Descriptor instead.

func (*HistoricalRange) GetDays

func (x *HistoricalRange) GetDays() uint32

func (*HistoricalRange) GetStartDate

func (x *HistoricalRange) GetStartDate() string

func (*HistoricalRange) ProtoMessage

func (*HistoricalRange) ProtoMessage()

func (*HistoricalRange) ProtoReflect

func (x *HistoricalRange) ProtoReflect() protoreflect.Message

func (*HistoricalRange) Reset

func (x *HistoricalRange) Reset()

func (*HistoricalRange) String

func (x *HistoricalRange) String() string

type KeyType

type KeyType int32
const (
	KeyType_UNKNOWN   KeyType = 0
	KeyType_DIAGNOSED KeyType = 1
)

func (KeyType) Descriptor

func (KeyType) Descriptor() protoreflect.EnumDescriptor

func (KeyType) Enum

func (x KeyType) Enum() *KeyType

func (KeyType) EnumDescriptor deprecated

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

Deprecated: Use KeyType.Descriptor instead.

func (KeyType) Number

func (x KeyType) Number() protoreflect.EnumNumber

func (KeyType) String

func (x KeyType) String() string

func (KeyType) Type

func (KeyType) Type() protoreflect.EnumType

type Report

type Report struct {

	// a unique authorization key given to the user upon
	// interaction with an authorized (healthcare) professional
	AuthorizationKey []byte `protobuf:"bytes,1,opt,name=authorization_key,json=authorizationKey,proto3" json:"authorization_key,omitempty"`
	// a set of timestamp-enin pairs (from the user)
	Reports []*TimestampedTEK `protobuf:"bytes,2,rep,name=reports,proto3" json:"reports,omitempty"`
	// contains filtered or unexported fields
}

func (*Report) Descriptor deprecated

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

Deprecated: Use Report.ProtoReflect.Descriptor instead.

func (*Report) GetAuthorizationKey

func (x *Report) GetAuthorizationKey() []byte

func (*Report) GetReports

func (x *Report) GetReports() []*TimestampedTEK

func (*Report) ProtoMessage

func (*Report) ProtoMessage()

func (*Report) ProtoReflect

func (x *Report) ProtoReflect() protoreflect.Message

func (*Report) Reset

func (x *Report) Reset()

func (*Report) String

func (x *Report) String() string

type TimestampedTEK

type TimestampedTEK struct {
	TEK  []byte `protobuf:"bytes,1,opt,name=TEK,proto3" json:"TEK,omitempty"`
	ENIN uint32 `protobuf:"varint,2,opt,name=ENIN,proto3" json:"ENIN,omitempty"`
	// contains filtered or unexported fields
}

func (*TimestampedTEK) Descriptor deprecated

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

Deprecated: Use TimestampedTEK.ProtoReflect.Descriptor instead.

func (*TimestampedTEK) GetENIN

func (x *TimestampedTEK) GetENIN() uint32

func (*TimestampedTEK) GetTEK

func (x *TimestampedTEK) GetTEK() []byte

func (*TimestampedTEK) ProtoMessage

func (*TimestampedTEK) ProtoMessage()

func (*TimestampedTEK) ProtoReflect

func (x *TimestampedTEK) ProtoReflect() protoreflect.Message

func (*TimestampedTEK) Reset

func (x *TimestampedTEK) Reset()

func (*TimestampedTEK) String

func (x *TimestampedTEK) String() string

type TokenRequest

type TokenRequest struct {

	// secret API key that uniquely identifies an authorized organization
	ApiKey []byte `protobuf:"bytes,1,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
	// the kind of key being requested; this is stored in the backend along
	// with the generated authorization_key
	KeyType KeyType `protobuf:"varint,2,opt,name=key_type,json=keyType,proto3,enum=proto.KeyType" json:"key_type,omitempty"`
	// bounds on the time range for the allowed keys; RFC 3339 timestamps
	PermittedRangeStart string `protobuf:"bytes,3,opt,name=permitted_range_start,json=permittedRangeStart,proto3" json:"permitted_range_start,omitempty"`
	PermittedRangeEnd   string `protobuf:"bytes,4,opt,name=permitted_range_end,json=permittedRangeEnd,proto3" json:"permitted_range_end,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenRequest) Descriptor deprecated

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

Deprecated: Use TokenRequest.ProtoReflect.Descriptor instead.

func (*TokenRequest) GetApiKey

func (x *TokenRequest) GetApiKey() []byte

func (*TokenRequest) GetKeyType

func (x *TokenRequest) GetKeyType() KeyType

func (*TokenRequest) GetPermittedRangeEnd

func (x *TokenRequest) GetPermittedRangeEnd() string

func (*TokenRequest) GetPermittedRangeStart

func (x *TokenRequest) GetPermittedRangeStart() string

func (*TokenRequest) ProtoMessage

func (*TokenRequest) ProtoMessage()

func (*TokenRequest) ProtoReflect

func (x *TokenRequest) ProtoReflect() protoreflect.Message

func (*TokenRequest) Reset

func (x *TokenRequest) Reset()

func (*TokenRequest) String

func (x *TokenRequest) String() string

type TokenResponse

type TokenResponse struct {
	Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// unique 16-byte key generated to be given to a user. The generation
	// of this key means that the association of <authority, auth_key> is
	// stored in the backend
	AuthorizationKey []byte `protobuf:"bytes,2,opt,name=authorization_key,json=authorizationKey,proto3" json:"authorization_key,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenResponse) Descriptor deprecated

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

Deprecated: Use TokenResponse.ProtoReflect.Descriptor instead.

func (*TokenResponse) GetAuthorizationKey

func (x *TokenResponse) GetAuthorizationKey() []byte

func (*TokenResponse) GetError

func (x *TokenResponse) GetError() string

func (*TokenResponse) ProtoMessage

func (*TokenResponse) ProtoMessage()

func (*TokenResponse) ProtoReflect

func (x *TokenResponse) ProtoReflect() protoreflect.Message

func (*TokenResponse) Reset

func (x *TokenResponse) Reset()

func (*TokenResponse) String

func (x *TokenResponse) String() string

type UnimplementedDiagnosisDBServer

type UnimplementedDiagnosisDBServer struct {
}

UnimplementedDiagnosisDBServer can be embedded to have forward compatible implementations.

func (*UnimplementedDiagnosisDBServer) AddReport

func (*UnimplementedDiagnosisDBServer) GetAuthorizationToken

func (*UnimplementedDiagnosisDBServer) GetDiagnosisKeys

Jump to

Keyboard shortcuts

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