Documentation ¶
Index ¶
- Constants
- func CodeFromHTTPStatus(httpStatusCode int) codes.Code
- func ErrorFromHTTPResponseCode(code int, detail string) error
- func ErrorFromInternalStatus(internalStatus *internalv1pb.Status) error
- func HTTPStatusFromCode(code codes.Code) int
- func InternalMetadataToGrpcMetadata(ctx context.Context, internalMD DaprInternalMetadata, ...) metadata.MD
- func InternalMetadataToHTTPHeader(ctx context.Context, internalMD DaprInternalMetadata, ...)
- func IsGRPCProtocol(internalMD DaprInternalMetadata) bool
- func IsJSONContentType(contentType string) bool
- type DaprInternalMetadata
- type InvokeMethodRequest
- func (imr *InvokeMethodRequest) APIVersion() internalv1pb.APIVersion
- func (imr *InvokeMethodRequest) Actor() *internalv1pb.Actor
- func (imr *InvokeMethodRequest) EncodeHTTPQueryString() string
- func (imr *InvokeMethodRequest) Message() *commonv1pb.InvokeRequest
- func (imr *InvokeMethodRequest) Metadata() DaprInternalMetadata
- func (imr *InvokeMethodRequest) Proto() *internalv1pb.InternalInvokeRequest
- func (imr *InvokeMethodRequest) RawData() (string, []byte)
- func (imr *InvokeMethodRequest) WithActor(actorType, actorID string) *InvokeMethodRequest
- func (imr *InvokeMethodRequest) WithFastHTTPHeaders(header *fasthttp.RequestHeader) *InvokeMethodRequest
- func (imr *InvokeMethodRequest) WithHTTPExtension(verb string, querystring string) *InvokeMethodRequest
- func (imr *InvokeMethodRequest) WithMetadata(md map[string][]string) *InvokeMethodRequest
- func (imr *InvokeMethodRequest) WithRawData(data []byte, contentType string) *InvokeMethodRequest
- type InvokeMethodResponse
- func (imr *InvokeMethodResponse) Headers() DaprInternalMetadata
- func (imr *InvokeMethodResponse) IsHTTPResponse() bool
- func (imr *InvokeMethodResponse) Message() *commonv1pb.InvokeResponse
- func (imr *InvokeMethodResponse) Proto() *internalv1pb.InternalInvokeResponse
- func (imr *InvokeMethodResponse) RawData() (string, []byte)
- func (imr *InvokeMethodResponse) Status() *internalv1pb.Status
- func (imr *InvokeMethodResponse) Trailers() DaprInternalMetadata
- func (imr *InvokeMethodResponse) WithFastHTTPHeaders(header *fasthttp.ResponseHeader) *InvokeMethodResponse
- func (imr *InvokeMethodResponse) WithHeaders(headers metadata.MD) *InvokeMethodResponse
- func (imr *InvokeMethodResponse) WithMessage(pb *commonv1pb.InvokeResponse) *InvokeMethodResponse
- func (imr *InvokeMethodResponse) WithRawData(data []byte, contentType string) *InvokeMethodResponse
- func (imr *InvokeMethodResponse) WithTrailers(trailer metadata.MD) *InvokeMethodResponse
Constants ¶
const ( // GRPCContentType is the MIME media type for grpc GRPCContentType = "application/grpc" // JSONContentType is the MIME media type for JSON JSONContentType = "application/json" // ProtobufContentType is the MIME media type for Protobuf ProtobufContentType = "application/x-protobuf" // ContentTypeHeader is the header key of content-type ContentTypeHeader = "content-type" // DaprHeaderPrefix is the prefix if metadata is defined by non user-defined http headers DaprHeaderPrefix = "dapr-" // DestinationIDHeader is the header carrying the value of the invoked app id DestinationIDHeader = "destination-app-id" )
const ( // DefaultAPIVersion is the default Dapr API version DefaultAPIVersion = internalv1pb.APIVersion_V1 )
Variables ¶
This section is empty.
Functions ¶
func CodeFromHTTPStatus ¶
CodeFromHTTPStatus converts http status code to gRPC status code See: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md
func ErrorFromHTTPResponseCode ¶ added in v0.8.0
ErrorFromHTTPResponseCode converts http response code to gRPC status error
func ErrorFromInternalStatus ¶ added in v0.8.0
func ErrorFromInternalStatus(internalStatus *internalv1pb.Status) error
ErrorFromInternalStatus converts internal status to gRPC status error
func HTTPStatusFromCode ¶
HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15 See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
func InternalMetadataToGrpcMetadata ¶
func InternalMetadataToGrpcMetadata(ctx context.Context, internalMD DaprInternalMetadata, httpHeaderConversion bool) metadata.MD
InternalMetadataToGrpcMetadata converts internal metadata map to gRPC metadata
func InternalMetadataToHTTPHeader ¶
func InternalMetadataToHTTPHeader(ctx context.Context, internalMD DaprInternalMetadata, setHeader func(string, string))
InternalMetadataToHTTPHeader converts internal metadata pb to HTTP headers
func IsGRPCProtocol ¶
func IsGRPCProtocol(internalMD DaprInternalMetadata) bool
IsGRPCProtocol checks if metadata is originated from gRPC API
func IsJSONContentType ¶
IsJSONContentType returns true if contentType is the mime media type for JSON
Types ¶
type DaprInternalMetadata ¶
type DaprInternalMetadata map[string]*internalv1pb.ListStringValue
DaprInternalMetadata is the metadata type to transfer HTTP header and gRPC metadata from user app to Dapr.
func MetadataToInternalMetadata ¶ added in v0.9.0
func MetadataToInternalMetadata(md map[string][]string) DaprInternalMetadata
MetadataToInternalMetadata converts metadata to dapr internal metadata map
type InvokeMethodRequest ¶
type InvokeMethodRequest struct {
// contains filtered or unexported fields
}
InvokeMethodRequest holds InternalInvokeRequest protobuf message and provides the helpers to manage it.
func FromInvokeRequestMessage ¶
func FromInvokeRequestMessage(pb *commonv1pb.InvokeRequest) *InvokeMethodRequest
FromInvokeRequestMessage creates InvokeMethodRequest object from InvokeRequest pb object
func InternalInvokeRequest ¶
func InternalInvokeRequest(pb *internalv1pb.InternalInvokeRequest) (*InvokeMethodRequest, error)
InternalInvokeRequest creates InvokeMethodRequest object from InternalInvokeRequest pb object
func NewInvokeMethodRequest ¶
func NewInvokeMethodRequest(method string) *InvokeMethodRequest
NewInvokeMethodRequest creates InvokeMethodRequest object for method
func (*InvokeMethodRequest) APIVersion ¶
func (imr *InvokeMethodRequest) APIVersion() internalv1pb.APIVersion
APIVersion gets API version of InvokeMethodRequest
func (*InvokeMethodRequest) Actor ¶
func (imr *InvokeMethodRequest) Actor() *internalv1pb.Actor
Actor returns actor type and id
func (*InvokeMethodRequest) EncodeHTTPQueryString ¶
func (imr *InvokeMethodRequest) EncodeHTTPQueryString() string
EncodeHTTPQueryString generates querystring for http using http extension object
func (*InvokeMethodRequest) Message ¶
func (imr *InvokeMethodRequest) Message() *commonv1pb.InvokeRequest
Message gets InvokeRequest Message object
func (*InvokeMethodRequest) Metadata ¶
func (imr *InvokeMethodRequest) Metadata() DaprInternalMetadata
Metadata gets Metadata of InvokeMethodRequest
func (*InvokeMethodRequest) Proto ¶
func (imr *InvokeMethodRequest) Proto() *internalv1pb.InternalInvokeRequest
Proto returns InternalInvokeRequest Proto object
func (*InvokeMethodRequest) RawData ¶
func (imr *InvokeMethodRequest) RawData() (string, []byte)
RawData returns content_type and byte array body
func (*InvokeMethodRequest) WithActor ¶
func (imr *InvokeMethodRequest) WithActor(actorType, actorID string) *InvokeMethodRequest
WithActor sets actor type and id
func (*InvokeMethodRequest) WithFastHTTPHeaders ¶ added in v0.9.0
func (imr *InvokeMethodRequest) WithFastHTTPHeaders(header *fasthttp.RequestHeader) *InvokeMethodRequest
WithFastHTTPHeaders sets fasthttp request headers
func (*InvokeMethodRequest) WithHTTPExtension ¶
func (imr *InvokeMethodRequest) WithHTTPExtension(verb string, querystring string) *InvokeMethodRequest
WithHTTPExtension sets new HTTP extension with verb and querystring
func (*InvokeMethodRequest) WithMetadata ¶
func (imr *InvokeMethodRequest) WithMetadata(md map[string][]string) *InvokeMethodRequest
WithMetadata sets metadata
func (*InvokeMethodRequest) WithRawData ¶
func (imr *InvokeMethodRequest) WithRawData(data []byte, contentType string) *InvokeMethodRequest
WithRawData sets message data and content_type
type InvokeMethodResponse ¶
type InvokeMethodResponse struct {
// contains filtered or unexported fields
}
InvokeMethodResponse holds InternalInvokeResponse protobuf message and provides the helpers to manage it.
func InternalInvokeResponse ¶
func InternalInvokeResponse(resp *internalv1pb.InternalInvokeResponse) (*InvokeMethodResponse, error)
InternalInvokeResponse returns InvokeMethodResponse for InternalInvokeResponse pb to use the helpers
func NewInvokeMethodResponse ¶
func NewInvokeMethodResponse(statusCode int32, statusMessage string, statusDetails []*any.Any) *InvokeMethodResponse
NewInvokeMethodResponse returns new InvokeMethodResponse object with status
func (*InvokeMethodResponse) Headers ¶
func (imr *InvokeMethodResponse) Headers() DaprInternalMetadata
Headers gets Headers metadata
func (*InvokeMethodResponse) IsHTTPResponse ¶
func (imr *InvokeMethodResponse) IsHTTPResponse() bool
IsHTTPResponse returns true if response status code is http response status
func (*InvokeMethodResponse) Message ¶
func (imr *InvokeMethodResponse) Message() *commonv1pb.InvokeResponse
Message returns message field in InvokeMethodResponse
func (*InvokeMethodResponse) Proto ¶
func (imr *InvokeMethodResponse) Proto() *internalv1pb.InternalInvokeResponse
Proto clones the internal InvokeMethodResponse pb object
func (*InvokeMethodResponse) RawData ¶
func (imr *InvokeMethodResponse) RawData() (string, []byte)
RawData returns content_type and byte array body
func (*InvokeMethodResponse) Status ¶
func (imr *InvokeMethodResponse) Status() *internalv1pb.Status
Status gets Response status
func (*InvokeMethodResponse) Trailers ¶
func (imr *InvokeMethodResponse) Trailers() DaprInternalMetadata
Trailers gets Trailers metadata
func (*InvokeMethodResponse) WithFastHTTPHeaders ¶
func (imr *InvokeMethodResponse) WithFastHTTPHeaders(header *fasthttp.ResponseHeader) *InvokeMethodResponse
WithFastHTTPHeaders populates fasthttp response header to gRPC header metadata
func (*InvokeMethodResponse) WithHeaders ¶
func (imr *InvokeMethodResponse) WithHeaders(headers metadata.MD) *InvokeMethodResponse
WithHeaders sets gRPC response header metadata
func (*InvokeMethodResponse) WithMessage ¶
func (imr *InvokeMethodResponse) WithMessage(pb *commonv1pb.InvokeResponse) *InvokeMethodResponse
WithMessage sets InvokeResponse pb object to Message field
func (*InvokeMethodResponse) WithRawData ¶
func (imr *InvokeMethodResponse) WithRawData(data []byte, contentType string) *InvokeMethodResponse
WithRawData sets Message using byte data and content type
func (*InvokeMethodResponse) WithTrailers ¶
func (imr *InvokeMethodResponse) WithTrailers(trailer metadata.MD) *InvokeMethodResponse
WithTrailers sets Trailer in internal InvokeMethodResponse