Documentation
¶
Overview ¶
Package rpc is the parsec management RPC surface.
The wire format is the Twirp v8 JSON protocol: POST to
/twirp/parsec.ParsecService/<Method>
with Content-Type application/json and a JSON body matching the corresponding generated request message. Responses are JSON-encoded generated response messages, or a Twirp-shaped error envelope on failure.
The code in this package is generated from service.proto by
make proto
(requires protoc + protoc-gen-go + protoc-gen-twirp on PATH). The generated files — service.pb.go and service.twirp.go — are the source of truth for the wire format. Any change to the proto must regenerate both files in the same commit.
Bearer enforcement (Authorization: Bearer <mgmt-token>) is layered on top of the generated handler by internal/server: every method except Manifest and RefreshToken requires a valid non-retired mgmt token.
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type ChannelRef
- type ChannelResponse
- type ChannelSummary
- func (*ChannelSummary) Descriptor() ([]byte, []int)deprecated
- func (x *ChannelSummary) GetCreatedAt() string
- func (x *ChannelSummary) GetLastActive() string
- func (x *ChannelSummary) GetName() string
- func (x *ChannelSummary) GetState() string
- func (x *ChannelSummary) GetTtlSeconds() int64
- func (*ChannelSummary) ProtoMessage()
- func (x *ChannelSummary) ProtoReflect() protoreflect.Message
- func (x *ChannelSummary) Reset()
- func (x *ChannelSummary) String() string
- type CreatePrivateRequest
- func (*CreatePrivateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreatePrivateRequest) GetName() string
- func (x *CreatePrivateRequest) GetScopes() []*Scope
- func (x *CreatePrivateRequest) GetSubject() string
- func (x *CreatePrivateRequest) GetTtlSeconds() int64
- func (*CreatePrivateRequest) ProtoMessage()
- func (x *CreatePrivateRequest) ProtoReflect() protoreflect.Message
- func (x *CreatePrivateRequest) Reset()
- func (x *CreatePrivateRequest) String() string
- type Credentials
- func (*Credentials) Descriptor() ([]byte, []int)deprecated
- func (x *Credentials) GetAccessExpiresUnix() int64
- func (x *Credentials) GetAccessToken() string
- func (x *Credentials) GetName() string
- func (x *Credentials) GetRefreshExpiresUnix() int64
- func (x *Credentials) GetRefreshToken() string
- func (*Credentials) ProtoMessage()
- func (x *Credentials) ProtoReflect() protoreflect.Message
- func (x *Credentials) Reset()
- func (x *Credentials) String() string
- type DlqCountRequest
- type DlqCountResponse
- type DlqDiscardRequest
- type DlqItem
- func (*DlqItem) Descriptor() ([]byte, []int)deprecated
- func (x *DlqItem) GetAt() string
- func (x *DlqItem) GetAttempts() int32
- func (x *DlqItem) GetBody() string
- func (x *DlqItem) GetId() string
- func (x *DlqItem) GetLastError() string
- func (x *DlqItem) GetMetadata() map[string]string
- func (x *DlqItem) GetRecipient() []byte
- func (x *DlqItem) GetSink() string
- func (x *DlqItem) GetSubject() string
- func (*DlqItem) ProtoMessage()
- func (x *DlqItem) ProtoReflect() protoreflect.Message
- func (x *DlqItem) Reset()
- func (x *DlqItem) String() string
- type DlqListRequest
- func (*DlqListRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DlqListRequest) GetLimit() int32
- func (x *DlqListRequest) GetSink() string
- func (*DlqListRequest) ProtoMessage()
- func (x *DlqListRequest) ProtoReflect() protoreflect.Message
- func (x *DlqListRequest) Reset()
- func (x *DlqListRequest) String() string
- type DlqListResponse
- type DlqReplayRequest
- type Empty
- type HTTPClient
- type IssueMgmtRequest
- func (*IssueMgmtRequest) Descriptor() ([]byte, []int)deprecated
- func (x *IssueMgmtRequest) GetSubject() string
- func (x *IssueMgmtRequest) GetTtlSeconds() int64
- func (*IssueMgmtRequest) ProtoMessage()
- func (x *IssueMgmtRequest) ProtoReflect() protoreflect.Message
- func (x *IssueMgmtRequest) Reset()
- func (x *IssueMgmtRequest) String() string
- type IssueMgmtResponse
- func (*IssueMgmtResponse) Descriptor() ([]byte, []int)deprecated
- func (x *IssueMgmtResponse) GetExpiresUnix() int64
- func (x *IssueMgmtResponse) GetMgmtToken() string
- func (x *IssueMgmtResponse) GetSignedByKeyId() string
- func (*IssueMgmtResponse) ProtoMessage()
- func (x *IssueMgmtResponse) ProtoReflect() protoreflect.Message
- func (x *IssueMgmtResponse) Reset()
- func (x *IssueMgmtResponse) String() string
- type JSONResponse
- type KeyRef
- type KeySummary
- func (*KeySummary) Descriptor() ([]byte, []int)deprecated
- func (x *KeySummary) GetCreatedAt() string
- func (x *KeySummary) GetId() string
- func (x *KeySummary) GetRetiredAt() string
- func (x *KeySummary) GetRole() string
- func (*KeySummary) ProtoMessage()
- func (x *KeySummary) ProtoReflect() protoreflect.Message
- func (x *KeySummary) Reset()
- func (x *KeySummary) String() string
- type ListChannelsResponse
- func (*ListChannelsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListChannelsResponse) GetChannels() []*ChannelSummary
- func (*ListChannelsResponse) ProtoMessage()
- func (x *ListChannelsResponse) ProtoReflect() protoreflect.Message
- func (x *ListChannelsResponse) Reset()
- func (x *ListChannelsResponse) String() string
- type ListKeysResponse
- func (*ListKeysResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListKeysResponse) GetActiveKeyId() string
- func (x *ListKeysResponse) GetKeys() []*KeySummary
- func (*ListKeysResponse) ProtoMessage()
- func (x *ListKeysResponse) ProtoReflect() protoreflect.Message
- func (x *ListKeysResponse) Reset()
- func (x *ListKeysResponse) String() string
- type OpenPublicRequest
- func (*OpenPublicRequest) Descriptor() ([]byte, []int)deprecated
- func (x *OpenPublicRequest) GetName() string
- func (x *OpenPublicRequest) GetTtlSeconds() int64
- func (*OpenPublicRequest) ProtoMessage()
- func (x *OpenPublicRequest) ProtoReflect() protoreflect.Message
- func (x *OpenPublicRequest) Reset()
- func (x *OpenPublicRequest) String() string
- type ParsecService
- type PresenceResponse
- type PublishRequest
- func (*PublishRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PublishRequest) GetData() []byte
- func (x *PublishRequest) GetName() string
- func (*PublishRequest) ProtoMessage()
- func (x *PublishRequest) ProtoReflect() protoreflect.Message
- func (x *PublishRequest) Reset()
- func (x *PublishRequest) String() string
- type PublishResponse
- func (*PublishResponse) Descriptor() ([]byte, []int)deprecated
- func (x *PublishResponse) GetEpoch() string
- func (x *PublishResponse) GetOffset() uint64
- func (*PublishResponse) ProtoMessage()
- func (x *PublishResponse) ProtoReflect() protoreflect.Message
- func (x *PublishResponse) Reset()
- func (x *PublishResponse) String() string
- type RefreshTokenRequest
- func (*RefreshTokenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RefreshTokenRequest) GetRefreshToken() string
- func (*RefreshTokenRequest) ProtoMessage()
- func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message
- func (x *RefreshTokenRequest) Reset()
- func (x *RefreshTokenRequest) String() string
- type RefreshTokenResponse
- func (*RefreshTokenResponse) Descriptor() ([]byte, []int)deprecated
- func (x *RefreshTokenResponse) GetAccessExpiresUnix() int64
- func (x *RefreshTokenResponse) GetAccessToken() string
- func (*RefreshTokenResponse) ProtoMessage()
- func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message
- func (x *RefreshTokenResponse) Reset()
- func (x *RefreshTokenResponse) String() string
- type Scope
- type TwirpServer
Constants ¶
const ParsecServicePathPrefix = "/twirp/parsec.ParsecService/"
ParsecServicePathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html
Variables ¶
var File_service_proto protoreflect.FileDescriptor
Functions ¶
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type ChannelRef ¶
type ChannelRef struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// contains filtered or unexported fields
}
func (*ChannelRef) Descriptor
deprecated
func (*ChannelRef) Descriptor() ([]byte, []int)
Deprecated: Use ChannelRef.ProtoReflect.Descriptor instead.
func (*ChannelRef) GetName ¶
func (x *ChannelRef) GetName() string
func (*ChannelRef) ProtoMessage ¶
func (*ChannelRef) ProtoMessage()
func (*ChannelRef) ProtoReflect ¶
func (x *ChannelRef) ProtoReflect() protoreflect.Message
func (*ChannelRef) Reset ¶
func (x *ChannelRef) Reset()
func (*ChannelRef) String ¶
func (x *ChannelRef) String() string
type ChannelResponse ¶
type ChannelResponse struct {
Channel *ChannelSummary `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
// contains filtered or unexported fields
}
func (*ChannelResponse) Descriptor
deprecated
func (*ChannelResponse) Descriptor() ([]byte, []int)
Deprecated: Use ChannelResponse.ProtoReflect.Descriptor instead.
func (*ChannelResponse) GetChannel ¶
func (x *ChannelResponse) GetChannel() *ChannelSummary
func (*ChannelResponse) ProtoMessage ¶
func (*ChannelResponse) ProtoMessage()
func (*ChannelResponse) ProtoReflect ¶
func (x *ChannelResponse) ProtoReflect() protoreflect.Message
func (*ChannelResponse) Reset ¶
func (x *ChannelResponse) Reset()
func (*ChannelResponse) String ¶
func (x *ChannelResponse) String() string
type ChannelSummary ¶
type ChannelSummary struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` // open | closed | deleted
TtlSeconds int64 `protobuf:"varint,3,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"`
CreatedAt string `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // RFC3339
LastActive string `protobuf:"bytes,5,opt,name=last_active,json=lastActive,proto3" json:"last_active,omitempty"` // RFC3339
// contains filtered or unexported fields
}
func (*ChannelSummary) Descriptor
deprecated
func (*ChannelSummary) Descriptor() ([]byte, []int)
Deprecated: Use ChannelSummary.ProtoReflect.Descriptor instead.
func (*ChannelSummary) GetCreatedAt ¶
func (x *ChannelSummary) GetCreatedAt() string
func (*ChannelSummary) GetLastActive ¶
func (x *ChannelSummary) GetLastActive() string
func (*ChannelSummary) GetName ¶
func (x *ChannelSummary) GetName() string
func (*ChannelSummary) GetState ¶
func (x *ChannelSummary) GetState() string
func (*ChannelSummary) GetTtlSeconds ¶
func (x *ChannelSummary) GetTtlSeconds() int64
func (*ChannelSummary) ProtoMessage ¶
func (*ChannelSummary) ProtoMessage()
func (*ChannelSummary) ProtoReflect ¶
func (x *ChannelSummary) ProtoReflect() protoreflect.Message
func (*ChannelSummary) Reset ¶
func (x *ChannelSummary) Reset()
func (*ChannelSummary) String ¶
func (x *ChannelSummary) String() string
type CreatePrivateRequest ¶
type CreatePrivateRequest struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
TtlSeconds int64 `protobuf:"varint,2,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"`
// Subject (sub claim) baked into the issued access + refresh tokens.
// Empty means anonymous.
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
// Scopes is the optional pattern-grant set baked into both tokens.
// Each scope binds a channel-name pattern (e.g. private:webapp.user.42.*)
// to a list of verbs (subscribe, publish, manage). Empty produces a
// token whose only authorization is the chs exact-match on `name`.
// Patterns are validated against the channel grammar at issue time;
// cross-visibility patterns (*:foo.bar) are rejected with
// PARSEC_INVALID_ARGUMENT.
Scopes []*Scope `protobuf:"bytes,4,rep,name=scopes,proto3" json:"scopes,omitempty"`
// contains filtered or unexported fields
}
func (*CreatePrivateRequest) Descriptor
deprecated
func (*CreatePrivateRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreatePrivateRequest.ProtoReflect.Descriptor instead.
func (*CreatePrivateRequest) GetName ¶
func (x *CreatePrivateRequest) GetName() string
func (*CreatePrivateRequest) GetScopes ¶
func (x *CreatePrivateRequest) GetScopes() []*Scope
func (*CreatePrivateRequest) GetSubject ¶
func (x *CreatePrivateRequest) GetSubject() string
func (*CreatePrivateRequest) GetTtlSeconds ¶
func (x *CreatePrivateRequest) GetTtlSeconds() int64
func (*CreatePrivateRequest) ProtoMessage ¶
func (*CreatePrivateRequest) ProtoMessage()
func (*CreatePrivateRequest) ProtoReflect ¶
func (x *CreatePrivateRequest) ProtoReflect() protoreflect.Message
func (*CreatePrivateRequest) Reset ¶
func (x *CreatePrivateRequest) Reset()
func (*CreatePrivateRequest) String ¶
func (x *CreatePrivateRequest) String() string
type Credentials ¶
type Credentials struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
AccessExpiresUnix int64 `protobuf:"varint,4,opt,name=access_expires_unix,json=accessExpiresUnix,proto3" json:"access_expires_unix,omitempty"`
RefreshExpiresUnix int64 `protobuf:"varint,5,opt,name=refresh_expires_unix,json=refreshExpiresUnix,proto3" json:"refresh_expires_unix,omitempty"`
// contains filtered or unexported fields
}
Credentials is the one-shot private-channel token pair, returned by CreatePrivate. The access + refresh tokens are returned exactly once.
func (*Credentials) Descriptor
deprecated
func (*Credentials) Descriptor() ([]byte, []int)
Deprecated: Use Credentials.ProtoReflect.Descriptor instead.
func (*Credentials) GetAccessExpiresUnix ¶
func (x *Credentials) GetAccessExpiresUnix() int64
func (*Credentials) GetAccessToken ¶
func (x *Credentials) GetAccessToken() string
func (*Credentials) GetName ¶
func (x *Credentials) GetName() string
func (*Credentials) GetRefreshExpiresUnix ¶
func (x *Credentials) GetRefreshExpiresUnix() int64
func (*Credentials) GetRefreshToken ¶
func (x *Credentials) GetRefreshToken() string
func (*Credentials) ProtoMessage ¶
func (*Credentials) ProtoMessage()
func (*Credentials) ProtoReflect ¶
func (x *Credentials) ProtoReflect() protoreflect.Message
func (*Credentials) Reset ¶
func (x *Credentials) Reset()
func (*Credentials) String ¶
func (x *Credentials) String() string
type DlqCountRequest ¶
type DlqCountRequest struct {
Sink string `protobuf:"bytes,1,opt,name=sink,proto3" json:"sink,omitempty"`
// contains filtered or unexported fields
}
func (*DlqCountRequest) Descriptor
deprecated
func (*DlqCountRequest) Descriptor() ([]byte, []int)
Deprecated: Use DlqCountRequest.ProtoReflect.Descriptor instead.
func (*DlqCountRequest) GetSink ¶
func (x *DlqCountRequest) GetSink() string
func (*DlqCountRequest) ProtoMessage ¶
func (*DlqCountRequest) ProtoMessage()
func (*DlqCountRequest) ProtoReflect ¶
func (x *DlqCountRequest) ProtoReflect() protoreflect.Message
func (*DlqCountRequest) Reset ¶
func (x *DlqCountRequest) Reset()
func (*DlqCountRequest) String ¶
func (x *DlqCountRequest) String() string
type DlqCountResponse ¶
type DlqCountResponse struct {
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
// contains filtered or unexported fields
}
func (*DlqCountResponse) Descriptor
deprecated
func (*DlqCountResponse) Descriptor() ([]byte, []int)
Deprecated: Use DlqCountResponse.ProtoReflect.Descriptor instead.
func (*DlqCountResponse) GetCount ¶
func (x *DlqCountResponse) GetCount() int32
func (*DlqCountResponse) ProtoMessage ¶
func (*DlqCountResponse) ProtoMessage()
func (*DlqCountResponse) ProtoReflect ¶
func (x *DlqCountResponse) ProtoReflect() protoreflect.Message
func (*DlqCountResponse) Reset ¶
func (x *DlqCountResponse) Reset()
func (*DlqCountResponse) String ¶
func (x *DlqCountResponse) String() string
type DlqDiscardRequest ¶
type DlqDiscardRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*DlqDiscardRequest) Descriptor
deprecated
func (*DlqDiscardRequest) Descriptor() ([]byte, []int)
Deprecated: Use DlqDiscardRequest.ProtoReflect.Descriptor instead.
func (*DlqDiscardRequest) GetId ¶
func (x *DlqDiscardRequest) GetId() string
func (*DlqDiscardRequest) ProtoMessage ¶
func (*DlqDiscardRequest) ProtoMessage()
func (*DlqDiscardRequest) ProtoReflect ¶
func (x *DlqDiscardRequest) ProtoReflect() protoreflect.Message
func (*DlqDiscardRequest) Reset ¶
func (x *DlqDiscardRequest) Reset()
func (*DlqDiscardRequest) String ¶
func (x *DlqDiscardRequest) String() string
type DlqItem ¶
type DlqItem struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Sink string `protobuf:"bytes,2,opt,name=sink,proto3" json:"sink,omitempty"`
At string `protobuf:"bytes,3,opt,name=at,proto3" json:"at,omitempty"` // RFC3339Nano
Recipient []byte `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"` // JSON
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
Body string `protobuf:"bytes,6,opt,name=body,proto3" json:"body,omitempty"`
Metadata map[string]string `` /* 143-byte string literal not displayed */
Attempts int32 `protobuf:"varint,8,opt,name=attempts,proto3" json:"attempts,omitempty"`
LastError string `protobuf:"bytes,9,opt,name=last_error,json=lastError,proto3" json:"last_error,omitempty"`
// contains filtered or unexported fields
}
DlqItem is the wire shape of a dead-letter queue entry. Recipient is transported as a JSON blob because each sink defines its own concrete type; consumers that need the typed Recipient can parse it sink-side.
func (*DlqItem) Descriptor
deprecated
func (*DlqItem) GetAttempts ¶
func (*DlqItem) GetLastError ¶
func (*DlqItem) GetMetadata ¶
func (*DlqItem) GetRecipient ¶
func (*DlqItem) GetSubject ¶
func (*DlqItem) ProtoMessage ¶
func (*DlqItem) ProtoMessage()
func (*DlqItem) ProtoReflect ¶
func (x *DlqItem) ProtoReflect() protoreflect.Message
type DlqListRequest ¶
type DlqListRequest struct {
Sink string `protobuf:"bytes,1,opt,name=sink,proto3" json:"sink,omitempty"`
Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
// contains filtered or unexported fields
}
func (*DlqListRequest) Descriptor
deprecated
func (*DlqListRequest) Descriptor() ([]byte, []int)
Deprecated: Use DlqListRequest.ProtoReflect.Descriptor instead.
func (*DlqListRequest) GetLimit ¶
func (x *DlqListRequest) GetLimit() int32
func (*DlqListRequest) GetSink ¶
func (x *DlqListRequest) GetSink() string
func (*DlqListRequest) ProtoMessage ¶
func (*DlqListRequest) ProtoMessage()
func (*DlqListRequest) ProtoReflect ¶
func (x *DlqListRequest) ProtoReflect() protoreflect.Message
func (*DlqListRequest) Reset ¶
func (x *DlqListRequest) Reset()
func (*DlqListRequest) String ¶
func (x *DlqListRequest) String() string
type DlqListResponse ¶
type DlqListResponse struct {
Items []*DlqItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
// contains filtered or unexported fields
}
func (*DlqListResponse) Descriptor
deprecated
func (*DlqListResponse) Descriptor() ([]byte, []int)
Deprecated: Use DlqListResponse.ProtoReflect.Descriptor instead.
func (*DlqListResponse) GetItems ¶
func (x *DlqListResponse) GetItems() []*DlqItem
func (*DlqListResponse) ProtoMessage ¶
func (*DlqListResponse) ProtoMessage()
func (*DlqListResponse) ProtoReflect ¶
func (x *DlqListResponse) ProtoReflect() protoreflect.Message
func (*DlqListResponse) Reset ¶
func (x *DlqListResponse) Reset()
func (*DlqListResponse) String ¶
func (x *DlqListResponse) String() string
type DlqReplayRequest ¶
type DlqReplayRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*DlqReplayRequest) Descriptor
deprecated
func (*DlqReplayRequest) Descriptor() ([]byte, []int)
Deprecated: Use DlqReplayRequest.ProtoReflect.Descriptor instead.
func (*DlqReplayRequest) GetId ¶
func (x *DlqReplayRequest) GetId() string
func (*DlqReplayRequest) ProtoMessage ¶
func (*DlqReplayRequest) ProtoMessage()
func (*DlqReplayRequest) ProtoReflect ¶
func (x *DlqReplayRequest) ProtoReflect() protoreflect.Message
func (*DlqReplayRequest) Reset ¶
func (x *DlqReplayRequest) Reset()
func (*DlqReplayRequest) String ¶
func (x *DlqReplayRequest) String() string
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type IssueMgmtRequest ¶
type IssueMgmtRequest struct {
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
TtlSeconds int64 `protobuf:"varint,2,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"`
// contains filtered or unexported fields
}
IssueMgmtRequest mints a new mgmt bearer signed by the currently active key. Used during key rotation so operators don't get locked out when they retire the key that signed their current bearer.
func (*IssueMgmtRequest) Descriptor
deprecated
func (*IssueMgmtRequest) Descriptor() ([]byte, []int)
Deprecated: Use IssueMgmtRequest.ProtoReflect.Descriptor instead.
func (*IssueMgmtRequest) GetSubject ¶
func (x *IssueMgmtRequest) GetSubject() string
func (*IssueMgmtRequest) GetTtlSeconds ¶
func (x *IssueMgmtRequest) GetTtlSeconds() int64
func (*IssueMgmtRequest) ProtoMessage ¶
func (*IssueMgmtRequest) ProtoMessage()
func (*IssueMgmtRequest) ProtoReflect ¶
func (x *IssueMgmtRequest) ProtoReflect() protoreflect.Message
func (*IssueMgmtRequest) Reset ¶
func (x *IssueMgmtRequest) Reset()
func (*IssueMgmtRequest) String ¶
func (x *IssueMgmtRequest) String() string
type IssueMgmtResponse ¶
type IssueMgmtResponse struct {
MgmtToken string `protobuf:"bytes,1,opt,name=mgmt_token,json=mgmtToken,proto3" json:"mgmt_token,omitempty"`
ExpiresUnix int64 `protobuf:"varint,2,opt,name=expires_unix,json=expiresUnix,proto3" json:"expires_unix,omitempty"`
SignedByKeyId string `protobuf:"bytes,3,opt,name=signed_by_key_id,json=signedByKeyId,proto3" json:"signed_by_key_id,omitempty"`
// contains filtered or unexported fields
}
IssueMgmtResponse carries the fresh mgmt token and its expiry.
func (*IssueMgmtResponse) Descriptor
deprecated
func (*IssueMgmtResponse) Descriptor() ([]byte, []int)
Deprecated: Use IssueMgmtResponse.ProtoReflect.Descriptor instead.
func (*IssueMgmtResponse) GetExpiresUnix ¶
func (x *IssueMgmtResponse) GetExpiresUnix() int64
func (*IssueMgmtResponse) GetMgmtToken ¶
func (x *IssueMgmtResponse) GetMgmtToken() string
func (*IssueMgmtResponse) GetSignedByKeyId ¶
func (x *IssueMgmtResponse) GetSignedByKeyId() string
func (*IssueMgmtResponse) ProtoMessage ¶
func (*IssueMgmtResponse) ProtoMessage()
func (*IssueMgmtResponse) ProtoReflect ¶
func (x *IssueMgmtResponse) ProtoReflect() protoreflect.Message
func (*IssueMgmtResponse) Reset ¶
func (x *IssueMgmtResponse) Reset()
func (*IssueMgmtResponse) String ¶
func (x *IssueMgmtResponse) String() string
type JSONResponse ¶
type JSONResponse struct {
Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
// contains filtered or unexported fields
}
JSONResponse carries a descriptor.Envelope as raw JSON in `payload`. Used for Manifest (and any future RPC whose response shape is intentionally schemaless).
func (*JSONResponse) Descriptor
deprecated
func (*JSONResponse) Descriptor() ([]byte, []int)
Deprecated: Use JSONResponse.ProtoReflect.Descriptor instead.
func (*JSONResponse) GetPayload ¶
func (x *JSONResponse) GetPayload() []byte
func (*JSONResponse) ProtoMessage ¶
func (*JSONResponse) ProtoMessage()
func (*JSONResponse) ProtoReflect ¶
func (x *JSONResponse) ProtoReflect() protoreflect.Message
func (*JSONResponse) Reset ¶
func (x *JSONResponse) Reset()
func (*JSONResponse) String ¶
func (x *JSONResponse) String() string
type KeyRef ¶
type KeyRef struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
KeyRef identifies one key by id.
func (*KeyRef) Descriptor
deprecated
func (*KeyRef) ProtoMessage ¶
func (*KeyRef) ProtoMessage()
func (*KeyRef) ProtoReflect ¶
func (x *KeyRef) ProtoReflect() protoreflect.Message
type KeySummary ¶
type KeySummary struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` // active | verify-only | retired
CreatedAt string `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // RFC3339
RetiredAt string `protobuf:"bytes,4,opt,name=retired_at,json=retiredAt,proto3" json:"retired_at,omitempty"` // RFC3339, empty when not retired
// contains filtered or unexported fields
}
KeySummary is the wire shape of one ring key.
func (*KeySummary) Descriptor
deprecated
func (*KeySummary) Descriptor() ([]byte, []int)
Deprecated: Use KeySummary.ProtoReflect.Descriptor instead.
func (*KeySummary) GetCreatedAt ¶
func (x *KeySummary) GetCreatedAt() string
func (*KeySummary) GetId ¶
func (x *KeySummary) GetId() string
func (*KeySummary) GetRetiredAt ¶
func (x *KeySummary) GetRetiredAt() string
func (*KeySummary) GetRole ¶
func (x *KeySummary) GetRole() string
func (*KeySummary) ProtoMessage ¶
func (*KeySummary) ProtoMessage()
func (*KeySummary) ProtoReflect ¶
func (x *KeySummary) ProtoReflect() protoreflect.Message
func (*KeySummary) Reset ¶
func (x *KeySummary) Reset()
func (*KeySummary) String ¶
func (x *KeySummary) String() string
type ListChannelsResponse ¶
type ListChannelsResponse struct {
Channels []*ChannelSummary `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty"`
// contains filtered or unexported fields
}
func (*ListChannelsResponse) Descriptor
deprecated
func (*ListChannelsResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListChannelsResponse.ProtoReflect.Descriptor instead.
func (*ListChannelsResponse) GetChannels ¶
func (x *ListChannelsResponse) GetChannels() []*ChannelSummary
func (*ListChannelsResponse) ProtoMessage ¶
func (*ListChannelsResponse) ProtoMessage()
func (*ListChannelsResponse) ProtoReflect ¶
func (x *ListChannelsResponse) ProtoReflect() protoreflect.Message
func (*ListChannelsResponse) Reset ¶
func (x *ListChannelsResponse) Reset()
func (*ListChannelsResponse) String ¶
func (x *ListChannelsResponse) String() string
type ListKeysResponse ¶
type ListKeysResponse struct {
ActiveKeyId string `protobuf:"bytes,1,opt,name=active_key_id,json=activeKeyId,proto3" json:"active_key_id,omitempty"`
Keys []*KeySummary `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"`
// contains filtered or unexported fields
}
ListKeysResponse is the bulk listing for the ring.
func (*ListKeysResponse) Descriptor
deprecated
func (*ListKeysResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListKeysResponse.ProtoReflect.Descriptor instead.
func (*ListKeysResponse) GetActiveKeyId ¶
func (x *ListKeysResponse) GetActiveKeyId() string
func (*ListKeysResponse) GetKeys ¶
func (x *ListKeysResponse) GetKeys() []*KeySummary
func (*ListKeysResponse) ProtoMessage ¶
func (*ListKeysResponse) ProtoMessage()
func (*ListKeysResponse) ProtoReflect ¶
func (x *ListKeysResponse) ProtoReflect() protoreflect.Message
func (*ListKeysResponse) Reset ¶
func (x *ListKeysResponse) Reset()
func (*ListKeysResponse) String ¶
func (x *ListKeysResponse) String() string
type OpenPublicRequest ¶
type OpenPublicRequest struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
TtlSeconds int64 `protobuf:"varint,2,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"`
// contains filtered or unexported fields
}
func (*OpenPublicRequest) Descriptor
deprecated
func (*OpenPublicRequest) Descriptor() ([]byte, []int)
Deprecated: Use OpenPublicRequest.ProtoReflect.Descriptor instead.
func (*OpenPublicRequest) GetName ¶
func (x *OpenPublicRequest) GetName() string
func (*OpenPublicRequest) GetTtlSeconds ¶
func (x *OpenPublicRequest) GetTtlSeconds() int64
func (*OpenPublicRequest) ProtoMessage ¶
func (*OpenPublicRequest) ProtoMessage()
func (*OpenPublicRequest) ProtoReflect ¶
func (x *OpenPublicRequest) ProtoReflect() protoreflect.Message
func (*OpenPublicRequest) Reset ¶
func (x *OpenPublicRequest) Reset()
func (*OpenPublicRequest) String ¶
func (x *OpenPublicRequest) String() string
type ParsecService ¶
type ParsecService interface {
// Read-only manifest. Public (no bearer required).
Manifest(context.Context, *Empty) (*JSONResponse, error)
// Channel CRUD and lifecycle.
OpenPublic(context.Context, *OpenPublicRequest) (*ChannelResponse, error)
CreatePrivate(context.Context, *CreatePrivateRequest) (*Credentials, error)
ListChannels(context.Context, *Empty) (*ListChannelsResponse, error)
GetChannel(context.Context, *ChannelRef) (*ChannelResponse, error)
DeleteChannel(context.Context, *ChannelRef) (*Empty, error)
// Publish + presence.
Publish(context.Context, *PublishRequest) (*PublishResponse, error)
Presence(context.Context, *ChannelRef) (*PresenceResponse, error)
// Token operations. RefreshToken is public — the refresh token itself
// is the credential. IssueMgmt mints a new mgmt bearer signed by the
// currently active key (used during key rotation).
RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
IssueMgmt(context.Context, *IssueMgmtRequest) (*IssueMgmtResponse, error)
// Key ring management.
ListKeys(context.Context, *Empty) (*ListKeysResponse, error)
GenerateKey(context.Context, *Empty) (*KeySummary, error)
PromoteKey(context.Context, *KeyRef) (*Empty, error)
RetireKey(context.Context, *KeyRef) (*Empty, error)
ReloadKeys(context.Context, *Empty) (*Empty, error)
// Dead-letter queue inspection + maintenance.
DlqList(context.Context, *DlqListRequest) (*DlqListResponse, error)
DlqCount(context.Context, *DlqCountRequest) (*DlqCountResponse, error)
DlqDiscard(context.Context, *DlqDiscardRequest) (*Empty, error)
DlqReplay(context.Context, *DlqReplayRequest) (*Empty, error)
}
ParsecService is the management RPC surface. It mirrors the CLI command set: anything you can do over twirp is a CLI subcommand, and vice versa.
Channel names are passed as strings — the validator in package channels is the single source of truth; clients don't need a typed parsing step. Publications carry raw bytes so consumers retain protocol flexibility.
func NewParsecServiceJSONClient ¶
func NewParsecServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) ParsecService
NewParsecServiceJSONClient creates a JSON client that implements the ParsecService interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewParsecServiceProtobufClient ¶
func NewParsecServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) ParsecService
NewParsecServiceProtobufClient creates a Protobuf client that implements the ParsecService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type PresenceResponse ¶
type PresenceResponse struct {
Subscribers int32 `protobuf:"varint,1,opt,name=subscribers,proto3" json:"subscribers,omitempty"`
// contains filtered or unexported fields
}
func (*PresenceResponse) Descriptor
deprecated
func (*PresenceResponse) Descriptor() ([]byte, []int)
Deprecated: Use PresenceResponse.ProtoReflect.Descriptor instead.
func (*PresenceResponse) GetSubscribers ¶
func (x *PresenceResponse) GetSubscribers() int32
func (*PresenceResponse) ProtoMessage ¶
func (*PresenceResponse) ProtoMessage()
func (*PresenceResponse) ProtoReflect ¶
func (x *PresenceResponse) ProtoReflect() protoreflect.Message
func (*PresenceResponse) Reset ¶
func (x *PresenceResponse) Reset()
func (*PresenceResponse) String ¶
func (x *PresenceResponse) String() string
type PublishRequest ¶
type PublishRequest struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*PublishRequest) Descriptor
deprecated
func (*PublishRequest) Descriptor() ([]byte, []int)
Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead.
func (*PublishRequest) GetData ¶
func (x *PublishRequest) GetData() []byte
func (*PublishRequest) GetName ¶
func (x *PublishRequest) GetName() string
func (*PublishRequest) ProtoMessage ¶
func (*PublishRequest) ProtoMessage()
func (*PublishRequest) ProtoReflect ¶
func (x *PublishRequest) ProtoReflect() protoreflect.Message
func (*PublishRequest) Reset ¶
func (x *PublishRequest) Reset()
func (*PublishRequest) String ¶
func (x *PublishRequest) String() string
type PublishResponse ¶
type PublishResponse struct {
Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
Epoch string `protobuf:"bytes,2,opt,name=epoch,proto3" json:"epoch,omitempty"`
// contains filtered or unexported fields
}
func (*PublishResponse) Descriptor
deprecated
func (*PublishResponse) Descriptor() ([]byte, []int)
Deprecated: Use PublishResponse.ProtoReflect.Descriptor instead.
func (*PublishResponse) GetEpoch ¶
func (x *PublishResponse) GetEpoch() string
func (*PublishResponse) GetOffset ¶
func (x *PublishResponse) GetOffset() uint64
func (*PublishResponse) ProtoMessage ¶
func (*PublishResponse) ProtoMessage()
func (*PublishResponse) ProtoReflect ¶
func (x *PublishResponse) ProtoReflect() protoreflect.Message
func (*PublishResponse) Reset ¶
func (x *PublishResponse) Reset()
func (*PublishResponse) String ¶
func (x *PublishResponse) String() string
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
// contains filtered or unexported fields
}
RefreshTokenRequest exchanges a refresh token for an access token.
func (*RefreshTokenRequest) Descriptor
deprecated
func (*RefreshTokenRequest) Descriptor() ([]byte, []int)
Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead.
func (*RefreshTokenRequest) GetRefreshToken ¶
func (x *RefreshTokenRequest) GetRefreshToken() string
func (*RefreshTokenRequest) ProtoMessage ¶
func (*RefreshTokenRequest) ProtoMessage()
func (*RefreshTokenRequest) ProtoReflect ¶
func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message
func (*RefreshTokenRequest) Reset ¶
func (x *RefreshTokenRequest) Reset()
func (*RefreshTokenRequest) String ¶
func (x *RefreshTokenRequest) String() string
type RefreshTokenResponse ¶
type RefreshTokenResponse struct {
AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
AccessExpiresUnix int64 `protobuf:"varint,2,opt,name=access_expires_unix,json=accessExpiresUnix,proto3" json:"access_expires_unix,omitempty"`
// contains filtered or unexported fields
}
RefreshTokenResponse carries the new access token + its expiry.
func (*RefreshTokenResponse) Descriptor
deprecated
func (*RefreshTokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use RefreshTokenResponse.ProtoReflect.Descriptor instead.
func (*RefreshTokenResponse) GetAccessExpiresUnix ¶
func (x *RefreshTokenResponse) GetAccessExpiresUnix() int64
func (*RefreshTokenResponse) GetAccessToken ¶
func (x *RefreshTokenResponse) GetAccessToken() string
func (*RefreshTokenResponse) ProtoMessage ¶
func (*RefreshTokenResponse) ProtoMessage()
func (*RefreshTokenResponse) ProtoReflect ¶
func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message
func (*RefreshTokenResponse) Reset ¶
func (x *RefreshTokenResponse) Reset()
func (*RefreshTokenResponse) String ¶
func (x *RefreshTokenResponse) String() string
type Scope ¶
type Scope struct {
// Pattern is the channel-name pattern, e.g. `private:webapp.user.42.*`.
// Single-star matches one segment, double-star matches one-or-more
// trailing segments (last position only).
Pattern string `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"`
// Verbs is the set of granted actions. Allowed values:
// "subscribe", "publish", "manage".
Verbs []string `protobuf:"bytes,2,rep,name=verbs,proto3" json:"verbs,omitempty"`
// Deny inverts the scope: when true, a matching (channel, verb) pair is
// subtracted from the grant set with "deny wins" precedence. A scope
// with deny=true on a pattern that overlaps an allow scope still wins
// — denies are not unlocked by any allow. A deny scope without an
// overlapping allow is a defensive no-op. The default (false) means a
// plain allow scope.
Deny bool `protobuf:"varint,3,opt,name=deny,proto3" json:"deny,omitempty"`
// contains filtered or unexported fields
}
Scope is one entry in CreatePrivateRequest.scopes.
func (*Scope) Descriptor
deprecated
func (*Scope) GetPattern ¶
func (*Scope) ProtoMessage ¶
func (*Scope) ProtoMessage()
func (*Scope) ProtoReflect ¶
func (x *Scope) ProtoReflect() protoreflect.Message
type TwirpServer ¶
type TwirpServer interface {
http.Handler
// ServiceDescriptor returns gzipped bytes describing the .proto file that
// this service was generated from. Once unzipped, the bytes can be
// unmarshalled as a
// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
//
// The returned integer is the index of this particular service within that
// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
// low-level field, expected to be used for reflection.
ServiceDescriptor() ([]byte, int)
// ProtocGenTwirpVersion is the semantic version string of the version of
// twirp used to generate this file.
ProtocGenTwirpVersion() string
// PathPrefix returns the HTTP URL path prefix for all methods handled by this
// service. This can be used with an HTTP mux to route Twirp requests.
// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
// that is, everything in a Twirp route except for the <Method> at the end.
PathPrefix() string
}
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewParsecServiceServer ¶
func NewParsecServiceServer(svc ParsecService, opts ...interface{}) TwirpServer
NewParsecServiceServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).