Documentation
¶
Overview ¶
Package vsrpc provides the RPC server that Visual Studio uses to interact with azd programmatically.
The RPC server is implemented using JSON-RPC 2.0 over WebSockets.
Index ¶
Constants ¶
const ( DeleteModeLocal = 1 << iota DeleteModeAzureResources )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AspireHost ¶
type DeleteMode ¶
type DeleteMode uint32
type DeploymentResult ¶
type Environment ¶
type EnvironmentInfo ¶
type Handler ¶
type Handler func(ctx context.Context, conn jsonrpc2.Conn, reply jsonrpc2.Replier, req jsonrpc2.Request) error
Handler is the type of function that handles incoming RPC requests.
func NewHandler ¶
NewHandler is a generic helper for creating a Handler from an arbitrary function. The function must:
- Take a context.Context as its first argument. - Return either an error or a value and an error.
If f does not meet these requirements, NewHandler will panic.
type InitializeServerOptions ¶
type InitializeServerOptions struct { // When non nil, AuthenticationEndpoint is the endpoint to connect to for authentication. It is in the same form as // expected by the AZD_AUTH_ENDPOINT environment variable. Note that both AuthenticationEndpoint and AuthenticationKey // need to be set for external authentication to be used. AuthenticationEndpoint *string `json:",omitempty"` // When non nil, AuthenticationKey is the key to use for authenticating to the server. It is in the same form as // expected by the AZD_AUTH_KEY environment variable. Note that both AuthenticationEndpoint and AuthenticationKey // need to be set for external authentication to be used. AuthenticationKey *string `json:",omitempty"` // When non nil, AuthenticationCertificate is a base64-encoded x509 certificate used to trust and // secure the communications to the server. It is in the same form as the AZD_AUTH_CERT environment variable. AuthenticationCertificate *string `json:",omitempty"` }
type Observer ¶
type Observer[T any] struct { // contains filtered or unexported fields }
Observer is treated special by our JSON-RPC implementation and plays nicely with StreamJsonRpc's ideas on how to marshal an Observer<T> in .NET.
The way this works is that that we can send a notification back to to the server with the method `$/invokeProxy/{handle}/{onCompleted|onNext}`. When marshalled as an argument, the wire format of Observer<T> is:
{ "__jsonrpc_marshaled": 1, "handle": <some-integer> }
func (*Observer[T]) UnmarshalJSON ¶
type ProgressMessage ¶
type ProgressMessage struct { Message string Severity MessageSeverity Time time.Time Kind MessageKind Code string AdditionalInfoLink string }
func (ProgressMessage) WithMessage ¶
func (m ProgressMessage) WithMessage(message string) ProgressMessage
WithMessage returns a new ProgressMessage with the given message and timestamp set to now.
type RequestContext ¶
type RequestContext struct { // The active session. Session Session // The app host project path. HostProjectPath string }
RequestContext provides the context for a request to the server. It identifies the active session and the azd project being operated on.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(rootContainer *ioc.NestedContainer) *Server
type Session ¶
type Session struct {
Id string
}
Session represents an active connection to the server. It is returned by InitializeAsync and holds an opaque connection id that the server can use to identify the client across multiple RPC calls (since our service is exposed over multiple endpoints a single client may have multiple connections to the server, and we want a way to correlate them so we can cache state across connections).
Source Files
¶
- aspire_service.go
- debug_service.go
- doc.go
- environment_service.go
- environment_service_create.go
- environment_service_deploy.go
- environment_service_load.go
- environment_service_refresh.go
- handler.go
- message_writer.go
- models.go
- observer.go
- server.go
- server_service.go
- server_session.go
- stream.go
- utils.go
- writer_multiplexer.go