Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClusterFromString ¶
ClusterFromString returns a cluster ID and possibly fully-usable Cluster from a base64-encoded JSON spec.
If an error occurs decoding or unmarshalling the string, this function returns, respectively, the empty string, a nil Cluster, and a non-nil error.
If the string can be decoded and unmarshalled, then the id will be non-empty, but errors may still be returned from instantiating the cluster, for example if the configuration in the JSON spec is invalid.
Therefore, callers should handle the return values as follows:
c, id, err := dynamic.ClusterFromString(ctx, s) if id == "" { // handle err, do not use `c`. } if err != nil { // log error. if desired, lookup the existing cluster with ID: `id` } // Use `c` (or existing cluster with ID == `id`) based on the dynamic cluster api.WithCluster(c, id).DoAThing()
func StreamServerInterceptor ¶
func StreamServerInterceptor(api API) grpc.StreamServerInterceptor
StreamServerInterceptor returns a StreamServerInterceptor that redirects a streaming RPC to a dynamic API if the incoming context has a cluster spec in its metadata. Otherwise, the interceptor is a no-op, and the original stream handler is invoked.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(api API) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a UnaryServerInterceptor that redirects a unary RPC to a dynamic API if the incoming context has a cluster spec in its metadata. Otherwise, the interceptor is a no-op, and the original method handler is invoked.